MEDIUM: sample change the prototype of sample-fetches and converters functions

This patch removes the structs "session", "stream" and "proxy" from
the sample-fetches and converters function prototypes.

This permits to remove some weight in the prototype call.
This commit is contained in:
Thierry FOURNIER 2015-05-11 15:20:49 +02:00 committed by Willy Tarreau
parent 6879ad31a5
commit 0a9a2b8cec
15 changed files with 489 additions and 529 deletions

View File

@ -126,11 +126,10 @@ void free_http_res_rules(struct list *r);
struct chunk *http_error_message(struct stream *s, int msgnum);
struct redirect_rule *http_parse_redirect_rule(const char *file, int linenum, struct proxy *curproxy,
const char **args, char **errmsg, int use_fmt);
int smp_fetch_cookie(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private);
int
smp_fetch_base32(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private);
int smp_fetch_cookie(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private);
int smp_fetch_base32(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private);
enum http_meth_t find_http_meth(const char *str, const int len);

View File

@ -270,8 +270,7 @@ struct sample_storage {
/* Descriptor for a sample conversion */
struct sample_conv {
const char *kw; /* configuration keyword */
int (*process)(struct stream *stream,
const struct arg *arg_p,
int (*process)(const struct arg *arg_p,
struct sample *smp,
void *private); /* process function */
unsigned int arg_mask; /* arguments (ARG*()) */
@ -294,11 +293,8 @@ struct sample_conv_expr {
/* Descriptor for a sample fetch method */
struct sample_fetch {
const char *kw; /* configuration keyword */
int (*process)(struct proxy *px,
struct session *sess,
struct stream *strm,
unsigned int opt, /* fetch options (SMP_OPT_*) */
const struct arg *arg_p,
int (*process)(unsigned int opt, /* fetch options (SMP_OPT_*) */
const struct arg *arg_p,
struct sample *smp,
const char *kw, /* fetch processing function */
void *private); /* private value. */

View File

@ -1486,9 +1486,11 @@ int backend_parse_balance(const char **args, char **err, struct proxy *curproxy)
* undefined behaviour.
*/
static int
smp_fetch_nbsrv(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_nbsrv(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct proxy *px;
smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT;
px = args->data.prx;
@ -1509,8 +1511,8 @@ smp_fetch_nbsrv(struct proxy *px, struct session *sess, struct stream *strm, uns
* undefined behaviour.
*/
static int
smp_fetch_srv_is_up(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_srv_is_up(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct server *srv = args->data.srv;
@ -1529,8 +1531,8 @@ smp_fetch_srv_is_up(struct proxy *px, struct session *sess, struct stream *strm,
* undefined behaviour.
*/
static int
smp_fetch_connslots(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_connslots(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct server *iterator;
@ -1557,25 +1559,25 @@ smp_fetch_connslots(struct proxy *px, struct session *sess, struct stream *strm,
/* set temp integer to the id of the backend */
static int
smp_fetch_be_id(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_be_id(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
smp->flags = SMP_F_VOL_TXN;
smp->type = SMP_T_UINT;
smp->data.uint = strm->be->uuid;
smp->data.uint = smp->strm->be->uuid;
return 1;
}
/* set temp integer to the id of the server */
static int
smp_fetch_srv_id(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_srv_id(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
if (!objt_server(strm->target))
if (!objt_server(smp->strm->target))
return 0;
smp->type = SMP_T_UINT;
smp->data.uint = objt_server(strm->target)->puid;
smp->data.uint = objt_server(smp->strm->target)->puid;
return 1;
}
@ -1585,8 +1587,8 @@ smp_fetch_srv_id(struct proxy *px, struct session *sess, struct stream *strm, un
* undefined behaviour.
*/
static int
smp_fetch_be_sess_rate(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_be_sess_rate(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT;
@ -1599,8 +1601,8 @@ smp_fetch_be_sess_rate(struct proxy *px, struct session *sess, struct stream *st
* undefined behaviour.
*/
static int
smp_fetch_be_conn(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_be_conn(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT;
@ -1613,8 +1615,8 @@ smp_fetch_be_conn(struct proxy *px, struct session *sess, struct stream *strm, u
* undefined behaviour.
*/
static int
smp_fetch_queue_size(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_queue_size(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT;
@ -1631,10 +1633,11 @@ smp_fetch_queue_size(struct proxy *px, struct session *sess, struct stream *strm
* undefined behaviour.
*/
static int
smp_fetch_avg_queue_size(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_avg_queue_size(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
int nbsrv;
struct proxy *px;
smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT;
@ -1660,8 +1663,8 @@ smp_fetch_avg_queue_size(struct proxy *px, struct session *sess, struct stream *
* undefined behaviour.
*/
static int
smp_fetch_srv_conn(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_srv_conn(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT;
@ -1674,8 +1677,8 @@ smp_fetch_srv_conn(struct proxy *px, struct session *sess, struct stream *strm,
* undefined behaviour.
*/
static int
smp_fetch_srv_sess_rate(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_srv_sess_rate(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT;

View File

@ -838,26 +838,26 @@ static int deflate_end(struct comp_ctx **comp_ctx)
/* boolean, returns true if compression is used (either gzip or deflate) in the response */
static int
smp_fetch_res_comp(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_res_comp(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
smp->type = SMP_T_BOOL;
smp->data.uint = (strm->comp_algo != NULL);
smp->data.uint = (smp->strm->comp_algo != NULL);
return 1;
}
/* string, returns algo */
static int
smp_fetch_res_comp_algo(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_res_comp_algo(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
if (!strm->comp_algo)
if (!smp->strm->comp_algo)
return 0;
smp->type = SMP_T_STR;
smp->flags = SMP_F_CONST;
smp->data.str.str = strm->comp_algo->cfg_name;
smp->data.str.len = strm->comp_algo->cfg_name_len;
smp->data.str.str = smp->strm->comp_algo->cfg_name;
smp->data.str.len = smp->strm->comp_algo->cfg_name_len;
return 1;
}

View File

@ -159,12 +159,12 @@ int frontend_accept(struct stream *s)
/* set temp integer to the id of the frontend */
static int
smp_fetch_fe_id(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_fe_id(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
smp->flags = SMP_F_VOL_SESS;
smp->type = SMP_T_UINT;
smp->data.uint = sess->fe->uuid;
smp->data.uint = smp->sess->fe->uuid;
return 1;
}
@ -173,8 +173,8 @@ smp_fetch_fe_id(struct proxy *px, struct session *sess, struct stream *strm, uns
* an undefined behaviour.
*/
static int
smp_fetch_fe_sess_rate(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_fe_sess_rate(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT;
@ -187,8 +187,8 @@ smp_fetch_fe_sess_rate(struct proxy *px, struct session *sess, struct stream *st
* an undefined behaviour.
*/
static int
smp_fetch_fe_conn(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_fe_conn(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT;

View File

@ -2773,7 +2773,7 @@ __LJMP static int hlua_run_sample_fetch(lua_State *L)
smp.px = hsmp->p;
smp.sess = hsmp->s->sess;
smp.strm = hsmp->s;
if (!f->process(hsmp->p, hsmp->s->sess, hsmp->s, 0, args, &smp, f->kw, f->private)) {
if (!f->process(0, args, &smp, f->kw, f->private)) {
if (hsmp->stringsafe)
lua_pushstring(L, "");
else
@ -2894,7 +2894,7 @@ __LJMP static int hlua_run_sample_conv(lua_State *L)
smp.px = hsmp->p;
smp.sess = hsmp->s->sess;
smp.strm = hsmp->s;
if (!conv->process(hsmp->s, args, &smp, conv->private)) {
if (!conv->process(args, &smp, conv->private)) {
if (hsmp->stringsafe)
lua_pushstring(L, "");
else
@ -3854,10 +3854,10 @@ static int hlua_register_task(lua_State *L)
* doesn't allow "yield" functions because the HAProxy engine cannot
* resume converters.
*/
static int hlua_sample_conv_wrapper(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int hlua_sample_conv_wrapper(const struct arg *arg_p, struct sample *smp, void *private)
{
struct hlua_function *fcn = (struct hlua_function *)private;
struct stream *stream = smp->strm;
/* In the execution wrappers linked with a stream, the
* Lua context can be not initialized. This behavior
@ -3955,80 +3955,79 @@ static int hlua_sample_conv_wrapper(struct stream *stream, const struct arg *arg
* doesn't allow "yield" functions because the HAProxy engine cannot
* resume sample-fetches.
*/
static int hlua_sample_fetch_wrapper(struct proxy *px, struct session *sess,
struct stream *s, unsigned int opt,
const struct arg *arg_p,
static int hlua_sample_fetch_wrapper(unsigned int opt, const struct arg *arg_p,
struct sample *smp, const char *kw, void *private)
{
struct hlua_function *fcn = (struct hlua_function *)private;
struct stream *stream = smp->strm;
/* In the execution wrappers linked with a stream, the
* Lua context can be not initialized. This behavior
* permits to save performances because a systematic
* Lua initialization cause 5% performances loss.
*/
if (!s->hlua.T && !hlua_ctx_init(&s->hlua, s->task)) {
send_log(s->be, LOG_ERR, "Lua sample-fetch '%s': can't initialize Lua context.", fcn->name);
if (!stream->hlua.T && !hlua_ctx_init(&stream->hlua, stream->task)) {
send_log(stream->be, LOG_ERR, "Lua sample-fetch '%s': can't initialize Lua context.", fcn->name);
if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE))
Alert("Lua sample-fetch '%s': can't initialize Lua context.\n", fcn->name);
return 0;
}
/* If it is the first run, initialize the data for the call. */
if (!HLUA_IS_RUNNING(&s->hlua)) {
if (!HLUA_IS_RUNNING(&stream->hlua)) {
/* Check stack available size. */
if (!lua_checkstack(s->hlua.T, 2)) {
send_log(px, LOG_ERR, "Lua sample-fetch '%s': full stack.", fcn->name);
if (!lua_checkstack(stream->hlua.T, 2)) {
send_log(smp->px, LOG_ERR, "Lua sample-fetch '%s': full stack.", fcn->name);
if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE))
Alert("Lua sample-fetch '%s': full stack.\n", fcn->name);
return 0;
}
/* Restore the function in the stack. */
lua_rawgeti(s->hlua.T, LUA_REGISTRYINDEX, fcn->function_ref);
lua_rawgeti(stream->hlua.T, LUA_REGISTRYINDEX, fcn->function_ref);
/* push arguments in the stack. */
if (!hlua_txn_new(s->hlua.T, s, px)) {
send_log(px, LOG_ERR, "Lua sample-fetch '%s': full stack.", fcn->name);
if (!hlua_txn_new(stream->hlua.T, stream, smp->px)) {
send_log(smp->px, LOG_ERR, "Lua sample-fetch '%s': full stack.", fcn->name);
if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE))
Alert("Lua sample-fetch '%s': full stack.\n", fcn->name);
return 0;
}
s->hlua.nargs = 1;
stream->hlua.nargs = 1;
/* push keywords in the stack. */
for (; arg_p && arg_p->type != ARGT_STOP; arg_p++) {
/* Check stack available size. */
if (!lua_checkstack(s->hlua.T, 1)) {
send_log(px, LOG_ERR, "Lua sample-fetch '%s': full stack.", fcn->name);
if (!lua_checkstack(stream->hlua.T, 1)) {
send_log(smp->px, LOG_ERR, "Lua sample-fetch '%s': full stack.", fcn->name);
if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE))
Alert("Lua sample-fetch '%s': full stack.\n", fcn->name);
return 0;
}
if (!lua_checkstack(s->hlua.T, 1)) {
send_log(px, LOG_ERR, "Lua sample-fetch '%s': full stack.", fcn->name);
if (!lua_checkstack(stream->hlua.T, 1)) {
send_log(smp->px, LOG_ERR, "Lua sample-fetch '%s': full stack.", fcn->name);
if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE))
Alert("Lua sample-fetch '%s': full stack.\n", fcn->name);
return 0;
}
hlua_arg2lua(s->hlua.T, arg_p);
s->hlua.nargs++;
hlua_arg2lua(stream->hlua.T, arg_p);
stream->hlua.nargs++;
}
/* We must initialize the execution timeouts. */
s->hlua.expire = tick_add(now_ms, hlua_timeout_session);
stream->hlua.expire = tick_add(now_ms, hlua_timeout_session);
/* Set the currently running flag. */
HLUA_SET_RUN(&s->hlua);
HLUA_SET_RUN(&stream->hlua);
}
/* Execute the function. */
switch (hlua_ctx_resume(&s->hlua, 0)) {
switch (hlua_ctx_resume(&stream->hlua, 0)) {
/* finished. */
case HLUA_E_OK:
/* Convert the returned value in sample. */
hlua_lua2smp(s->hlua.T, -1, smp);
lua_pop(s->hlua.T, 1);
hlua_lua2smp(stream->hlua.T, -1, smp);
lua_pop(stream->hlua.T, 1);
/* Set the end of execution flag. */
smp->flags &= ~SMP_F_MAY_CHANGE;
@ -4036,7 +4035,7 @@ static int hlua_sample_fetch_wrapper(struct proxy *px, struct session *sess,
/* yield. */
case HLUA_E_AGAIN:
send_log(px, LOG_ERR, "Lua sample-fetch '%s': cannot use yielded functions.", fcn->name);
send_log(smp->px, LOG_ERR, "Lua sample-fetch '%s': cannot use yielded functions.", fcn->name);
if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE))
Alert("Lua sample-fetch '%s': cannot use yielded functions.\n", fcn->name);
return 0;
@ -4044,15 +4043,15 @@ static int hlua_sample_fetch_wrapper(struct proxy *px, struct session *sess,
/* finished with error. */
case HLUA_E_ERRMSG:
/* Display log. */
send_log(px, LOG_ERR, "Lua sample-fetch '%s': %s.", fcn->name, lua_tostring(s->hlua.T, -1));
send_log(smp->px, LOG_ERR, "Lua sample-fetch '%s': %s.", fcn->name, lua_tostring(stream->hlua.T, -1));
if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE))
Alert("Lua sample-fetch '%s': %s.\n", fcn->name, lua_tostring(s->hlua.T, -1));
lua_pop(s->hlua.T, 1);
Alert("Lua sample-fetch '%s': %s.\n", fcn->name, lua_tostring(stream->hlua.T, -1));
lua_pop(stream->hlua.T, 1);
return 0;
case HLUA_E_ERR:
/* Display log. */
send_log(px, LOG_ERR, "Lua sample-fetch '%s' returns an unknown error.", fcn->name);
send_log(smp->px, LOG_ERR, "Lua sample-fetch '%s' returns an unknown error.", fcn->name);
if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE))
Alert("Lua sample-fetch '%s': returns an unknown error.\n", fcn->name);

View File

@ -591,21 +591,21 @@ void bind_dump_kws(char **out)
/* set temp integer to the number of connexions to the same listening socket */
static int
smp_fetch_dconn(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_dconn(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
smp->type = SMP_T_UINT;
smp->data.uint = sess->listener->nbconn;
smp->data.uint = smp->sess->listener->nbconn;
return 1;
}
/* set temp integer to the id of the socket (listener) */
static int
smp_fetch_so_id(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_so_id(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
smp->type = SMP_T_UINT;
smp->data.uint = sess->listener->luid;
smp->data.uint = smp->sess->listener->luid;
return 1;
}

View File

@ -164,8 +164,7 @@ int sample_load_map(struct arg *arg, struct sample_conv *conv,
return 1;
}
static int sample_conv_map(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_map(const struct arg *arg_p, struct sample *smp, void *private)
{
struct map_descriptor *desc;
struct pattern *pat;

View File

@ -29,8 +29,8 @@
* used with content inspection.
*/
static int
smp_fetch_wait_end(struct proxy *px, struct session *sess, struct stream *s, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_wait_end(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
if (!(opt & SMP_OPT_FINAL)) {
smp->flags |= SMP_F_MAY_CHANGE;
@ -43,12 +43,12 @@ smp_fetch_wait_end(struct proxy *px, struct session *sess, struct stream *s, uns
/* return the number of bytes in the request buffer */
static int
smp_fetch_len(struct proxy *px, struct session *sess, struct stream *s, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_len(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct channel *chn;
chn = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &s->res : &s->req;
chn = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
if (!chn->buf)
return 0;
@ -60,15 +60,15 @@ smp_fetch_len(struct proxy *px, struct session *sess, struct stream *s, unsigned
/* returns the type of SSL hello message (mainly used to detect an SSL hello) */
static int
smp_fetch_ssl_hello_type(struct proxy *px, struct session *sess, struct stream *s, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_ssl_hello_type(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
int hs_len;
int hs_type, bleft;
struct channel *chn;
const unsigned char *data;
chn = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &s->res : &s->req;
chn = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
if (!chn->buf)
goto not_ssl_hello;
@ -128,21 +128,22 @@ smp_fetch_ssl_hello_type(struct proxy *px, struct session *sess, struct stream *
* Note: this decoder only works with non-wrapping data.
*/
static int
smp_fetch_req_ssl_ver(struct proxy *px, struct session *sess, struct stream *s, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_req_ssl_ver(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
int version, bleft, msg_len;
const unsigned char *data;
struct channel *req = &smp->strm->req;
if (!s->req.buf)
if (!req->buf)
return 0;
msg_len = 0;
bleft = s->req.buf->i;
bleft = req->buf->i;
if (!bleft)
goto too_short;
data = (const unsigned char *)s->req.buf->p;
data = (const unsigned char *)req->buf->p;
if ((*data >= 0x14 && *data <= 0x17) || (*data == 0xFF)) {
/* SSLv3 header format */
if (bleft < 5)
@ -210,8 +211,8 @@ smp_fetch_req_ssl_ver(struct proxy *px, struct session *sess, struct stream *s,
* all the part of the request which fits in a buffer is already
* there.
*/
if (msg_len > channel_recv_limit(&s->req) + s->req.buf->data - s->req.buf->p)
msg_len = channel_recv_limit(&s->req) + s->req.buf->data - s->req.buf->p;
if (msg_len > channel_recv_limit(req) + req->buf->data - req->buf->p)
msg_len = channel_recv_limit(req) + req->buf->data - req->buf->p;
if (bleft < msg_len)
goto too_short;
@ -264,14 +265,14 @@ smp_fetch_req_ssl_ver(struct proxy *px, struct session *sess, struct stream *s,
* - opaque hostname[name_len bytes]
*/
static int
smp_fetch_ssl_hello_sni(struct proxy *px, struct session *sess, struct stream *s, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_ssl_hello_sni(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
int hs_len, ext_len, bleft;
struct channel *chn;
unsigned char *data;
chn = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &s->res : &s->req;
chn = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
if (!chn->buf)
goto not_ssl_hello;
@ -493,20 +494,20 @@ fetch_rdp_cookie_name(struct stream *s, struct sample *smp, const char *cname, i
* returned sample has type SMP_T_CSTR.
*/
int
smp_fetch_rdp_cookie(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_rdp_cookie(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
return fetch_rdp_cookie_name(strm, smp, args ? args->data.str.str : NULL, args ? args->data.str.len : 0);
return fetch_rdp_cookie_name(smp->strm, smp, args ? args->data.str.str : NULL, args ? args->data.str.len : 0);
}
/* returns either 1 or 0 depending on whether an RDP cookie is found or not */
static int
smp_fetch_rdp_cookie_cnt(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_rdp_cookie_cnt(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
int ret;
ret = smp_fetch_rdp_cookie(px, sess, strm, opt, args, smp, kw, private);
ret = smp_fetch_rdp_cookie(opt, args, smp, kw, private);
if (smp->flags & SMP_F_MAY_CHANGE)
return 0;
@ -519,8 +520,8 @@ smp_fetch_rdp_cookie_cnt(struct proxy *px, struct session *sess, struct stream *
/* extracts part of a payload with offset and length at a given position */
static int
smp_fetch_payload_lv(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *arg_p, struct sample *smp, const char *kw, void *private)
smp_fetch_payload_lv(unsigned int opt, const struct arg *arg_p, struct sample *smp,
const char *kw, void *private)
{
unsigned int len_offset = arg_p[0].data.uint;
unsigned int len_size = arg_p[1].data.uint;
@ -533,7 +534,7 @@ smp_fetch_payload_lv(struct proxy *px, struct session *sess, struct stream *strm
/* by default buf offset == len offset + len size */
/* buf offset could be absolute or relative to len offset + len size if prefixed by + or - */
chn = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &strm->res : &strm->req;
chn = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
if (!chn->buf)
return 0;
@ -573,14 +574,14 @@ smp_fetch_payload_lv(struct proxy *px, struct session *sess, struct stream *strm
/* extracts some payload at a fixed position and length */
static int
smp_fetch_payload(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *arg_p, struct sample *smp, const char *kw, void *private)
smp_fetch_payload(unsigned int opt, const struct arg *arg_p, struct sample *smp,
const char *kw, void *private)
{
unsigned int buf_offset = arg_p[0].data.uint;
unsigned int buf_size = arg_p[1].data.uint;
struct channel *chn;
chn = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &strm->res : &strm->req;
chn = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
if (!chn->buf)
return 0;

View File

@ -10176,10 +10176,10 @@ smp_prefetch_http(struct proxy *px, struct stream *s, unsigned int opt,
* least the type and uint value are modified.
*/
#define CHECK_HTTP_MESSAGE_FIRST() \
do { int r = smp_prefetch_http(px, strm, opt, args, smp, 1); if (r <= 0) return r; } while (0)
do { int r = smp_prefetch_http(smp->px, smp->strm, opt, args, smp, 1); if (r <= 0) return r; } while (0)
#define CHECK_HTTP_MESSAGE_FIRST_PERM() \
do { int r = smp_prefetch_http(px, strm, opt, args, smp, 0); if (r <= 0) return r; } while (0)
do { int r = smp_prefetch_http(smp->px, smp->strm, opt, args, smp, 0); if (r <= 0) return r; } while (0)
/* 1. Check on METHOD
@ -10214,11 +10214,11 @@ static int pat_parse_meth(const char *text, struct pattern *pattern, int mflags,
* This is intended to be used with pat_match_meth() only.
*/
static int
smp_fetch_meth(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_meth(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
int meth;
struct http_txn *txn = strm->txn;
struct http_txn *txn = smp->strm->txn;
CHECK_HTTP_MESSAGE_FIRST_PERM();
@ -10268,10 +10268,10 @@ static struct pattern *pat_match_meth(struct sample *smp, struct pattern_expr *e
}
static int
smp_fetch_rqver(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_rqver(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct http_txn *txn = strm->txn;
struct http_txn *txn = smp->strm->txn;
char *ptr;
int len;
@ -10293,8 +10293,8 @@ smp_fetch_rqver(struct proxy *px, struct session *sess, struct stream *strm, uns
}
static int
smp_fetch_stver(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_stver(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct http_txn *txn;
char *ptr;
@ -10302,7 +10302,7 @@ smp_fetch_stver(struct proxy *px, struct session *sess, struct stream *strm, uns
CHECK_HTTP_MESSAGE_FIRST();
txn = strm->txn;
txn = smp->strm->txn;
if (txn->rsp.msg_state < HTTP_MSG_BODY)
return 0;
@ -10323,8 +10323,8 @@ smp_fetch_stver(struct proxy *px, struct session *sess, struct stream *strm, uns
/* 3. Check on Status Code. We manipulate integers here. */
static int
smp_fetch_stcode(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_stcode(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct http_txn *txn;
char *ptr;
@ -10332,7 +10332,7 @@ smp_fetch_stcode(struct proxy *px, struct session *sess, struct stream *strm, un
CHECK_HTTP_MESSAGE_FIRST();
txn = strm->txn;
txn = smp->strm->txn;
if (txn->rsp.msg_state < HTTP_MSG_BODY)
return 0;
@ -10349,10 +10349,10 @@ smp_fetch_stcode(struct proxy *px, struct session *sess, struct stream *strm, un
* has been waited for using http-buffer-request.
*/
static int
smp_fetch_body(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_body(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct http_txn *txn = strm->txn;
struct http_txn *txn = smp->strm->txn;
struct http_msg *msg;
unsigned long len;
unsigned long block1;
@ -10398,10 +10398,10 @@ smp_fetch_body(struct proxy *px, struct session *sess, struct stream *strm, unsi
* has been waited for using http-buffer-request.
*/
static int
smp_fetch_body_len(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_body_len(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct http_txn *txn = strm->txn;
struct http_txn *txn = smp->strm->txn;
struct http_msg *msg;
CHECK_HTTP_MESSAGE_FIRST();
@ -10424,10 +10424,10 @@ smp_fetch_body_len(struct proxy *px, struct session *sess, struct stream *strm,
* for using http-buffer-request.
*/
static int
smp_fetch_body_size(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_body_size(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct http_txn *txn = strm->txn;
struct http_txn *txn = smp->strm->txn;
struct http_msg *msg;
CHECK_HTTP_MESSAGE_FIRST();
@ -10447,14 +10447,14 @@ smp_fetch_body_size(struct proxy *px, struct session *sess, struct stream *strm,
/* 4. Check on URL/URI. A pointer to the URI is stored. */
static int
smp_fetch_url(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_url(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct http_txn *txn;
CHECK_HTTP_MESSAGE_FIRST();
txn = strm->txn;
txn = smp->strm->txn;
smp->type = SMP_T_STR;
smp->data.str.len = txn->req.sl.rq.u_l;
smp->data.str.str = txn->req.chn->buf->p + txn->req.sl.rq.u;
@ -10463,15 +10463,15 @@ smp_fetch_url(struct proxy *px, struct session *sess, struct stream *strm, unsig
}
static int
smp_fetch_url_ip(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_url_ip(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct http_txn *txn;
struct sockaddr_storage addr;
CHECK_HTTP_MESSAGE_FIRST();
txn = strm->txn;
txn = smp->strm->txn;
url2sa(txn->req.chn->buf->p + txn->req.sl.rq.u, txn->req.sl.rq.u_l, &addr, NULL);
if (((struct sockaddr_in *)&addr)->sin_family != AF_INET)
return 0;
@ -10483,15 +10483,15 @@ smp_fetch_url_ip(struct proxy *px, struct session *sess, struct stream *strm, un
}
static int
smp_fetch_url_port(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_url_port(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct http_txn *txn;
struct sockaddr_storage addr;
CHECK_HTTP_MESSAGE_FIRST();
txn = strm->txn;
txn = smp->strm->txn;
url2sa(txn->req.chn->buf->p + txn->req.sl.rq.u, txn->req.sl.rq.u_l, &addr, NULL);
if (((struct sockaddr_in *)&addr)->sin_family != AF_INET)
return 0;
@ -10510,8 +10510,8 @@ smp_fetch_url_port(struct proxy *px, struct session *sess, struct stream *strm,
* returns full lines instead (useful for User-Agent or Date for example).
*/
static int
smp_fetch_fhdr(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_fhdr(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct hdr_idx *idx;
struct hdr_ctx *ctx = smp->ctx.a[0];
@ -10539,8 +10539,8 @@ smp_fetch_fhdr(struct proxy *px, struct session *sess, struct stream *strm, unsi
CHECK_HTTP_MESSAGE_FIRST();
idx = &strm->txn->hdr_idx;
msg = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &strm->txn->req : &strm->txn->rsp;
idx = &smp->strm->txn->hdr_idx;
msg = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &smp->strm->txn->req : &smp->strm->txn->rsp;
if (ctx && !(smp->flags & SMP_F_NOT_LAST))
/* search for header from the beginning */
@ -10568,8 +10568,8 @@ smp_fetch_fhdr(struct proxy *px, struct session *sess, struct stream *strm, unsi
* returns full lines instead (useful for User-Agent or Date for example).
*/
static int
smp_fetch_fhdr_cnt(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_fhdr_cnt(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct hdr_idx *idx;
struct hdr_ctx ctx;
@ -10585,8 +10585,8 @@ smp_fetch_fhdr_cnt(struct proxy *px, struct session *sess, struct stream *strm,
CHECK_HTTP_MESSAGE_FIRST();
idx = &strm->txn->hdr_idx;
msg = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &strm->txn->req : &strm->txn->rsp;
idx = &smp->strm->txn->hdr_idx;
msg = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &smp->strm->txn->req : &smp->strm->txn->rsp;
ctx.idx = 0;
cnt = 0;
@ -10600,8 +10600,8 @@ smp_fetch_fhdr_cnt(struct proxy *px, struct session *sess, struct stream *strm,
}
static int
smp_fetch_hdr_names(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_hdr_names(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct hdr_idx *idx;
struct hdr_ctx ctx;
@ -10614,8 +10614,8 @@ smp_fetch_hdr_names(struct proxy *px, struct session *sess, struct stream *strm,
CHECK_HTTP_MESSAGE_FIRST();
idx = &strm->txn->hdr_idx;
msg = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &strm->txn->req : &strm->txn->rsp;
idx = &smp->strm->txn->hdr_idx;
msg = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &smp->strm->txn->req : &smp->strm->txn->rsp;
temp = get_trash_chunk();
@ -10641,8 +10641,8 @@ smp_fetch_hdr_names(struct proxy *px, struct session *sess, struct stream *strm,
* headers are considered from the first one.
*/
static int
smp_fetch_hdr(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_hdr(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct hdr_idx *idx;
struct hdr_ctx *ctx = smp->ctx.a[0];
@ -10670,8 +10670,8 @@ smp_fetch_hdr(struct proxy *px, struct session *sess, struct stream *strm, unsig
CHECK_HTTP_MESSAGE_FIRST();
idx = &strm->txn->hdr_idx;
msg = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &strm->txn->req : &strm->txn->rsp;
idx = &smp->strm->txn->hdr_idx;
msg = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &smp->strm->txn->req : &smp->strm->txn->rsp;
if (ctx && !(smp->flags & SMP_F_NOT_LAST))
/* search for header from the beginning */
@ -10698,8 +10698,8 @@ smp_fetch_hdr(struct proxy *px, struct session *sess, struct stream *strm, unsig
* Accepts exactly 1 argument of type string.
*/
static int
smp_fetch_hdr_cnt(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_hdr_cnt(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct hdr_idx *idx;
struct hdr_ctx ctx;
@ -10715,8 +10715,8 @@ smp_fetch_hdr_cnt(struct proxy *px, struct session *sess, struct stream *strm, u
CHECK_HTTP_MESSAGE_FIRST();
idx = &strm->txn->hdr_idx;
msg = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &strm->txn->req : &strm->txn->rsp;
idx = &smp->strm->txn->hdr_idx;
msg = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &smp->strm->txn->req : &smp->strm->txn->rsp;
ctx.idx = 0;
cnt = 0;
@ -10735,10 +10735,10 @@ smp_fetch_hdr_cnt(struct proxy *px, struct session *sess, struct stream *strm, u
* may or may not be appropriate for everything.
*/
static int
smp_fetch_hdr_val(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_hdr_val(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
int ret = smp_fetch_hdr(px, sess, strm, opt, args, smp, kw, private);
int ret = smp_fetch_hdr(opt, args, smp, kw, private);
if (ret > 0) {
smp->type = SMP_T_UINT;
@ -10753,12 +10753,12 @@ smp_fetch_hdr_val(struct proxy *px, struct session *sess, struct stream *strm, u
* It returns an IPv4 or IPv6 address.
*/
static int
smp_fetch_hdr_ip(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_hdr_ip(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
int ret;
while ((ret = smp_fetch_hdr(px, sess, strm, opt, args, smp, kw, private)) > 0) {
while ((ret = smp_fetch_hdr(opt, args, smp, kw, private)) > 0) {
if (url2ipv4((char *)smp->data.str.str, &smp->data.ipv4)) {
smp->type = SMP_T_IPV4;
break;
@ -10785,15 +10785,15 @@ smp_fetch_hdr_ip(struct proxy *px, struct session *sess, struct stream *strm, un
* the first '/' after the possible hostname, and ends before the possible '?'.
*/
static int
smp_fetch_path(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_path(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct http_txn *txn;
char *ptr, *end;
CHECK_HTTP_MESSAGE_FIRST();
txn = strm->txn;
txn = smp->strm->txn;
end = txn->req.chn->buf->p + txn->req.sl.rq.u + txn->req.sl.rq.u_l;
ptr = http_get_path(txn);
if (!ptr)
@ -10819,8 +10819,8 @@ smp_fetch_path(struct proxy *px, struct session *sess, struct stream *strm, unsi
* The returned sample is of type string.
*/
static int
smp_fetch_base(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_base(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct http_txn *txn;
char *ptr, *end, *beg;
@ -10829,10 +10829,10 @@ smp_fetch_base(struct proxy *px, struct session *sess, struct stream *strm, unsi
CHECK_HTTP_MESSAGE_FIRST();
txn = strm->txn;
txn = smp->strm->txn;
ctx.idx = 0;
if (!http_find_header2("Host", 4, txn->req.chn->buf->p, &txn->hdr_idx, &ctx) || !ctx.vlen)
return smp_fetch_path(px, sess, strm, opt, args, smp, kw, private);
return smp_fetch_path(opt, args, smp, kw, private);
/* OK we have the header value in ctx.line+ctx.val for ctx.vlen bytes */
temp = get_trash_chunk();
@ -10867,8 +10867,8 @@ smp_fetch_base(struct proxy *px, struct session *sess, struct stream *strm, unsi
* high-traffic sites without having to store whole paths.
*/
int
smp_fetch_base32(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_base32(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct http_txn *txn;
struct hdr_ctx ctx;
@ -10878,7 +10878,7 @@ smp_fetch_base32(struct proxy *px, struct session *sess, struct stream *strm, un
CHECK_HTTP_MESSAGE_FIRST();
txn = strm->txn;
txn = smp->strm->txn;
ctx.idx = 0;
if (http_find_header2("Host", 4, txn->req.chn->buf->p, &txn->hdr_idx, &ctx)) {
/* OK we have the header value in ctx.line+ctx.val for ctx.vlen bytes */
@ -10916,16 +10916,16 @@ smp_fetch_base32(struct proxy *px, struct session *sess, struct stream *strm, un
* 8 bytes would still work.
*/
static int
smp_fetch_base32_src(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_base32_src(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct chunk *temp;
struct connection *cli_conn = objt_conn(sess->origin);
struct connection *cli_conn = objt_conn(smp->sess->origin);
if (!cli_conn)
return 0;
if (!smp_fetch_base32(px, sess, strm, opt, args, smp, kw, private))
if (!smp_fetch_base32(opt, args, smp, kw, private))
return 0;
temp = get_trash_chunk();
@ -10955,15 +10955,15 @@ smp_fetch_base32_src(struct proxy *px, struct session *sess, struct stream *strm
* of type string carrying the whole query string.
*/
static int
smp_fetch_query(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_query(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct http_txn *txn;
char *ptr, *end;
CHECK_HTTP_MESSAGE_FIRST();
txn = strm->txn;
txn = smp->strm->txn;
ptr = txn->req.chn->buf->p + txn->req.sl.rq.u;
end = ptr + txn->req.sl.rq.u_l;
@ -10981,8 +10981,8 @@ smp_fetch_query(struct proxy *px, struct session *sess, struct stream *strm, uns
}
static int
smp_fetch_proto_http(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_proto_http(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
/* Note: hdr_idx.v cannot be NULL in this ACL because the ACL is tagged
* as a layer7 ACL, which involves automatic allocation of hdr_idx.
@ -10997,18 +10997,18 @@ smp_fetch_proto_http(struct proxy *px, struct session *sess, struct stream *strm
/* return a valid test if the current request is the first one on the connection */
static int
smp_fetch_http_first_req(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_http_first_req(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
smp->type = SMP_T_BOOL;
smp->data.uint = !(strm->txn->flags & TX_NOT_FIRST);
smp->data.uint = !(smp->strm->txn->flags & TX_NOT_FIRST);
return 1;
}
/* Accepts exactly 1 argument of type userlist */
static int
smp_fetch_http_auth(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_http_auth(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
if (!args || args->type != ARGT_USR)
@ -11016,32 +11016,34 @@ smp_fetch_http_auth(struct proxy *px, struct session *sess, struct stream *strm,
CHECK_HTTP_MESSAGE_FIRST();
if (!get_http_auth(strm))
if (!get_http_auth(smp->strm))
return 0;
smp->type = SMP_T_BOOL;
smp->data.uint = check_user(args->data.usr, strm->txn->auth.user, strm->txn->auth.pass);
smp->data.uint = check_user(args->data.usr, smp->strm->txn->auth.user,
smp->strm->txn->auth.pass);
return 1;
}
/* Accepts exactly 1 argument of type userlist */
static int
smp_fetch_http_auth_grp(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_http_auth_grp(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
if (!args || args->type != ARGT_USR)
return 0;
CHECK_HTTP_MESSAGE_FIRST();
if (!get_http_auth(strm))
if (!get_http_auth(smp->strm))
return 0;
/* if the user does not belong to the userlist or has a wrong password,
* report that it unconditionally does not match. Otherwise we return
* a string containing the username.
*/
if (!check_user(args->data.usr, strm->txn->auth.user, strm->txn->auth.pass))
if (!check_user(args->data.usr, smp->strm->txn->auth.user,
smp->strm->txn->auth.pass))
return 0;
/* pat_match_auth() will need the user list */
@ -11049,8 +11051,8 @@ smp_fetch_http_auth_grp(struct proxy *px, struct session *sess, struct stream *s
smp->type = SMP_T_STR;
smp->flags = SMP_F_CONST;
smp->data.str.str = strm->txn->auth.user;
smp->data.str.len = strlen(strm->txn->auth.user);
smp->data.str.str = smp->strm->txn->auth.user;
smp->data.str.len = strlen(smp->strm->txn->auth.user);
return 1;
}
@ -11154,10 +11156,10 @@ extract_cookie_value(char *hdr, const char *hdr_end,
* the "capture" option in the configuration file
*/
static int
smp_fetch_capture_header_req(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_capture_header_req(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct proxy *fe = strm_fe(strm);
struct proxy *fe = strm_fe(smp->strm);
int idx;
if (!args || args->type != ARGT_UINT)
@ -11165,13 +11167,13 @@ smp_fetch_capture_header_req(struct proxy *px, struct session *sess, struct stre
idx = args->data.uint;
if (idx > (fe->nb_req_cap - 1) || strm->req_cap == NULL || strm->req_cap[idx] == NULL)
if (idx > (fe->nb_req_cap - 1) || smp->strm->req_cap == NULL || smp->strm->req_cap[idx] == NULL)
return 0;
smp->type = SMP_T_STR;
smp->flags |= SMP_F_CONST;
smp->data.str.str = strm->req_cap[idx];
smp->data.str.len = strlen(strm->req_cap[idx]);
smp->data.str.str = smp->strm->req_cap[idx];
smp->data.str.len = strlen(smp->strm->req_cap[idx]);
return 1;
}
@ -11180,10 +11182,10 @@ smp_fetch_capture_header_req(struct proxy *px, struct session *sess, struct stre
* the "capture" option in the configuration file
*/
static int
smp_fetch_capture_header_res(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_capture_header_res(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct proxy *fe = strm_fe(strm);
struct proxy *fe = strm_fe(smp->strm);
int idx;
if (!args || args->type != ARGT_UINT)
@ -11191,24 +11193,24 @@ smp_fetch_capture_header_res(struct proxy *px, struct session *sess, struct stre
idx = args->data.uint;
if (idx > (fe->nb_rsp_cap - 1) || strm->res_cap == NULL || strm->res_cap[idx] == NULL)
if (idx > (fe->nb_rsp_cap - 1) || smp->strm->res_cap == NULL || smp->strm->res_cap[idx] == NULL)
return 0;
smp->type = SMP_T_STR;
smp->flags |= SMP_F_CONST;
smp->data.str.str = strm->res_cap[idx];
smp->data.str.len = strlen(strm->res_cap[idx]);
smp->data.str.str = smp->strm->res_cap[idx];
smp->data.str.len = strlen(smp->strm->res_cap[idx]);
return 1;
}
/* Extracts the METHOD in the HTTP request, the txn->uri should be filled before the call */
static int
smp_fetch_capture_req_method(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_capture_req_method(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct chunk *temp;
struct http_txn *txn = strm->txn;
struct http_txn *txn = smp->strm->txn;
char *ptr;
if (!txn || !txn->uri)
@ -11232,11 +11234,11 @@ smp_fetch_capture_req_method(struct proxy *px, struct session *sess, struct stre
/* Extracts the path in the HTTP request, the txn->uri should be filled before the call */
static int
smp_fetch_capture_req_uri(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_capture_req_uri(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct chunk *temp;
struct http_txn *txn = strm->txn;
struct http_txn *txn = smp->strm->txn;
char *ptr;
if (!txn || !txn->uri)
@ -11271,10 +11273,10 @@ smp_fetch_capture_req_uri(struct proxy *px, struct session *sess, struct stream
* as a string (either "HTTP/1.0" or "HTTP/1.1").
*/
static int
smp_fetch_capture_req_ver(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_capture_req_ver(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct http_txn *txn = strm->txn;
struct http_txn *txn = smp->strm->txn;
if (!txn || txn->req.msg_state < HTTP_MSG_HDR_FIRST)
return 0;
@ -11295,10 +11297,10 @@ smp_fetch_capture_req_ver(struct proxy *px, struct session *sess, struct stream
* as a string (either "HTTP/1.0" or "HTTP/1.1").
*/
static int
smp_fetch_capture_res_ver(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_capture_res_ver(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct http_txn *txn = strm->txn;
struct http_txn *txn = smp->strm->txn;
if (!txn || txn->rsp.msg_state < HTTP_MSG_HDR_FIRST)
return 0;
@ -11326,8 +11328,8 @@ smp_fetch_capture_res_ver(struct proxy *px, struct session *sess, struct stream
* The returned sample is of type CSTR. Can be used to parse cookies in other
* files.
*/
int smp_fetch_cookie(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
int smp_fetch_cookie(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct http_txn *txn;
struct hdr_idx *idx;
@ -11351,8 +11353,8 @@ int smp_fetch_cookie(struct proxy *px, struct session *sess, struct stream *strm
CHECK_HTTP_MESSAGE_FIRST();
txn = strm->txn;
idx = &strm->txn->hdr_idx;
txn = smp->strm->txn;
idx = &smp->strm->txn->hdr_idx;
if ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) {
msg = &txn->req;
@ -11428,8 +11430,8 @@ int smp_fetch_cookie(struct proxy *px, struct session *sess, struct stream *strm
* type UINT. Accepts exactly 1 argument of type string.
*/
static int
smp_fetch_cookie_cnt(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_cookie_cnt(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct http_txn *txn;
struct hdr_idx *idx;
@ -11446,8 +11448,8 @@ smp_fetch_cookie_cnt(struct proxy *px, struct session *sess, struct stream *strm
CHECK_HTTP_MESSAGE_FIRST();
txn = strm->txn;
idx = &strm->txn->hdr_idx;
txn = smp->strm->txn;
idx = &smp->strm->txn->hdr_idx;
if ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) {
msg = &txn->req;
@ -11498,10 +11500,10 @@ smp_fetch_cookie_cnt(struct proxy *px, struct session *sess, struct stream *strm
* takes a mandatory argument of type string. It relies on smp_fetch_cookie().
*/
static int
smp_fetch_cookie_val(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_cookie_val(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
int ret = smp_fetch_cookie(px, sess, strm, opt, args, smp, kw, private);
int ret = smp_fetch_cookie(opt, args, smp, kw, private);
if (ret > 0) {
smp->type = SMP_T_UINT;
@ -11603,8 +11605,8 @@ find_url_param_value(char* path, size_t path_l,
}
static int
smp_fetch_url_param(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_url_param(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
char delim = '?';
struct http_msg *msg;
@ -11615,7 +11617,7 @@ smp_fetch_url_param(struct proxy *px, struct session *sess, struct stream *strm,
CHECK_HTTP_MESSAGE_FIRST();
msg = &strm->txn->req;
msg = &smp->strm->txn->req;
if (args[1].type)
delim = *args[1].data.str.str;
@ -11635,10 +11637,10 @@ smp_fetch_url_param(struct proxy *px, struct session *sess, struct stream *strm,
* above).
*/
static int
smp_fetch_url_param_val(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_url_param_val(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
int ret = smp_fetch_url_param(px, sess, strm, opt, args, smp, kw, private);
int ret = smp_fetch_url_param(opt, args, smp, kw, private);
if (ret > 0) {
smp->type = SMP_T_UINT;
@ -11659,8 +11661,8 @@ smp_fetch_url_param_val(struct proxy *px, struct session *sess, struct stream *s
* as well as the path
*/
static int
smp_fetch_url32(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_url32(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct http_txn *txn;
struct hdr_ctx ctx;
@ -11670,7 +11672,7 @@ smp_fetch_url32(struct proxy *px, struct session *sess, struct stream *strm, uns
CHECK_HTTP_MESSAGE_FIRST();
txn = strm->txn;
txn = smp->strm->txn;
ctx.idx = 0;
if (http_find_header2("Host", 4, txn->req.chn->buf->p, &txn->hdr_idx, &ctx)) {
/* OK we have the header value in ctx.line+ctx.val for ctx.vlen bytes */
@ -11708,13 +11710,13 @@ smp_fetch_url32(struct proxy *px, struct session *sess, struct stream *strm, uns
* 8 bytes would still work.
*/
static int
smp_fetch_url32_src(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_url32_src(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct chunk *temp;
struct connection *cli_conn = objt_conn(sess->origin);
struct connection *cli_conn = objt_conn(smp->sess->origin);
if (!smp_fetch_url32(px, sess, strm, opt, args, smp, kw, private))
if (!smp_fetch_url32(opt, args, smp, kw, private))
return 0;
temp = get_trash_chunk();
@ -11760,8 +11762,7 @@ int val_hdr(struct arg *arg, char **err_msg)
* adds an optional offset found in args[0] and emits a string representing
* the date in RFC-1123/5322 format.
*/
static int sample_conv_http_date(struct stream *stream, const struct arg *args,
struct sample *smp, void *private)
static int sample_conv_http_date(const struct arg *args, struct sample *smp, void *private)
{
const char day[7][4] = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" };
const char mon[12][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
@ -11812,8 +11813,7 @@ static inline int language_range_match(const char *range, int range_len,
}
/* Arguments: The list of expected value, the number of parts returned and the separator */
static int sample_conv_q_prefered(struct stream *stream, const struct arg *args,
struct sample *smp, void *private)
static int sample_conv_q_prefered(const struct arg *args, struct sample *smp, void *private)
{
const char *al = smp->data.str.str;
const char *end = al + smp->data.str.len;
@ -11960,8 +11960,7 @@ expect_comma:
}
/* This fetch url-decode any input string. */
static int sample_conv_url_dec(struct stream *stream, const struct arg *args,
struct sample *smp, void *private)
static int sample_conv_url_dec(const struct arg *args, struct sample *smp, void *private)
{
/* If the constant flag is set or if not size is avalaible at
* the end of the buffer, copy the string in other buffer

View File

@ -1963,10 +1963,10 @@ static int tcp_parse_tcp_req(char **args, int section_type, struct proxy *curpx,
/* fetch the connection's source IPv4/IPv6 address */
static int
smp_fetch_src(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_src(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct connection *cli_conn = objt_conn(sess->origin);
struct connection *cli_conn = objt_conn(smp->sess->origin);
if (!cli_conn)
return 0;
@ -1990,10 +1990,10 @@ smp_fetch_src(struct proxy *px, struct session *sess, struct stream *strm, unsig
/* set temp integer to the connection's source port */
static int
smp_fetch_sport(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *k, void *private)
smp_fetch_sport(unsigned int opt, const struct arg *args, struct sample *smp,
const char *k, void *private)
{
struct connection *cli_conn = objt_conn(sess->origin);
struct connection *cli_conn = objt_conn(smp->sess->origin);
if (!cli_conn)
return 0;
@ -2008,10 +2008,10 @@ smp_fetch_sport(struct proxy *px, struct session *sess, struct stream *strm, uns
/* fetch the connection's destination IPv4/IPv6 address */
static int
smp_fetch_dst(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_dst(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct connection *cli_conn = objt_conn(sess->origin);
struct connection *cli_conn = objt_conn(smp->sess->origin);
if (!cli_conn)
return 0;
@ -2037,10 +2037,10 @@ smp_fetch_dst(struct proxy *px, struct session *sess, struct stream *strm, unsig
/* set temp integer to the frontend connexion's destination port */
static int
smp_fetch_dport(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_dport(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct connection *cli_conn = objt_conn(sess->origin);
struct connection *cli_conn = objt_conn(smp->sess->origin);
if (!cli_conn)
return 0;

View File

@ -1036,7 +1036,7 @@ struct sample *sample_process(struct proxy *px, struct session *sess,
p->px = px;
p->sess = sess;
p->strm = strm;
if (!expr->fetch->process(px, sess, strm, opt, expr->arg_p, p, expr->fetch->kw, expr->fetch->private))
if (!expr->fetch->process(opt, expr->arg_p, p, expr->fetch->kw, expr->fetch->private))
return NULL;
list_for_each_entry(conv_expr, &expr->conv_exprs, list) {
@ -1055,7 +1055,7 @@ struct sample *sample_process(struct proxy *px, struct session *sess,
/* OK cast succeeded */
if (!conv_expr->conv->process(strm, conv_expr->arg_p, p, conv_expr->conv->private))
if (!conv_expr->conv->process(conv_expr->arg_p, p, conv_expr->conv->private))
return NULL;
}
return p;
@ -1364,8 +1364,7 @@ struct sample *sample_fetch_string(struct proxy *px, struct session *sess,
/* These functions set the data type on return. */
/*****************************************************************/
static int sample_conv_bin2base64(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_bin2base64(const struct arg *arg_p, struct sample *smp, void *private)
{
struct chunk *trash = get_trash_chunk();
int b64_len;
@ -1382,8 +1381,7 @@ static int sample_conv_bin2base64(struct stream *stream, const struct arg *arg_p
return 1;
}
static int sample_conv_bin2hex(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_bin2hex(const struct arg *arg_p, struct sample *smp, void *private)
{
struct chunk *trash = get_trash_chunk();
unsigned char c;
@ -1402,8 +1400,7 @@ static int sample_conv_bin2hex(struct stream *stream, const struct arg *arg_p,
}
/* hashes the binary input into a 32-bit unsigned int */
static int sample_conv_djb2(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_djb2(const struct arg *arg_p, struct sample *smp, void *private)
{
smp->data.uint = hash_djb2(smp->data.str.str, smp->data.str.len);
if (arg_p && arg_p->data.uint)
@ -1412,8 +1409,7 @@ static int sample_conv_djb2(struct stream *stream, const struct arg *arg_p,
return 1;
}
static int sample_conv_str2lower(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_str2lower(const struct arg *arg_p, struct sample *smp, void *private)
{
int i;
@ -1430,8 +1426,7 @@ static int sample_conv_str2lower(struct stream *stream, const struct arg *arg_p,
return 1;
}
static int sample_conv_str2upper(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_str2upper(const struct arg *arg_p, struct sample *smp, void *private)
{
int i;
@ -1449,8 +1444,7 @@ static int sample_conv_str2upper(struct stream *stream, const struct arg *arg_p,
}
/* takes the netmask in arg_p */
static int sample_conv_ipmask(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_ipmask(const struct arg *arg_p, struct sample *smp, void *private)
{
smp->data.ipv4.s_addr &= arg_p->data.ipv4.s_addr;
smp->type = SMP_T_IPV4;
@ -1461,8 +1455,7 @@ static int sample_conv_ipmask(struct stream *stream, const struct arg *arg_p,
* adds an optional offset found in args[1] and emits a string representing
* the local time in the format specified in args[1] using strftime().
*/
static int sample_conv_ltime(struct stream *stream, const struct arg *args,
struct sample *smp, void *private)
static int sample_conv_ltime(const struct arg *args, struct sample *smp, void *private)
{
struct chunk *temp;
time_t curr_date = smp->data.uint;
@ -1479,8 +1472,7 @@ static int sample_conv_ltime(struct stream *stream, const struct arg *args,
}
/* hashes the binary input into a 32-bit unsigned int */
static int sample_conv_sdbm(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_sdbm(const struct arg *arg_p, struct sample *smp, void *private)
{
smp->data.uint = hash_sdbm(smp->data.str.str, smp->data.str.len);
if (arg_p && arg_p->data.uint)
@ -1493,8 +1485,7 @@ static int sample_conv_sdbm(struct stream *stream, const struct arg *arg_p,
* adds an optional offset found in args[1] and emits a string representing
* the UTC date in the format specified in args[1] using strftime().
*/
static int sample_conv_utime(struct stream *stream, const struct arg *args,
struct sample *smp, void *private)
static int sample_conv_utime(const struct arg *args, struct sample *smp, void *private)
{
struct chunk *temp;
time_t curr_date = smp->data.uint;
@ -1511,8 +1502,7 @@ static int sample_conv_utime(struct stream *stream, const struct arg *args,
}
/* hashes the binary input into a 32-bit unsigned int */
static int sample_conv_wt6(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_wt6(const struct arg *arg_p, struct sample *smp, void *private)
{
smp->data.uint = hash_wt6(smp->data.str.str, smp->data.str.len);
if (arg_p && arg_p->data.uint)
@ -1522,8 +1512,7 @@ static int sample_conv_wt6(struct stream *stream, const struct arg *arg_p,
}
/* hashes the binary input into a 32-bit unsigned int */
static int sample_conv_crc32(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_crc32(const struct arg *arg_p, struct sample *smp, void *private)
{
smp->data.uint = hash_crc32(smp->data.str.str, smp->data.str.len);
if (arg_p && arg_p->data.uint)
@ -1603,8 +1592,7 @@ static int sample_conv_json_check(struct arg *arg, struct sample_conv *conv,
return 0;
}
static int sample_conv_json(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_json(const struct arg *arg_p, struct sample *smp, void *private)
{
struct chunk *temp;
char _str[7]; /* \u + 4 hex digit + null char for sprintf. */
@ -1718,8 +1706,7 @@ static int sample_conv_json(struct stream *stream, const struct arg *arg_p,
/* This sample function is designed to extract some bytes from an input buffer.
* First arg is the offset.
* Optional second arg is the length to truncate */
static int sample_conv_bytes(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_bytes(const struct arg *arg_p, struct sample *smp, void *private)
{
if (smp->data.str.len <= arg_p[0].data.uint) {
smp->data.str.len = 0;
@ -1776,8 +1763,7 @@ static int sample_conv_field_check(struct arg *args, struct sample_conv *conv,
* First arg is the index of the field (start at 1)
* Second arg is a char list of separators (type string)
*/
static int sample_conv_field(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_field(const struct arg *arg_p, struct sample *smp, void *private)
{
unsigned int field;
char *start, *end;
@ -1828,8 +1814,7 @@ found:
* First arg is the index of the word (start at 1)
* Second arg is a char list of words separators (type string)
*/
static int sample_conv_word(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_word(const struct arg *arg_p, struct sample *smp, void *private)
{
unsigned int word;
char *start, *end;
@ -1923,8 +1908,7 @@ static int sample_conv_regsub_check(struct arg *args, struct sample_conv *conv,
* location until nothing matches anymore. First arg is the regex to apply to
* the input string, second arg is the replacement expression.
*/
static int sample_conv_regsub(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_regsub(const struct arg *arg_p, struct sample *smp, void *private)
{
char *start, *end;
struct my_regex *reg = arg_p[0].data.reg;
@ -1996,8 +1980,7 @@ static int sample_conv_regsub(struct stream *stream, const struct arg *arg_p,
/* Takes a UINT on input, applies a binary twos complement and returns the UINT
* result.
*/
static int sample_conv_binary_cpl(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_binary_cpl(const struct arg *arg_p, struct sample *smp, void *private)
{
smp->data.uint = ~smp->data.uint;
return 1;
@ -2006,8 +1989,7 @@ static int sample_conv_binary_cpl(struct stream *stream, const struct arg *arg_p
/* Takes a UINT on input, applies a binary "and" with the UINT in arg_p, and
* returns the UINT result.
*/
static int sample_conv_binary_and(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_binary_and(const struct arg *arg_p, struct sample *smp, void *private)
{
smp->data.uint &= arg_p->data.uint;
return 1;
@ -2016,8 +1998,7 @@ static int sample_conv_binary_and(struct stream *stream, const struct arg *arg_p
/* Takes a UINT on input, applies a binary "or" with the UINT in arg_p, and
* returns the UINT result.
*/
static int sample_conv_binary_or(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_binary_or(const struct arg *arg_p, struct sample *smp, void *private)
{
smp->data.uint |= arg_p->data.uint;
return 1;
@ -2026,8 +2007,7 @@ static int sample_conv_binary_or(struct stream *stream, const struct arg *arg_p,
/* Takes a UINT on input, applies a binary "xor" with the UINT in arg_p, and
* returns the UINT result.
*/
static int sample_conv_binary_xor(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_binary_xor(const struct arg *arg_p, struct sample *smp, void *private)
{
smp->data.uint ^= arg_p->data.uint;
return 1;
@ -2036,8 +2016,7 @@ static int sample_conv_binary_xor(struct stream *stream, const struct arg *arg_p
/* Takes a UINT on input, applies an arithmetic "add" with the UINT in arg_p,
* and returns the UINT result.
*/
static int sample_conv_arith_add(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_arith_add(const struct arg *arg_p, struct sample *smp, void *private)
{
smp->data.uint += arg_p->data.uint;
return 1;
@ -2046,7 +2025,7 @@ static int sample_conv_arith_add(struct stream *stream, const struct arg *arg_p,
/* Takes a UINT on input, applies an arithmetic "sub" with the UINT in arg_p,
* and returns the UINT result.
*/
static int sample_conv_arith_sub(struct stream *stream, const struct arg *arg_p,
static int sample_conv_arith_sub(const struct arg *arg_p,
struct sample *smp, void *private)
{
smp->data.uint -= arg_p->data.uint;
@ -2056,7 +2035,7 @@ static int sample_conv_arith_sub(struct stream *stream, const struct arg *arg_p,
/* Takes a UINT on input, applies an arithmetic "mul" with the UINT in arg_p,
* and returns the UINT result.
*/
static int sample_conv_arith_mul(struct stream *stream, const struct arg *arg_p,
static int sample_conv_arith_mul(const struct arg *arg_p,
struct sample *smp, void *private)
{
smp->data.uint *= arg_p->data.uint;
@ -2067,7 +2046,7 @@ static int sample_conv_arith_mul(struct stream *stream, const struct arg *arg_p,
* and returns the UINT result. If arg_p makes the result overflow, then the
* largest possible quantity is returned.
*/
static int sample_conv_arith_div(struct stream *stream, const struct arg *arg_p,
static int sample_conv_arith_div(const struct arg *arg_p,
struct sample *smp, void *private)
{
if (arg_p->data.uint)
@ -2081,7 +2060,7 @@ static int sample_conv_arith_div(struct stream *stream, const struct arg *arg_p,
* and returns the UINT result. If arg_p makes the result overflow, then zero
* is returned.
*/
static int sample_conv_arith_mod(struct stream *stream, const struct arg *arg_p,
static int sample_conv_arith_mod(const struct arg *arg_p,
struct sample *smp, void *private)
{
if (arg_p->data.uint)
@ -2094,7 +2073,7 @@ static int sample_conv_arith_mod(struct stream *stream, const struct arg *arg_p,
/* Takes an UINT on input, applies an arithmetic "neg" and returns the UINT
* result.
*/
static int sample_conv_arith_neg(struct stream *stream, const struct arg *arg_p,
static int sample_conv_arith_neg(const struct arg *arg_p,
struct sample *smp, void *private)
{
smp->data.uint = -smp->data.uint;
@ -2104,7 +2083,7 @@ static int sample_conv_arith_neg(struct stream *stream, const struct arg *arg_p,
/* Takes a UINT on input, returns true is the value is non-null, otherwise
* false. The output is a BOOL.
*/
static int sample_conv_arith_bool(struct stream *stream, const struct arg *arg_p,
static int sample_conv_arith_bool(const struct arg *arg_p,
struct sample *smp, void *private)
{
smp->data.uint = !!smp->data.uint;
@ -2115,7 +2094,7 @@ static int sample_conv_arith_bool(struct stream *stream, const struct arg *arg_p
/* Takes a UINT on input, returns false is the value is non-null, otherwise
* truee. The output is a BOOL.
*/
static int sample_conv_arith_not(struct stream *stream, const struct arg *arg_p,
static int sample_conv_arith_not(const struct arg *arg_p,
struct sample *smp, void *private)
{
smp->data.uint = !smp->data.uint;
@ -2126,7 +2105,7 @@ static int sample_conv_arith_not(struct stream *stream, const struct arg *arg_p,
/* Takes a UINT on input, returns true is the value is odd, otherwise false.
* The output is a BOOL.
*/
static int sample_conv_arith_odd(struct stream *stream, const struct arg *arg_p,
static int sample_conv_arith_odd(const struct arg *arg_p,
struct sample *smp, void *private)
{
smp->data.uint = smp->data.uint & 1;
@ -2137,7 +2116,7 @@ static int sample_conv_arith_odd(struct stream *stream, const struct arg *arg_p,
/* Takes a UINT on input, returns true is the value is even, otherwise false.
* The output is a BOOL.
*/
static int sample_conv_arith_even(struct stream *stream, const struct arg *arg_p,
static int sample_conv_arith_even(const struct arg *arg_p,
struct sample *smp, void *private)
{
smp->data.uint = !(smp->data.uint & 1);
@ -2151,8 +2130,8 @@ static int sample_conv_arith_even(struct stream *stream, const struct arg *arg_p
/* force TRUE to be returned at the fetch level */
static int
smp_fetch_true(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_true(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
smp->type = SMP_T_BOOL;
smp->data.uint = 1;
@ -2161,8 +2140,8 @@ smp_fetch_true(struct proxy *px, struct session *sess, struct stream *strm, unsi
/* force FALSE to be returned at the fetch level */
static int
smp_fetch_false(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_false(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
smp->type = SMP_T_BOOL;
smp->data.uint = 0;
@ -2171,8 +2150,8 @@ smp_fetch_false(struct proxy *px, struct session *sess, struct stream *strm, uns
/* retrieve environment variable $1 as a string */
static int
smp_fetch_env(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_env(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
char *env;
@ -2194,8 +2173,8 @@ smp_fetch_env(struct proxy *px, struct session *sess, struct stream *strm, unsig
* of args[0] seconds.
*/
static int
smp_fetch_date(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_date(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
smp->data.uint = date.tv_sec;
@ -2210,8 +2189,8 @@ smp_fetch_date(struct proxy *px, struct session *sess, struct stream *strm, unsi
/* returns the number of processes */
static int
smp_fetch_nbproc(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_nbproc(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
smp->type = SMP_T_UINT;
smp->data.uint = global.nbproc;
@ -2220,8 +2199,8 @@ smp_fetch_nbproc(struct proxy *px, struct session *sess, struct stream *strm, un
/* returns the number of the current process (between 1 and nbproc */
static int
smp_fetch_proc(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_proc(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
smp->type = SMP_T_UINT;
smp->data.uint = relative_pid;
@ -2232,8 +2211,8 @@ smp_fetch_proc(struct proxy *px, struct session *sess, struct stream *strm, unsi
* range specified in argument.
*/
static int
smp_fetch_rand(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_rand(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
smp->data.uint = random();
@ -2248,8 +2227,8 @@ smp_fetch_rand(struct proxy *px, struct session *sess, struct stream *strm, unsi
/* returns true if the current process is stopping */
static int
smp_fetch_stopping(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_stopping(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
smp->type = SMP_T_BOOL;
smp->data.uint = stopping;

View File

@ -3084,12 +3084,12 @@ unsigned int ssl_sock_get_verify_result(struct connection *conn)
/* boolean, returns true if client cert was present */
static int
smp_fetch_ssl_fc_has_crt(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_ssl_fc_has_crt(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct connection *conn;
conn = objt_conn(sess->origin);
conn = objt_conn(smp->sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@ -3110,8 +3110,8 @@ smp_fetch_ssl_fc_has_crt(struct proxy *px, struct session *sess, struct stream *
* should be use.
*/
static int
smp_fetch_ssl_x_der(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_ssl_x_der(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
int cert_peer = (kw[4] == 'c') ? 1 : 0;
X509 *crt = NULL;
@ -3119,7 +3119,7 @@ smp_fetch_ssl_x_der(struct proxy *px, struct session *sess, struct stream *strm,
struct chunk *smp_trash;
struct connection *conn;
conn = objt_conn(sess->origin);
conn = objt_conn(smp->sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@ -3155,8 +3155,8 @@ out:
* should be use.
*/
static int
smp_fetch_ssl_x_serial(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_ssl_x_serial(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
int cert_peer = (kw[4] == 'c') ? 1 : 0;
X509 *crt = NULL;
@ -3164,7 +3164,7 @@ smp_fetch_ssl_x_serial(struct proxy *px, struct session *sess, struct stream *st
struct chunk *smp_trash;
struct connection *conn;
conn = objt_conn(sess->origin);
conn = objt_conn(smp->sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@ -3200,8 +3200,8 @@ out:
* should be use.
*/
static int
smp_fetch_ssl_x_sha1(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_ssl_x_sha1(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
int cert_peer = (kw[4] == 'c') ? 1 : 0;
X509 *crt = NULL;
@ -3210,7 +3210,7 @@ smp_fetch_ssl_x_sha1(struct proxy *px, struct session *sess, struct stream *strm
struct chunk *smp_trash;
struct connection *conn;
conn = objt_conn(sess->origin);
conn = objt_conn(smp->sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@ -3245,8 +3245,8 @@ out:
* should be use.
*/
static int
smp_fetch_ssl_x_notafter(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_ssl_x_notafter(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
int cert_peer = (kw[4] == 'c') ? 1 : 0;
X509 *crt = NULL;
@ -3254,7 +3254,7 @@ smp_fetch_ssl_x_notafter(struct proxy *px, struct session *sess, struct stream *
struct chunk *smp_trash;
struct connection *conn;
conn = objt_conn(sess->origin);
conn = objt_conn(smp->sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@ -3289,8 +3289,8 @@ out:
* should be use.
*/
static int
smp_fetch_ssl_x_i_dn(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_ssl_x_i_dn(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
int cert_peer = (kw[4] == 'c') ? 1 : 0;
X509 *crt = NULL;
@ -3299,7 +3299,7 @@ smp_fetch_ssl_x_i_dn(struct proxy *px, struct session *sess, struct stream *strm
struct chunk *smp_trash;
struct connection *conn;
conn = objt_conn(sess->origin);
conn = objt_conn(smp->sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@ -3349,8 +3349,8 @@ out:
* should be use.
*/
static int
smp_fetch_ssl_x_notbefore(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_ssl_x_notbefore(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
int cert_peer = (kw[4] == 'c') ? 1 : 0;
X509 *crt = NULL;
@ -3358,7 +3358,7 @@ smp_fetch_ssl_x_notbefore(struct proxy *px, struct session *sess, struct stream
struct chunk *smp_trash;
struct connection *conn;
conn = objt_conn(sess->origin);
conn = objt_conn(smp->sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@ -3393,8 +3393,8 @@ out:
* should be use.
*/
static int
smp_fetch_ssl_x_s_dn(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_ssl_x_s_dn(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
int cert_peer = (kw[4] == 'c') ? 1 : 0;
X509 *crt = NULL;
@ -3403,7 +3403,7 @@ smp_fetch_ssl_x_s_dn(struct proxy *px, struct session *sess, struct stream *strm
struct chunk *smp_trash;
struct connection *conn;
conn = objt_conn(sess->origin);
conn = objt_conn(smp->sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@ -3450,13 +3450,13 @@ out:
/* integer, returns true if current session use a client certificate */
static int
smp_fetch_ssl_c_used(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_ssl_c_used(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
X509 *crt;
struct connection *conn;
conn = objt_conn(sess->origin);
conn = objt_conn(smp->sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@ -3481,14 +3481,14 @@ smp_fetch_ssl_c_used(struct proxy *px, struct session *sess, struct stream *strm
* should be use.
*/
static int
smp_fetch_ssl_x_version(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_ssl_x_version(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
int cert_peer = (kw[4] == 'c') ? 1 : 0;
X509 *crt;
struct connection *conn;
conn = objt_conn(sess->origin);
conn = objt_conn(smp->sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@ -3518,15 +3518,15 @@ smp_fetch_ssl_x_version(struct proxy *px, struct session *sess, struct stream *s
* should be use.
*/
static int
smp_fetch_ssl_x_sig_alg(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_ssl_x_sig_alg(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
int cert_peer = (kw[4] == 'c') ? 1 : 0;
X509 *crt;
int nid;
struct connection *conn;
conn = objt_conn(sess->origin);
conn = objt_conn(smp->sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@ -3567,15 +3567,15 @@ smp_fetch_ssl_x_sig_alg(struct proxy *px, struct session *sess, struct stream *s
* should be use.
*/
static int
smp_fetch_ssl_x_key_alg(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_ssl_x_key_alg(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
int cert_peer = (kw[4] == 'c') ? 1 : 0;
X509 *crt;
int nid;
struct connection *conn;
conn = objt_conn(sess->origin);
conn = objt_conn(smp->sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@ -3615,11 +3615,11 @@ smp_fetch_ssl_x_key_alg(struct proxy *px, struct session *sess, struct stream *s
* char is 'b'.
*/
static int
smp_fetch_ssl_fc(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_ssl_fc(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
int back_conn = (kw[4] == 'b') ? 1 : 0;
struct connection *conn = objt_conn(strm->si[back_conn].end);
struct connection *conn = objt_conn(smp->strm->si[back_conn].end);
smp->type = SMP_T_BOOL;
smp->data.uint = (conn && conn->xprt == &ssl_sock);
@ -3628,11 +3628,11 @@ smp_fetch_ssl_fc(struct proxy *px, struct session *sess, struct stream *strm, un
/* boolean, returns true if client present a SNI */
static int
smp_fetch_ssl_fc_has_sni(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_ssl_fc_has_sni(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
struct connection *conn = objt_conn(sess->origin);
struct connection *conn = objt_conn(smp->sess->origin);
smp->type = SMP_T_BOOL;
smp->data.uint = (conn && conn->xprt == &ssl_sock) &&
@ -3649,15 +3649,15 @@ smp_fetch_ssl_fc_has_sni(struct proxy *px, struct session *sess, struct stream *
* char is 'b'.
*/
static int
smp_fetch_ssl_fc_cipher(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_ssl_fc_cipher(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
int back_conn = (kw[4] == 'b') ? 1 : 0;
struct connection *conn;
smp->flags = 0;
conn = objt_conn(strm->si[back_conn].end);
conn = objt_conn(smp->strm->si[back_conn].end);
if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
return 0;
@ -3678,15 +3678,15 @@ smp_fetch_ssl_fc_cipher(struct proxy *px, struct session *sess, struct stream *s
* char is 'b'.
*/
static int
smp_fetch_ssl_fc_alg_keysize(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_ssl_fc_alg_keysize(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
int back_conn = (kw[4] == 'b') ? 1 : 0;
struct connection *conn;
smp->flags = 0;
conn = objt_conn(strm->si[back_conn].end);
conn = objt_conn(smp->strm->si[back_conn].end);
if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
return 0;
@ -3703,15 +3703,15 @@ smp_fetch_ssl_fc_alg_keysize(struct proxy *px, struct session *sess, struct stre
* char is 'b'.
*/
static int
smp_fetch_ssl_fc_use_keysize(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_ssl_fc_use_keysize(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
int back_conn = (kw[4] == 'b') ? 1 : 0;
struct connection *conn;
smp->flags = 0;
conn = objt_conn(strm->si[back_conn].end);
conn = objt_conn(smp->strm->si[back_conn].end);
if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
return 0;
@ -3726,15 +3726,15 @@ smp_fetch_ssl_fc_use_keysize(struct proxy *px, struct session *sess, struct stre
#ifdef OPENSSL_NPN_NEGOTIATED
static int
smp_fetch_ssl_fc_npn(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_ssl_fc_npn(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct connection *conn;
smp->flags = SMP_F_CONST;
smp->type = SMP_T_STR;
conn = objt_conn(sess->origin);
conn = objt_conn(smp->sess->origin);
if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
return 0;
@ -3751,8 +3751,8 @@ smp_fetch_ssl_fc_npn(struct proxy *px, struct session *sess, struct stream *strm
#ifdef TLSEXT_TYPE_application_layer_protocol_negotiation
static int
smp_fetch_ssl_fc_alpn(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_ssl_fc_alpn(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct connection *conn;
@ -3779,15 +3779,15 @@ smp_fetch_ssl_fc_alpn(struct proxy *px, struct session *sess, struct stream *str
* char is 'b'.
*/
static int
smp_fetch_ssl_fc_protocol(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_ssl_fc_protocol(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
int back_conn = (kw[4] == 'b') ? 1 : 0;
struct connection *conn;
smp->flags = 0;
conn = objt_conn(strm->si[back_conn].end);
conn = objt_conn(smp->strm->si[back_conn].end);
if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
return 0;
@ -3807,8 +3807,8 @@ smp_fetch_ssl_fc_protocol(struct proxy *px, struct session *sess, struct stream
* char is 'b'.
*/
static int
smp_fetch_ssl_fc_session_id(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_ssl_fc_session_id(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
#if OPENSSL_VERSION_NUMBER > 0x0090800fL
int back_conn = (kw[4] == 'b') ? 1 : 0;
@ -3818,7 +3818,7 @@ smp_fetch_ssl_fc_session_id(struct proxy *px, struct session *sess, struct strea
smp->flags = SMP_F_CONST;
smp->type = SMP_T_BIN;
conn = objt_conn(strm->si[back_conn].end);
conn = objt_conn(smp->strm->si[back_conn].end);
if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
return 0;
@ -3837,8 +3837,8 @@ smp_fetch_ssl_fc_session_id(struct proxy *px, struct session *sess, struct strea
}
static int
smp_fetch_ssl_fc_sni(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_ssl_fc_sni(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
struct connection *conn;
@ -3846,7 +3846,7 @@ smp_fetch_ssl_fc_sni(struct proxy *px, struct session *sess, struct stream *strm
smp->flags = SMP_F_CONST;
smp->type = SMP_T_STR;
conn = objt_conn(sess->origin);
conn = objt_conn(smp->sess->origin);
if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
return 0;
@ -3862,8 +3862,8 @@ smp_fetch_ssl_fc_sni(struct proxy *px, struct session *sess, struct stream *strm
}
static int
smp_fetch_ssl_fc_unique_id(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_ssl_fc_unique_id(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
#if OPENSSL_VERSION_NUMBER > 0x0090800fL
int back_conn = (kw[4] == 'b') ? 1 : 0;
@ -3873,7 +3873,7 @@ smp_fetch_ssl_fc_unique_id(struct proxy *px, struct session *sess, struct stream
smp->flags = 0;
conn = objt_conn(strm->si[back_conn].end);
conn = objt_conn(smp->strm->si[back_conn].end);
if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
return 0;
@ -3903,12 +3903,12 @@ smp_fetch_ssl_fc_unique_id(struct proxy *px, struct session *sess, struct stream
/* integer, returns the first verify error in CA chain of client certificate chain. */
static int
smp_fetch_ssl_c_ca_err(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_ssl_c_ca_err(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct connection *conn;
conn = objt_conn(sess->origin);
conn = objt_conn(smp->sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@ -3926,12 +3926,12 @@ smp_fetch_ssl_c_ca_err(struct proxy *px, struct session *sess, struct stream *st
/* integer, returns the depth of the first verify error in CA chain of client certificate chain. */
static int
smp_fetch_ssl_c_ca_err_depth(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_ssl_c_ca_err_depth(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct connection *conn;
conn = objt_conn(sess->origin);
conn = objt_conn(smp->sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@ -3949,12 +3949,12 @@ smp_fetch_ssl_c_ca_err_depth(struct proxy *px, struct session *sess, struct stre
/* integer, returns the first verify error on client certificate */
static int
smp_fetch_ssl_c_err(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_ssl_c_err(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct connection *conn;
conn = objt_conn(sess->origin);
conn = objt_conn(smp->sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;
@ -3972,12 +3972,12 @@ smp_fetch_ssl_c_err(struct proxy *px, struct session *sess, struct stream *strm,
/* integer, returns the verify result on client cert */
static int
smp_fetch_ssl_c_verify(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_ssl_c_verify(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct connection *conn;
conn = objt_conn(sess->origin);
conn = objt_conn(smp->sess->origin);
if (!conn || conn->xprt != &ssl_sock)
return 0;

View File

@ -809,8 +809,7 @@ struct proxy *find_stktable(const char *name)
* the table's type. This is a double conversion, but in the future we might
* support automatic input types to perform the cast on the fly.
*/
static int sample_conv_in_table(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_in_table(const struct arg *arg_p, struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
@ -836,8 +835,7 @@ static int sample_conv_in_table(struct stream *stream, const struct arg *arg_p,
* be easily performed. If the inspected parameter is not stored in the table,
* <not found> is returned.
*/
static int sample_conv_table_bytes_in_rate(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_table_bytes_in_rate(const struct arg *arg_p, struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
@ -873,8 +871,7 @@ static int sample_conv_table_bytes_in_rate(struct stream *stream, const struct a
* be easily performed. If the inspected parameter is not stored in the table,
* <not found> is returned.
*/
static int sample_conv_table_conn_cnt(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_table_conn_cnt(const struct arg *arg_p, struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
@ -909,8 +906,7 @@ static int sample_conv_table_conn_cnt(struct stream *stream, const struct arg *a
* can be easily performed. If the inspected parameter is not stored in the
* table, <not found> is returned.
*/
static int sample_conv_table_conn_cur(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_table_conn_cur(const struct arg *arg_p, struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
@ -945,8 +941,7 @@ static int sample_conv_table_conn_cur(struct stream *stream, const struct arg *a
* be easily performed. If the inspected parameter is not stored in the table,
* <not found> is returned.
*/
static int sample_conv_table_conn_rate(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_table_conn_rate(const struct arg *arg_p, struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
@ -982,8 +977,7 @@ static int sample_conv_table_conn_rate(struct stream *stream, const struct arg *
* be easily performed. If the inspected parameter is not stored in the table,
* <not found> is returned.
*/
static int sample_conv_table_bytes_out_rate(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_table_bytes_out_rate(const struct arg *arg_p, struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
@ -1019,8 +1013,7 @@ static int sample_conv_table_bytes_out_rate(struct stream *stream, const struct
* be easily performed. If the inspected parameter is not stored in the table,
* <not found> is returned.
*/
static int sample_conv_table_gpc0(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_table_gpc0(const struct arg *arg_p, struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
@ -1055,8 +1048,7 @@ static int sample_conv_table_gpc0(struct stream *stream, const struct arg *arg_p
* be easily performed. If the inspected parameter is not stored in the table,
* <not found> is returned.
*/
static int sample_conv_table_gpc0_rate(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_table_gpc0_rate(const struct arg *arg_p, struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
@ -1092,8 +1084,7 @@ static int sample_conv_table_gpc0_rate(struct stream *stream, const struct arg *
* comparisons can be easily performed. If the inspected parameter is not stored
* in the table, <not found> is returned.
*/
static int sample_conv_table_http_err_cnt(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_table_http_err_cnt(const struct arg *arg_p, struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
@ -1128,8 +1119,7 @@ static int sample_conv_table_http_err_cnt(struct stream *stream, const struct ar
* be easily performed. If the inspected parameter is not stored in the table,
* <not found> is returned.
*/
static int sample_conv_table_http_err_rate(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_table_http_err_rate(const struct arg *arg_p, struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
@ -1165,8 +1155,7 @@ static int sample_conv_table_http_err_rate(struct stream *stream, const struct a
* can be easily performed. If the inspected parameter is not stored in the
* table, <not found> is returned.
*/
static int sample_conv_table_http_req_cnt(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_table_http_req_cnt(const struct arg *arg_p, struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
@ -1201,8 +1190,7 @@ static int sample_conv_table_http_req_cnt(struct stream *stream, const struct ar
* performed. If the inspected parameter is not stored in the table, <not found>
* is returned.
*/
static int sample_conv_table_http_req_rate(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_table_http_req_rate(const struct arg *arg_p, struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
@ -1238,8 +1226,7 @@ static int sample_conv_table_http_req_rate(struct stream *stream, const struct a
* be easily performed. If the inspected parameter is not stored in the table,
* <not found> is returned.
*/
static int sample_conv_table_kbytes_in(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_table_kbytes_in(const struct arg *arg_p, struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
@ -1274,8 +1261,7 @@ static int sample_conv_table_kbytes_in(struct stream *stream, const struct arg *
* be easily performed. If the inspected parameter is not stored in the table,
* <not found> is returned.
*/
static int sample_conv_table_kbytes_out(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_table_kbytes_out(const struct arg *arg_p, struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
@ -1310,8 +1296,7 @@ static int sample_conv_table_kbytes_out(struct stream *stream, const struct arg
* easily performed. If the inspected parameter is not stored in the table,
* <not found> is returned.
*/
static int sample_conv_table_server_id(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_table_server_id(const struct arg *arg_p, struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
@ -1346,8 +1331,7 @@ static int sample_conv_table_server_id(struct stream *stream, const struct arg *
* can be easily performed. If the inspected parameter is not stored in the
* table, <not found> is returned.
*/
static int sample_conv_table_sess_cnt(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_table_sess_cnt(const struct arg *arg_p, struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
@ -1382,8 +1366,7 @@ static int sample_conv_table_sess_cnt(struct stream *stream, const struct arg *a
* performed. If the inspected parameter is not stored in the table, <not found>
* is returned.
*/
static int sample_conv_table_sess_rate(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_table_sess_rate(const struct arg *arg_p, struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
@ -1419,8 +1402,7 @@ static int sample_conv_table_sess_rate(struct stream *stream, const struct arg *
* comparisons can be easily performed. If the inspected parameter is not
* stored in the table, <not found> is returned.
*/
static int sample_conv_table_trackers(struct stream *stream, const struct arg *arg_p,
struct sample *smp, void *private)
static int sample_conv_table_trackers(const struct arg *arg_p, struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;

View File

@ -2585,12 +2585,12 @@ smp_fetch_sc_stkctr(struct session *sess, struct stream *strm, const struct arg
* Supports being called as "sc[0-9]_tracked" only.
*/
static int
smp_fetch_sc_tracked(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_sc_tracked(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_BOOL;
smp->data.uint = !!smp_fetch_sc_stkctr(sess, strm, args, kw);
smp->data.uint = !!smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
return 1;
}
@ -2600,10 +2600,10 @@ smp_fetch_sc_tracked(struct proxy *px, struct session *sess, struct stream *strm
* zero is returned if the key is new.
*/
static int
smp_fetch_sc_get_gpc0(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_sc_get_gpc0(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@ -2627,10 +2627,10 @@ smp_fetch_sc_get_gpc0(struct proxy *px, struct session *sess, struct stream *str
* Value zero is returned if the key is new.
*/
static int
smp_fetch_sc_gpc0_rate(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_sc_gpc0_rate(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@ -2643,7 +2643,7 @@ smp_fetch_sc_gpc0_rate(struct proxy *px, struct session *sess, struct stream *st
if (!ptr)
return 0; /* parameter not stored */
smp->data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, gpc0_rate),
stkctr->table->data_arg[STKTABLE_DT_GPC0_RATE].u);
stkctr->table->data_arg[STKTABLE_DT_GPC0_RATE].u);
}
return 1;
}
@ -2653,10 +2653,10 @@ smp_fetch_sc_gpc0_rate(struct proxy *px, struct session *sess, struct stream *st
* Supports being called as "sc[0-9]_inc_gpc0" or "src_inc_gpc0" only.
*/
static int
smp_fetch_sc_inc_gpc0(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_sc_inc_gpc0(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@ -2690,10 +2690,10 @@ smp_fetch_sc_inc_gpc0(struct proxy *px, struct session *sess, struct stream *str
* Supports being called as "sc[0-9]_clr_gpc0" or "src_clr_gpc0" only.
*/
static int
smp_fetch_sc_clr_gpc0(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_sc_clr_gpc0(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@ -2716,10 +2716,10 @@ smp_fetch_sc_clr_gpc0(struct proxy *px, struct session *sess, struct stream *str
* "src_conn_cnt" only.
*/
static int
smp_fetch_sc_conn_cnt(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_sc_conn_cnt(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@ -2741,10 +2741,10 @@ smp_fetch_sc_conn_cnt(struct proxy *px, struct session *sess, struct stream *str
* only.
*/
static int
smp_fetch_sc_conn_rate(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_sc_conn_rate(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@ -2767,18 +2767,19 @@ smp_fetch_sc_conn_rate(struct proxy *px, struct session *sess, struct stream *st
* Accepts exactly 1 argument of type table.
*/
static int
smp_fetch_src_updt_conn_cnt(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_src_updt_conn_cnt(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct connection *conn = objt_conn(sess->origin);
struct connection *conn = objt_conn(smp->sess->origin);
struct stksess *ts;
struct stktable_key *key;
void *ptr;
struct proxy *px;
if (!conn)
return 0;
key = addr_to_stktable_key(&conn->addr.from, px->table.type);
key = addr_to_stktable_key(&conn->addr.from, smp->px->table.type);
if (!key)
return 0;
@ -2803,10 +2804,10 @@ smp_fetch_src_updt_conn_cnt(struct proxy *px, struct session *sess, struct strea
* "src_conn_cur" only.
*/
static int
smp_fetch_sc_conn_cur(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_sc_conn_cur(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@ -2828,10 +2829,10 @@ smp_fetch_sc_conn_cur(struct proxy *px, struct session *sess, struct stream *str
* "src_sess_cnt" only.
*/
static int
smp_fetch_sc_sess_cnt(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_sc_sess_cnt(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@ -2852,10 +2853,10 @@ smp_fetch_sc_sess_cnt(struct proxy *px, struct session *sess, struct stream *str
* Supports being called as "sc[0-9]_sess_rate" or "src_sess_rate" only.
*/
static int
smp_fetch_sc_sess_rate(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_sc_sess_rate(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@ -2878,10 +2879,10 @@ smp_fetch_sc_sess_rate(struct proxy *px, struct session *sess, struct stream *st
* "src_http_req_cnt" only.
*/
static int
smp_fetch_sc_http_req_cnt(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_sc_http_req_cnt(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@ -2903,10 +2904,10 @@ smp_fetch_sc_http_req_cnt(struct proxy *px, struct session *sess, struct stream
* "src_http_req_rate" only.
*/
static int
smp_fetch_sc_http_req_rate(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_sc_http_req_rate(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@ -2929,10 +2930,10 @@ smp_fetch_sc_http_req_rate(struct proxy *px, struct session *sess, struct stream
* "src_http_err_cnt" only.
*/
static int
smp_fetch_sc_http_err_cnt(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_sc_http_err_cnt(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@ -2954,10 +2955,10 @@ smp_fetch_sc_http_err_cnt(struct proxy *px, struct session *sess, struct stream
* "src_http_err_rate" only.
*/
static int
smp_fetch_sc_http_err_rate(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_sc_http_err_rate(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@ -2980,10 +2981,10 @@ smp_fetch_sc_http_err_rate(struct proxy *px, struct session *sess, struct stream
* "sc[0-9]_kbytes_in" or "src_kbytes_in" only.
*/
static int
smp_fetch_sc_kbytes_in(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_sc_kbytes_in(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@ -3005,10 +3006,10 @@ smp_fetch_sc_kbytes_in(struct proxy *px, struct session *sess, struct stream *st
* "sc[0-9]_bytes_in_rate" or "src_bytes_in_rate" only.
*/
static int
smp_fetch_sc_bytes_in_rate(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_sc_bytes_in_rate(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@ -3031,10 +3032,10 @@ smp_fetch_sc_bytes_in_rate(struct proxy *px, struct session *sess, struct stream
* "sc[0-9]_kbytes_out" or "src_kbytes_out" only.
*/
static int
smp_fetch_sc_kbytes_out(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_sc_kbytes_out(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@ -3056,10 +3057,10 @@ smp_fetch_sc_kbytes_out(struct proxy *px, struct session *sess, struct stream *s
* "sc[0-9]_bytes_out_rate" or "src_bytes_out_rate" only.
*/
static int
smp_fetch_sc_bytes_out_rate(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_sc_bytes_out_rate(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@ -3081,10 +3082,10 @@ smp_fetch_sc_bytes_out_rate(struct proxy *px, struct session *sess, struct strea
* tracked frontend counters. Supports being called as "sc[0-9]_trackers" only.
*/
static int
smp_fetch_sc_trackers(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_sc_trackers(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
if (!stkctr)
return 0;
@ -3099,8 +3100,8 @@ smp_fetch_sc_trackers(struct proxy *px, struct session *sess, struct stream *str
* Accepts exactly 1 argument of type table.
*/
static int
smp_fetch_table_cnt(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_table_cnt(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT;
@ -3112,9 +3113,11 @@ smp_fetch_table_cnt(struct proxy *px, struct session *sess, struct stream *strm,
* Accepts exactly 1 argument of type table.
*/
static int
smp_fetch_table_avl(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
smp_fetch_table_avl(unsigned int opt, const struct arg *args, struct sample *smp,
const char *kw, void *private)
{
struct proxy *px;
px = args->data.prx;
smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT;