1 /*
2  * include/types/obj_type.h
3  * This file declares some object types for use in various structures.
4  *
5  * Copyright (C) 2000-2013 Willy Tarreau - w@1wt.eu
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation, version 2.1
10  * exclusively.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20  */
21 
22 #ifndef _TYPES_OBJ_TYPE_H
23 #define _TYPES_OBJ_TYPE_H
24 
25 /* The principle is to be able to change the type of a pointer by pointing
26  * it directly to an object type. The object type indicates the format of the
27  * structure holing the type, and this is used to retrieve the pointer to the
28  * beginning of the structure. Doing so saves us from having to maintain both
29  * a pointer and a type for elements such as connections which can point to
30  * various types of objects.
31  */
32 
33 /* object types : these ones take the same space as a char */
34 enum obj_type {
35 	OBJ_TYPE_NONE = 0,     /* pointer is NULL by definition */
36 	OBJ_TYPE_LISTENER,     /* object is a struct listener */
37 	OBJ_TYPE_PROXY,        /* object is a struct proxy */
38 	OBJ_TYPE_SERVER,       /* object is a struct server */
39 	OBJ_TYPE_APPLET,       /* object is a struct applet */
40 	OBJ_TYPE_APPCTX,       /* object is a struct appctx */
41 	OBJ_TYPE_CONN,         /* object is a struct connection */
42 	OBJ_TYPE_SRVRQ,        /* object is a struct dns_srvrq */
43 	OBJ_TYPE_CS,           /* object is a struct conn_stream */
44 	OBJ_TYPE_STREAM,       /* object is a struct stream */
45 	OBJ_TYPE_ENTRIES       /* last one : number of entries */
46 } __attribute__((packed)) ;
47 
48 #endif /* _TYPES_OBJ_TYPE_H */
49 
50 /*
51  * Local variables:
52  *  c-indent-level: 8
53  *  c-basic-offset: 8
54  * End:
55  */
56