MINOR: obj: introduce a new type appctx
The object type was added to "struct appctx". The purpose will be to identify an appctx when the applet context is detached from the stream interface. For now, it's still attached, so this patch only adds the new type and does not replace its use.
This commit is contained in:
parent
452d3bb0c4
commit
0788f47cc1
|
@ -45,6 +45,7 @@ static inline const char *obj_type_name(enum obj_type *t)
|
|||
case OBJ_TYPE_PROXY: return "PROXY";
|
||||
case OBJ_TYPE_SERVER: return "SERVER";
|
||||
case OBJ_TYPE_APPLET: return "APPLET";
|
||||
case OBJ_TYPE_APPCTX: return "APPCTX";
|
||||
case OBJ_TYPE_CONN: return "CONN";
|
||||
default: return "NONE";
|
||||
}
|
||||
|
@ -105,6 +106,18 @@ static inline struct si_applet *objt_applet(enum obj_type *t)
|
|||
return __objt_applet(t);
|
||||
}
|
||||
|
||||
static inline struct appctx *__objt_appctx(enum obj_type *t)
|
||||
{
|
||||
return container_of(t, struct appctx, obj_type);
|
||||
}
|
||||
|
||||
static inline struct appctx *objt_appctx(enum obj_type *t)
|
||||
{
|
||||
if (!t || *t != OBJ_TYPE_APPCTX)
|
||||
return NULL;
|
||||
return __objt_appctx(t);
|
||||
}
|
||||
|
||||
static inline struct connection *__objt_conn(enum obj_type *t)
|
||||
{
|
||||
return container_of(t, struct connection, obj_type);
|
||||
|
@ -124,6 +137,7 @@ static inline void *obj_base_ptr(enum obj_type *t)
|
|||
case OBJ_TYPE_PROXY: return __objt_proxy(t);
|
||||
case OBJ_TYPE_SERVER: return __objt_server(t);
|
||||
case OBJ_TYPE_APPLET: return __objt_applet(t);
|
||||
case OBJ_TYPE_APPCTX: return __objt_appctx(t);
|
||||
case OBJ_TYPE_CONN: return __objt_conn(t);
|
||||
default: return NULL;
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ enum obj_type {
|
|||
OBJ_TYPE_PROXY, /* object is a struct proxy */
|
||||
OBJ_TYPE_SERVER, /* object is a struct server */
|
||||
OBJ_TYPE_APPLET, /* object is a struct si_applet */
|
||||
OBJ_TYPE_APPCTX, /* object is a struct appctx */
|
||||
OBJ_TYPE_CONN, /* object is a struct connection */
|
||||
OBJ_TYPE_ENTRIES /* last one : number of entries */
|
||||
};
|
||||
|
|
|
@ -91,6 +91,7 @@ struct si_ops {
|
|||
|
||||
/* Context of a running applet. */
|
||||
struct appctx {
|
||||
enum obj_type obj_type; /* OBJ_TYPE_APPCTX */
|
||||
unsigned int st0; /* CLI state for stats, session state for peers */
|
||||
unsigned int st1; /* prompt for stats, session error for peers */
|
||||
unsigned int st2; /* output state for stats, unused by peers */
|
||||
|
|
Loading…
Reference in New Issue