MEDIUM: applet: Set the conn-stream as appctx owner instead of the stream-int

Because appctx is now an endpoint of the conn-stream, there is no reason to
still have the stream-interface as appctx owner. Thus, the conn-stream is
now the appctx owner.
This commit is contained in:
Christopher Faulet 2021-12-20 17:09:39 +01:00
parent 13a35e5752
commit 86e1c3381b
28 changed files with 129 additions and 123 deletions

View File

@ -543,7 +543,7 @@ static int promex_dump_global_metrics(struct appctx *appctx, struct htx *htx)
{ {
static struct ist prefix = IST("haproxy_process_"); static struct ist prefix = IST("haproxy_process_");
struct field val; struct field val;
struct channel *chn = si_ic(appctx->owner); struct channel *chn = si_ic(cs_si(appctx->owner));
struct ist out = ist2(trash.area, 0); struct ist out = ist2(trash.area, 0);
size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx)); size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
int ret = 1; int ret = 1;
@ -594,7 +594,7 @@ static int promex_dump_front_metrics(struct appctx *appctx, struct htx *htx)
static struct ist prefix = IST("haproxy_frontend_"); static struct ist prefix = IST("haproxy_frontend_");
struct proxy *px; struct proxy *px;
struct field val; struct field val;
struct channel *chn = si_ic(appctx->owner); struct channel *chn = si_ic(cs_si(appctx->owner));
struct ist out = ist2(trash.area, 0); struct ist out = ist2(trash.area, 0);
size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx)); size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
struct field *stats = stat_l[STATS_DOMAIN_PROXY]; struct field *stats = stat_l[STATS_DOMAIN_PROXY];
@ -694,7 +694,7 @@ static int promex_dump_listener_metrics(struct appctx *appctx, struct htx *htx)
static struct ist prefix = IST("haproxy_listener_"); static struct ist prefix = IST("haproxy_listener_");
struct proxy *px; struct proxy *px;
struct field val; struct field val;
struct channel *chn = si_ic(appctx->owner); struct channel *chn = si_ic(cs_si(appctx->owner));
struct ist out = ist2(trash.area, 0); struct ist out = ist2(trash.area, 0);
size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx)); size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
struct field *stats = stat_l[STATS_DOMAIN_PROXY]; struct field *stats = stat_l[STATS_DOMAIN_PROXY];
@ -785,7 +785,7 @@ static int promex_dump_back_metrics(struct appctx *appctx, struct htx *htx)
struct proxy *px; struct proxy *px;
struct server *sv; struct server *sv;
struct field val; struct field val;
struct channel *chn = si_ic(appctx->owner); struct channel *chn = si_ic(cs_si(appctx->owner));
struct ist out = ist2(trash.area, 0); struct ist out = ist2(trash.area, 0);
size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx)); size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
struct field *stats = stat_l[STATS_DOMAIN_PROXY]; struct field *stats = stat_l[STATS_DOMAIN_PROXY];
@ -938,7 +938,7 @@ static int promex_dump_srv_metrics(struct appctx *appctx, struct htx *htx)
struct proxy *px; struct proxy *px;
struct server *sv; struct server *sv;
struct field val; struct field val;
struct channel *chn = si_ic(appctx->owner); struct channel *chn = si_ic(cs_si(appctx->owner));
struct ist out = ist2(trash.area, 0); struct ist out = ist2(trash.area, 0);
size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx)); size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
struct field *stats = stat_l[STATS_DOMAIN_PROXY]; struct field *stats = stat_l[STATS_DOMAIN_PROXY];
@ -1107,7 +1107,7 @@ static int promex_dump_sticktable_metrics(struct appctx *appctx, struct htx *htx
{ {
static struct ist prefix = IST("haproxy_sticktable_"); static struct ist prefix = IST("haproxy_sticktable_");
struct field val; struct field val;
struct channel *chn = si_ic(appctx->owner); struct channel *chn = si_ic(cs_si(appctx->owner));
struct ist out = ist2(trash.area, 0); struct ist out = ist2(trash.area, 0);
size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx)); size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
int ret = 1; int ret = 1;
@ -1427,7 +1427,7 @@ static int promex_parse_uri(struct appctx *appctx, struct stream_interface *si)
* full. */ * full. */
static int promex_send_headers(struct appctx *appctx, struct stream_interface *si, struct htx *htx) static int promex_send_headers(struct appctx *appctx, struct stream_interface *si, struct htx *htx)
{ {
struct channel *chn = si_ic(appctx->owner); struct channel *chn = si_ic(cs_si(appctx->owner));
struct htx_sl *sl; struct htx_sl *sl;
unsigned int flags; unsigned int flags;
@ -1463,7 +1463,7 @@ static int promex_appctx_init(struct appctx *appctx, struct proxy *px, struct st
/* The main I/O handler for the promex applet. */ /* The main I/O handler for the promex applet. */
static void promex_appctx_handle_io(struct appctx *appctx) static void promex_appctx_handle_io(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct stream *s = si_strm(si); struct stream *s = si_strm(si);
struct channel *req = si_oc(si); struct channel *req = si_oc(si);
struct channel *res = si_ic(si); struct channel *res = si_ic(si);

View File

@ -58,7 +58,7 @@ struct appctx {
struct buffer *chunk; /* used to store unfinished commands */ struct buffer *chunk; /* used to store unfinished commands */
unsigned int st2; /* output state for stats, unused by peers */ unsigned int st2; /* output state for stats, unused by peers */
struct applet *applet; /* applet this context refers to */ struct applet *applet; /* applet this context refers to */
void *owner; /* pointer to upper layer's entity (eg: stream interface) */ void *owner; /* pointer to upper layer's entity (eg: conn_stream) */
struct act_rule *rule; /* rule associated with the applet. */ struct act_rule *rule; /* rule associated with the applet. */
int (*io_handler)(struct appctx *appctx); /* used within the cli_io_handler when st0 = CLI_ST_CALLBACK */ int (*io_handler)(struct appctx *appctx); /* used within the cli_io_handler when st0 = CLI_ST_CALLBACK */
void (*io_release)(struct appctx *appctx); /* used within the cli_io_handler when st0 = CLI_ST_CALLBACK, void (*io_release)(struct appctx *appctx); /* used within the cli_io_handler when st0 = CLI_ST_CALLBACK,

View File

@ -86,6 +86,11 @@ static inline struct appctx *cs_appctx(const struct conn_stream *cs)
return (cs ? objt_appctx(cs->end) : NULL); return (cs ? objt_appctx(cs->end) : NULL);
} }
static inline struct stream_interface *cs_si(const struct conn_stream *cs)
{
return ((cs_conn(cs) || cs_appctx(cs)) ? cs->data : NULL);
}
/* Attaches a conn_stream to a data layer and sets the relevant callbacks */ /* Attaches a conn_stream to a data layer and sets the relevant callbacks */
static inline void cs_attach(struct conn_stream *cs, void *data, const struct data_cb *data_cb) static inline void cs_attach(struct conn_stream *cs, void *data, const struct data_cb *data_cb)
{ {

View File

@ -193,7 +193,7 @@ static inline void si_attach_cs(struct stream_interface *si, struct conn_stream
struct appctx *appctx = cs_appctx(cs); struct appctx *appctx = cs_appctx(cs);
si->ops = &si_applet_ops; si->ops = &si_applet_ops;
appctx->owner = si; appctx->owner = cs;
cs_attach(cs, si, NULL); cs_attach(cs, si, NULL);
} }
else { else {
@ -221,7 +221,7 @@ static inline void si_attach_appctx(struct stream_interface *si, struct appctx *
{ {
si_reset_endpoint(si); si_reset_endpoint(si);
cs_init(si->cs, &appctx->obj_type); cs_init(si->cs, &appctx->obj_type);
appctx->owner = si; appctx->owner = si->cs;
si_attach_cs(si, si->cs); si_attach_cs(si, si->cs);
} }

View File

@ -610,7 +610,7 @@ static int cli_io_handler_show_profiling(struct appctx *appctx)
unsigned long long tot_alloc_calls, tot_free_calls; unsigned long long tot_alloc_calls, tot_free_calls;
unsigned long long tot_alloc_bytes, tot_free_bytes; unsigned long long tot_alloc_bytes, tot_free_bytes;
#endif #endif
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct buffer *name_buffer = get_trash_chunk(); struct buffer *name_buffer = get_trash_chunk();
const char *str; const char *str;
int max_lines; int max_lines;
@ -837,7 +837,7 @@ static int cli_parse_show_profiling(char **args, char *payload, struct appctx *a
static int cli_io_handler_show_tasks(struct appctx *appctx) static int cli_io_handler_show_tasks(struct appctx *appctx)
{ {
struct sched_activity tmp_activity[256] __attribute__((aligned(64))); struct sched_activity tmp_activity[256] __attribute__((aligned(64)));
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct buffer *name_buffer = get_trash_chunk(); struct buffer *name_buffer = get_trash_chunk();
struct sched_activity *entry; struct sched_activity *entry;
const struct tasklet *tl; const struct tasklet *tl;

View File

@ -35,7 +35,7 @@ DECLARE_POOL(pool_head_appctx, "appctx", sizeof(struct appctx));
int appctx_buf_available(void *arg) int appctx_buf_available(void *arg)
{ {
struct appctx *appctx = arg; struct appctx *appctx = arg;
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
/* allocation requested ? */ /* allocation requested ? */
if (!(si->flags & SI_FL_RXBLK_BUFF)) if (!(si->flags & SI_FL_RXBLK_BUFF))
@ -61,7 +61,7 @@ int appctx_buf_available(void *arg)
struct task *task_run_applet(struct task *t, void *context, unsigned int state) struct task *task_run_applet(struct task *t, void *context, unsigned int state)
{ {
struct appctx *app = context; struct appctx *app = context;
struct stream_interface *si = app->owner; struct stream_interface *si;
unsigned int rate; unsigned int rate;
size_t count; size_t count;
@ -70,6 +70,8 @@ struct task *task_run_applet(struct task *t, void *context, unsigned int state)
return NULL; return NULL;
} }
si = cs_si(app->owner);
/* We always pretend the applet can't get and doesn't want to /* We always pretend the applet can't get and doesn't want to
* put, it's up to it to change this if needed. This ensures * put, it's up to it to change this if needed. This ensures
* that one applet which ignores any event will not spin. * that one applet which ignores any event will not spin.
@ -112,4 +114,3 @@ struct task *task_run_applet(struct task *t, void *context, unsigned int state)
channel_release_buffer(si_ic(si), &app->buffer_wait); channel_release_buffer(si_ic(si), &app->buffer_wait);
return t; return t;
} }

View File

@ -1272,7 +1272,7 @@ static unsigned int htx_cache_dump_blk(struct appctx *appctx, struct htx *htx, e
unsigned int max, total; unsigned int max, total;
uint32_t blksz; uint32_t blksz;
max = htx_get_max_blksz(htx, channel_htx_recv_max(si_ic(appctx->owner), htx)); max = htx_get_max_blksz(htx, channel_htx_recv_max(si_ic(cs_si(appctx->owner)), htx));
if (!max) if (!max)
return 0; return 0;
blksz = ((type == HTX_BLK_HDR || type == HTX_BLK_TLR) blksz = ((type == HTX_BLK_HDR || type == HTX_BLK_TLR)
@ -1315,7 +1315,7 @@ static unsigned int htx_cache_dump_data_blk(struct appctx *appctx, struct htx *h
unsigned int max, total, rem_data; unsigned int max, total, rem_data;
uint32_t blksz; uint32_t blksz;
max = htx_get_max_blksz(htx, channel_htx_recv_max(si_ic(appctx->owner), htx)); max = htx_get_max_blksz(htx, channel_htx_recv_max(si_ic(cs_si(appctx->owner)), htx));
if (!max) if (!max)
return 0; return 0;
@ -1429,7 +1429,7 @@ static void http_cache_io_handler(struct appctx *appctx)
{ {
struct cache_entry *cache_ptr = appctx->ctx.cache.entry; struct cache_entry *cache_ptr = appctx->ctx.cache.entry;
struct shared_block *first = block_ptr(cache_ptr); struct shared_block *first = block_ptr(cache_ptr);
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct channel *req = si_oc(si); struct channel *req = si_oc(si);
struct channel *res = si_ic(si); struct channel *res = si_ic(si);
struct htx *req_htx, *res_htx; struct htx *req_htx, *res_htx;
@ -2563,7 +2563,7 @@ static int cli_parse_show_cache(char **args, char *payload, struct appctx *appct
static int cli_io_handler_show_cache(struct appctx *appctx) static int cli_io_handler_show_cache(struct appctx *appctx)
{ {
struct cache* cache = appctx->ctx.cli.p0; struct cache* cache = appctx->ctx.cli.p0;
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
if (cache == NULL) { if (cache == NULL) {
cache = LIST_ELEM((caches).n, typeof(struct cache *), list); cache = LIST_ELEM((caches).n, typeof(struct cache *), list);

View File

@ -669,7 +669,7 @@ static int cli_get_severity_output(struct appctx *appctx)
{ {
if (appctx->cli_severity_output) if (appctx->cli_severity_output)
return appctx->cli_severity_output; return appctx->cli_severity_output;
return strm_li(si_strm(appctx->owner))->bind_conf->severity_output; return strm_li(si_strm(cs_si(appctx->owner)))->bind_conf->severity_output;
} }
/* Processes the CLI interpreter on the stats socket. This function is called /* Processes the CLI interpreter on the stats socket. This function is called
@ -837,7 +837,7 @@ static int cli_output_msg(struct channel *chn, const char *msg, int severity, in
*/ */
static void cli_io_handler(struct appctx *appctx) static void cli_io_handler(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct channel *req = si_oc(si); struct channel *req = si_oc(si);
struct channel *res = si_ic(si); struct channel *res = si_ic(si);
struct bind_conf *bind_conf = strm_li(si_strm(si))->bind_conf; struct bind_conf *bind_conf = strm_li(si_strm(si))->bind_conf;
@ -1160,7 +1160,7 @@ static void cli_release_handler(struct appctx *appctx)
*/ */
static int cli_io_handler_show_env(struct appctx *appctx) static int cli_io_handler_show_env(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
char **var = appctx->ctx.cli.p0; char **var = appctx->ctx.cli.p0;
if (unlikely(si_ic(si)->flags & (CF_WRITE_ERROR|CF_SHUTW))) if (unlikely(si_ic(si)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
@ -1195,7 +1195,7 @@ static int cli_io_handler_show_env(struct appctx *appctx)
*/ */
static int cli_io_handler_show_fd(struct appctx *appctx) static int cli_io_handler_show_fd(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
int fd = appctx->ctx.cli.i0; int fd = appctx->ctx.cli.i0;
int ret = 1; int ret = 1;
@ -1394,7 +1394,7 @@ static int cli_io_handler_show_fd(struct appctx *appctx)
*/ */
static int cli_io_handler_show_activity(struct appctx *appctx) static int cli_io_handler_show_activity(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
int thr; int thr;
if (unlikely(si_ic(si)->flags & (CF_WRITE_ERROR|CF_SHUTW))) if (unlikely(si_ic(si)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
@ -1497,7 +1497,7 @@ static int cli_io_handler_show_activity(struct appctx *appctx)
static int cli_io_handler_show_cli_sock(struct appctx *appctx) static int cli_io_handler_show_cli_sock(struct appctx *appctx)
{ {
struct bind_conf *bind_conf; struct bind_conf *bind_conf;
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
chunk_reset(&trash); chunk_reset(&trash);
@ -1634,7 +1634,7 @@ static int cli_parse_show_fd(char **args, char *payload, struct appctx *appctx,
/* parse a "set timeout" CLI request. It always returns 1. */ /* parse a "set timeout" CLI request. It always returns 1. */
static int cli_parse_set_timeout(char **args, char *payload, struct appctx *appctx, void *private) static int cli_parse_set_timeout(char **args, char *payload, struct appctx *appctx, void *private)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct stream *s = si_strm(si); struct stream *s = si_strm(si);
if (strcmp(args[2], "cli") == 0) { if (strcmp(args[2], "cli") == 0) {
@ -1918,7 +1918,7 @@ static int _getsocks(char **args, char *payload, struct appctx *appctx, void *pr
char *cmsgbuf = NULL; char *cmsgbuf = NULL;
unsigned char *tmpbuf = NULL; unsigned char *tmpbuf = NULL;
struct cmsghdr *cmsg; struct cmsghdr *cmsg;
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct stream *s = si_strm(si); struct stream *s = si_strm(si);
struct connection *remote = cs_conn(si_opposite(si)->cs); struct connection *remote = cs_conn(si_opposite(si)->cs);
struct msghdr msghdr; struct msghdr msghdr;

View File

@ -249,7 +249,7 @@ void ha_task_dump(struct buffer *buf, const struct task *task, const char *pfx)
if (task->process == process_stream && task->context) if (task->process == process_stream && task->context)
s = (struct stream *)task->context; s = (struct stream *)task->context;
else if (task->process == task_run_applet && task->context) else if (task->process == task_run_applet && task->context)
s = si_strm(((struct appctx *)task->context)->owner); s = si_strm(cs_si(((struct appctx *)task->context)->owner));
else if (task->process == si_cs_io_cb && task->context) else if (task->process == si_cs_io_cb && task->context)
s = si_strm((struct stream_interface *)task->context); s = si_strm((struct stream_interface *)task->context);
@ -288,7 +288,7 @@ void ha_task_dump(struct buffer *buf, const struct task *task, const char *pfx)
*/ */
static int cli_io_handler_show_threads(struct appctx *appctx) static int cli_io_handler_show_threads(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
int thr; int thr;
if (unlikely(si_ic(si)->flags & (CF_WRITE_ERROR|CF_SHUTW))) if (unlikely(si_ic(si)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
@ -632,7 +632,7 @@ static int debug_parse_cli_write(char **args, char *payload, struct appctx *appc
*/ */
static int debug_parse_cli_stream(char **args, char *payload, struct appctx *appctx, void *private) static int debug_parse_cli_stream(char **args, char *payload, struct appctx *appctx, void *private)
{ {
struct stream *s = si_strm(appctx->owner); struct stream *s = si_strm(cs_si(appctx->owner));
int arg; int arg;
void *ptr; void *ptr;
int size; int size;
@ -1182,7 +1182,7 @@ static int debug_parse_cli_memstats(char **args, char *payload, struct appctx *a
*/ */
static int debug_iohandler_memstats(struct appctx *appctx) static int debug_iohandler_memstats(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct mem_stats *ptr = appctx->ctx.cli.p0; struct mem_stats *ptr = appctx->ctx.cli.p0;
int ret = 1; int ret = 1;

View File

@ -407,7 +407,7 @@ out:
*/ */
static void dns_session_io_handler(struct appctx *appctx) static void dns_session_io_handler(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct dns_session *ds = appctx->ctx.sft.ptr; struct dns_session *ds = appctx->ctx.sft.ptr;
struct ring *ring = &ds->ring; struct ring *ring = &ds->ring;
struct buffer *buf = &ring->buf; struct buffer *buf = &ring->buf;

View File

@ -1135,7 +1135,7 @@ spoe_handle_healthcheck_response(char *frame, size_t size, char *err, int errlen
static int static int
spoe_send_frame(struct appctx *appctx, char *buf, size_t framesz) spoe_send_frame(struct appctx *appctx, char *buf, size_t framesz)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
int ret; int ret;
uint32_t netint; uint32_t netint;
@ -1161,7 +1161,7 @@ spoe_send_frame(struct appctx *appctx, char *buf, size_t framesz)
static int static int
spoe_recv_frame(struct appctx *appctx, char *buf, size_t framesz) spoe_recv_frame(struct appctx *appctx, char *buf, size_t framesz)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
int ret; int ret;
uint32_t netint; uint32_t netint;
@ -1190,8 +1190,8 @@ spoe_recv_frame(struct appctx *appctx, char *buf, size_t framesz)
static int static int
spoe_wakeup_appctx(struct appctx *appctx) spoe_wakeup_appctx(struct appctx *appctx)
{ {
si_want_get(appctx->owner); si_want_get(cs_si(appctx->owner));
si_rx_endp_more(appctx->owner); si_rx_endp_more(cs_si(appctx->owner));
appctx_wakeup(appctx); appctx_wakeup(appctx);
return 1; return 1;
} }
@ -1217,7 +1217,7 @@ spoe_process_appctx(struct task * task, void *context, unsigned int state)
static void static void
spoe_release_appctx(struct appctx *appctx) spoe_release_appctx(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct spoe_appctx *spoe_appctx = SPOE_APPCTX(appctx); struct spoe_appctx *spoe_appctx = SPOE_APPCTX(appctx);
struct spoe_agent *agent; struct spoe_agent *agent;
struct spoe_context *ctx, *back; struct spoe_context *ctx, *back;
@ -1337,7 +1337,7 @@ spoe_release_appctx(struct appctx *appctx)
static int static int
spoe_handle_connect_appctx(struct appctx *appctx) spoe_handle_connect_appctx(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct spoe_agent *agent = SPOE_APPCTX(appctx)->agent; struct spoe_agent *agent = SPOE_APPCTX(appctx)->agent;
char *frame, *buf; char *frame, *buf;
int ret; int ret;
@ -1403,7 +1403,7 @@ spoe_handle_connect_appctx(struct appctx *appctx)
static int static int
spoe_handle_connecting_appctx(struct appctx *appctx) spoe_handle_connecting_appctx(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct spoe_agent *agent = SPOE_APPCTX(appctx)->agent; struct spoe_agent *agent = SPOE_APPCTX(appctx)->agent;
char *frame; char *frame;
int ret; int ret;
@ -1648,7 +1648,7 @@ spoe_handle_receiving_frame_appctx(struct appctx *appctx, int *skip)
/* Do not forget to remove processed frame from the output buffer */ /* Do not forget to remove processed frame from the output buffer */
if (trash.data) if (trash.data)
co_skip(si_oc(appctx->owner), trash.data); co_skip(si_oc(cs_si(appctx->owner)), trash.data);
end: end:
return ret; return ret;
} }
@ -1656,7 +1656,7 @@ spoe_handle_receiving_frame_appctx(struct appctx *appctx, int *skip)
static int static int
spoe_handle_processing_appctx(struct appctx *appctx) spoe_handle_processing_appctx(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct server *srv = objt_server(si_strm(si)->target); struct server *srv = objt_server(si_strm(si)->target);
struct spoe_agent *agent = SPOE_APPCTX(appctx)->agent; struct spoe_agent *agent = SPOE_APPCTX(appctx)->agent;
int ret, skip_sending = 0, skip_receiving = 0, active_s = 0, active_r = 0, close_asap = 0; int ret, skip_sending = 0, skip_receiving = 0, active_s = 0, active_r = 0, close_asap = 0;
@ -1779,7 +1779,7 @@ spoe_handle_processing_appctx(struct appctx *appctx)
static int static int
spoe_handle_disconnect_appctx(struct appctx *appctx) spoe_handle_disconnect_appctx(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct spoe_agent *agent = SPOE_APPCTX(appctx)->agent; struct spoe_agent *agent = SPOE_APPCTX(appctx)->agent;
char *frame, *buf; char *frame, *buf;
int ret; int ret;
@ -1832,7 +1832,7 @@ spoe_handle_disconnect_appctx(struct appctx *appctx)
static int static int
spoe_handle_disconnecting_appctx(struct appctx *appctx) spoe_handle_disconnecting_appctx(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
char *frame; char *frame;
int ret; int ret;
@ -1883,7 +1883,7 @@ spoe_handle_disconnecting_appctx(struct appctx *appctx)
next: next:
/* Do not forget to remove processed frame from the output buffer */ /* Do not forget to remove processed frame from the output buffer */
if (trash.data) if (trash.data)
co_skip(si_oc(appctx->owner), trash.data); co_skip(si_oc(cs_si(appctx->owner)), trash.data);
return 0; return 0;
stop: stop:
@ -1897,7 +1897,7 @@ spoe_handle_disconnecting_appctx(struct appctx *appctx)
static void static void
spoe_handle_appctx(struct appctx *appctx) spoe_handle_appctx(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct spoe_agent *agent; struct spoe_agent *agent;
if (SPOE_APPCTX(appctx) == NULL) if (SPOE_APPCTX(appctx) == NULL)

View File

@ -1905,7 +1905,7 @@ __LJMP static struct hlua_socket *hlua_checksocket(lua_State *L, int ud)
*/ */
static void hlua_socket_handler(struct appctx *appctx) static void hlua_socket_handler(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
if (appctx->ctx.hlua_cosocket.die) { if (appctx->ctx.hlua_cosocket.die) {
si_shutw(si); si_shutw(si);
@ -2101,7 +2101,7 @@ __LJMP static int hlua_socket_receive_yield(struct lua_State *L, int status, lua
if (!peer) if (!peer)
goto no_peer; goto no_peer;
appctx = container_of(peer, struct appctx, ctx.hlua_cosocket.xref); appctx = container_of(peer, struct appctx, ctx.hlua_cosocket.xref);
si = appctx->owner; si = cs_si(appctx->owner);
s = si_strm(si); s = si_strm(si);
oc = &s->res; oc = &s->res;
@ -2340,7 +2340,7 @@ static int hlua_socket_write_yield(struct lua_State *L,int status, lua_KContext
return 1; return 1;
} }
appctx = container_of(peer, struct appctx, ctx.hlua_cosocket.xref); appctx = container_of(peer, struct appctx, ctx.hlua_cosocket.xref);
si = appctx->owner; si = cs_si(appctx->owner);
s = si_strm(si); s = si_strm(si);
/* Check for connection close. */ /* Check for connection close. */
@ -2573,7 +2573,7 @@ __LJMP static int hlua_socket_getpeername(struct lua_State *L)
return 1; return 1;
} }
appctx = container_of(peer, struct appctx, ctx.hlua_cosocket.xref); appctx = container_of(peer, struct appctx, ctx.hlua_cosocket.xref);
si = appctx->owner; si = cs_si(appctx->owner);
dst = si_dst(si_opposite(si)); dst = si_dst(si_opposite(si));
if (!dst) { if (!dst) {
xref_unlock(&socket->xref, peer); xref_unlock(&socket->xref, peer);
@ -2614,7 +2614,7 @@ static int hlua_socket_getsockname(struct lua_State *L)
return 1; return 1;
} }
appctx = container_of(peer, struct appctx, ctx.hlua_cosocket.xref); appctx = container_of(peer, struct appctx, ctx.hlua_cosocket.xref);
si = appctx->owner; si = cs_si(appctx->owner);
s = si_strm(si); s = si_strm(si);
conn = cs_conn(s->si[1].cs); conn = cs_conn(s->si[1].cs);
@ -2665,7 +2665,7 @@ __LJMP static int hlua_socket_connect_yield(struct lua_State *L, int status, lua
return 2; return 2;
} }
appctx = container_of(peer, struct appctx, ctx.hlua_cosocket.xref); appctx = container_of(peer, struct appctx, ctx.hlua_cosocket.xref);
si = appctx->owner; si = cs_si(appctx->owner);
s = si_strm(si); s = si_strm(si);
/* Check if we run on the same thread than the xreator thread. /* Check if we run on the same thread than the xreator thread.
@ -2777,7 +2777,7 @@ __LJMP static int hlua_socket_connect(struct lua_State *L)
} }
appctx = container_of(peer, struct appctx, ctx.hlua_cosocket.xref); appctx = container_of(peer, struct appctx, ctx.hlua_cosocket.xref);
si = appctx->owner; si = cs_si(appctx->owner);
s = si_strm(si); s = si_strm(si);
if (!sockaddr_alloc(&si_opposite(si)->dst, addr, sizeof(*addr))) { if (!sockaddr_alloc(&si_opposite(si)->dst, addr, sizeof(*addr))) {
@ -2833,7 +2833,7 @@ __LJMP static int hlua_socket_connect_ssl(struct lua_State *L)
return 1; return 1;
} }
appctx = container_of(peer, struct appctx, ctx.hlua_cosocket.xref); appctx = container_of(peer, struct appctx, ctx.hlua_cosocket.xref);
si = appctx->owner; si = cs_si(appctx->owner);
s = si_strm(si); s = si_strm(si);
s->target = &socket_ssl->obj_type; s->target = &socket_ssl->obj_type;
@ -2889,7 +2889,7 @@ __LJMP static int hlua_socket_settimeout(struct lua_State *L)
return 0; return 0;
} }
appctx = container_of(peer, struct appctx, ctx.hlua_cosocket.xref); appctx = container_of(peer, struct appctx, ctx.hlua_cosocket.xref);
si = appctx->owner; si = cs_si(appctx->owner);
s = si_strm(si); s = si_strm(si);
s->sess->fe->timeout.connect = tmout; s->sess->fe->timeout.connect = tmout;
@ -4269,7 +4269,7 @@ __LJMP static struct hlua_appctx *hlua_checkapplet_tcp(lua_State *L, int ud)
static int hlua_applet_tcp_new(lua_State *L, struct appctx *ctx) static int hlua_applet_tcp_new(lua_State *L, struct appctx *ctx)
{ {
struct hlua_appctx *luactx; struct hlua_appctx *luactx;
struct stream_interface *si = ctx->owner; struct stream_interface *si = cs_si(ctx->owner);
struct stream *s = si_strm(si); struct stream *s = si_strm(si);
struct proxy *p = s->be; struct proxy *p = s->be;
@ -4450,7 +4450,7 @@ __LJMP static int hlua_applet_tcp_get_priv(lua_State *L)
__LJMP static int hlua_applet_tcp_getline_yield(lua_State *L, int status, lua_KContext ctx) __LJMP static int hlua_applet_tcp_getline_yield(lua_State *L, int status, lua_KContext ctx)
{ {
struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_tcp(L, 1)); struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_tcp(L, 1));
struct stream_interface *si = luactx->appctx->owner; struct stream_interface *si = cs_si(luactx->appctx->owner);
int ret; int ret;
const char *blk1; const char *blk1;
size_t len1; size_t len1;
@ -4504,7 +4504,7 @@ __LJMP static int hlua_applet_tcp_getline(lua_State *L)
__LJMP static int hlua_applet_tcp_recv_yield(lua_State *L, int status, lua_KContext ctx) __LJMP static int hlua_applet_tcp_recv_yield(lua_State *L, int status, lua_KContext ctx)
{ {
struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_tcp(L, 1)); struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_tcp(L, 1));
struct stream_interface *si = luactx->appctx->owner; struct stream_interface *si = cs_si(luactx->appctx->owner);
size_t len = MAY_LJMP(luaL_checkinteger(L, 2)); size_t len = MAY_LJMP(luaL_checkinteger(L, 2));
int ret; int ret;
const char *blk1; const char *blk1;
@ -4612,7 +4612,7 @@ __LJMP static int hlua_applet_tcp_send_yield(lua_State *L, int status, lua_KCont
struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_tcp(L, 1)); struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_tcp(L, 1));
const char *str = MAY_LJMP(luaL_checklstring(L, 2, &len)); const char *str = MAY_LJMP(luaL_checklstring(L, 2, &len));
int l = MAY_LJMP(luaL_checkinteger(L, 3)); int l = MAY_LJMP(luaL_checkinteger(L, 3));
struct stream_interface *si = luactx->appctx->owner; struct stream_interface *si = cs_si(luactx->appctx->owner);
struct channel *chn = si_ic(si); struct channel *chn = si_ic(si);
int max; int max;
@ -4675,7 +4675,7 @@ static int hlua_applet_http_new(lua_State *L, struct appctx *ctx)
{ {
struct hlua_appctx *luactx; struct hlua_appctx *luactx;
struct hlua_txn htxn; struct hlua_txn htxn;
struct stream_interface *si = ctx->owner; struct stream_interface *si = cs_si(ctx->owner);
struct stream *s = si_strm(si); struct stream *s = si_strm(si);
struct proxy *px = s->be; struct proxy *px = s->be;
struct htx *htx; struct htx *htx;
@ -4937,7 +4937,7 @@ __LJMP static int hlua_applet_http_get_priv(lua_State *L)
__LJMP static int hlua_applet_http_getline_yield(lua_State *L, int status, lua_KContext ctx) __LJMP static int hlua_applet_http_getline_yield(lua_State *L, int status, lua_KContext ctx)
{ {
struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_http(L, 1)); struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_http(L, 1));
struct stream_interface *si = luactx->appctx->owner; struct stream_interface *si = cs_si(luactx->appctx->owner);
struct channel *req = si_oc(si); struct channel *req = si_oc(si);
struct htx *htx; struct htx *htx;
struct htx_blk *blk; struct htx_blk *blk;
@ -5032,7 +5032,7 @@ __LJMP static int hlua_applet_http_getline(lua_State *L)
__LJMP static int hlua_applet_http_recv_yield(lua_State *L, int status, lua_KContext ctx) __LJMP static int hlua_applet_http_recv_yield(lua_State *L, int status, lua_KContext ctx)
{ {
struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_http(L, 1)); struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_http(L, 1));
struct stream_interface *si = luactx->appctx->owner; struct stream_interface *si = cs_si(luactx->appctx->owner);
struct channel *req = si_oc(si); struct channel *req = si_oc(si);
struct htx *htx; struct htx *htx;
struct htx_blk *blk; struct htx_blk *blk;
@ -5141,7 +5141,7 @@ __LJMP static int hlua_applet_http_recv(lua_State *L)
__LJMP static int hlua_applet_http_send_yield(lua_State *L, int status, lua_KContext ctx) __LJMP static int hlua_applet_http_send_yield(lua_State *L, int status, lua_KContext ctx)
{ {
struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_http(L, 1)); struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_http(L, 1));
struct stream_interface *si = luactx->appctx->owner; struct stream_interface *si = cs_si(luactx->appctx->owner);
struct channel *res = si_ic(si); struct channel *res = si_ic(si);
struct htx *htx = htx_from_buf(&res->buf); struct htx *htx = htx_from_buf(&res->buf);
const char *data; const char *data;
@ -5275,7 +5275,7 @@ __LJMP static int hlua_applet_http_status(lua_State *L)
__LJMP static int hlua_applet_http_send_response(lua_State *L) __LJMP static int hlua_applet_http_send_response(lua_State *L)
{ {
struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_http(L, 1)); struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_http(L, 1));
struct stream_interface *si = luactx->appctx->owner; struct stream_interface *si = cs_si(luactx->appctx->owner);
struct channel *res = si_ic(si); struct channel *res = si_ic(si);
struct htx *htx; struct htx *htx;
struct htx_sl *sl; struct htx_sl *sl;
@ -5474,7 +5474,7 @@ __LJMP static int hlua_applet_http_send_response(lua_State *L)
__LJMP static int hlua_applet_http_start_response_yield(lua_State *L, int status, lua_KContext ctx) __LJMP static int hlua_applet_http_start_response_yield(lua_State *L, int status, lua_KContext ctx)
{ {
struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_http(L, 1)); struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_http(L, 1));
struct stream_interface *si = luactx->appctx->owner; struct stream_interface *si = cs_si(luactx->appctx->owner);
struct channel *res = si_ic(si); struct channel *res = si_ic(si);
if (co_data(res)) { if (co_data(res)) {
@ -9182,7 +9182,7 @@ struct task *hlua_applet_wakeup(struct task *t, void *context, unsigned int stat
static int hlua_applet_tcp_init(struct appctx *ctx, struct proxy *px, struct stream *strm) static int hlua_applet_tcp_init(struct appctx *ctx, struct proxy *px, struct stream *strm)
{ {
struct stream_interface *si = ctx->owner; struct stream_interface *si = cs_si(ctx->owner);
struct hlua *hlua; struct hlua *hlua;
struct task *task; struct task *task;
char **arg; char **arg;
@ -9278,7 +9278,7 @@ static int hlua_applet_tcp_init(struct appctx *ctx, struct proxy *px, struct str
void hlua_applet_tcp_fct(struct appctx *ctx) void hlua_applet_tcp_fct(struct appctx *ctx)
{ {
struct stream_interface *si = ctx->owner; struct stream_interface *si = cs_si(ctx->owner);
struct stream *strm = si_strm(si); struct stream *strm = si_strm(si);
struct channel *res = si_ic(si); struct channel *res = si_ic(si);
struct act_rule *rule = ctx->rule; struct act_rule *rule = ctx->rule;
@ -9369,7 +9369,7 @@ static void hlua_applet_tcp_release(struct appctx *ctx)
*/ */
static int hlua_applet_http_init(struct appctx *ctx, struct proxy *px, struct stream *strm) static int hlua_applet_http_init(struct appctx *ctx, struct proxy *px, struct stream *strm)
{ {
struct stream_interface *si = ctx->owner; struct stream_interface *si = cs_si(ctx->owner);
struct http_txn *txn; struct http_txn *txn;
struct hlua *hlua; struct hlua *hlua;
char **arg; char **arg;
@ -9470,7 +9470,7 @@ static int hlua_applet_http_init(struct appctx *ctx, struct proxy *px, struct st
void hlua_applet_http_fct(struct appctx *ctx) void hlua_applet_http_fct(struct appctx *ctx)
{ {
struct stream_interface *si = ctx->owner; struct stream_interface *si = cs_si(ctx->owner);
struct stream *strm = si_strm(si); struct stream *strm = si_strm(si);
struct channel *req = si_oc(si); struct channel *req = si_oc(si);
struct channel *res = si_ic(si); struct channel *res = si_ic(si);
@ -10089,7 +10089,7 @@ static int hlua_cli_io_handler_fct(struct appctx *appctx)
struct hlua_function *fcn; struct hlua_function *fcn;
hlua = appctx->ctx.hlua_cli.hlua; hlua = appctx->ctx.hlua_cli.hlua;
si = appctx->owner; si = cs_si(appctx->owner);
fcn = appctx->ctx.hlua_cli.fcn; fcn = appctx->ctx.hlua_cli.fcn;
/* If the stream is disconnect or closed, ldo nothing. */ /* If the stream is disconnect or closed, ldo nothing. */

View File

@ -165,7 +165,7 @@ err:
*/ */
static int hc_cli_io_handler(struct appctx *appctx) static int hc_cli_io_handler(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct buffer *trash = alloc_trash_chunk(); struct buffer *trash = alloc_trash_chunk();
struct httpclient *hc = appctx->ctx.cli.p0; struct httpclient *hc = appctx->ctx.cli.p0;
struct http_hdr *hdrs, *hdr; struct http_hdr *hdrs, *hdr;
@ -639,7 +639,7 @@ err:
static void httpclient_applet_io_handler(struct appctx *appctx) static void httpclient_applet_io_handler(struct appctx *appctx)
{ {
struct httpclient *hc = appctx->ctx.httpclient.ptr; struct httpclient *hc = appctx->ctx.httpclient.ptr;
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct stream *s = si_strm(si); struct stream *s = si_strm(si);
struct channel *req = &s->req; struct channel *req = &s->req;
struct channel *res = &s->res; struct channel *res = &s->res;

View File

@ -3550,7 +3550,7 @@ out:
static void syslog_io_handler(struct appctx *appctx) static void syslog_io_handler(struct appctx *appctx)
{ {
static THREAD_LOCAL struct ist metadata[LOG_META_FIELDS]; static THREAD_LOCAL struct ist metadata[LOG_META_FIELDS];
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct stream *s = si_strm(si); struct stream *s = si_strm(si);
struct proxy *frontend = strm_fe(s); struct proxy *frontend = strm_fe(s);
struct listener *l = strm_li(s); struct listener *l = strm_li(s);

View File

@ -323,7 +323,7 @@ struct pattern_expr *pat_expr_get_next(struct pattern_expr *getnext, struct list
/* expects the current generation ID in appctx->cli.cli.i0 */ /* expects the current generation ID in appctx->cli.cli.i0 */
static int cli_io_handler_pat_list(struct appctx *appctx) static int cli_io_handler_pat_list(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct pat_ref_elt *elt; struct pat_ref_elt *elt;
if (unlikely(si_ic(si)->flags & (CF_WRITE_ERROR|CF_SHUTW))) { if (unlikely(si_ic(si)->flags & (CF_WRITE_ERROR|CF_SHUTW))) {
@ -406,7 +406,7 @@ static int cli_io_handler_pat_list(struct appctx *appctx)
static int cli_io_handler_pats_list(struct appctx *appctx) static int cli_io_handler_pats_list(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
switch (appctx->st2) { switch (appctx->st2) {
case STAT_ST_INIT: case STAT_ST_INIT:
@ -468,7 +468,7 @@ static int cli_io_handler_pats_list(struct appctx *appctx)
static int cli_io_handler_map_lookup(struct appctx *appctx) static int cli_io_handler_map_lookup(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct sample sample; struct sample sample;
struct pattern *pat; struct pattern *pat;
int match_method; int match_method;
@ -993,7 +993,7 @@ static int cli_parse_del_map(char **args, char *payload, struct appctx *appctx,
*/ */
static int cli_io_handler_clear_map(struct appctx *appctx) static int cli_io_handler_clear_map(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
int finished; int finished;
HA_SPIN_LOCK(PATREF_LOCK, &appctx->ctx.map.ref->lock); HA_SPIN_LOCK(PATREF_LOCK, &appctx->ctx.map.ref->lock);

View File

@ -509,7 +509,7 @@ void mworker_cleanup_proc()
/* Displays workers and processes */ /* Displays workers and processes */
static int cli_io_handler_show_proc(struct appctx *appctx) static int cli_io_handler_show_proc(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct mworker_proc *child; struct mworker_proc *child;
int old = 0; int old = 0;
int up = now.tv_sec - proc_self->timestamp; int up = now.tv_sec - proc_self->timestamp;

View File

@ -446,7 +446,7 @@ static void peers_trace(enum trace_level level, uint64_t mask,
if (peer->appctx) { if (peer->appctx) {
struct stream_interface *si; struct stream_interface *si;
si = peer->appctx->owner; si = cs_si(peer->appctx->owner);
if (si) { if (si) {
struct stream *s = si_strm(si); struct stream *s = si_strm(si);
@ -1049,7 +1049,7 @@ void __peer_session_deinit(struct peer *peer)
if (!peer->appctx) if (!peer->appctx)
return; return;
si = peer->appctx->owner; si = cs_si(peer->appctx->owner);
if (!si) if (!si)
return; return;
@ -1149,7 +1149,7 @@ static int peer_get_version(const char *str,
static inline int peer_getline(struct appctx *appctx) static inline int peer_getline(struct appctx *appctx)
{ {
int n; int n;
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
n = co_getline(si_oc(si), trash.area, trash.size); n = co_getline(si_oc(si), trash.area, trash.size);
if (!n) if (!n)
@ -1182,7 +1182,7 @@ static inline int peer_send_msg(struct appctx *appctx,
struct peer_prep_params *params) struct peer_prep_params *params)
{ {
int ret, msglen; int ret, msglen;
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
msglen = peer_prepare_msg(trash.area, trash.size, params); msglen = peer_prepare_msg(trash.area, trash.size, params);
if (!msglen) { if (!msglen) {
@ -1662,7 +1662,7 @@ static inline int peer_send_teach_stage2_msgs(struct appctx *appctx, struct peer
static int peer_treat_updatemsg(struct appctx *appctx, struct peer *p, int updt, int exp, static int peer_treat_updatemsg(struct appctx *appctx, struct peer *p, int updt, int exp,
char **msg_cur, char *msg_end, int msg_len, int totl) char **msg_cur, char *msg_end, int msg_len, int totl)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct shared_table *st = p->remote_table; struct shared_table *st = p->remote_table;
struct stksess *ts, *newts; struct stksess *ts, *newts;
uint32_t update; uint32_t update;
@ -2114,7 +2114,7 @@ static inline int peer_treat_switchmsg(struct appctx *appctx, struct peer *p,
static inline int peer_treat_definemsg(struct appctx *appctx, struct peer *p, static inline int peer_treat_definemsg(struct appctx *appctx, struct peer *p,
char **msg_cur, char *msg_end, int totl) char **msg_cur, char *msg_end, int totl)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
int table_id_len; int table_id_len;
struct shared_table *st; struct shared_table *st;
int table_type; int table_type;
@ -2313,7 +2313,7 @@ static inline int peer_recv_msg(struct appctx *appctx, char *msg_head, size_t ms
uint32_t *msg_len, int *totl) uint32_t *msg_len, int *totl)
{ {
int reql; int reql;
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
char *cur; char *cur;
reql = co_getblk(si_oc(si), msg_head, 2 * sizeof(char), *totl); reql = co_getblk(si_oc(si), msg_head, 2 * sizeof(char), *totl);
@ -2385,7 +2385,7 @@ static inline int peer_recv_msg(struct appctx *appctx, char *msg_head, size_t ms
static inline int peer_treat_awaited_msg(struct appctx *appctx, struct peer *peer, unsigned char *msg_head, static inline int peer_treat_awaited_msg(struct appctx *appctx, struct peer *peer, unsigned char *msg_head,
char **msg_cur, char *msg_end, int msg_len, int totl) char **msg_cur, char *msg_end, int msg_len, int totl)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct stream *s = si_strm(si); struct stream *s = si_strm(si);
struct peers *peers = strm_fe(s)->parent; struct peers *peers = strm_fe(s)->parent;
@ -2673,7 +2673,7 @@ static inline int peer_getline_last(struct appctx *appctx, struct peer **curpeer
char *p; char *p;
int reql; int reql;
struct peer *peer; struct peer *peer;
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct stream *s = si_strm(si); struct stream *s = si_strm(si);
struct peers *peers = strm_fe(s)->parent; struct peers *peers = strm_fe(s)->parent;
@ -2834,7 +2834,7 @@ static inline void init_connected_peer(struct peer *peer, struct peers *peers)
*/ */
static void peer_io_handler(struct appctx *appctx) static void peer_io_handler(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct stream *s = si_strm(si); struct stream *s = si_strm(si);
struct peers *curpeers = strm_fe(s)->parent; struct peers *curpeers = strm_fe(s)->parent;
struct peer *curpeer = NULL; struct peer *curpeer = NULL;
@ -3829,7 +3829,7 @@ static int peers_dump_peer(struct buffer *msg, struct stream_interface *si, stru
chunk_appendf(&trash, " appctx:%p st0=%d st1=%d task_calls=%u", appctx, appctx->st0, appctx->st1, chunk_appendf(&trash, " appctx:%p st0=%d st1=%d task_calls=%u", appctx, appctx->st0, appctx->st1,
appctx->t ? appctx->t->calls : 0); appctx->t ? appctx->t->calls : 0);
peer_si = peer->appctx->owner; peer_si = cs_si(peer->appctx->owner);
if (!peer_si) if (!peer_si)
goto table_info; goto table_info;
@ -3952,7 +3952,7 @@ static int cli_io_handler_show_peers(struct appctx *appctx)
{ {
int show_all; int show_all;
int ret = 0, first_peers = 1; int ret = 0, first_peers = 1;
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
thread_isolate(); thread_isolate();

View File

@ -995,7 +995,7 @@ int pool_parse_debugging(const char *str, char **err)
*/ */
static int cli_io_handler_dump_pools(struct appctx *appctx) static int cli_io_handler_dump_pools(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
dump_pools_to_trash(); dump_pools_to_trash();
if (ci_putchk(si_ic(si), &trash) == -1) { if (ci_putchk(si_ic(si), &trash) == -1) {

View File

@ -2689,7 +2689,7 @@ static int dump_servers_state(struct stream_interface *si)
*/ */
static int cli_io_handler_servers_state(struct appctx *appctx) static int cli_io_handler_servers_state(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct proxy *curproxy; struct proxy *curproxy;
chunk_reset(&trash); chunk_reset(&trash);
@ -2736,7 +2736,7 @@ static int cli_io_handler_servers_state(struct appctx *appctx)
*/ */
static int cli_io_handler_show_backend(struct appctx *appctx) static int cli_io_handler_show_backend(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct proxy *curproxy; struct proxy *curproxy;
chunk_reset(&trash); chunk_reset(&trash);
@ -3039,7 +3039,7 @@ static int cli_parse_show_errors(char **args, char *payload, struct appctx *appc
*/ */
static int cli_io_handler_show_errors(struct appctx *appctx) static int cli_io_handler_show_errors(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
extern const char *monthname[12]; extern const char *monthname[12];
if (unlikely(si_ic(si)->flags & (CF_WRITE_ERROR|CF_SHUTW))) if (unlikely(si_ic(si)->flags & (CF_WRITE_ERROR|CF_SHUTW)))

View File

@ -2745,7 +2745,7 @@ static int cli_parse_stat_resolvers(char **args, char *payload, struct appctx *a
*/ */
static int cli_io_handler_dump_resolvers_to_buffer(struct appctx *appctx) static int cli_io_handler_dump_resolvers_to_buffer(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct resolvers *resolvers; struct resolvers *resolvers;
struct dns_nameserver *ns; struct dns_nameserver *ns;

View File

@ -276,7 +276,7 @@ int ring_attach_cli(struct ring *ring, struct appctx *appctx)
*/ */
int cli_io_handler_show_ring(struct appctx *appctx) int cli_io_handler_show_ring(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct ring *ring = appctx->ctx.cli.p0; struct ring *ring = appctx->ctx.cli.p0;
struct buffer *buf = &ring->buf; struct buffer *buf = &ring->buf;
size_t ofs = appctx->ctx.cli.o0; size_t ofs = appctx->ctx.cli.o0;

View File

@ -4314,7 +4314,7 @@ static int cli_parse_set_server(char **args, char *payload, struct appctx *appct
static int cli_parse_get_weight(char **args, char *payload, struct appctx *appctx, void *private) static int cli_parse_get_weight(char **args, char *payload, struct appctx *appctx, void *private)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct proxy *px; struct proxy *px;
struct server *sv; struct server *sv;
char *line; char *line;

View File

@ -1159,7 +1159,7 @@ static int cli_io_handler_show_cert(struct appctx *appctx)
{ {
struct buffer *trash = alloc_trash_chunk(); struct buffer *trash = alloc_trash_chunk();
struct ebmb_node *node; struct ebmb_node *node;
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct ckch_store *ckchs; struct ckch_store *ckchs;
if (trash == NULL) if (trash == NULL)
@ -1558,7 +1558,7 @@ static int ckch_store_show_ocsp_certid(struct ckch_store *ckch_store, struct buf
/* IO handler of the details "show ssl cert <filename>" */ /* IO handler of the details "show ssl cert <filename>" */
static int cli_io_handler_show_cert_detail(struct appctx *appctx) static int cli_io_handler_show_cert_detail(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct ckch_store *ckchs = appctx->ctx.cli.p0; struct ckch_store *ckchs = appctx->ctx.cli.p0;
struct buffer *out = alloc_trash_chunk(); struct buffer *out = alloc_trash_chunk();
int retval = 0; int retval = 0;
@ -1606,7 +1606,7 @@ yield:
static int cli_io_handler_show_cert_ocsp_detail(struct appctx *appctx) static int cli_io_handler_show_cert_ocsp_detail(struct appctx *appctx)
{ {
#if ((defined SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB && !defined OPENSSL_NO_OCSP) && !defined OPENSSL_IS_BORINGSSL) #if ((defined SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB && !defined OPENSSL_NO_OCSP) && !defined OPENSSL_IS_BORINGSSL)
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct ckch_store *ckchs = appctx->ctx.cli.p0; struct ckch_store *ckchs = appctx->ctx.cli.p0;
struct buffer *out = alloc_trash_chunk(); struct buffer *out = alloc_trash_chunk();
int from_transaction = appctx->ctx.cli.i0; int from_transaction = appctx->ctx.cli.i0;
@ -1837,7 +1837,7 @@ static void __ckch_inst_free_locked(struct ckch_inst *ckchi)
*/ */
static int cli_io_handler_commit_cert(struct appctx *appctx) static int cli_io_handler_commit_cert(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
int y = 0; int y = 0;
char *err = NULL; char *err = NULL;
struct ckch_store *old_ckchs, *new_ckchs = NULL; struct ckch_store *old_ckchs, *new_ckchs = NULL;
@ -2603,7 +2603,7 @@ static inline int __create_new_instance(struct appctx *appctx, struct ckch_inst
*/ */
static int cli_io_handler_commit_cafile_crlfile(struct appctx *appctx) static int cli_io_handler_commit_cafile_crlfile(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
int y = 0; int y = 0;
char *err = NULL; char *err = NULL;
struct cafile_entry *old_cafile_entry = NULL, *new_cafile_entry = NULL; struct cafile_entry *old_cafile_entry = NULL, *new_cafile_entry = NULL;
@ -2827,7 +2827,7 @@ static void cli_release_commit_cafile(struct appctx *appctx)
/* IO handler of details "show ssl ca-file <filename[:index]>" */ /* IO handler of details "show ssl ca-file <filename[:index]>" */
static int cli_io_handler_show_cafile_detail(struct appctx *appctx) static int cli_io_handler_show_cafile_detail(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct cafile_entry *cafile_entry = appctx->ctx.cli.p0; struct cafile_entry *cafile_entry = appctx->ctx.cli.p0;
struct buffer *out = alloc_trash_chunk(); struct buffer *out = alloc_trash_chunk();
int i; int i;
@ -2980,7 +2980,7 @@ static int cli_io_handler_show_cafile(struct appctx *appctx)
{ {
struct buffer *trash = alloc_trash_chunk(); struct buffer *trash = alloc_trash_chunk();
struct ebmb_node *node; struct ebmb_node *node;
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct cafile_entry *cafile_entry; struct cafile_entry *cafile_entry;
if (trash == NULL) if (trash == NULL)
@ -3486,7 +3486,7 @@ end:
/* IO handler of details "show ssl crl-file <filename[:index]>" */ /* IO handler of details "show ssl crl-file <filename[:index]>" */
static int cli_io_handler_show_crlfile_detail(struct appctx *appctx) static int cli_io_handler_show_crlfile_detail(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct cafile_entry *cafile_entry = appctx->ctx.cli.p0; struct cafile_entry *cafile_entry = appctx->ctx.cli.p0;
struct buffer *out = alloc_trash_chunk(); struct buffer *out = alloc_trash_chunk();
int i; int i;
@ -3616,7 +3616,7 @@ static int cli_io_handler_show_crlfile(struct appctx *appctx)
{ {
struct buffer *trash = alloc_trash_chunk(); struct buffer *trash = alloc_trash_chunk();
struct ebmb_node *node; struct ebmb_node *node;
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct cafile_entry *cafile_entry; struct cafile_entry *cafile_entry;
if (trash == NULL) if (trash == NULL)

View File

@ -887,7 +887,7 @@ static void dump_crtlist_filters(struct buffer *buf, struct crtlist_entry *entry
static int cli_io_handler_dump_crtlist(struct appctx *appctx) static int cli_io_handler_dump_crtlist(struct appctx *appctx)
{ {
struct buffer *trash = alloc_trash_chunk(); struct buffer *trash = alloc_trash_chunk();
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct ebmb_node *lnode; struct ebmb_node *lnode;
if (trash == NULL) if (trash == NULL)
@ -918,7 +918,7 @@ static int cli_io_handler_dump_crtlist_entries(struct appctx *appctx)
{ {
struct buffer *trash = alloc_trash_chunk(); struct buffer *trash = alloc_trash_chunk();
struct crtlist *crtlist; struct crtlist *crtlist;
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct crtlist_entry *entry; struct crtlist_entry *entry;
if (trash == NULL) if (trash == NULL)
@ -1041,7 +1041,7 @@ static void cli_release_add_crtlist(struct appctx *appctx)
static int cli_io_handler_add_crtlist(struct appctx *appctx) static int cli_io_handler_add_crtlist(struct appctx *appctx)
{ {
struct bind_conf_list *bind_conf_node; struct bind_conf_list *bind_conf_node;
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct crtlist *crtlist = appctx->ctx.cli.p0; struct crtlist *crtlist = appctx->ctx.cli.p0;
struct crtlist_entry *entry = appctx->ctx.cli.p1; struct crtlist_entry *entry = appctx->ctx.cli.p1;
struct ckch_store *store = entry->node.key; struct ckch_store *store = entry->node.key;

View File

@ -7195,7 +7195,7 @@ static inline int cli_io_handler_tlskeys_entries(struct appctx *appctx) {
*/ */
static int cli_io_handler_tlskeys_files(struct appctx *appctx) { static int cli_io_handler_tlskeys_files(struct appctx *appctx) {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
switch (appctx->st2) { switch (appctx->st2) {
case STAT_ST_INIT: case STAT_ST_INIT:
@ -7471,7 +7471,7 @@ static int cli_io_handler_show_ocspresponse(struct appctx *appctx)
struct buffer *trash = alloc_trash_chunk(); struct buffer *trash = alloc_trash_chunk();
struct buffer *tmp = NULL; struct buffer *tmp = NULL;
struct ebmb_node *node; struct ebmb_node *node;
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct certificate_ocsp *ocsp = NULL; struct certificate_ocsp *ocsp = NULL;
BIO *bio = NULL; BIO *bio = NULL;
int write = -1; int write = -1;
@ -7658,7 +7658,7 @@ static int cli_io_handler_show_ocspresponse_detail(struct appctx *appctx)
{ {
struct buffer *trash = alloc_trash_chunk(); struct buffer *trash = alloc_trash_chunk();
struct certificate_ocsp *ocsp = NULL; struct certificate_ocsp *ocsp = NULL;
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
ocsp = appctx->ctx.cli.p0; ocsp = appctx->ctx.cli.p0;

View File

@ -4262,7 +4262,7 @@ full:
*/ */
static void http_stats_io_handler(struct appctx *appctx) static void http_stats_io_handler(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct stream *s = si_strm(si); struct stream *s = si_strm(si);
struct channel *req = si_oc(si); struct channel *req = si_oc(si);
struct channel *res = si_ic(si); struct channel *res = si_ic(si);
@ -4911,7 +4911,7 @@ static int cli_parse_show_stat(char **args, char *payload, struct appctx *appctx
appctx->ctx.stats.scope_len = 0; appctx->ctx.stats.scope_len = 0;
appctx->ctx.stats.flags = STAT_SHNODE | STAT_SHDESC; appctx->ctx.stats.flags = STAT_SHNODE | STAT_SHDESC;
if ((strm_li(si_strm(appctx->owner))->bind_conf->level & ACCESS_LVL_MASK) >= ACCESS_LVL_OPER) if ((strm_li(si_strm(cs_si(appctx->owner)))->bind_conf->level & ACCESS_LVL_MASK) >= ACCESS_LVL_OPER)
appctx->ctx.stats.flags |= STAT_SHLGNDS; appctx->ctx.stats.flags |= STAT_SHLGNDS;
/* proxy is the default domain */ /* proxy is the default domain */
@ -4967,7 +4967,7 @@ static int cli_parse_show_stat(char **args, char *payload, struct appctx *appctx
static int cli_io_handler_dump_info(struct appctx *appctx) static int cli_io_handler_dump_info(struct appctx *appctx)
{ {
return stats_dump_info_to_buffer(appctx->owner); return stats_dump_info_to_buffer(cs_si(appctx->owner));
} }
/* This I/O handler runs as an applet embedded in a stream interface. It is /* This I/O handler runs as an applet embedded in a stream interface. It is
@ -4975,12 +4975,12 @@ static int cli_io_handler_dump_info(struct appctx *appctx)
*/ */
static int cli_io_handler_dump_stat(struct appctx *appctx) static int cli_io_handler_dump_stat(struct appctx *appctx)
{ {
return stats_dump_stat_to_buffer(appctx->owner, NULL, NULL); return stats_dump_stat_to_buffer(cs_si(appctx->owner), NULL, NULL);
} }
static int cli_io_handler_dump_json_schema(struct appctx *appctx) static int cli_io_handler_dump_json_schema(struct appctx *appctx)
{ {
return stats_dump_json_schema_to_buffer(appctx->owner); return stats_dump_json_schema_to_buffer(cs_si(appctx->owner));
} }
int stats_allocate_proxy_counters_internal(struct extra_counters **counters, int stats_allocate_proxy_counters_internal(struct extra_counters **counters,

View File

@ -4391,7 +4391,7 @@ static int table_dump_entry_to_buffer(struct buffer *msg,
*/ */
static int table_process_entry_per_key(struct appctx *appctx, char **args) static int table_process_entry_per_key(struct appctx *appctx, char **args)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct stktable *t = appctx->ctx.table.target; struct stktable *t = appctx->ctx.table.target;
struct stksess *ts; struct stksess *ts;
uint32_t uint32_key; uint32_t uint32_key;
@ -4646,7 +4646,7 @@ err_args:
*/ */
static int cli_io_handler_table(struct appctx *appctx) static int cli_io_handler_table(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct stream *s = si_strm(si); struct stream *s = si_strm(si);
struct ebmb_node *eb; struct ebmb_node *eb;
int skip_entry; int skip_entry;

View File

@ -2789,7 +2789,7 @@ void stream_dump_and_crash(enum obj_type *obj, int rate)
if (!appctx) if (!appctx)
return; return;
ptr = appctx; ptr = appctx;
s = si_strm(appctx->owner); s = si_strm(cs_si(appctx->owner));
if (!s) if (!s)
return; return;
} }
@ -3476,7 +3476,7 @@ static int cli_parse_show_sess(char **args, char *payload, struct appctx *appctx
/* let's set our own stream's epoch to the current one and increment /* let's set our own stream's epoch to the current one and increment
* it so that we know which streams were already there before us. * it so that we know which streams were already there before us.
*/ */
si_strm(appctx->owner)->stream_epoch = _HA_ATOMIC_FETCH_ADD(&stream_epoch, 1); si_strm(cs_si(appctx->owner))->stream_epoch = _HA_ATOMIC_FETCH_ADD(&stream_epoch, 1);
return 0; return 0;
} }
@ -3487,7 +3487,7 @@ static int cli_parse_show_sess(char **args, char *payload, struct appctx *appctx
*/ */
static int cli_io_handler_dump_sess(struct appctx *appctx) static int cli_io_handler_dump_sess(struct appctx *appctx)
{ {
struct stream_interface *si = appctx->owner; struct stream_interface *si = cs_si(appctx->owner);
struct connection *conn; struct connection *conn;
thread_isolate(); thread_isolate();
@ -3539,7 +3539,7 @@ static int cli_io_handler_dump_sess(struct appctx *appctx)
else { else {
/* check if we've found a stream created after issuing the "show sess" */ /* check if we've found a stream created after issuing the "show sess" */
curr_strm = LIST_ELEM(appctx->ctx.sess.bref.ref, struct stream *, list); curr_strm = LIST_ELEM(appctx->ctx.sess.bref.ref, struct stream *, list);
if ((int)(curr_strm->stream_epoch - si_strm(appctx->owner)->stream_epoch) > 0) if ((int)(curr_strm->stream_epoch - si_strm(cs_si(appctx->owner))->stream_epoch) > 0)
done = 1; done = 1;
} }