]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: converters: add a "void *private" argument to converters
authorThierry FOURNIER <tfournier@haproxy.com>
Mon, 15 Dec 2014 15:18:39 +0000 (16:18 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 28 Feb 2015 22:12:31 +0000 (23:12 +0100)
This permits to store specific configuration pointer. It is useful
with future Lua integration.

include/types/sample.h
src/map.c
src/proto_http.c
src/sample.c
src/stick_table.c

index a5140d6a714ad39eb8da9d451074dbb2b30718a7..2dd18e666ae8628122cfccdb47142ed905952566 100644 (file)
@@ -261,7 +261,8 @@ struct sample_storage {
 struct sample_conv {
        const char *kw;                           /* configuration keyword  */
        int (*process)(const struct arg *arg_p,
-                      struct sample *smp);       /* process function */
+                      struct sample *smp,
+                      void *private);            /* process function */
        unsigned int arg_mask;                    /* arguments (ARG*()) */
        int (*val_args)(struct arg *arg_p,
                        struct sample_conv *smp_conv,
@@ -269,7 +270,7 @@ struct sample_conv {
                        char **err_msg);          /* argument validation function */
        unsigned int in_type;                     /* expected input sample type */
        unsigned int out_type;                    /* output sample type */
-       unsigned int private;                     /* private values. only used by maps */
+       void *private;                            /* private values. only used by maps and Lua */
 };
 
 /* sample conversion expression */
index a4fd54b0ed39f622c224b7ffa9905ffa08ecee7f..ec760d16baf0bdd387cf500308a7054956cdb4f7 100644 (file)
--- a/src/map.c
+++ b/src/map.c
@@ -133,12 +133,12 @@ static int sample_load_map(struct arg *arg, struct sample_conv *conv,
        desc->do_free = 1;
 
        /* Set the match method. */
-       desc->pat.match = pat_match_fcts[conv->private];
-       desc->pat.parse = pat_parse_fcts[conv->private];
-       desc->pat.index = pat_index_fcts[conv->private];
-       desc->pat.delete = pat_delete_fcts[conv->private];
-       desc->pat.prune = pat_prune_fcts[conv->private];
-       desc->pat.expect_type = pat_match_types[conv->private];
+       desc->pat.match = pat_match_fcts[(long)conv->private];
+       desc->pat.parse = pat_parse_fcts[(long)conv->private];
+       desc->pat.index = pat_index_fcts[(long)conv->private];
+       desc->pat.delete = pat_delete_fcts[(long)conv->private];
+       desc->pat.prune = pat_prune_fcts[(long)conv->private];
+       desc->pat.expect_type = pat_match_types[(long)conv->private];
 
        /* Set the output parse method. */
        switch (desc->conv->out_type) {
@@ -184,7 +184,7 @@ static int sample_load_map(struct arg *arg, struct sample_conv *conv,
        return 1;
 }
 
-static int sample_conv_map(const struct arg *arg_p, struct sample *smp)
+static int sample_conv_map(const struct arg *arg_p, struct sample *smp, void *private)
 {
        struct map_descriptor *desc;
        struct pattern *pat;
@@ -239,36 +239,36 @@ static int sample_conv_map(const struct arg *arg_p, struct sample *smp)
  * The arguments are: <file>[,<default value>]
  */
 static struct sample_conv_kw_list sample_conv_kws = {ILH, {
-       { "map",         sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_STR,  PAT_MATCH_STR },
-       { "map_str",     sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_STR,  PAT_MATCH_STR },
-       { "map_beg",     sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_STR,  PAT_MATCH_BEG },
-       { "map_sub",     sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_STR,  PAT_MATCH_SUB },
-       { "map_dir",     sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_STR,  PAT_MATCH_DIR },
-       { "map_dom",     sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_STR,  PAT_MATCH_DOM },
-       { "map_end",     sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_STR,  PAT_MATCH_END },
-       { "map_reg",     sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_STR,  PAT_MATCH_REG },
-       { "map_int",     sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_UINT, SMP_T_STR,  PAT_MATCH_INT },
-       { "map_ip",      sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_ADDR, SMP_T_STR,  PAT_MATCH_IP  },
-
-       { "map_str_int", sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_UINT, PAT_MATCH_STR },
-       { "map_beg_int", sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_UINT, PAT_MATCH_BEG },
-       { "map_sub_int", sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_UINT, PAT_MATCH_SUB },
-       { "map_dir_int", sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_UINT, PAT_MATCH_DIR },
-       { "map_dom_int", sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_UINT, PAT_MATCH_DOM },
-       { "map_end_int", sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_UINT, PAT_MATCH_END },
-       { "map_reg_int", sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_UINT, PAT_MATCH_REG },
-       { "map_int_int", sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_UINT, SMP_T_UINT, PAT_MATCH_INT },
-       { "map_ip_int",  sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_ADDR, SMP_T_UINT, PAT_MATCH_IP  },
-
-       { "map_str_ip",  sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_IPV4, PAT_MATCH_STR },
-       { "map_beg_ip",  sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_IPV4, PAT_MATCH_BEG },
-       { "map_sub_ip",  sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_IPV4, PAT_MATCH_SUB },
-       { "map_dir_ip",  sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_IPV4, PAT_MATCH_DIR },
-       { "map_dom_ip",  sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_IPV4, PAT_MATCH_DOM },
-       { "map_end_ip",  sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_IPV4, PAT_MATCH_END },
-       { "map_reg_ip",  sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_IPV4, PAT_MATCH_REG },
-       { "map_int_ip",  sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_UINT, SMP_T_IPV4, PAT_MATCH_INT },
-       { "map_ip_ip",   sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_ADDR, SMP_T_IPV4, PAT_MATCH_IP  },
+       { "map",         sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_STR,  (void *)PAT_MATCH_STR },
+       { "map_str",     sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_STR,  (void *)PAT_MATCH_STR },
+       { "map_beg",     sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_STR,  (void *)PAT_MATCH_BEG },
+       { "map_sub",     sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_STR,  (void *)PAT_MATCH_SUB },
+       { "map_dir",     sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_STR,  (void *)PAT_MATCH_DIR },
+       { "map_dom",     sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_STR,  (void *)PAT_MATCH_DOM },
+       { "map_end",     sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_STR,  (void *)PAT_MATCH_END },
+       { "map_reg",     sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_STR,  (void *)PAT_MATCH_REG },
+       { "map_int",     sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_UINT, SMP_T_STR,  (void *)PAT_MATCH_INT },
+       { "map_ip",      sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_ADDR, SMP_T_STR,  (void *)PAT_MATCH_IP  },
+
+       { "map_str_int", sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_UINT, (void *)PAT_MATCH_STR },
+       { "map_beg_int", sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_UINT, (void *)PAT_MATCH_BEG },
+       { "map_sub_int", sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_UINT, (void *)PAT_MATCH_SUB },
+       { "map_dir_int", sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_UINT, (void *)PAT_MATCH_DIR },
+       { "map_dom_int", sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_UINT, (void *)PAT_MATCH_DOM },
+       { "map_end_int", sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_UINT, (void *)PAT_MATCH_END },
+       { "map_reg_int", sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_UINT, (void *)PAT_MATCH_REG },
+       { "map_int_int", sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_UINT, SMP_T_UINT, (void *)PAT_MATCH_INT },
+       { "map_ip_int",  sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_ADDR, SMP_T_UINT, (void *)PAT_MATCH_IP  },
+
+       { "map_str_ip",  sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_IPV4, (void *)PAT_MATCH_STR },
+       { "map_beg_ip",  sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_IPV4, (void *)PAT_MATCH_BEG },
+       { "map_sub_ip",  sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_IPV4, (void *)PAT_MATCH_SUB },
+       { "map_dir_ip",  sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_IPV4, (void *)PAT_MATCH_DIR },
+       { "map_dom_ip",  sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_IPV4, (void *)PAT_MATCH_DOM },
+       { "map_end_ip",  sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_IPV4, (void *)PAT_MATCH_END },
+       { "map_reg_ip",  sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR,  SMP_T_IPV4, (void *)PAT_MATCH_REG },
+       { "map_int_ip",  sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_UINT, SMP_T_IPV4, (void *)PAT_MATCH_INT },
+       { "map_ip_ip",   sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_ADDR, SMP_T_IPV4, (void *)PAT_MATCH_IP  },
 
        { /* END */ },
 }};
index 4484bcf48765bbe83fa3417003371b00d8228369..3738aa4b3bfa5af7a921f49c611e53cb5cc1d3a1 100644 (file)
@@ -11377,7 +11377,7 @@ static 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(const struct arg *args, struct sample *smp)
+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" };
@@ -11428,7 +11428,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(const struct arg *args, struct sample *smp)
+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;
index 57b2c003a80917513dfaf8ecc435484ae877274e..14a71971de712d164bbf3a0e8825e11489ed3dce 100644 (file)
@@ -967,7 +967,7 @@ struct sample *sample_process(struct proxy *px, struct session *l4, void *l7,
 
                /* OK cast succeeded */
 
-               if (!conv_expr->conv->process(conv_expr->arg_p, p))
+               if (!conv_expr->conv->process(conv_expr->arg_p, p, conv_expr->conv->private))
                        return NULL;
        }
        return p;
@@ -1275,7 +1275,7 @@ struct sample *sample_fetch_string(struct proxy *px, struct session *l4, void *l
 /*    These functions set the data type on return.               */
 /*****************************************************************/
 
-static int sample_conv_bin2base64(const struct arg *arg_p, struct sample *smp)
+static int sample_conv_bin2base64(const struct arg *arg_p, struct sample *smp, void *private)
 {
        struct chunk *trash = get_trash_chunk();
        int b64_len;
@@ -1292,7 +1292,7 @@ static int sample_conv_bin2base64(const struct arg *arg_p, struct sample *smp)
        return 1;
 }
 
-static int sample_conv_bin2hex(const struct arg *arg_p, struct sample *smp)
+static int sample_conv_bin2hex(const struct arg *arg_p, struct sample *smp, void *private)
 {
        struct chunk *trash = get_trash_chunk();
        unsigned char c;
@@ -1311,7 +1311,7 @@ static int sample_conv_bin2hex(const struct arg *arg_p, struct sample *smp)
 }
 
 /* hashes the binary input into a 32-bit unsigned int */
-static int sample_conv_djb2(const struct arg *arg_p, struct sample *smp)
+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)
@@ -1320,7 +1320,7 @@ static int sample_conv_djb2(const struct arg *arg_p, struct sample *smp)
        return 1;
 }
 
-static int sample_conv_str2lower(const struct arg *arg_p, struct sample *smp)
+static int sample_conv_str2lower(const struct arg *arg_p, struct sample *smp, void *private)
 {
        int i;
 
@@ -1337,7 +1337,7 @@ static int sample_conv_str2lower(const struct arg *arg_p, struct sample *smp)
        return 1;
 }
 
-static int sample_conv_str2upper(const struct arg *arg_p, struct sample *smp)
+static int sample_conv_str2upper(const struct arg *arg_p, struct sample *smp, void *private)
 {
        int i;
 
@@ -1355,7 +1355,7 @@ static int sample_conv_str2upper(const struct arg *arg_p, struct sample *smp)
 }
 
 /* takes the netmask in arg_p */
-static int sample_conv_ipmask(const struct arg *arg_p, struct sample *smp)
+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;
@@ -1366,7 +1366,7 @@ static int sample_conv_ipmask(const struct arg *arg_p, struct sample *smp)
  * 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(const struct arg *args, struct sample *smp)
+static int sample_conv_ltime(const struct arg *args, struct sample *smp, void *private)
 {
        struct chunk *temp;
        time_t curr_date = smp->data.uint;
@@ -1383,7 +1383,7 @@ static int sample_conv_ltime(const struct arg *args, struct sample *smp)
 }
 
 /* hashes the binary input into a 32-bit unsigned int */
-static int sample_conv_sdbm(const struct arg *arg_p, struct sample *smp)
+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)
@@ -1396,7 +1396,7 @@ static int sample_conv_sdbm(const struct arg *arg_p, struct sample *smp)
  * 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(const struct arg *args, struct sample *smp)
+static int sample_conv_utime(const struct arg *args, struct sample *smp, void *private)
 {
        struct chunk *temp;
        time_t curr_date = smp->data.uint;
@@ -1413,7 +1413,7 @@ static int sample_conv_utime(const struct arg *args, struct sample *smp)
 }
 
 /* hashes the binary input into a 32-bit unsigned int */
-static int sample_conv_wt6(const struct arg *arg_p, struct sample *smp)
+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)
@@ -1423,7 +1423,7 @@ static int sample_conv_wt6(const struct arg *arg_p, struct sample *smp)
 }
 
 /* hashes the binary input into a 32-bit unsigned int */
-static int sample_conv_crc32(const struct arg *arg_p, struct sample *smp)
+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)
@@ -1503,7 +1503,7 @@ static int sample_conv_json_check(struct arg *arg, struct sample_conv *conv,
        return 0;
 }
 
