Willy Tarreau | 3fdb366 | 2012-11-12 00:42:33 +0100 | [diff] [blame] | 1 | /* |
| 2 | * include/types/obj_type.h |
| 3 | * This file declares some object types for use in various structures. |
| 4 | * |
Willy Tarreau | 66337a0 | 2013-09-29 09:15:31 +0200 | [diff] [blame] | 5 | * Copyright (C) 2000-2013 Willy Tarreau - w@1wt.eu |
Willy Tarreau | 3fdb366 | 2012-11-12 00:42:33 +0100 | [diff] [blame] | 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 | |
Willy Tarreau | 939478d | 2013-12-06 21:08:11 +0100 | [diff] [blame] | 33 | /* object types : these ones take the same space as a char */ |
Willy Tarreau | 3fdb366 | 2012-11-12 00:42:33 +0100 | [diff] [blame] | 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 si_applet */ |
Willy Tarreau | 0788f47 | 2013-10-24 22:45:25 +0200 | [diff] [blame] | 40 | OBJ_TYPE_APPCTX, /* object is a struct appctx */ |
Willy Tarreau | 51c2184 | 2013-09-29 09:06:42 +0200 | [diff] [blame] | 41 | OBJ_TYPE_CONN, /* object is a struct connection */ |
Willy Tarreau | 66337a0 | 2013-09-29 09:15:31 +0200 | [diff] [blame] | 42 | OBJ_TYPE_ENTRIES /* last one : number of entries */ |
Willy Tarreau | 939478d | 2013-12-06 21:08:11 +0100 | [diff] [blame] | 43 | } __attribute__((packed)) ; |
Willy Tarreau | 3fdb366 | 2012-11-12 00:42:33 +0100 | [diff] [blame] | 44 | |
| 45 | #endif /* _TYPES_OBJ_TYPE_H */ |
| 46 | |
| 47 | /* |
| 48 | * Local variables: |
| 49 | * c-indent-level: 8 |
| 50 | * c-basic-offset: 8 |
| 51 | * End: |
| 52 | */ |