/* OK cast succeeded */
- if (!conv_expr->conv->process(conv_expr->arg_p, p, conv_expr->conv->private))
+ if (!conv_expr->conv->process(l4, conv_expr->arg_p, p, conv_expr->conv->private))
return NULL;
}
return p;
/* These functions set the data type on return. */
/*****************************************************************/
-static int sample_conv_bin2base64(const struct arg *arg_p, struct sample *smp, void *private)
+static int sample_conv_bin2base64(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
struct chunk *trash = get_trash_chunk();
int b64_len;
return 1;
}
-static int sample_conv_bin2hex(const struct arg *arg_p, struct sample *smp, void *private)
+static int sample_conv_bin2hex(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
struct chunk *trash = get_trash_chunk();
unsigned char c;
}
/* hashes the binary input into a 32-bit unsigned int */
-static int sample_conv_djb2(const struct arg *arg_p, struct sample *smp, void *private)
+static int sample_conv_djb2(struct session *session, 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)
return 1;
}
-static int sample_conv_str2lower(const struct arg *arg_p, struct sample *smp, void *private)
+static int sample_conv_str2lower(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
int i;
return 1;
}
-static int sample_conv_str2upper(const struct arg *arg_p, struct sample *smp, void *private)
+static int sample_conv_str2upper(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
int i;
}
/* takes the netmask in arg_p */
-static int sample_conv_ipmask(const struct arg *arg_p, struct sample *smp, void *private)
+static int sample_conv_ipmask(struct session *session, 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;
* 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, void *private)
+static int sample_conv_ltime(struct session *session, const struct arg *args,
+ struct sample *smp, void *private)
{
struct chunk *temp;
time_t curr_date = smp->data.uint;
}
/* hashes the binary input into a 32-bit unsigned int */
-static int sample_conv_sdbm(const struct arg *arg_p, struct sample *smp, void *private)
+static int sample_conv_sdbm(struct session *session, 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)
* 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, void *private)
+static int sample_conv_utime(struct session *session, const struct arg *args,
+ struct sample *smp, void *private)
{
struct chunk *temp;
time_t curr_date = smp->data.uint;
}
/* hashes the binary input into a 32-bit unsigned int */
-static int sample_conv_wt6(const struct arg *arg_p, struct sample *smp, void *private)
+static int sample_conv_wt6(struct session *session, 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)
}
/* hashes the binary input into a 32-bit unsigned int */
-static int sample_conv_crc32(const struct arg *arg_p, struct sample *smp, void *private)
+static int sample_conv_crc32(struct session *session, 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)
return 0;
}
-static int sample_conv_json(const struct arg *arg_p, struct sample *smp, void *private)
+static int sample_conv_json(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
struct chunk *temp;
char _str[7]; /* \u + 4 hex digit + null char for sprintf. */
/* 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, void *private)
+static int sample_conv_bytes(struct session *session, 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;
* 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, void *private)
+static int sample_conv_field(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
unsigned int field;
char *start, *end;
* 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, void *private)
+static int sample_conv_word(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
unsigned int word;
char *start, *end;
* 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, void *private)
+static int sample_conv_regsub(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
char *start, *end;
struct my_regex *reg = arg_p[0].data.reg;
/* 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, void *private)
+static int sample_conv_binary_cpl(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
smp->data.uint = ~smp->data.uint;
return 1;
/* 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, void *private)
+static int sample_conv_binary_and(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
smp->data.uint &= arg_p->data.uint;
return 1;
/* 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, void *private)
+static int sample_conv_binary_or(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
smp->data.uint |= arg_p->data.uint;
return 1;
/* 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, void *private)
+static int sample_conv_binary_xor(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
smp->data.uint ^= arg_p->data.uint;
return 1;
/* 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, void *private)
+static int sample_conv_arith_add(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
smp->data.uint += arg_p->data.uint;
return 1;
/* 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, void *private)
+static int sample_conv_arith_sub(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
smp->data.uint -= arg_p->data.uint;
return 1;
/* 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, void *private)
+static int sample_conv_arith_mul(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
smp->data.uint *= arg_p->data.uint;
return 1;
* 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, void *private)
+static int sample_conv_arith_div(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
if (arg_p->data.uint)
smp->data.uint /= arg_p->data.uint;
* 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, void *private)
+static int sample_conv_arith_mod(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
if (arg_p->data.uint)
smp->data.uint %= arg_p->data.uint;
/* 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, void *private)
+static int sample_conv_arith_neg(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
smp->data.uint = -smp->data.uint;
return 1;
/* 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, void *private)
+static int sample_conv_arith_bool(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
smp->data.uint = !!smp->data.uint;
smp->type = SMP_T_BOOL;
/* 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, void *private)
+static int sample_conv_arith_not(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
smp->data.uint = !smp->data.uint;
smp->type = SMP_T_BOOL;
/* 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, void *private)
+static int sample_conv_arith_odd(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
smp->data.uint = smp->data.uint & 1;
smp->type = SMP_T_BOOL;
/* 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, void *private)
+static int sample_conv_arith_even(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
smp->data.uint = !(smp->data.uint & 1);
smp->type = SMP_T_BOOL;
* 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, void *private)
+static int sample_conv_in_table(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
* 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, void *private)
+static int sample_conv_table_bytes_in_rate(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
* 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, void *private)
+static int sample_conv_table_conn_cnt(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
* 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, void *private)
+static int sample_conv_table_conn_cur(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
* 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, void *private)
+static int sample_conv_table_conn_rate(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
* 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, void *private)
+static int sample_conv_table_bytes_out_rate(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
* 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, void *private)
+static int sample_conv_table_gpc0(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
* 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, void *private)
+static int sample_conv_table_gpc0_rate(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
* 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, void *private)
+static int sample_conv_table_http_err_cnt(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
* 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, void *private)
+static int sample_conv_table_http_err_rate(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
* 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, void *private)
+static int sample_conv_table_http_req_cnt(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
* 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, void *private)
+static int sample_conv_table_http_req_rate(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
* 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, void *private)
+static int sample_conv_table_kbytes_in(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
* 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, void *private)
+static int sample_conv_table_kbytes_out(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
* 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, void *private)
+static int sample_conv_table_server_id(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
* 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, void *private)
+static int sample_conv_table_sess_cnt(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
* 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, void *private)
+static int sample_conv_table_sess_rate(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;
* 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, void *private)
+static int sample_conv_table_trackers(struct session *session, const struct arg *arg_p,
+ struct sample *smp, void *private)
{
struct stktable *t;
struct stktable_key *key;