-static int sample_conv_json(const struct arg *arg_p, struct sample *smp)
+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. */
@@ -1617,7 +1617,7 @@ static int sample_conv_json(const struct arg *arg_p, struct sample *smp)
 /* 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(const struct arg *arg_p, struct sample *smp)
+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;
@@ -1674,7 +1674,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(const struct arg *arg_p, struct sample *smp)
+static int sample_conv_field(const struct arg *arg_p, struct sample *smp, void *private)
 {
        unsigned int field;
        char *start, *end;
@@ -1725,7 +1725,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(const struct arg *arg_p, struct sample *smp)
+static int sample_conv_word(const struct arg *arg_p, struct sample *smp, void *private)
 {
        unsigned int word;
        char *start, *end;
@@ -1819,7 +1819,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(const struct arg *arg_p, struct sample *smp)
+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;
@@ -1891,7 +1891,7 @@ static int sample_conv_regsub(const struct arg *arg_p, struct sample *smp)
 /* Takes a UINT on input, applies a binary twos complement and returns the UINT
  * result.
  */
-static int sample_conv_binary_cpl(const struct arg *arg_p, struct sample *smp)
+static int sample_conv_binary_cpl(const struct arg *arg_p, struct sample *smp, void *private)
 {
        smp->data.uint = ~smp->data.uint;
        return 1;
@@ -1900,7 +1900,7 @@ static int sample_conv_binary_cpl(const struct arg *arg_p, struct sample *smp)
 /* 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(const struct arg *arg_p, struct sample *smp)
+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;
@@ -1909,7 +1909,7 @@ static int sample_conv_binary_and(const struct arg *arg_p, struct sample *smp)
 /* 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(const struct arg *arg_p, struct sample *smp)
+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;
@@ -1918,7 +1918,7 @@ static int sample_conv_binary_or(const struct arg *arg_p, struct sample *smp)
 /* 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(const struct arg *arg_p, struct sample *smp)
+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;
@@ -1927,7 +1927,7 @@ static int sample_conv_binary_xor(const struct arg *arg_p, struct sample *smp)
 /* 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(const struct arg *arg_p, struct sample *smp)
+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;
@@ -1936,7 +1936,7 @@ static int sample_conv_arith_add(const struct arg *arg_p, struct sample *smp)
 /* 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(const struct arg *arg_p, struct sample *smp)
+static int sample_conv_arith_sub(const struct arg *arg_p, struct sample *smp, void *private)
 {
        smp->data.uint -= arg_p->data.uint;
        return 1;
@@ -1945,7 +1945,7 @@ static int sample_conv_arith_sub(const struct arg *arg_p, struct sample *smp)
 /* 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(const struct arg *arg_p, struct sample *smp)
+static int sample_conv_arith_mul(const struct arg *arg_p, struct sample *smp, void *private)
 {
        smp->data.uint *= arg_p->data.uint;
        return 1;
@@ -1955,7 +1955,7 @@ static int sample_conv_arith_mul(const struct arg *arg_p, struct sample *smp)
  * 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(const struct arg *arg_p, struct sample *smp)
+static int sample_conv_arith_div(const struct arg *arg_p, struct sample *smp, void *private)
 {
        if (arg_p->data.uint)
                smp->data.uint /= arg_p->data.uint;
@@ -1968,7 +1968,7 @@ static int sample_conv_arith_div(const struct arg *arg_p, struct sample *smp)
  * and returns the UINT result. If arg_p makes the result overflow, then zero
  * is returned.
  */
-static int sample_conv_arith_mod(const struct arg *arg_p, struct sample *smp)
+static int sample_conv_arith_mod(const struct arg *arg_p, struct sample *smp, void *private)
 {
        if (arg_p->data.uint)
                smp->data.uint %= arg_p->data.uint;
@@ -1980,7 +1980,7 @@ static int sample_conv_arith_mod(const struct arg *arg_p, struct sample *smp)
 /* Takes an UINT on input, applies an arithmetic "neg" and returns the UINT
  * result.
  */
-static int sample_conv_arith_neg(const struct arg *arg_p, struct sample *smp)
+static int sample_conv_arith_neg(const struct arg *arg_p, struct sample *smp, void *private)
 {
        smp->data.uint = -smp->data.uint;
        return 1;
@@ -1989,7 +1989,7 @@ static int sample_conv_arith_neg(const struct arg *arg_p, struct sample *smp)
 /* 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(const struct arg *arg_p, struct sample *smp)
+static int sample_conv_arith_bool(const struct arg *arg_p, struct sample *smp, void *private)
 {
        smp->data.uint = !!smp->data.uint;
        smp->type = SMP_T_BOOL;
@@ -1999,7 +1999,7 @@ static int sample_conv_arith_bool(const struct arg *arg_p, struct sample *smp)
 /* 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(const struct arg *arg_p, struct sample *smp)
+static int sample_conv_arith_not(const struct arg *arg_p, struct sample *smp, void *private)
 {
        smp->data.uint = !smp->data.uint;
        smp->type = SMP_T_BOOL;
@@ -2009,7 +2009,7 @@ static int sample_conv_arith_not(const struct arg *arg_p, struct sample *smp)
 /* 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(const struct arg *arg_p, struct sample *smp)
+static int sample_conv_arith_odd(const struct arg *arg_p, struct sample *smp, void *private)
 {
        smp->data.uint = smp->data.uint & 1;
        smp->type = SMP_T_BOOL;
@@ -2019,7 +2019,7 @@ static int sample_conv_arith_odd(const struct arg *arg_p, struct sample *smp)
 /* 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(const struct arg *arg_p, struct sample *smp)
+static int sample_conv_arith_even(const struct arg *arg_p, struct sample *smp, void *private)
 {
        smp->data.uint = !(smp->data.uint & 1);
        smp->type = SMP_T_BOOL;
index 32fd60acb52e2390bc4cdf0b26f0ac60660b9797..9fe0b8699ac49ae3ba6e04396fb50ff7a98c75d2 100644 (file)
@@ -809,7 +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(const struct arg *arg_p, struct sample *smp)
+static int sample_conv_in_table(const struct arg *arg_p, struct sample *smp, void *private)
 {
        struct stktable *t;
        struct stktable_key *key;
@@ -835,7 +835,7 @@ static int sample_conv_in_table(const struct arg *arg_p, struct sample *smp)
  * 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(const struct arg *arg_p, struct sample *smp)
+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;
@@ -871,7 +871,7 @@ static int sample_conv_table_bytes_in_rate(const struct arg *arg_p, struct sampl
  * be easily performed. If the inspected parameter is not stored in the table,
  * <not found> is returned.
  */
-static int sample_conv_table_conn_cnt(const struct arg *arg_p, struct sample *smp)
+static int sample_conv_table_conn_cnt(const struct arg *arg_p, struct sample *smp, void *private)
 {
        struct stktable *t;
        struct stktable_key *key;
@@ -906,7 +906,7 @@ static int sample_conv_table_conn_cnt(const struct arg *arg_p, struct sample *sm
  * 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(const struct arg *arg_p, struct sample *smp)
+static int sample_conv_table_conn_cur(const struct arg *arg_p, struct sample *smp, void *private)
 {
        struct stktable *t;
        struct stktable_key *key;
@@ -941,7 +941,7 @@ static int sample_conv_table_conn_cur(const struct arg *arg_p, struct sample *sm
  * be easily performed. If the inspected parameter is not stored in the table,
  * <not found> is returned.
  */
-static int sample_conv_table_conn_rate(const struct arg *arg_p, struct sample *smp)
+static int sample_conv_table_conn_rate(const struct arg *arg_p, struct sample *smp, void *private)
 {
        struct stktable *t;
        struct stktable_key *key;
@@ -977,7 +977,7 @@ static int sample_conv_table_conn_rate(const struct arg *arg_p, struct sample *s
  * 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(const struct arg *arg_p, struct sample *smp)
+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;
@@ -1013,7 +1013,7 @@ static int sample_conv_table_bytes_out_rate(const struct arg *arg_p, struct samp
  * be easily performed. If the inspected parameter is not stored in the table,
  * <not found> is returned.
  */
-static int sample_conv_table_gpc0(const struct arg *arg_p, struct sample *smp)
+static int sample_conv_table_gpc0(const struct arg *arg_p, struct sample *smp, void *private)
 {
        struct stktable *t;
        struct stktable_key *key;
@@ -1048,7 +1048,7 @@ static int sample_conv_table_gpc0(const struct arg *arg_p, struct sample *smp)
  * be easily performed. If the inspected parameter is not stored in the table,
  * <not found> is returned.
  */
-static int sample_conv_table_gpc0_rate(const struct arg *arg_p, struct sample *smp)
+static int sample_conv_table_gpc0_rate(const struct arg *arg_p, struct sample *smp, void *private)
 {
        struct stktable *t;
        struct stktable_key *key;
@@ -1084,7 +1084,7 @@ static int sample_conv_table_gpc0_rate(const struct arg *arg_p, struct sample *s
  * 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(const struct arg *arg_p, struct sample *smp)
+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;
@@ -1119,7 +1119,7 @@ static int sample_conv_table_http_err_cnt(const struct arg *arg_p, struct sample
  * 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(const struct arg *arg_p, struct sample *smp)
+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;
@@ -1155,7 +1155,7 @@ static int sample_conv_table_http_err_rate(const struct arg *arg_p, struct sampl
  * 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(const struct arg *arg_p, struct sample *smp)
+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;
@@ -1190,7 +1190,7 @@ static int sample_conv_table_http_req_cnt(const struct arg *arg_p, struct sample
  * performed. If the inspected parameter is not stored in the table, <not found>
  * is returned.
  */
-static int sample_conv_table_http_req_rate(const struct arg *arg_p, struct sample *smp)
+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;
@@ -1226,7 +1226,7 @@ static int sample_conv_table_http_req_rate(const struct arg *arg_p, struct sampl
  * be easily performed. If the inspected parameter is not stored in the table,
  * <not found> is returned.
  */
-static int sample_conv_table_kbytes_in(const struct arg *arg_p, struct sample *smp)
+static int sample_conv_table_kbytes_in(const struct arg *arg_p, struct sample *smp, void *private)
 {
        struct stktable *t;
        struct stktable_key *key;
@@ -1261,7 +1261,7 @@ static int sample_conv_table_kbytes_in(const struct arg *arg_p, struct sample *s
  * be easily performed. If the inspected parameter is not stored in the table,
  * <not found> is returned.
  */
-static int sample_conv_table_kbytes_out(const struct arg *arg_p, struct sample *smp)
+static int sample_conv_table_kbytes_out(const struct arg *arg_p, struct sample *smp, void *private)
 {
        struct stktable *t;
        struct stktable_key *key;
@@ -1296,7 +1296,7 @@ static int sample_conv_table_kbytes_out(const struct arg *arg_p, struct sample *
  * easily performed. If the inspected parameter is not stored in the table,
  * <not found> is returned.
  */
-static int sample_conv_table_server_id(const struct arg *arg_p, struct sample *smp)
+static int sample_conv_table_server_id(const struct arg *arg_p, struct sample *smp, void *private)
 {
        struct stktable *t;
        struct stktable_key *key;
@@ -1331,7 +1331,7 @@ static int sample_conv_table_server_id(const struct arg *arg_p, struct sample *s
  * 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(const struct arg *arg_p, struct sample *smp)
+static int sample_conv_table_sess_cnt(const struct arg *arg_p, struct sample *smp, void *private)
 {
        struct stktable *t;
        struct stktable_key *key;
@@ -1366,7 +1366,7 @@ static int sample_conv_table_sess_cnt(const struct arg *arg_p, struct sample *sm
  * performed. If the inspected parameter is not stored in the table, <not found>
  * is returned.
  */
-static int sample_conv_table_sess_rate(const struct arg *arg_p, struct sample *smp)
+static int sample_conv_table_sess_rate(const struct arg *arg_p, struct sample *smp, void *private)
 {
        struct stktable *t;
        struct stktable_key *key;
@@ -1402,7 +1402,7 @@ static int sample_conv_table_sess_rate(const struct arg *arg_p, struct sample *s
  * 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(const struct arg *arg_p, struct sample *smp)
+static int sample_conv_table_trackers(const struct arg *arg_p, struct sample *smp, void *private)
 {
        struct stktable *t;
        struct stktable_key *key;