static struct ist prefix = IST("haproxy_process_");
struct promex_ctx *ctx = appctx->svcctx;
struct field val;
- struct channel *chn = cs_ic(appctx->owner);
+ struct channel *chn = cs_ic(appctx_cs(appctx));
struct ist out = ist2(trash.area, 0);
size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
int ret = 1;
struct promex_ctx *ctx = appctx->svcctx;
struct proxy *px;
struct field val;
- struct channel *chn = cs_ic(appctx->owner);
+ struct channel *chn = cs_ic(appctx_cs(appctx));
struct ist out = ist2(trash.area, 0);
size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
struct field *stats = stat_l[STATS_DOMAIN_PROXY];
struct promex_ctx *ctx = appctx->svcctx;
struct proxy *px;
struct field val;
- struct channel *chn = cs_ic(appctx->owner);
+ struct channel *chn = cs_ic(appctx_cs(appctx));
struct ist out = ist2(trash.area, 0);
size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
struct field *stats = stat_l[STATS_DOMAIN_PROXY];
struct proxy *px;
struct server *sv;
struct field val;
- struct channel *chn = cs_ic(appctx->owner);
+ struct channel *chn = cs_ic(appctx_cs(appctx));
struct ist out = ist2(trash.area, 0);
size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
struct field *stats = stat_l[STATS_DOMAIN_PROXY];
struct proxy *px;
struct server *sv;
struct field val;
- struct channel *chn = cs_ic(appctx->owner);
+ struct channel *chn = cs_ic(appctx_cs(appctx));
struct ist out = ist2(trash.area, 0);
size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
struct field *stats = stat_l[STATS_DOMAIN_PROXY];
static struct ist prefix = IST("haproxy_sticktable_");
struct promex_ctx *ctx = appctx->svcctx;
struct field val;
- struct channel *chn = cs_ic(appctx->owner);
+ struct channel *chn = cs_ic(appctx_cs(appctx));
struct ist out = ist2(trash.area, 0);
size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
int ret = 1;
/* The main I/O handler for the promex applet. */
static void promex_appctx_handle_io(struct appctx *appctx)
{
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct stream *s = __cs_strm(cs);
struct channel *req = cs_oc(cs);
struct channel *res = cs_ic(cs);
unsigned int st1; /* prompt/payload (bitwise OR of APPCTX_CLI_ST1_*) for stats, session error for peers */
struct buffer *chunk; /* used to store unfinished commands */
struct applet *applet; /* applet this context refers to */
- struct conn_stream *owner;
struct cs_endpoint *endp;
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 */
unsigned long long tot_alloc_calls, tot_free_calls;
unsigned long long tot_alloc_bytes, tot_free_bytes;
#endif
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct buffer *name_buffer = get_trash_chunk();
const char *str;
int max_lines;
static int cli_io_handler_show_tasks(struct appctx *appctx)
{
struct sched_activity tmp_activity[256] __attribute__((aligned(64)));
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct buffer *name_buffer = get_trash_chunk();
struct sched_activity *entry;
const struct tasklet *tl;
int appctx_buf_available(void *arg)
{
struct appctx *appctx = arg;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
/* allocation requested ? */
if (!(appctx->endp->flags & CS_EP_RXBLK_BUFF))
struct task *task_run_applet(struct task *t, void *context, unsigned int state)
{
struct appctx *app = context;
- struct conn_stream *cs = app->owner;
+ struct conn_stream *cs = appctx_cs(app);
unsigned int rate;
size_t count;
unsigned int max, total;
uint32_t blksz;
- max = htx_get_max_blksz(htx, channel_htx_recv_max(cs_ic(appctx->owner), htx));
+ max = htx_get_max_blksz(htx,
+ channel_htx_recv_max(cs_ic(appctx_cs(appctx)), htx));
if (!max)
return 0;
blksz = ((type == HTX_BLK_HDR || type == HTX_BLK_TLR)
unsigned int max, total, rem_data;
uint32_t blksz;
- max = htx_get_max_blksz(htx, channel_htx_recv_max(cs_ic(appctx->owner), htx));
+ max = htx_get_max_blksz(htx,
+ channel_htx_recv_max(cs_ic(appctx_cs(appctx)), htx));
if (!max)
return 0;
struct cache_appctx *ctx = appctx->svcctx;
struct cache_entry *cache_ptr = ctx->entry;
struct shared_block *first = block_ptr(cache_ptr);
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct channel *req = cs_oc(cs);
struct channel *res = cs_ic(cs);
struct htx *req_htx, *res_htx;
{
struct show_cache_ctx *ctx = appctx->svcctx;
struct cache* cache = ctx->cache;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
list_for_each_entry_from(cache, &caches, list) {
struct eb32_node *node = NULL;
{
if (appctx->cli_severity_output)
return appctx->cli_severity_output;
- return strm_li(__cs_strm(appctx->owner))->bind_conf->severity_output;
+ return strm_li(appctx_strm(appctx))->bind_conf->severity_output;
}
/* Processes the CLI interpreter on the stats socket. This function is called
*/
static void cli_io_handler(struct appctx *appctx)
{
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct channel *req = cs_oc(cs);
struct channel *res = cs_ic(cs);
struct bind_conf *bind_conf = strm_li(__cs_strm(cs))->bind_conf;
static int cli_io_handler_show_env(struct appctx *appctx)
{
struct show_env_ctx *ctx = appctx->svcctx;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
char **var = ctx->var;
if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
*/
static int cli_io_handler_show_fd(struct appctx *appctx)
{
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct show_fd_ctx *fdctx = appctx->svcctx;
int fd = fdctx->fd;
int ret = 1;
*/
static int cli_io_handler_show_activity(struct appctx *appctx)
{
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
int thr;
if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
{
struct show_sock_ctx *ctx = applet_reserve_svcctx(appctx, sizeof(*ctx));
struct bind_conf *bind_conf = ctx->bind_conf;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
if (!global.cli_fe)
goto done;
/* 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)
{
- struct stream *s = __cs_strm(appctx->owner);
+ struct stream *s = appctx_strm(appctx);
if (strcmp(args[2], "cli") == 0) {
unsigned timeout;
char *cmsgbuf = NULL;
unsigned char *tmpbuf = NULL;
struct cmsghdr *cmsg;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct stream *s = __cs_strm(cs);
struct connection *remote = cs_conn(cs_opposite(cs));
struct msghdr msghdr;
struct conn_stream *cs_new_from_applet(struct cs_endpoint *endp, struct session *sess, struct buffer *input)
{
struct conn_stream *cs;
- struct appctx *appctx = endp->ctx;
cs = cs_new(endp);
if (unlikely(!cs))
return NULL;
- appctx->owner = cs;
if (unlikely(!stream_new(sess, cs, input))) {
pool_free(pool_head_connstream, cs);
cs = NULL;
*/
static void cs_attach_applet(struct conn_stream *cs, void *target, void *ctx)
{
- struct appctx *appctx = target;
-
cs->endp->target = target;
cs->endp->ctx = ctx;
cs->endp->flags |= CS_EP_T_APPLET;
cs->endp->flags &= ~CS_EP_DETACHED;
- appctx->owner = cs;
if (cs_strm(cs)) {
cs->ops = &cs_app_applet_ops;
cs->data_cb = &cs_data_applet_cb;
if (!appctx)
return NULL;
cs_attach_applet(cs, appctx, appctx);
- appctx->owner = cs;
appctx->t->nice = __cs_strm(cs)->task->nice;
cs_cant_get(cs);
appctx_wakeup(appctx);
if (task->process == process_stream && task->context)
s = (struct stream *)task->context;
else if (task->process == task_run_applet && task->context)
- s = cs_strm(((struct appctx *)task->context)->owner);
+ s = cs_strm(appctx_cs((struct appctx *)task->context));
else if (task->process == cs_conn_io_cb && task->context)
s = cs_strm(((struct conn_stream *)task->context));
*/
static int cli_io_handler_show_threads(struct appctx *appctx)
{
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
int thr;
if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
*/
static int debug_parse_cli_stream(char **args, char *payload, struct appctx *appctx, void *private)
{
- struct stream *s = __cs_strm(appctx->owner);
+ struct stream *s = appctx_strm(appctx);
int arg;
void *ptr;
int size;
static int debug_iohandler_fd(struct appctx *appctx)
{
struct dev_fd_ctx *ctx = appctx->svcctx;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct sockaddr_storage sa;
struct stat statbuf;
socklen_t salen, vlen;
static int debug_iohandler_memstats(struct appctx *appctx)
{
struct dev_mem_ctx *ctx = appctx->svcctx;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct mem_stats *ptr = ctx->start;
int ret = 1;
*/
static void dns_session_io_handler(struct appctx *appctx)
{
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct dns_session *ds = appctx->svcctx;
struct ring *ring = &ds->ring;
struct buffer *buf = &ring->buf;
static int
spoe_send_frame(struct appctx *appctx, char *buf, size_t framesz)
{
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
int ret;
uint32_t netint;
static int
spoe_recv_frame(struct appctx *appctx, char *buf, size_t framesz)
{
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
int ret;
uint32_t netint;
static int
spoe_wakeup_appctx(struct appctx *appctx)
{
- cs_want_get(appctx->owner);
- cs_rx_endp_more(appctx->owner);
+ cs_want_get(appctx_cs(appctx));
+ cs_rx_endp_more(appctx_cs(appctx));
appctx_wakeup(appctx);
return 1;
}
static void
spoe_release_appctx(struct appctx *appctx)
{
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct spoe_appctx *spoe_appctx = SPOE_APPCTX(appctx);
struct spoe_agent *agent;
struct spoe_context *ctx, *back;
static int
spoe_handle_connect_appctx(struct appctx *appctx)
{
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct spoe_agent *agent = SPOE_APPCTX(appctx)->agent;
char *frame, *buf;
int ret;
static int
spoe_handle_connecting_appctx(struct appctx *appctx)
{
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct spoe_agent *agent = SPOE_APPCTX(appctx)->agent;
char *frame;
int ret;
/* Do not forget to remove processed frame from the output buffer */
if (trash.data)
- co_skip(cs_oc(appctx->owner), trash.data);
+ co_skip(cs_oc(appctx_cs(appctx)), trash.data);
end:
return ret;
}
static int
spoe_handle_processing_appctx(struct appctx *appctx)
{
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct server *srv = objt_server(__cs_strm(cs)->target);
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;
static int
spoe_handle_disconnect_appctx(struct appctx *appctx)
{
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct spoe_agent *agent = SPOE_APPCTX(appctx)->agent;
char *frame, *buf;
int ret;
static int
spoe_handle_disconnecting_appctx(struct appctx *appctx)
{
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
char *frame;
int ret;
static void
spoe_handle_appctx(struct appctx *appctx)
{
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct spoe_agent *agent;
if (SPOE_APPCTX(appctx) == NULL)
static void hlua_socket_handler(struct appctx *appctx)
{
struct hlua_csk_ctx *ctx = appctx->svcctx;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
if (ctx->die) {
cs_shutw(cs);
csk_ctx = container_of(peer, struct hlua_csk_ctx, xref);
appctx = csk_ctx->appctx;
- s = __cs_strm(appctx->owner);
+ s = appctx_strm(appctx);
oc = &s->res;
if (wanted == HLSR_READ_LINE) {
csk_ctx = container_of(peer, struct hlua_csk_ctx, xref);
appctx = csk_ctx->appctx;
- cs = appctx->owner;
+ cs = appctx_cs(appctx);
s = __cs_strm(cs);
/* Check for connection close. */
}
appctx = container_of(peer, struct hlua_csk_ctx, xref)->appctx;
- cs = appctx->owner;
+ cs = appctx_cs(appctx);
dst = cs_dst(cs_opposite(cs));
if (!dst) {
xref_unlock(&socket->xref, peer);
}
appctx = container_of(peer, struct hlua_csk_ctx, xref)->appctx;
- s = __cs_strm(appctx->owner);
+ s = appctx_strm(appctx);
conn = cs_conn(s->csb);
if (!conn || !conn_get_src(conn)) {
csk_ctx = container_of(peer, struct hlua_csk_ctx, xref);
appctx = csk_ctx->appctx;
- s = __cs_strm(appctx->owner);
+ s = appctx_strm(appctx);
/* Check if we run on the same thread than the xreator thread.
* We cannot access to the socket if the thread is different.
csk_ctx = container_of(peer, struct hlua_csk_ctx, xref);
appctx = csk_ctx->appctx;
- cs = appctx->owner;
+ cs = appctx_cs(appctx);
s = __cs_strm(cs);
if (!sockaddr_alloc(&cs_opposite(cs)->dst, addr, sizeof(*addr))) {
{
struct hlua_socket *socket;
struct xref *peer;
- struct appctx *appctx;
struct stream *s;
MAY_LJMP(check_args(L, 3, "connect_ssl"));
return 1;
}
- appctx = container_of(peer, struct hlua_csk_ctx, xref)->appctx;
- s = __cs_strm(appctx->owner);
+ s = appctx_strm(container_of(peer, struct hlua_csk_ctx, xref)->appctx);
s->target = &socket_ssl->obj_type;
xref_unlock(&socket->xref, peer);
int tmout;
double dtmout;
struct xref *peer;
- struct appctx *appctx;
struct stream *s;
MAY_LJMP(check_args(L, 2, "settimeout"));
return 0;
}
- appctx = container_of(peer, struct hlua_csk_ctx, xref)->appctx;
- s = __cs_strm(appctx->owner);
+ s = appctx_strm(container_of(peer, struct hlua_csk_ctx, xref)->appctx);
s->sess->fe->timeout.connect = tmout;
s->req.rto = tmout;
static int hlua_applet_tcp_new(lua_State *L, struct appctx *ctx)
{
struct hlua_appctx *luactx;
- struct stream *s = __cs_strm(ctx->owner);
+ struct stream *s = appctx_strm(ctx);
struct proxy *p;
ALREADY_CHECKED(s);
__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 conn_stream *cs = luactx->appctx->owner;
+ struct conn_stream *cs = appctx_cs(luactx->appctx);
int ret;
const char *blk1;
size_t len1;
__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 conn_stream *cs = luactx->appctx->owner;
+ struct conn_stream *cs = appctx_cs(luactx->appctx);
size_t len = MAY_LJMP(luaL_checkinteger(L, 2));
int ret;
const char *blk1;
struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_tcp(L, 1));
const char *str = MAY_LJMP(luaL_checklstring(L, 2, &len));
int l = MAY_LJMP(luaL_checkinteger(L, 3));
- struct conn_stream *cs = luactx->appctx->owner;
+ struct conn_stream *cs = appctx_cs(luactx->appctx);
struct channel *chn = cs_ic(cs);
int max;
struct hlua_http_ctx *http_ctx = ctx->svcctx;
struct hlua_appctx *luactx;
struct hlua_txn htxn;
- struct stream *s = __cs_strm(ctx->owner);
+ struct stream *s = appctx_strm(ctx);
struct proxy *px = s->be;
struct htx *htx;
struct htx_blk *blk;
__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 conn_stream *cs = luactx->appctx->owner;
+ struct conn_stream *cs = appctx_cs(luactx->appctx);
struct channel *req = cs_oc(cs);
struct htx *htx;
struct htx_blk *blk;
__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 conn_stream *cs = luactx->appctx->owner;
+ struct conn_stream *cs = appctx_cs(luactx->appctx);
struct channel *req = cs_oc(cs);
struct htx *htx;
struct htx_blk *blk;
__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 conn_stream *cs = luactx->appctx->owner;
+ struct conn_stream *cs = appctx_cs(luactx->appctx);
struct channel *res = cs_ic(cs);
struct htx *htx = htx_from_buf(&res->buf);
const char *data;
{
struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_http(L, 1));
struct hlua_http_ctx *http_ctx = luactx->appctx->svcctx;
- struct conn_stream *cs = luactx->appctx->owner;
+ struct conn_stream *cs = appctx_cs(luactx->appctx);
struct channel *res = cs_ic(cs);
struct htx *htx;
struct htx_sl *sl;
__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 conn_stream *cs = luactx->appctx->owner;
+ struct conn_stream *cs = appctx_cs(luactx->appctx);
struct channel *res = cs_ic(cs);
if (co_data(res)) {
static int hlua_applet_tcp_init(struct appctx *ctx)
{
struct hlua_tcp_ctx *tcp_ctx = applet_reserve_svcctx(ctx, sizeof(*tcp_ctx));
- struct conn_stream *cs = ctx->owner;
+ struct conn_stream *cs = appctx_cs(ctx);
struct stream *strm = __cs_strm(cs);
struct hlua *hlua;
struct task *task;
void hlua_applet_tcp_fct(struct appctx *ctx)
{
struct hlua_tcp_ctx *tcp_ctx = ctx->svcctx;
- struct conn_stream *cs = ctx->owner;
+ struct conn_stream *cs = appctx_cs(ctx);
struct stream *strm = __cs_strm(cs);
struct channel *res = cs_ic(cs);
struct act_rule *rule = ctx->rule;
static int hlua_applet_http_init(struct appctx *ctx)
{
struct hlua_http_ctx *http_ctx = applet_reserve_svcctx(ctx, sizeof(*http_ctx));
- struct conn_stream *cs = ctx->owner;
+ struct conn_stream *cs = appctx_cs(ctx);
struct stream *strm = __cs_strm(cs);
struct http_txn *txn;
struct hlua *hlua;
void hlua_applet_http_fct(struct appctx *ctx)
{
struct hlua_http_ctx *http_ctx = ctx->svcctx;
- struct conn_stream *cs = ctx->owner;
+ struct conn_stream *cs = appctx_cs(ctx);
struct stream *strm = __cs_strm(cs);
struct channel *req = cs_oc(cs);
struct channel *res = cs_ic(cs);
struct hlua_function *fcn;
hlua = ctx->hlua;
- cs = appctx->owner;
+ cs = appctx_cs(appctx);
fcn = ctx->fcn;
/* If the stream is disconnect or closed, ldo nothing. */
static int hc_cli_io_handler(struct appctx *appctx)
{
struct hcli_svc_ctx *ctx = appctx->svcctx;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct buffer *trash = alloc_trash_chunk();
struct httpclient *hc = ctx->hc;
struct http_hdr *hdrs, *hdr;
static void httpclient_applet_io_handler(struct appctx *appctx)
{
struct httpclient *hc = appctx->svcctx;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct stream *s = __cs_strm(cs);
struct channel *req = &s->req;
struct channel *res = &s->res;
static void syslog_io_handler(struct appctx *appctx)
{
static THREAD_LOCAL struct ist metadata[LOG_META_FIELDS];
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct stream *s = __cs_strm(cs);
struct proxy *frontend = strm_fe(s);
struct listener *l = strm_li(s);
static int cli_io_handler_pat_list(struct appctx *appctx)
{
struct show_map_ctx *ctx = appctx->svcctx;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct pat_ref_elt *elt;
if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW))) {
static int cli_io_handler_pats_list(struct appctx *appctx)
{
struct show_map_ctx *ctx = appctx->svcctx;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
switch (ctx->state) {
case STATE_INIT:
static int cli_io_handler_map_lookup(struct appctx *appctx)
{
struct show_map_ctx *ctx = appctx->svcctx;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct sample sample;
struct pattern *pat;
int match_method;
if (!finished) {
/* let's come back later */
- cs_rx_endp_more(appctx->owner);
+ cs_rx_endp_more(appctx_cs(appctx));
return 0;
}
return 1;
/* Displays workers and processes */
static int cli_io_handler_show_proc(struct appctx *appctx)
{
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct mworker_proc *child;
int old = 0;
int up = now.tv_sec - proc_self->timestamp;
struct peers *peers = NULL;
if (peer->appctx) {
- struct stream *s = __cs_strm(peer->appctx->owner);
+ struct stream *s = appctx_strm(peer->appctx);
peers = strm_fe(s)->parent;
}
if (!peer->appctx)
return;
- s = __cs_strm(peer->appctx->owner);
+ s = appctx_strm(peer->appctx);
peers = strm_fe(s)->parent;
if (!peers)
*/
static inline int peer_getline(struct appctx *appctx)
{
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
int n;
n = co_getline(cs_oc(cs), trash.area, trash.size);
struct peer_prep_params *params)
{
int ret, msglen;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
msglen = peer_prepare_msg(trash.area, trash.size, params);
if (!msglen) {
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)
{
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct shared_table *st = p->remote_table;
struct stksess *ts, *newts;
uint32_t update;
static inline int peer_treat_definemsg(struct appctx *appctx, struct peer *p,
char **msg_cur, char *msg_end, int totl)
{
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
int table_id_len;
struct shared_table *st;
int table_type;
uint32_t *msg_len, int *totl)
{
int reql;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
char *cur;
reql = co_getblk(cs_oc(cs), msg_head, 2 * sizeof(char), *totl);
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)
{
- struct stream *s = __cs_strm(appctx->owner);
+ struct stream *s = appctx_strm(appctx);
struct peers *peers = strm_fe(s)->parent;
if (msg_head[0] == PEER_MSG_CLASS_CONTROL) {
char *p;
int reql;
struct peer *peer;
- struct stream *s = __cs_strm(appctx->owner);
+ struct stream *s = appctx_strm(appctx);
struct peers *peers = strm_fe(s)->parent;
reql = peer_getline(appctx);
*/
static void peer_io_handler(struct appctx *appctx)
{
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct stream *s = __cs_strm(cs);
struct peers *curpeers = strm_fe(s)->parent;
struct peer *curpeer = NULL;
chunk_appendf(&trash, " appctx:%p st0=%d st1=%d task_calls=%u", appctx, appctx->st0, appctx->st1,
appctx->t ? appctx->t->calls : 0);
- peer_cs = peer->appctx->owner;
+ peer_cs = appctx_cs(peer->appctx);
peer_s = __cs_strm(peer_cs);
chunk_appendf(&trash, " state=%s", cs_state_str(cs_opposite(peer_cs)->state));
chunk_appendf(&trash, "\n");
else
first_peers = 0;
- if (!peers_dump_head(&trash, appctx->owner, ctx->peers))
+ if (!peers_dump_head(&trash, appctx_cs(appctx), ctx->peers))
goto out;
ctx->peer = ctx->peers->remote;
ctx->state = STATE_DONE;
}
else {
- if (!peers_dump_peer(&trash, appctx->owner, ctx->peer, ctx->flags))
+ if (!peers_dump_peer(&trash, appctx_cs(appctx), ctx->peer, ctx->flags))
goto out;
ctx->peer = ctx->peer->next;
*/
static int cli_io_handler_dump_pools(struct appctx *appctx)
{
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
dump_pools_to_trash();
if (ci_putchk(cs_ic(cs), &trash) == -1) {
static int cli_io_handler_servers_state(struct appctx *appctx)
{
struct show_srv_ctx *ctx = appctx->svcctx;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct proxy *curproxy;
if (ctx->state == SHOW_SRV_HEAD) {
*/
static int cli_io_handler_show_backend(struct appctx *appctx)
{
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct proxy *curproxy;
chunk_reset(&trash);
static int cli_io_handler_show_errors(struct appctx *appctx)
{
struct show_errors_ctx *ctx = appctx->svcctx;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
extern const char *monthname[12];
if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
static int cli_io_handler_dump_resolvers_to_buffer(struct appctx *appctx)
{
struct show_resolvers_ctx *ctx = appctx->svcctx;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct resolvers *resolvers = ctx->resolvers;
struct dns_nameserver *ns;
int cli_io_handler_show_ring(struct appctx *appctx)
{
struct show_ring_ctx *ctx = appctx->svcctx;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct ring *ring = ctx->ring;
struct buffer *buf = &ring->buf;
size_t ofs = ctx->ofs;
static int cli_parse_get_weight(char **args, char *payload, struct appctx *appctx, void *private)
{
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct proxy *px;
struct server *sv;
char *line;
*/
static void sink_forward_io_handler(struct appctx *appctx)
{
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct stream *s = __cs_strm(cs);
struct sink *sink = strm_fe(s)->parent;
struct sink_forward_target *sft = appctx->svcctx;
*/
static void sink_forward_oc_io_handler(struct appctx *appctx)
{
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct stream *s = __cs_strm(cs);
struct sink *sink = strm_fe(s)->parent;
struct sink_forward_target *sft = appctx->svcctx;
void __sink_forward_session_deinit(struct sink_forward_target *sft)
{
- struct stream *s = __cs_strm(sft->appctx->owner);
+ struct stream *s = appctx_strm(sft->appctx);
struct sink *sink;
sink = strm_fe(s)->parent;
struct show_cert_ctx *ctx = appctx->svcctx;
struct buffer *trash = alloc_trash_chunk();
struct ebmb_node *node;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct ckch_store *ckchs;
if (trash == NULL)
static int cli_io_handler_show_cert_detail(struct appctx *appctx)
{
struct show_cert_ctx *ctx = appctx->svcctx;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct ckch_store *ckchs = ctx->cur_ckchs;
struct buffer *out = alloc_trash_chunk();
int retval = 0;
{
#if ((defined SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB && !defined OPENSSL_NO_OCSP) && !defined OPENSSL_IS_BORINGSSL)
struct show_cert_ctx *ctx = appctx->svcctx;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct ckch_store *ckchs = ctx->cur_ckchs;
struct buffer *out = alloc_trash_chunk();
int from_transaction = ctx->transaction;
static int cli_io_handler_commit_cert(struct appctx *appctx)
{
struct commit_cert_ctx *ctx = appctx->svcctx;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
int y = 0;
char *err = NULL;
struct ckch_store *old_ckchs, *new_ckchs = NULL;
static int cli_io_handler_commit_cafile_crlfile(struct appctx *appctx)
{
struct commit_cacrlfile_ctx *ctx = appctx->svcctx;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
int y = 0;
char *err = NULL;
struct cafile_entry *old_cafile_entry = NULL, *new_cafile_entry = NULL;
static int cli_io_handler_show_cafile_detail(struct appctx *appctx)
{
struct show_cafile_ctx *ctx = appctx->svcctx;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct cafile_entry *cafile_entry = ctx->cur_cafile_entry;
struct buffer *out = alloc_trash_chunk();
int i = 0;
struct show_cafile_ctx *ctx = appctx->svcctx;
struct buffer *trash = alloc_trash_chunk();
struct ebmb_node *node;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct cafile_entry *cafile_entry;
if (trash == NULL)
static int cli_io_handler_show_crlfile_detail(struct appctx *appctx)
{
struct show_crlfile_ctx *ctx = appctx->svcctx;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct cafile_entry *cafile_entry = ctx->cafile_entry;
struct buffer *out = alloc_trash_chunk();
int i;
struct show_crlfile_ctx *ctx = appctx->svcctx;
struct buffer *trash = alloc_trash_chunk();
struct ebmb_node *node;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct cafile_entry *cafile_entry;
if (trash == NULL)
{
struct show_crtlist_ctx *ctx = appctx->svcctx;
struct buffer *trash = alloc_trash_chunk();
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct ebmb_node *lnode;
if (trash == NULL)
struct show_crtlist_ctx *ctx = appctx->svcctx;
struct buffer *trash = alloc_trash_chunk();
struct crtlist *crtlist;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct crtlist_entry *entry;
if (trash == NULL)
{
struct add_crtlist_ctx *ctx = appctx->svcctx;
struct bind_conf_list *bind_conf_node;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct crtlist *crtlist = ctx->crtlist;
struct crtlist_entry *entry = ctx->entry;
struct ckch_store *store = entry->node.key;
static int cli_io_handler_tlskeys_files(struct appctx *appctx)
{
struct show_keys_ctx *ctx = appctx->svcctx;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
switch (ctx->state) {
case SHOW_KEYS_INIT:
struct buffer *trash = alloc_trash_chunk();
struct buffer *tmp = NULL;
struct ebmb_node *node;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct certificate_ocsp *ocsp = NULL;
BIO *bio = NULL;
int write = -1;
static int cli_io_handler_show_providers(struct appctx *appctx)
{
struct buffer *trash = get_trash_chunk();
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct list provider_names;
struct provider_name *name;
{
struct buffer *trash = alloc_trash_chunk();
struct certificate_ocsp *ocsp = appctx->svcctx;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
if (trash == NULL)
return 1;
static void http_stats_io_handler(struct appctx *appctx)
{
struct show_stat_ctx *ctx = appctx->svcctx;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct stream *s = __cs_strm(cs);
struct channel *req = cs_oc(cs);
struct channel *res = cs_ic(cs);
ctx->scope_len = 0;
ctx->flags = STAT_SHNODE | STAT_SHDESC;
- if ((strm_li(__cs_strm(appctx->owner))->bind_conf->level & ACCESS_LVL_MASK) >= ACCESS_LVL_OPER)
+ if ((strm_li(appctx_strm(appctx))->bind_conf->level & ACCESS_LVL_MASK) >= ACCESS_LVL_OPER)
ctx->flags |= STAT_SHLGNDS;
/* proxy is the default domain */
static int cli_io_handler_dump_info(struct appctx *appctx)
{
- return stats_dump_info_to_buffer(appctx->owner);
+ return stats_dump_info_to_buffer(appctx_cs(appctx));
}
/* This I/O handler runs as an applet embedded in a conn-stream. It is
*/
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(appctx_cs(appctx), NULL, NULL);
}
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(appctx_cs(appctx));
}
int stats_allocate_proxy_counters_internal(struct extra_counters **counters,
*/
static int table_process_entry_per_key(struct appctx *appctx, char **args)
{
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct show_table_ctx *ctx = appctx->svcctx;
struct stktable *t = ctx->target;
struct stksess *ts;
static int cli_io_handler_table(struct appctx *appctx)
{
struct show_table_ctx *ctx = appctx->svcctx;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct stream *s = __cs_strm(cs);
struct ebmb_node *eb;
int skip_entry;
if (!appctx)
return;
ptr = appctx;
- s = __cs_strm(appctx->owner);
+ s = appctx_strm(appctx);
if (!s)
return;
}
/* 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.
*/
- __cs_strm(appctx->owner)->stream_epoch = _HA_ATOMIC_FETCH_ADD(&stream_epoch, 1);
+ appctx_strm(appctx)->stream_epoch = _HA_ATOMIC_FETCH_ADD(&stream_epoch, 1);
return 0;
}
static int cli_io_handler_dump_sess(struct appctx *appctx)
{
struct show_sess_ctx *ctx = appctx->svcctx;
- struct conn_stream *cs = appctx->owner;
+ struct conn_stream *cs = appctx_cs(appctx);
struct connection *conn;
thread_isolate();
else {
/* check if we've found a stream created after issuing the "show sess" */
curr_strm = LIST_ELEM(ctx->bref.ref, struct stream *, list);
- if ((int)(curr_strm->stream_epoch - __cs_strm(appctx->owner)->stream_epoch) > 0)
+ if ((int)(curr_strm->stream_epoch - appctx_strm(appctx)->stream_epoch) > 0)
done = 1;
}