mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-05 06:37:02 +02:00
MINOR: applet: Add support for flags on applets with a flag about the new API
A new field was added in the applet structure to be able to set flags on the applets The first one is related to the new API. APPLET_FL_NEW_API is set for applets based on the new API. It was set on all HAProxy's applets.
This commit is contained in:
parent
2e5e6cdf23
commit
337768656b
@ -2144,6 +2144,7 @@ static void promex_appctx_handle_io(struct appctx *appctx)
|
||||
|
||||
struct applet promex_applet = {
|
||||
.obj_type = OBJ_TYPE_APPLET,
|
||||
.flags = APPLET_FL_NEW_API,
|
||||
.name = "<PROMEX>", /* used for logging */
|
||||
.init = promex_appctx_init,
|
||||
.release = promex_appctx_release,
|
||||
|
@ -81,9 +81,12 @@ static forceinline char *appctx_show_flags(char *buf, size_t len, const char *de
|
||||
#undef _
|
||||
}
|
||||
|
||||
#define APPLET_FL_NEW_API 0x00000001 /* Set if the applet is based on the new API (using applet's buffers) */
|
||||
|
||||
/* Applet descriptor */
|
||||
struct applet {
|
||||
enum obj_type obj_type; /* object type = OBJ_TYPE_APPLET */
|
||||
unsigned int flags; /* APPLET_FL_* flags */
|
||||
/* 3 unused bytes here */
|
||||
char *name; /* applet's name to report in logs */
|
||||
int (*init)(struct appctx *); /* callback to init resources, may be NULL.
|
||||
|
@ -3139,6 +3139,7 @@ INITCALL1(STG_REGISTER, http_req_keywords_register, &http_req_actions);
|
||||
|
||||
struct applet http_cache_applet = {
|
||||
.obj_type = OBJ_TYPE_APPLET,
|
||||
.flags = APPLET_FL_NEW_API,
|
||||
.name = "<CACHE>", /* used for logging */
|
||||
.fct = http_cache_io_handler,
|
||||
.rcv_buf = appctx_htx_rcv_buf,
|
||||
|
@ -3899,6 +3899,7 @@ int mworker_cli_global_proxy_new_listener(struct mworker_proc *proc)
|
||||
|
||||
static struct applet cli_applet = {
|
||||
.obj_type = OBJ_TYPE_APPLET,
|
||||
.flags = APPLET_FL_NEW_API,
|
||||
.name = "<CLI>", /* used for logging */
|
||||
.fct = cli_io_handler,
|
||||
.rcv_buf = appctx_raw_rcv_buf,
|
||||
@ -3909,6 +3910,7 @@ static struct applet cli_applet = {
|
||||
/* master CLI */
|
||||
static struct applet mcli_applet = {
|
||||
.obj_type = OBJ_TYPE_APPLET,
|
||||
.flags = APPLET_FL_NEW_API,
|
||||
.name = "<MCLI>", /* used for logging */
|
||||
.fct = cli_io_handler,
|
||||
.rcv_buf = appctx_raw_rcv_buf,
|
||||
|
@ -952,6 +952,7 @@ static void dns_session_release(struct appctx *appctx)
|
||||
/* DNS tcp session applet */
|
||||
static struct applet dns_session_applet = {
|
||||
.obj_type = OBJ_TYPE_APPLET,
|
||||
.flags = APPLET_FL_NEW_API,
|
||||
.name = "<STRMDNS>", /* used for logging */
|
||||
.fct = dns_session_io_handler,
|
||||
.rcv_buf = appctx_raw_rcv_buf,
|
||||
|
@ -538,6 +538,7 @@ static void spoe_handle_appctx(struct appctx *appctx)
|
||||
|
||||
struct applet spoe_applet = {
|
||||
.obj_type = OBJ_TYPE_APPLET,
|
||||
.flags = APPLET_FL_NEW_API,
|
||||
.name = "<SPOE>", /* used for logging */
|
||||
.fct = spoe_handle_appctx,
|
||||
.init = spoe_init_appctx,
|
||||
|
@ -3437,6 +3437,7 @@ static int hlua_socket_getsockname(struct lua_State *L)
|
||||
/* This struct define the applet. */
|
||||
static struct applet update_applet = {
|
||||
.obj_type = OBJ_TYPE_APPLET,
|
||||
.flags = APPLET_FL_NEW_API,
|
||||
.name = "<LUA_TCP>",
|
||||
.fct = hlua_socket_handler,
|
||||
.rcv_buf = appctx_raw_rcv_buf,
|
||||
@ -11610,6 +11611,7 @@ static enum act_parse_ret action_register_service_http(const char **args, int *c
|
||||
|
||||
/* Add applet pointer in the rule. */
|
||||
rule->applet.obj_type = OBJ_TYPE_APPLET;
|
||||
rule->applet.flags = APPLET_FL_NEW_API;
|
||||
rule->applet.name = fcn->name;
|
||||
rule->applet.init = hlua_applet_http_init;
|
||||
rule->applet.rcv_buf = appctx_htx_rcv_buf;
|
||||
@ -11797,6 +11799,7 @@ static enum act_parse_ret action_register_service_tcp(const char **args, int *cu
|
||||
|
||||
/* Add applet pointer in the rule. */
|
||||
rule->applet.obj_type = OBJ_TYPE_APPLET;
|
||||
rule->applet.flags = APPLET_FL_NEW_API;
|
||||
rule->applet.name = fcn->name;
|
||||
rule->applet.init = hlua_applet_tcp_init;
|
||||
rule->applet.rcv_buf = appctx_raw_rcv_buf;
|
||||
|
@ -1019,6 +1019,7 @@ void httpclient_applet_release(struct appctx *appctx)
|
||||
/* HTTP client applet */
|
||||
static struct applet httpclient_applet = {
|
||||
.obj_type = OBJ_TYPE_APPLET,
|
||||
.flags = APPLET_FL_NEW_API,
|
||||
.name = "<HTTPCLIENT>",
|
||||
.fct = httpclient_applet_io_handler,
|
||||
.rcv_buf = appctx_htx_rcv_buf,
|
||||
|
@ -5967,6 +5967,7 @@ static void syslog_io_handler(struct appctx *appctx)
|
||||
|
||||
static struct applet syslog_applet = {
|
||||
.obj_type = OBJ_TYPE_APPLET,
|
||||
.flags = APPLET_FL_NEW_API,
|
||||
.name = "<SYSLOG>", /* used for logging */
|
||||
.fct = syslog_io_handler,
|
||||
.rcv_buf = appctx_raw_rcv_buf,
|
||||
|
@ -3228,6 +3228,7 @@ static void peer_io_handler(struct appctx *appctx)
|
||||
|
||||
static struct applet peer_applet = {
|
||||
.obj_type = OBJ_TYPE_APPLET,
|
||||
.flags = APPLET_FL_NEW_API,
|
||||
.name = "<PEER>", /* used for logging */
|
||||
.fct = peer_io_handler,
|
||||
.rcv_buf = appctx_raw_rcv_buf,
|
||||
|
@ -600,6 +600,7 @@ static void sink_forward_session_release(struct appctx *appctx)
|
||||
|
||||
static struct applet sink_forward_applet = {
|
||||
.obj_type = OBJ_TYPE_APPLET,
|
||||
.flags = APPLET_FL_NEW_API,
|
||||
.name = "<SINKFWD>", /* used for logging */
|
||||
.fct = sink_forward_io_handler,
|
||||
.rcv_buf = appctx_raw_rcv_buf,
|
||||
@ -610,6 +611,7 @@ static struct applet sink_forward_applet = {
|
||||
|
||||
static struct applet sink_forward_oc_applet = {
|
||||
.obj_type = OBJ_TYPE_APPLET,
|
||||
.flags = APPLET_FL_NEW_API,
|
||||
.name = "<SINKFWDOC>", /* used for logging */
|
||||
.fct = sink_forward_oc_io_handler,
|
||||
.rcv_buf = appctx_raw_rcv_buf,
|
||||
|
@ -2103,6 +2103,7 @@ static void http_stats_release(struct appctx *appctx)
|
||||
|
||||
struct applet http_stats_applet = {
|
||||
.obj_type = OBJ_TYPE_APPLET,
|
||||
.flags = APPLET_FL_NEW_API,
|
||||
.name = "<STATS>", /* used for logging */
|
||||
.fct = http_stats_io_handler,
|
||||
.rcv_buf = appctx_htx_rcv_buf,
|
||||
|
Loading…
Reference in New Issue
Block a user