MAJOR: sample: converts uint and sint in 64 bits signed integer

This patch removes the 32 bits unsigned integer and the 32 bit signed
integer. It replaces these types by a unique type 64 bit signed.

This makes easy the usage of integer and clarify signed and unsigned use.
With the previous version, signed and unsigned are used ones in place of
others, and sometimes the converter loose the sign. For example, divisions
are processed with "unsigned", if one entry is negative, the result is
wrong.

Note that the integer pattern matching and dotted version pattern matching
are already working with signed 64 bits integer values.

There is one user-visible change : the "uint()" and "sint()" sample fetch
functions which used to return a constant integer have been replaced with
a new more natural, unified "int()" function. These functions were only
introduced in the latest 1.6-dev2 so there's no impact on regular
deployments.
This commit is contained in:
Thierry FOURNIER 2015-07-06 23:43:03 +02:00 committed by Willy Tarreau
parent 5b4dd683cb
commit 07ee64ef4d
18 changed files with 584 additions and 644 deletions

View File

@ -11030,12 +11030,12 @@ bool) which make it possible to report a match without having to write an ACL.
The currently available list of transformation keywords include : The currently available list of transformation keywords include :
add(<value>) add(<value>)
Adds <value> to the input value of type unsigned integer, and returns the Adds <value> to the input value of type signed integer, and returns the
result as an unsigned integer. result as a signed integer.
and(<value>) and(<value>)
Performs a bitwise "AND" between <value> and the input value of type unsigned Performs a bitwise "AND" between <value> and the input value of type signed
integer, and returns the result as an unsigned integer. integer, and returns the result as an signed integer.
base64 base64
Converts a binary input sample to a base64 string. It is used to log or Converts a binary input sample to a base64 string. It is used to log or
@ -11043,7 +11043,7 @@ base64
an SSL ID can be copied in a header). an SSL ID can be copied in a header).
bool bool
Returns a boolean TRUE if the input value of type unsigned integer is Returns a boolean TRUE if the input value of type signed integer is
non-null, otherwise returns FALSE. Used in conjunction with and(), it can be non-null, otherwise returns FALSE. Used in conjunction with and(), it can be
used to report true/false for bit testing on input values (eg: verify the used to report true/false for bit testing on input values (eg: verify the
presence of a flag). presence of a flag).
@ -11054,8 +11054,8 @@ bytes(<offset>[,<length>])
optionnaly truncated at the given length. optionnaly truncated at the given length.
cpl cpl
Takes the input value of type unsigned integer, applies a twos-complement Takes the input value of type signed integer, applies a ones-complement
(flips all bits) and returns the result as an unsigned integer. (flips all bits) and returns the result as an signed integer.
crc32([<avalanche>]) crc32([<avalanche>])
Hashes a binary input sample into an unsigned 32-bit quantity using the CRC32 Hashes a binary input sample into an unsigned 32-bit quantity using the CRC32
@ -11090,9 +11090,9 @@ debug
converter only exists when haproxy was built with debugging enabled. converter only exists when haproxy was built with debugging enabled.
div(<value>) div(<value>)
Divides the input value of type unsigned integer by <value>, and returns the Divides the input value of type signed integer by <value>, and returns the
result as an unsigned integer. If <value> is null, the largest unsigned result as an signed integer. If <value> is null, the largest unsigned
integer is returned (typically 2^32-1). integer is returned (typically 2^63-1).
djb2([<avalanche>]) djb2([<avalanche>])
Hashes a binary input sample into an unsigned 32-bit quantity using the DJB2 Hashes a binary input sample into an unsigned 32-bit quantity using the DJB2
@ -11106,7 +11106,7 @@ djb2([<avalanche>])
"hash-type" directive. "hash-type" directive.
even even
Returns a boolean TRUE if the input value of type unsigned integer is even Returns a boolean TRUE if the input value of type signed integer is even
otherwise returns FALSE. It is functionally equivalent to "not,and(1),bool". otherwise returns FALSE. It is functionally equivalent to "not,and(1),bool".
field(<index>,<delimiters>) field(<index>,<delimiters>)
@ -11285,33 +11285,33 @@ map_<match_type>_<output_type>(<map_file>[,<default_value>])
`------------------------------------ leading spaces ignored `------------------------------------ leading spaces ignored
mod(<value>) mod(<value>)
Divides the input value of type unsigned integer by <value>, and returns the Divides the input value of type signed integer by <value>, and returns the
remainder as an unsigned integer. If <value> is null, then zero is returned. remainder as an signed integer. If <value> is null, then zero is returned.
mul(<value>) mul(<value>)
Multiplies the input value of type unsigned integer by <value>, and returns Multiplies the input value of type signed integer by <value>, and returns
the product as an unsigned integer. In case of overflow, the higher bits are the product as an signed integer. In case of overflow, the higher bits are
lost, leading to seemingly strange values. lost, leading to seemingly strange values.
neg neg
Takes the input value of type unsigned integer, computes the opposite value, Takes the input value of type signed integer, computes the opposite value,
and returns the remainder as an unsigned integer. 0 is identity. This and returns the remainder as an signed integer. 0 is identity. This operator
operator is provided for reversed subtracts : in order to subtract the input is provided for reversed subtracts : in order to subtract the input from a
from a constant, simply perform a "neg,add(value)". constant, simply perform a "neg,add(value)".
not not
Returns a boolean FALSE if the input value of type unsigned integer is Returns a boolean FALSE if the input value of type signed integer is
non-null, otherwise returns TRUE. Used in conjunction with and(), it can be non-null, otherwise returns TRUE. Used in conjunction with and(), it can be
used to report true/false for bit testing on input values (eg: verify the used to report true/false for bit testing on input values (eg: verify the
absence of a flag). absence of a flag).
odd odd
Returns a boolean TRUE if the input value of type unsigned integer is odd Returns a boolean TRUE if the input value of type signed integer is odd
otherwise returns FALSE. It is functionally equivalent to "and(1),bool". otherwise returns FALSE. It is functionally equivalent to "and(1),bool".
or(<value>) or(<value>)
Performs a bitwise "OR" between <value> and the input value of type unsigned Performs a bitwise "OR" between <value> and the input value of type signed
integer, and returns the result as an unsigned integer. integer, and returns the result as an signed integer.
regsub(<regex>,<subst>[,<flags>]) regsub(<regex>,<subst>[,<flags>])
Applies a regex-based substitution to the input string. It does the same Applies a regex-based substitution to the input string. It does the same
@ -11375,8 +11375,8 @@ set-var(<var name>)
contain characters 'a-z', 'A-Z', '0-9' and '_'. contain characters 'a-z', 'A-Z', '0-9' and '_'.
sub(<value>) sub(<value>)
Subtracts <value> from the input value of type unsigned integer, and returns Subtracts <value> from the input value of type signed integer, and returns
the result as an unsigned integer. Note: in order to subtract the input from the result as an signed integer. Note: in order to subtract the input from
a constant, simply perform a "neg,add(value)". a constant, simply perform a "neg,add(value)".
table_bytes_in_rate(<table>) table_bytes_in_rate(<table>)
@ -11558,7 +11558,7 @@ wt6([<avalanche>])
xor(<value>) xor(<value>)
Performs a bitwise "XOR" (exclusive OR) between <value> and the input value Performs a bitwise "XOR" (exclusive OR) between <value> and the input value
of type unsigned integer, and returns the result as an unsigned integer. of type signed integer, and returns the result as an signed integer.
7.3.2. Fetching samples from internal states 7.3.2. Fetching samples from internal states
@ -11709,6 +11709,9 @@ fe_sess_rate([<frontend>]) : integer
tcp-request content accept if ! too_fast tcp-request content accept if ! too_fast
tcp-request content accept if WAIT_END tcp-request content accept if WAIT_END
int(<integer>) : signed integer
Returns a signed integer.
ipv4(<ipv4>) : ipv4 ipv4(<ipv4>) : ipv4
Returns an ipv4. Returns an ipv4.
@ -11753,9 +11756,6 @@ rand([<range>]) : integer
needed to take some routing decisions for example, or just for debugging needed to take some routing decisions for example, or just for debugging
purposes. This random must not be used for security purposes. purposes. This random must not be used for security purposes.
sint(<sint>) : signed integer
Returns a signed integer.
srv_conn([<backend>/]<server>) : integer srv_conn([<backend>/]<server>) : integer
Returns an integer value corresponding to the number of currently established Returns an integer value corresponding to the number of currently established
connections on the designated server, possibly including the connection being connections on the designated server, possibly including the connection being
@ -11806,9 +11806,6 @@ table_cnt([<table>]) : integer
stick-table or in the designated stick-table. See also src_conn_cnt and stick-table or in the designated stick-table. See also src_conn_cnt and
table_avl for other entry counting methods. table_avl for other entry counting methods.
uint(<uint>) : unsigned integer
Returns an unsigned integer.
var(<var-name>) : undefined var(<var-name>) : undefined
Returns a variable with the stored type. If the variable is not set, the Returns a variable with the stored type. If the variable is not set, the
sample fetch fails. The name of the variable starts by an indication about its sample fetch fails. The name of the variable starts by an indication about its

View File

@ -36,8 +36,7 @@ struct arg;
enum { enum {
SMP_T_ANY = 0, /* any type */ SMP_T_ANY = 0, /* any type */
SMP_T_BOOL, /* boolean */ SMP_T_BOOL, /* boolean */
SMP_T_UINT, /* unsigned 32bits integer type */ SMP_T_SINT, /* signed 64bits integer type */
SMP_T_SINT, /* signed 32bits integer type */
SMP_T_ADDR, /* ipv4 or ipv6, only used for input type compatibility */ SMP_T_ADDR, /* ipv4 or ipv6, only used for input type compatibility */
SMP_T_IPV4, /* ipv4 type */ SMP_T_IPV4, /* ipv4 type */
SMP_T_IPV6, /* ipv6 type */ SMP_T_IPV6, /* ipv6 type */
@ -237,8 +236,7 @@ struct sample {
unsigned int flags; /* SMP_F_* */ unsigned int flags; /* SMP_F_* */
int type; /* SMP_T_* */ int type; /* SMP_T_* */
union { union {
unsigned int uint; /* used for unsigned 32bits integers and booleans */ long long int sint; /* used for signed 64bits integers */
int sint; /* used for signed 32bits integers */
struct in_addr ipv4; /* used for ipv4 addresses */ struct in_addr ipv4; /* used for ipv4 addresses */
struct in6_addr ipv6; /* used for ipv6 addresses */ struct in6_addr ipv6; /* used for ipv6 addresses */
struct chunk str; /* used for char strings or buffers */ struct chunk str; /* used for char strings or buffers */
@ -261,8 +259,7 @@ struct sample {
struct sample_storage { struct sample_storage {
int type; /* SMP_T_* */ int type; /* SMP_T_* */
union { union {
unsigned int uint; /* used for unsigned 32bits integers and booleans */ long long int sint; /* used for signed 64bits integers */
int sint; /* used for signed 32bits integers */
struct in_addr ipv4; /* used for ipv4 addresses */ struct in_addr ipv4; /* used for ipv4 addresses */
struct in6_addr ipv6; /* used for ipv6 addresses */ struct in6_addr ipv6; /* used for ipv6 addresses */
struct chunk str; /* used for char strings or buffers */ struct chunk str; /* used for char strings or buffers */

View File

@ -390,7 +390,6 @@ struct acl_expr *parse_acl_expr(const char **args, char **err, struct arg_list *
expr->pat.expect_type = pat_match_types[PAT_MATCH_BOOL]; expr->pat.expect_type = pat_match_types[PAT_MATCH_BOOL];
break; break;
case SMP_T_SINT: case SMP_T_SINT:
case SMP_T_UINT:
expr->pat.parse = pat_parse_fcts[PAT_MATCH_INT]; expr->pat.parse = pat_parse_fcts[PAT_MATCH_INT];
expr->pat.index = pat_index_fcts[PAT_MATCH_INT]; expr->pat.index = pat_index_fcts[PAT_MATCH_INT];
expr->pat.match = pat_match_fcts[PAT_MATCH_INT]; expr->pat.match = pat_match_fcts[PAT_MATCH_INT];

View File

@ -1525,15 +1525,15 @@ smp_fetch_nbsrv(const struct arg *args, struct sample *smp, const char *kw, void
struct proxy *px; struct proxy *px;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
px = args->data.prx; px = args->data.prx;
if (px->srv_act) if (px->srv_act)
smp->data.uint = px->srv_act; smp->data.sint = px->srv_act;
else if (px->lbprm.fbck) else if (px->lbprm.fbck)
smp->data.uint = 1; smp->data.sint = 1;
else else
smp->data.uint = px->srv_bck; smp->data.sint = px->srv_bck;
return 1; return 1;
} }
@ -1552,9 +1552,9 @@ smp_fetch_srv_is_up(const struct arg *args, struct sample *smp, const char *kw,
smp->type = SMP_T_BOOL; smp->type = SMP_T_BOOL;
if (!(srv->admin & SRV_ADMF_MAINT) && if (!(srv->admin & SRV_ADMF_MAINT) &&
(!(srv->check.state & CHK_ST_CONFIGURED) || (srv->state != SRV_ST_STOPPED))) (!(srv->check.state & CHK_ST_CONFIGURED) || (srv->state != SRV_ST_STOPPED)))
smp->data.uint = 1; smp->data.sint = 1;
else else
smp->data.uint = 0; smp->data.sint = 0;
return 1; return 1;
} }
@ -1568,8 +1568,8 @@ smp_fetch_connslots(const struct arg *args, struct sample *smp, const char *kw,
struct server *iterator; struct server *iterator;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
for (iterator = args->data.prx->srv; iterator; iterator = iterator->next) { for (iterator = args->data.prx->srv; iterator; iterator = iterator->next) {
if (iterator->state == SRV_ST_STOPPED) if (iterator->state == SRV_ST_STOPPED)
@ -1577,11 +1577,11 @@ smp_fetch_connslots(const struct arg *args, struct sample *smp, const char *kw,
if (iterator->maxconn == 0 || iterator->maxqueue == 0) { if (iterator->maxconn == 0 || iterator->maxqueue == 0) {
/* configuration is stupid */ /* configuration is stupid */
smp->data.uint = -1; /* FIXME: stupid value! */ smp->data.sint = -1; /* FIXME: stupid value! */
return 1; return 1;
} }
smp->data.uint += (iterator->maxconn - iterator->cur_sess) smp->data.sint += (iterator->maxconn - iterator->cur_sess)
+ (iterator->maxqueue - iterator->nbpend); + (iterator->maxqueue - iterator->nbpend);
} }
@ -1593,8 +1593,8 @@ static int
smp_fetch_be_id(const struct arg *args, struct sample *smp, const char *kw, void *private) smp_fetch_be_id(const struct arg *args, struct sample *smp, const char *kw, void *private)
{ {
smp->flags = SMP_F_VOL_TXN; smp->flags = SMP_F_VOL_TXN;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = smp->strm->be->uuid; smp->data.sint = smp->strm->be->uuid;
return 1; return 1;
} }
@ -1605,8 +1605,8 @@ smp_fetch_srv_id(const struct arg *args, struct sample *smp, const char *kw, voi
if (!objt_server(smp->strm->target)) if (!objt_server(smp->strm->target))
return 0; return 0;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = objt_server(smp->strm->target)->puid; smp->data.sint = objt_server(smp->strm->target)->puid;
return 1; return 1;
} }
@ -1619,8 +1619,8 @@ static int
smp_fetch_be_sess_rate(const struct arg *args, struct sample *smp, const char *kw, void *private) smp_fetch_be_sess_rate(const struct arg *args, struct sample *smp, const char *kw, void *private)
{ {
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = read_freq_ctr(&args->data.prx->be_sess_per_sec); smp->data.sint = read_freq_ctr(&args->data.prx->be_sess_per_sec);
return 1; return 1;
} }
@ -1632,8 +1632,8 @@ static int
smp_fetch_be_conn(const struct arg *args, struct sample *smp, const char *kw, void *private) smp_fetch_be_conn(const struct arg *args, struct sample *smp, const char *kw, void *private)
{ {
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = args->data.prx->beconn; smp->data.sint = args->data.prx->beconn;
return 1; return 1;
} }
@ -1645,8 +1645,8 @@ static int
smp_fetch_queue_size(const struct arg *args, struct sample *smp, const char *kw, void *private) smp_fetch_queue_size(const struct arg *args, struct sample *smp, const char *kw, void *private)
{ {
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = args->data.prx->totpend; smp->data.sint = args->data.prx->totpend;
return 1; return 1;
} }
@ -1665,7 +1665,7 @@ smp_fetch_avg_queue_size(const struct arg *args, struct sample *smp, const char
struct proxy *px; struct proxy *px;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
px = args->data.prx; px = args->data.prx;
if (px->srv_act) if (px->srv_act)
@ -1676,9 +1676,9 @@ smp_fetch_avg_queue_size(const struct arg *args, struct sample *smp, const char
nbsrv = px->srv_bck; nbsrv = px->srv_bck;
if (nbsrv > 0) if (nbsrv > 0)
smp->data.uint = (px->totpend + nbsrv - 1) / nbsrv; smp->data.sint = (px->totpend + nbsrv - 1) / nbsrv;
else else
smp->data.uint = px->totpend * 2; smp->data.sint = px->totpend * 2;
return 1; return 1;
} }
@ -1691,8 +1691,8 @@ static int
smp_fetch_srv_conn(const struct arg *args, struct sample *smp, const char *kw, void *private) smp_fetch_srv_conn(const struct arg *args, struct sample *smp, const char *kw, void *private)
{ {
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = args->data.srv->cur_sess; smp->data.sint = args->data.srv->cur_sess;
return 1; return 1;
} }
@ -1704,8 +1704,8 @@ static int
smp_fetch_srv_sess_rate(const struct arg *args, struct sample *smp, const char *kw, void *private) smp_fetch_srv_sess_rate(const struct arg *args, struct sample *smp, const char *kw, void *private)
{ {
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = read_freq_ctr(&args->data.srv->sess_per_sec); smp->data.sint = read_freq_ctr(&args->data.srv->sess_per_sec);
return 1; return 1;
} }
@ -1714,17 +1714,17 @@ smp_fetch_srv_sess_rate(const struct arg *args, struct sample *smp, const char *
* Please take care of keeping this list alphabetically sorted. * Please take care of keeping this list alphabetically sorted.
*/ */
static struct sample_fetch_kw_list smp_kws = {ILH, { static struct sample_fetch_kw_list smp_kws = {ILH, {
{ "avg_queue", smp_fetch_avg_queue_size, ARG1(1,BE), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "avg_queue", smp_fetch_avg_queue_size, ARG1(1,BE), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "be_conn", smp_fetch_be_conn, ARG1(1,BE), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "be_conn", smp_fetch_be_conn, ARG1(1,BE), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "be_id", smp_fetch_be_id, 0, NULL, SMP_T_UINT, SMP_USE_BKEND, }, { "be_id", smp_fetch_be_id, 0, NULL, SMP_T_SINT, SMP_USE_BKEND, },
{ "be_sess_rate", smp_fetch_be_sess_rate, ARG1(1,BE), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "be_sess_rate", smp_fetch_be_sess_rate, ARG1(1,BE), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "connslots", smp_fetch_connslots, ARG1(1,BE), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "connslots", smp_fetch_connslots, ARG1(1,BE), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "nbsrv", smp_fetch_nbsrv, ARG1(1,BE), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "nbsrv", smp_fetch_nbsrv, ARG1(1,BE), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "queue", smp_fetch_queue_size, ARG1(1,BE), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "queue", smp_fetch_queue_size, ARG1(1,BE), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "srv_conn", smp_fetch_srv_conn, ARG1(1,SRV), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "srv_conn", smp_fetch_srv_conn, ARG1(1,SRV), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "srv_id", smp_fetch_srv_id, 0, NULL, SMP_T_UINT, SMP_USE_SERVR, }, { "srv_id", smp_fetch_srv_id, 0, NULL, SMP_T_SINT, SMP_USE_SERVR, },
{ "srv_is_up", smp_fetch_srv_is_up, ARG1(1,SRV), NULL, SMP_T_BOOL, SMP_USE_INTRN, }, { "srv_is_up", smp_fetch_srv_is_up, ARG1(1,SRV), NULL, SMP_T_BOOL, SMP_USE_INTRN, },
{ "srv_sess_rate", smp_fetch_srv_sess_rate, ARG1(1,SRV), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "srv_sess_rate", smp_fetch_srv_sess_rate, ARG1(1,SRV), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ /* END */ }, { /* END */ },
}}; }};

View File

@ -841,7 +841,7 @@ static int
smp_fetch_res_comp(const struct arg *args, struct sample *smp, const char *kw, void *private) smp_fetch_res_comp(const struct arg *args, struct sample *smp, const char *kw, void *private)
{ {
smp->type = SMP_T_BOOL; smp->type = SMP_T_BOOL;
smp->data.uint = (smp->strm->comp_algo != NULL); smp->data.sint = (smp->strm->comp_algo != NULL);
return 1; return 1;
} }

View File

@ -162,8 +162,8 @@ static int
smp_fetch_fe_id(const struct arg *args, struct sample *smp, const char *kw, void *private) smp_fetch_fe_id(const struct arg *args, struct sample *smp, const char *kw, void *private)
{ {
smp->flags = SMP_F_VOL_SESS; smp->flags = SMP_F_VOL_SESS;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = smp->sess->fe->uuid; smp->data.sint = smp->sess->fe->uuid;
return 1; return 1;
} }
@ -175,8 +175,8 @@ static int
smp_fetch_fe_sess_rate(const struct arg *args, struct sample *smp, const char *kw, void *private) smp_fetch_fe_sess_rate(const struct arg *args, struct sample *smp, const char *kw, void *private)
{ {
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = read_freq_ctr(&args->data.prx->fe_sess_per_sec); smp->data.sint = read_freq_ctr(&args->data.prx->fe_sess_per_sec);
return 1; return 1;
} }
@ -188,8 +188,8 @@ static int
smp_fetch_fe_conn(const struct arg *args, struct sample *smp, const char *kw, void *private) smp_fetch_fe_conn(const struct arg *args, struct sample *smp, const char *kw, void *private)
{ {
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = args->data.prx->feconn; smp->data.sint = args->data.prx->feconn;
return 1; return 1;
} }
@ -198,9 +198,9 @@ smp_fetch_fe_conn(const struct arg *args, struct sample *smp, const char *kw, vo
* Please take care of keeping this list alphabetically sorted. * Please take care of keeping this list alphabetically sorted.
*/ */
static struct sample_fetch_kw_list smp_kws = {ILH, { static struct sample_fetch_kw_list smp_kws = {ILH, {
{ "fe_conn", smp_fetch_fe_conn, ARG1(1,FE), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "fe_conn", smp_fetch_fe_conn, ARG1(1,FE), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "fe_id", smp_fetch_fe_id, 0, NULL, SMP_T_UINT, SMP_USE_FTEND, }, { "fe_id", smp_fetch_fe_id, 0, NULL, SMP_T_SINT, SMP_USE_FTEND, },
{ "fe_sess_rate", smp_fetch_fe_sess_rate, ARG1(1,FE), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "fe_sess_rate", smp_fetch_fe_sess_rate, ARG1(1,FE), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ /* END */ }, { /* END */ },
}}; }};

View File

@ -389,7 +389,6 @@ static int hlua_smp2lua(lua_State *L, struct sample *smp)
switch (smp->type) { switch (smp->type) {
case SMP_T_SINT: case SMP_T_SINT:
case SMP_T_BOOL: case SMP_T_BOOL:
case SMP_T_UINT:
lua_pushinteger(L, smp->data.sint); lua_pushinteger(L, smp->data.sint);
break; break;
@ -467,7 +466,6 @@ static int hlua_smp2lua_str(lua_State *L, struct sample *smp)
case SMP_T_SINT: case SMP_T_SINT:
case SMP_T_BOOL: case SMP_T_BOOL:
case SMP_T_UINT:
case SMP_T_IPV4: case SMP_T_IPV4:
case SMP_T_IPV6: case SMP_T_IPV6:
case SMP_T_ADDR: /* This type is never used to qualify a sample. */ case SMP_T_ADDR: /* This type is never used to qualify a sample. */
@ -500,7 +498,7 @@ static int hlua_lua2smp(lua_State *L, int ud, struct sample *smp)
case LUA_TBOOLEAN: case LUA_TBOOLEAN:
smp->type = SMP_T_BOOL; smp->type = SMP_T_BOOL;
smp->data.uint = lua_toboolean(L, ud); smp->data.sint = lua_toboolean(L, ud);
break; break;
case LUA_TSTRING: case LUA_TSTRING:
@ -516,7 +514,7 @@ static int hlua_lua2smp(lua_State *L, int ud, struct sample *smp)
case LUA_TTHREAD: case LUA_TTHREAD:
case LUA_TLIGHTUSERDATA: case LUA_TLIGHTUSERDATA:
smp->type = SMP_T_BOOL; smp->type = SMP_T_BOOL;
smp->data.uint = 0; smp->data.sint = 0;
break; break;
} }
return 1; return 1;
@ -1336,7 +1334,7 @@ __LJMP static int hlua_map_new(struct lua_State *L)
case PAT_MATCH_DOM: conv.in_type = SMP_T_STR; break; case PAT_MATCH_DOM: conv.in_type = SMP_T_STR; break;
case PAT_MATCH_END: conv.in_type = SMP_T_STR; break; case PAT_MATCH_END: conv.in_type = SMP_T_STR; break;
case PAT_MATCH_REG: conv.in_type = SMP_T_STR; break; case PAT_MATCH_REG: conv.in_type = SMP_T_STR; break;
case PAT_MATCH_INT: conv.in_type = SMP_T_UINT; break; case PAT_MATCH_INT: conv.in_type = SMP_T_SINT; break;
case PAT_MATCH_IP: conv.in_type = SMP_T_ADDR; break; case PAT_MATCH_IP: conv.in_type = SMP_T_ADDR; break;
default: default:
WILL_LJMP(luaL_error(L, "'new' doesn't support this match mode.")); WILL_LJMP(luaL_error(L, "'new' doesn't support this match mode."));
@ -1380,9 +1378,9 @@ __LJMP static inline int _hlua_map_lookup(struct lua_State *L, int str)
MAY_LJMP(check_args(L, 2, "lookup")); MAY_LJMP(check_args(L, 2, "lookup"));
desc = MAY_LJMP(hlua_checkmap(L, 1)); desc = MAY_LJMP(hlua_checkmap(L, 1));
if (desc->pat.expect_type == SMP_T_UINT) { if (desc->pat.expect_type == SMP_T_SINT) {
smp.type = SMP_T_UINT; smp.type = SMP_T_SINT;
smp.data.uint = MAY_LJMP(luaL_checkinteger(L, 2)); smp.data.sint = MAY_LJMP(luaL_checkinteger(L, 2));
} }
else { else {
smp.type = SMP_T_STR; smp.type = SMP_T_STR;

View File

@ -593,8 +593,8 @@ void bind_dump_kws(char **out)
static int static int
smp_fetch_dconn(const struct arg *args, struct sample *smp, const char *kw, void *private) smp_fetch_dconn(const struct arg *args, struct sample *smp, const char *kw, void *private)
{ {
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = smp->sess->listener->nbconn; smp->data.sint = smp->sess->listener->nbconn;
return 1; return 1;
} }
@ -602,8 +602,8 @@ smp_fetch_dconn(const struct arg *args, struct sample *smp, const char *kw, void
static int static int
smp_fetch_so_id(const struct arg *args, struct sample *smp, const char *kw, void *private) smp_fetch_so_id(const struct arg *args, struct sample *smp, const char *kw, void *private)
{ {
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = smp->sess->listener->luid; smp->data.sint = smp->sess->listener->luid;
return 1; return 1;
} }
@ -789,8 +789,8 @@ static int bind_parse_process(char **args, int cur_arg, struct proxy *px, struct
* Please take care of keeping this list alphabetically sorted. * Please take care of keeping this list alphabetically sorted.
*/ */
static struct sample_fetch_kw_list smp_kws = {ILH, { static struct sample_fetch_kw_list smp_kws = {ILH, {
{ "dst_conn", smp_fetch_dconn, 0, NULL, SMP_T_UINT, SMP_USE_FTEND, }, { "dst_conn", smp_fetch_dconn, 0, NULL, SMP_T_SINT, SMP_USE_FTEND, },
{ "so_id", smp_fetch_so_id, 0, NULL, SMP_T_UINT, SMP_USE_FTEND, }, { "so_id", smp_fetch_so_id, 0, NULL, SMP_T_SINT, SMP_USE_FTEND, },
{ /* END */ }, { /* END */ },
}}; }};

View File

@ -67,28 +67,10 @@ int map_parse_str(const char *text, struct sample_storage *smp)
*/ */
int map_parse_int(const char *text, struct sample_storage *smp) int map_parse_int(const char *text, struct sample_storage *smp)
{ {
long long int value; smp->type = SMP_T_SINT;
char *error; smp->data.sint = read_int64(&text, text + strlen(text));
if (*text != '\0')
/* parse interger and convert it. Return the value in 64 format. */
value = strtoll(text, &error, 10);
if (*error != '\0')
return 0; return 0;
/* check sign iand limits */
if (value < 0) {
if (value < INT_MIN)
return 0;
smp->type = SMP_T_SINT;
smp->data.sint = value;
}
else {
if (value > UINT_MAX)
return 0;
smp->type = SMP_T_UINT;
smp->data.uint = value;
}
return 1; return 1;
} }
@ -143,7 +125,7 @@ int sample_load_map(struct arg *arg, struct sample_conv *conv,
/* Set the output parse method. */ /* Set the output parse method. */
switch (desc->conv->out_type) { switch (desc->conv->out_type) {
case SMP_T_STR: desc->pat.parse_smp = map_parse_str; break; case SMP_T_STR: desc->pat.parse_smp = map_parse_str; break;
case SMP_T_UINT: desc->pat.parse_smp = map_parse_int; break; case SMP_T_SINT: desc->pat.parse_smp = map_parse_int; break;
case SMP_T_IPV4: desc->pat.parse_smp = map_parse_ip; break; case SMP_T_IPV4: desc->pat.parse_smp = map_parse_ip; break;
case SMP_T_IPV6: desc->pat.parse_smp = map_parse_ip6; break; case SMP_T_IPV6: desc->pat.parse_smp = map_parse_ip6; break;
default: default:
@ -186,8 +168,8 @@ static int sample_conv_map(const struct arg *arg_p, struct sample *smp, void *pr
} }
/* Return just int sample containing 1. */ /* Return just int sample containing 1. */
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint= 1; smp->data.sint = 1;
return 1; return 1;
} }
@ -204,9 +186,9 @@ static int sample_conv_map(const struct arg *arg_p, struct sample *smp, void *pr
smp->data.str = arg_p[1].data.str; smp->data.str = arg_p[1].data.str;
break; break;
case SMP_T_UINT: case SMP_T_SINT:
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = arg_p[1].data.uint; smp->data.sint = arg_p[1].data.uint;
break; break;
case SMP_T_IPV4: case SMP_T_IPV4:
@ -248,18 +230,18 @@ static struct sample_conv_kw_list sample_conv_kws = {ILH, {
{ "map_dom", sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR, SMP_T_STR, (void *)PAT_MATCH_DOM }, { "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_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_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_int", sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_SINT, 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_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,UINT), sample_load_map, SMP_T_STR, SMP_T_UINT, (void *)PAT_MATCH_STR }, { "map_str_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_STR, SMP_T_SINT, (void *)PAT_MATCH_STR },
{ "map_beg_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_STR, SMP_T_UINT, (void *)PAT_MATCH_BEG }, { "map_beg_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_STR, SMP_T_SINT, (void *)PAT_MATCH_BEG },
{ "map_sub_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_STR, SMP_T_UINT, (void *)PAT_MATCH_SUB }, { "map_sub_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_STR, SMP_T_SINT, (void *)PAT_MATCH_SUB },
{ "map_dir_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_STR, SMP_T_UINT, (void *)PAT_MATCH_DIR }, { "map_dir_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_STR, SMP_T_SINT, (void *)PAT_MATCH_DIR },
{ "map_dom_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_STR, SMP_T_UINT, (void *)PAT_MATCH_DOM }, { "map_dom_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_STR, SMP_T_SINT, (void *)PAT_MATCH_DOM },
{ "map_end_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_STR, SMP_T_UINT, (void *)PAT_MATCH_END }, { "map_end_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_STR, SMP_T_SINT, (void *)PAT_MATCH_END },
{ "map_reg_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_STR, SMP_T_UINT, (void *)PAT_MATCH_REG }, { "map_reg_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_STR, SMP_T_SINT, (void *)PAT_MATCH_REG },
{ "map_int_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_UINT, SMP_T_UINT, (void *)PAT_MATCH_INT }, { "map_int_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_SINT, SMP_T_SINT, (void *)PAT_MATCH_INT },
{ "map_ip_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_ADDR, SMP_T_UINT, (void *)PAT_MATCH_IP }, { "map_ip_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_ADDR, SMP_T_SINT, (void *)PAT_MATCH_IP },
{ "map_str_ip", sample_conv_map, ARG2(1,STR,IPV4), sample_load_map, SMP_T_STR, SMP_T_IPV4, (void *)PAT_MATCH_STR }, { "map_str_ip", sample_conv_map, ARG2(1,STR,IPV4), sample_load_map, SMP_T_STR, SMP_T_IPV4, (void *)PAT_MATCH_STR },
{ "map_beg_ip", sample_conv_map, ARG2(1,STR,IPV4), sample_load_map, SMP_T_STR, SMP_T_IPV4, (void *)PAT_MATCH_BEG }, { "map_beg_ip", sample_conv_map, ARG2(1,STR,IPV4), sample_load_map, SMP_T_STR, SMP_T_IPV4, (void *)PAT_MATCH_BEG },
@ -268,7 +250,7 @@ static struct sample_conv_kw_list sample_conv_kws = {ILH, {
{ "map_dom_ip", sample_conv_map, ARG2(1,STR,IPV4), sample_load_map, SMP_T_STR, SMP_T_IPV4, (void *)PAT_MATCH_DOM }, { "map_dom_ip", sample_conv_map, ARG2(1,STR,IPV4), sample_load_map, SMP_T_STR, SMP_T_IPV4, (void *)PAT_MATCH_DOM },
{ "map_end_ip", sample_conv_map, ARG2(1,STR,IPV4), sample_load_map, SMP_T_STR, SMP_T_IPV4, (void *)PAT_MATCH_END }, { "map_end_ip", sample_conv_map, ARG2(1,STR,IPV4), sample_load_map, SMP_T_STR, SMP_T_IPV4, (void *)PAT_MATCH_END },
{ "map_reg_ip", sample_conv_map, ARG2(1,STR,IPV4), sample_load_map, SMP_T_STR, SMP_T_IPV4, (void *)PAT_MATCH_REG }, { "map_reg_ip", sample_conv_map, ARG2(1,STR,IPV4), sample_load_map, SMP_T_STR, SMP_T_IPV4, (void *)PAT_MATCH_REG },
{ "map_int_ip", sample_conv_map, ARG2(1,STR,IPV4), sample_load_map, SMP_T_UINT, SMP_T_IPV4, (void *)PAT_MATCH_INT }, { "map_int_ip", sample_conv_map, ARG2(1,STR,IPV4), sample_load_map, SMP_T_SINT, SMP_T_IPV4, (void *)PAT_MATCH_INT },
{ "map_ip_ip", sample_conv_map, ARG2(1,STR,IPV4), sample_load_map, SMP_T_ADDR, SMP_T_IPV4, (void *)PAT_MATCH_IP }, { "map_ip_ip", sample_conv_map, ARG2(1,STR,IPV4), sample_load_map, SMP_T_ADDR, SMP_T_IPV4, (void *)PAT_MATCH_IP },
{ /* END */ }, { /* END */ },

View File

@ -125,9 +125,9 @@ struct pattern *(*pat_match_fcts[PAT_MATCH_NUM])(struct sample *, struct pattern
/* Just used for checking configuration compatibility */ /* Just used for checking configuration compatibility */
int pat_match_types[PAT_MATCH_NUM] = { int pat_match_types[PAT_MATCH_NUM] = {
[PAT_MATCH_FOUND] = SMP_T_UINT, [PAT_MATCH_FOUND] = SMP_T_SINT,
[PAT_MATCH_BOOL] = SMP_T_UINT, [PAT_MATCH_BOOL] = SMP_T_SINT,
[PAT_MATCH_INT] = SMP_T_UINT, [PAT_MATCH_INT] = SMP_T_SINT,
[PAT_MATCH_IP] = SMP_T_ADDR, [PAT_MATCH_IP] = SMP_T_ADDR,
[PAT_MATCH_BIN] = SMP_T_BIN, [PAT_MATCH_BIN] = SMP_T_BIN,
[PAT_MATCH_LEN] = SMP_T_STR, [PAT_MATCH_LEN] = SMP_T_STR,
@ -247,7 +247,7 @@ int pat_parse_int(const char *text, struct pattern *pattern, int mflags, char **
{ {
const char *ptr = text; const char *ptr = text;
pattern->type = SMP_T_UINT; pattern->type = SMP_T_SINT;
/* Empty string is not valid */ /* Empty string is not valid */
if (!*text) if (!*text)
@ -332,7 +332,7 @@ int pat_parse_dotted_ver(const char *text, struct pattern *pattern, int mflags,
{ {
const char *ptr = text; const char *ptr = text;
pattern->type = SMP_T_UINT; pattern->type = SMP_T_SINT;
/* Search ':' or '-' separator. */ /* Search ':' or '-' separator. */
while (*ptr != '\0' && *ptr != ':' && *ptr != '-') while (*ptr != '\0' && *ptr != ':' && *ptr != '-')
@ -425,7 +425,7 @@ int pat_parse_ip(const char *text, struct pattern *pattern, int mflags, char **e
/* always return false */ /* always return false */
struct pattern *pat_match_nothing(struct sample *smp, struct pattern_expr *expr, int fill) struct pattern *pat_match_nothing(struct sample *smp, struct pattern_expr *expr, int fill)
{ {
if (smp->data.uint) { if (smp->data.sint) {
if (fill) { if (fill) {
static_pattern.smp = NULL; static_pattern.smp = NULL;
static_pattern.ref = NULL; static_pattern.ref = NULL;
@ -832,8 +832,8 @@ struct pattern *pat_match_int(struct sample *smp, struct pattern_expr *expr, int
list_for_each_entry(lst, &expr->patterns, list) { list_for_each_entry(lst, &expr->patterns, list) {
pattern = &lst->pat; pattern = &lst->pat;
if ((!pattern->val.range.min_set || pattern->val.range.min <= smp->data.uint) && if ((!pattern->val.range.min_set || pattern->val.range.min <= smp->data.sint) &&
(!pattern->val.range.max_set || smp->data.uint <= pattern->val.range.max)) (!pattern->val.range.max_set || smp->data.sint <= pattern->val.range.max))
return pattern; return pattern;
} }
return NULL; return NULL;
@ -2337,7 +2337,7 @@ struct pattern *pattern_exec_match(struct pattern_head *head, struct sample *smp
static_pattern.smp = NULL; static_pattern.smp = NULL;
static_pattern.ref = NULL; static_pattern.ref = NULL;
static_pattern.sflags = 0; static_pattern.sflags = 0;
static_pattern.type = SMP_T_UINT; static_pattern.type = SMP_T_SINT;
static_pattern.val.i = 1; static_pattern.val.i = 1;
} }
return &static_pattern; return &static_pattern;

View File

@ -36,7 +36,7 @@ smp_fetch_wait_end(const struct arg *args, struct sample *smp, const char *kw, v
return 0; return 0;
} }
smp->type = SMP_T_BOOL; smp->type = SMP_T_BOOL;
smp->data.uint = 1; smp->data.sint = 1;
return 1; return 1;
} }
@ -50,8 +50,8 @@ smp_fetch_len(const struct arg *args, struct sample *smp, const char *kw, void *
if (!chn->buf) if (!chn->buf)
return 0; return 0;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = chn->buf->i; smp->data.sint = chn->buf->i;
smp->flags = SMP_F_VOLATILE | SMP_F_MAY_CHANGE; smp->flags = SMP_F_VOLATILE | SMP_F_MAY_CHANGE;
return 1; return 1;
} }
@ -160,7 +160,7 @@ smp_fetch_req_ssl_ec_ext(const struct arg *args, struct sample *smp, const char
/* Elliptic curves extension */ /* Elliptic curves extension */
if (ext_type == 10) { if (ext_type == 10) {
smp->type = SMP_T_BOOL; smp->type = SMP_T_BOOL;
smp->data.uint = 1; smp->data.sint = 1;
smp->flags = SMP_F_VOLATILE; smp->flags = SMP_F_VOLATILE;
return 1; return 1;
} }
@ -224,8 +224,8 @@ smp_fetch_ssl_hello_type(const struct arg *args, struct sample *smp, const char
goto not_ssl_hello; goto not_ssl_hello;
} }
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = hs_type; smp->data.sint = hs_type;
smp->flags = SMP_F_VOLATILE; smp->flags = SMP_F_VOLATILE;
return 1; return 1;
@ -338,8 +338,8 @@ smp_fetch_req_ssl_ver(const struct arg *args, struct sample *smp, const char *kw
/* OK that's enough. We have at least the whole message, and we have /* OK that's enough. We have at least the whole message, and we have
* the protocol version. * the protocol version.
*/ */
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = version; smp->data.sint = version;
smp->flags = SMP_F_VOLATILE; smp->flags = SMP_F_VOLATILE;
return 1; return 1;
@ -628,8 +628,8 @@ smp_fetch_rdp_cookie_cnt(const struct arg *args, struct sample *smp, const char
return 0; return 0;
smp->flags = SMP_F_VOLATILE; smp->flags = SMP_F_VOLATILE;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = ret; smp->data.sint = ret;
return 1; return 1;
} }
@ -756,28 +756,28 @@ int val_payload_lv(struct arg *arg, char **err_msg)
*/ */
static struct sample_fetch_kw_list smp_kws = {ILH, { static struct sample_fetch_kw_list smp_kws = {ILH, {
{ "payload", smp_fetch_payload, ARG2(2,UINT,UINT), NULL, SMP_T_BIN, SMP_USE_L6REQ|SMP_USE_L6RES }, { "payload", smp_fetch_payload, ARG2(2,UINT,UINT), NULL, SMP_T_BIN, SMP_USE_L6REQ|SMP_USE_L6RES },
{ "payload_lv", smp_fetch_payload_lv, ARG3(2,UINT,UINT,SINT), val_payload_lv, SMP_T_BIN, SMP_USE_L6REQ|SMP_USE_L6RES }, { "payload_lv", smp_fetch_payload_lv, ARG3(2,UINT,UINT,UINT), val_payload_lv, SMP_T_BIN, SMP_USE_L6REQ|SMP_USE_L6RES },
{ "rdp_cookie", smp_fetch_rdp_cookie, ARG1(0,STR), NULL, SMP_T_STR, SMP_USE_L6REQ }, { "rdp_cookie", smp_fetch_rdp_cookie, ARG1(0,STR), NULL, SMP_T_STR, SMP_USE_L6REQ },
{ "rdp_cookie_cnt", smp_fetch_rdp_cookie_cnt, ARG1(0,STR), NULL, SMP_T_UINT, SMP_USE_L6REQ }, { "rdp_cookie_cnt", smp_fetch_rdp_cookie_cnt, ARG1(0,STR), NULL, SMP_T_SINT, SMP_USE_L6REQ },
{ "rep_ssl_hello_type", smp_fetch_ssl_hello_type, 0, NULL, SMP_T_UINT, SMP_USE_L6RES }, { "rep_ssl_hello_type", smp_fetch_ssl_hello_type, 0, NULL, SMP_T_SINT, SMP_USE_L6RES },
{ "req_len", smp_fetch_len, 0, NULL, SMP_T_UINT, SMP_USE_L6REQ }, { "req_len", smp_fetch_len, 0, NULL, SMP_T_SINT, SMP_USE_L6REQ },
{ "req_ssl_hello_type", smp_fetch_ssl_hello_type, 0, NULL, SMP_T_UINT, SMP_USE_L6REQ }, { "req_ssl_hello_type", smp_fetch_ssl_hello_type, 0, NULL, SMP_T_SINT, SMP_USE_L6REQ },
{ "req_ssl_sni", smp_fetch_ssl_hello_sni, 0, NULL, SMP_T_STR, SMP_USE_L6REQ }, { "req_ssl_sni", smp_fetch_ssl_hello_sni, 0, NULL, SMP_T_STR, SMP_USE_L6REQ },
{ "req_ssl_ver", smp_fetch_req_ssl_ver, 0, NULL, SMP_T_UINT, SMP_USE_L6REQ }, { "req_ssl_ver", smp_fetch_req_ssl_ver, 0, NULL, SMP_T_SINT, SMP_USE_L6REQ },
{ "req.len", smp_fetch_len, 0, NULL, SMP_T_UINT, SMP_USE_L6REQ }, { "req.len", smp_fetch_len, 0, NULL, SMP_T_SINT, SMP_USE_L6REQ },
{ "req.payload", smp_fetch_payload, ARG2(2,UINT,UINT), NULL, SMP_T_BIN, SMP_USE_L6REQ }, { "req.payload", smp_fetch_payload, ARG2(2,UINT,UINT), NULL, SMP_T_BIN, SMP_USE_L6REQ },
{ "req.payload_lv", smp_fetch_payload_lv, ARG3(2,UINT,UINT,SINT), val_payload_lv, SMP_T_BIN, SMP_USE_L6REQ }, { "req.payload_lv", smp_fetch_payload_lv, ARG3(2,UINT,UINT,UINT), val_payload_lv, SMP_T_BIN, SMP_USE_L6REQ },
{ "req.rdp_cookie", smp_fetch_rdp_cookie, ARG1(0,STR), NULL, SMP_T_STR, SMP_USE_L6REQ }, { "req.rdp_cookie", smp_fetch_rdp_cookie, ARG1(0,STR), NULL, SMP_T_STR, SMP_USE_L6REQ },
{ "req.rdp_cookie_cnt", smp_fetch_rdp_cookie_cnt, ARG1(0,STR), NULL, SMP_T_UINT, SMP_USE_L6REQ }, { "req.rdp_cookie_cnt", smp_fetch_rdp_cookie_cnt, ARG1(0,STR), NULL, SMP_T_SINT, SMP_USE_L6REQ },
{ "req.ssl_ec_ext", smp_fetch_req_ssl_ec_ext, 0, NULL, SMP_T_BOOL, SMP_USE_L6REQ }, { "req.ssl_ec_ext", smp_fetch_req_ssl_ec_ext, 0, NULL, SMP_T_BOOL, SMP_USE_L6REQ },
{ "req.ssl_hello_type", smp_fetch_ssl_hello_type, 0, NULL, SMP_T_UINT, SMP_USE_L6REQ }, { "req.ssl_hello_type", smp_fetch_ssl_hello_type, 0, NULL, SMP_T_SINT, SMP_USE_L6REQ },
{ "req.ssl_sni", smp_fetch_ssl_hello_sni, 0, NULL, SMP_T_STR, SMP_USE_L6REQ }, { "req.ssl_sni", smp_fetch_ssl_hello_sni, 0, NULL, SMP_T_STR, SMP_USE_L6REQ },
{ "req.ssl_ver", smp_fetch_req_ssl_ver, 0, NULL, SMP_T_UINT, SMP_USE_L6REQ }, { "req.ssl_ver", smp_fetch_req_ssl_ver, 0, NULL, SMP_T_SINT, SMP_USE_L6REQ },
{ "res.len", smp_fetch_len, 0, NULL, SMP_T_UINT, SMP_USE_L6RES }, { "res.len", smp_fetch_len, 0, NULL, SMP_T_SINT, SMP_USE_L6RES },
{ "res.payload", smp_fetch_payload, ARG2(2,UINT,UINT), NULL, SMP_T_BIN, SMP_USE_L6RES }, { "res.payload", smp_fetch_payload, ARG2(2,UINT,UINT), NULL, SMP_T_BIN, SMP_USE_L6RES },
{ "res.payload_lv", smp_fetch_payload_lv, ARG3(2,UINT,UINT,SINT), val_payload_lv, SMP_T_BIN, SMP_USE_L6RES }, { "res.payload_lv", smp_fetch_payload_lv, ARG3(2,UINT,UINT,SINT), val_payload_lv, SMP_T_BIN, SMP_USE_L6RES },
{ "res.ssl_hello_type", smp_fetch_ssl_hello_type, 0, NULL, SMP_T_UINT, SMP_USE_L6RES }, { "res.ssl_hello_type", smp_fetch_ssl_hello_type, 0, NULL, SMP_T_SINT, SMP_USE_L6RES },
{ "wait_end", smp_fetch_wait_end, 0, NULL, SMP_T_BOOL, SMP_USE_INTRN }, { "wait_end", smp_fetch_wait_end, 0, NULL, SMP_T_BOOL, SMP_USE_INTRN },
{ /* END */ }, { /* END */ },
}}; }};

View File

@ -10222,7 +10222,7 @@ smp_prefetch_http(struct proxy *px, struct stream *s, unsigned int opt,
if (unlikely(s->req.buf->i + s->req.buf->p > if (unlikely(s->req.buf->i + s->req.buf->p >
s->req.buf->data + s->req.buf->size - global.tune.maxrewrite)) { s->req.buf->data + s->req.buf->size - global.tune.maxrewrite)) {
msg->msg_state = HTTP_MSG_ERROR; msg->msg_state = HTTP_MSG_ERROR;
smp->data.uint = 1; smp->data.sint = 1;
return 1; return 1;
} }
@ -10249,7 +10249,7 @@ smp_prefetch_http(struct proxy *px, struct stream *s, unsigned int opt,
} }
/* everything's OK */ /* everything's OK */
smp->data.uint = 1; smp->data.sint = 1;
return 1; return 1;
} }
@ -10416,8 +10416,8 @@ smp_fetch_stcode(const struct arg *args, struct sample *smp, const char *kw, voi
len = txn->rsp.sl.st.c_l; len = txn->rsp.sl.st.c_l;
ptr = txn->rsp.chn->buf->p + txn->rsp.sl.st.c; ptr = txn->rsp.chn->buf->p + txn->rsp.sl.st.c;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = __strl2ui(ptr, len); smp->data.sint = __strl2ui(ptr, len);
smp->flags = SMP_F_VOL_1ST; smp->flags = SMP_F_VOL_1ST;
return 1; return 1;
} }
@ -10486,8 +10486,8 @@ smp_fetch_body_len(const struct arg *args, struct sample *smp, const char *kw, v
else else
msg = &txn->rsp; msg = &txn->rsp;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = http_body_bytes(msg); smp->data.sint = http_body_bytes(msg);
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
return 1; return 1;
@ -10511,8 +10511,8 @@ smp_fetch_body_size(const struct arg *args, struct sample *smp, const char *kw,
else else
msg = &txn->rsp; msg = &txn->rsp;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = msg->body_len; smp->data.sint = msg->body_len;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
return 1; return 1;
@ -10567,8 +10567,8 @@ smp_fetch_url_port(const struct arg *args, struct sample *smp, const char *kw, v
if (((struct sockaddr_in *)&addr)->sin_family != AF_INET) if (((struct sockaddr_in *)&addr)->sin_family != AF_INET)
return 0; return 0;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = ntohs(((struct sockaddr_in *)&addr)->sin_port); smp->data.sint = ntohs(((struct sockaddr_in *)&addr)->sin_port);
smp->flags = 0; smp->flags = 0;
return 1; return 1;
} }
@ -10662,8 +10662,8 @@ smp_fetch_fhdr_cnt(const struct arg *args, struct sample *smp, const char *kw, v
while (http_find_full_header2(name, len, msg->chn->buf->p, idx, &ctx)) while (http_find_full_header2(name, len, msg->chn->buf->p, idx, &ctx))
cnt++; cnt++;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = cnt; smp->data.sint = cnt;
smp->flags = SMP_F_VOL_HDR; smp->flags = SMP_F_VOL_HDR;
return 1; return 1;
} }
@ -10789,8 +10789,8 @@ smp_fetch_hdr_cnt(const struct arg *args, struct sample *smp, const char *kw, vo
while (http_find_header2(name, len, msg->chn->buf->p, idx, &ctx)) while (http_find_header2(name, len, msg->chn->buf->p, idx, &ctx))
cnt++; cnt++;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = cnt; smp->data.sint = cnt;
smp->flags = SMP_F_VOL_HDR; smp->flags = SMP_F_VOL_HDR;
return 1; return 1;
} }
@ -10806,8 +10806,8 @@ smp_fetch_hdr_val(const struct arg *args, struct sample *smp, const char *kw, vo
int ret = smp_fetch_hdr(args, smp, kw, private); int ret = smp_fetch_hdr(args, smp, kw, private);
if (ret > 0) { if (ret > 0) {
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = strl2ic(smp->data.str.str, smp->data.str.len); smp->data.sint = strl2ic(smp->data.str.str, smp->data.str.len);
} }
return ret; return ret;
@ -10963,8 +10963,8 @@ smp_fetch_base32(const struct arg *args, struct sample *smp, const char *kw, voi
} }
hash = full_hash(hash); hash = full_hash(hash);
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = hash; smp->data.sint = hash;
smp->flags = SMP_F_VOL_1ST; smp->flags = SMP_F_VOL_1ST;
return 1; return 1;
} }
@ -10989,7 +10989,7 @@ smp_fetch_base32_src(const struct arg *args, struct sample *smp, const char *kw,
return 0; return 0;
temp = get_trash_chunk(); temp = get_trash_chunk();
*(unsigned int *)temp->str = htonl(smp->data.uint); *(unsigned int *)temp->str = htonl(smp->data.sint);
temp->len += sizeof(unsigned int); temp->len += sizeof(unsigned int);
switch (cli_conn->addr.from.ss_family) { switch (cli_conn->addr.from.ss_family) {
@ -11049,7 +11049,7 @@ smp_fetch_proto_http(const struct arg *args, struct sample *smp, const char *kw,
CHECK_HTTP_MESSAGE_FIRST_PERM(); CHECK_HTTP_MESSAGE_FIRST_PERM();
smp->type = SMP_T_BOOL; smp->type = SMP_T_BOOL;
smp->data.uint = 1; smp->data.sint = 1;
return 1; return 1;
} }
@ -11058,7 +11058,7 @@ static int
smp_fetch_http_first_req(const struct arg *args, struct sample *smp, const char *kw, void *private) smp_fetch_http_first_req(const struct arg *args, struct sample *smp, const char *kw, void *private)
{ {
smp->type = SMP_T_BOOL; smp->type = SMP_T_BOOL;
smp->data.uint = !(smp->strm->txn->flags & TX_NOT_FIRST); smp->data.sint = !(smp->strm->txn->flags & TX_NOT_FIRST);
return 1; return 1;
} }
@ -11076,7 +11076,7 @@ smp_fetch_http_auth(const struct arg *args, struct sample *smp, const char *kw,
return 0; return 0;
smp->type = SMP_T_BOOL; smp->type = SMP_T_BOOL;
smp->data.uint = check_user(args->data.usr, smp->strm->txn->auth.user, smp->data.sint = check_user(args->data.usr, smp->strm->txn->auth.user,
smp->strm->txn->auth.pass); smp->strm->txn->auth.pass);
return 1; return 1;
} }
@ -11537,8 +11537,8 @@ smp_fetch_cookie_cnt(const struct arg *args, struct sample *smp, const char *kw,
} }
} }
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = cnt; smp->data.sint = cnt;
smp->flags |= SMP_F_VOL_HDR; smp->flags |= SMP_F_VOL_HDR;
return 1; return 1;
} }
@ -11552,8 +11552,8 @@ smp_fetch_cookie_val(const struct arg *args, struct sample *smp, const char *kw,
int ret = smp_fetch_cookie(args, smp, kw, private); int ret = smp_fetch_cookie(args, smp, kw, private);
if (ret > 0) { if (ret > 0) {
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = strl2ic(smp->data.str.str, smp->data.str.len); smp->data.sint = strl2ic(smp->data.str.str, smp->data.str.len);
} }
return ret; return ret;
@ -11954,8 +11954,8 @@ smp_fetch_url_param_val(const struct arg *args, struct sample *smp, const char *
int ret = smp_fetch_url_param(args, smp, kw, private); int ret = smp_fetch_url_param(args, smp, kw, private);
if (ret > 0) { if (ret > 0) {
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = strl2ic(smp->data.str.str, smp->data.str.len); smp->data.sint = strl2ic(smp->data.str.str, smp->data.str.len);
} }
return ret; return ret;
@ -12006,8 +12006,8 @@ smp_fetch_url32(const struct arg *args, struct sample *smp, const char *kw, void
} }
hash = full_hash(hash); hash = full_hash(hash);
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = hash; smp->data.sint = hash;
smp->flags = SMP_F_VOL_1ST; smp->flags = SMP_F_VOL_1ST;
return 1; return 1;
} }
@ -12024,13 +12024,17 @@ smp_fetch_url32_src(const struct arg *args, struct sample *smp, const char *kw,
{ {
struct chunk *temp; struct chunk *temp;
struct connection *cli_conn = objt_conn(smp->sess->origin); struct connection *cli_conn = objt_conn(smp->sess->origin);
unsigned int hash;
if (!smp_fetch_url32(args, smp, kw, private)) if (!smp_fetch_url32(args, smp, kw, private))
return 0; return 0;
/* The returned hash is a 32 bytes integer. */
hash = smp->data.sint;
temp = get_trash_chunk(); temp = get_trash_chunk();
memcpy(temp->str + temp->len, &smp->data.uint, sizeof(smp->data.uint)); memcpy(temp->str + temp->len, &hash, sizeof(hash));
temp->len += sizeof(smp->data.uint); temp->len += sizeof(hash);
switch (cli_conn->addr.from.ss_family) { switch (cli_conn->addr.from.ss_family) {
case AF_INET: case AF_INET:
@ -12077,7 +12081,7 @@ static int sample_conv_http_date(const struct arg *args, struct sample *smp, voi
const char mon[12][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; const char mon[12][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
struct chunk *temp; struct chunk *temp;
struct tm *tm; struct tm *tm;
time_t curr_date = smp->data.uint; time_t curr_date = smp->data.sint;
/* add offset */ /* add offset */
if (args && (args[0].type == ARGT_SINT || args[0].type == ARGT_UINT)) if (args && (args[0].type == ARGT_SINT || args[0].type == ARGT_UINT))
@ -13005,7 +13009,7 @@ static struct acl_kw_list acl_kws = {ILH, {
/* Note: must not be declared <const> as its list will be overwritten */ /* Note: must not be declared <const> as its list will be overwritten */
static struct sample_fetch_kw_list sample_fetch_keywords = {ILH, { static struct sample_fetch_kw_list sample_fetch_keywords = {ILH, {
{ "base", smp_fetch_base, 0, NULL, SMP_T_STR, SMP_USE_HRQHV }, { "base", smp_fetch_base, 0, NULL, SMP_T_STR, SMP_USE_HRQHV },
{ "base32", smp_fetch_base32, 0, NULL, SMP_T_UINT, SMP_USE_HRQHV }, { "base32", smp_fetch_base32, 0, NULL, SMP_T_SINT, SMP_USE_HRQHV },
{ "base32+src", smp_fetch_base32_src, 0, NULL, SMP_T_BIN, SMP_USE_HRQHV }, { "base32+src", smp_fetch_base32_src, 0, NULL, SMP_T_BIN, SMP_USE_HRQHV },
/* capture are allocated and are permanent in the stream */ /* capture are allocated and are permanent in the stream */
@ -13025,17 +13029,17 @@ static struct sample_fetch_kw_list sample_fetch_keywords = {ILH, {
*/ */
{ "cook", smp_fetch_cookie, ARG1(0,STR), NULL, SMP_T_STR, SMP_USE_HRQHV }, { "cook", smp_fetch_cookie, ARG1(0,STR), NULL, SMP_T_STR, SMP_USE_HRQHV },
{ "cookie", smp_fetch_cookie, ARG1(0,STR), NULL, SMP_T_STR, SMP_USE_HRQHV|SMP_USE_HRSHV }, { "cookie", smp_fetch_cookie, ARG1(0,STR), NULL, SMP_T_STR, SMP_USE_HRQHV|SMP_USE_HRSHV },
{ "cook_cnt", smp_fetch_cookie_cnt, ARG1(0,STR), NULL, SMP_T_UINT, SMP_USE_HRQHV }, { "cook_cnt", smp_fetch_cookie_cnt, ARG1(0,STR), NULL, SMP_T_SINT, SMP_USE_HRQHV },
{ "cook_val", smp_fetch_cookie_val, ARG1(0,STR), NULL, SMP_T_UINT, SMP_USE_HRQHV }, { "cook_val", smp_fetch_cookie_val, ARG1(0,STR), NULL, SMP_T_SINT, SMP_USE_HRQHV },
/* hdr is valid in both directions (eg: for "stick ...") but hdr_* are /* hdr is valid in both directions (eg: for "stick ...") but hdr_* are
* only here to match the ACL's name, are request-only and are used for * only here to match the ACL's name, are request-only and are used for
* ACL compatibility only. * ACL compatibility only.
*/ */
{ "hdr", smp_fetch_hdr, ARG2(0,STR,SINT), val_hdr, SMP_T_STR, SMP_USE_HRQHV|SMP_USE_HRSHV }, { "hdr", smp_fetch_hdr, ARG2(0,STR,SINT), val_hdr, SMP_T_STR, SMP_USE_HRQHV|SMP_USE_HRSHV },
{ "hdr_cnt", smp_fetch_hdr_cnt, ARG1(0,STR), NULL, SMP_T_UINT, SMP_USE_HRQHV }, { "hdr_cnt", smp_fetch_hdr_cnt, ARG1(0,STR), NULL, SMP_T_SINT, SMP_USE_HRQHV },
{ "hdr_ip", smp_fetch_hdr_ip, ARG2(0,STR,SINT), val_hdr, SMP_T_IPV4, SMP_USE_HRQHV }, { "hdr_ip", smp_fetch_hdr_ip, ARG2(0,STR,SINT), val_hdr, SMP_T_IPV4, SMP_USE_HRQHV },
{ "hdr_val", smp_fetch_hdr_val, ARG2(0,STR,SINT), val_hdr, SMP_T_UINT, SMP_USE_HRQHV }, { "hdr_val", smp_fetch_hdr_val, ARG2(0,STR,SINT), val_hdr, SMP_T_SINT, SMP_USE_HRQHV },
{ "http_auth", smp_fetch_http_auth, ARG1(1,USR), NULL, SMP_T_BOOL, SMP_USE_HRQHV }, { "http_auth", smp_fetch_http_auth, ARG1(1,USR), NULL, SMP_T_BOOL, SMP_USE_HRQHV },
{ "http_auth_group", smp_fetch_http_auth_grp, ARG1(1,USR), NULL, SMP_T_STR, SMP_USE_HRQHV }, { "http_auth_group", smp_fetch_http_auth_grp, ARG1(1,USR), NULL, SMP_T_STR, SMP_USE_HRQHV },
@ -13053,8 +13057,8 @@ static struct sample_fetch_kw_list sample_fetch_keywords = {ILH, {
{ "req_ver", smp_fetch_rqver, 0, NULL, SMP_T_STR, SMP_USE_HRQHV }, { "req_ver", smp_fetch_rqver, 0, NULL, SMP_T_STR, SMP_USE_HRQHV },
{ "req.body", smp_fetch_body, 0, NULL, SMP_T_BIN, SMP_USE_HRQHV }, { "req.body", smp_fetch_body, 0, NULL, SMP_T_BIN, SMP_USE_HRQHV },
{ "req.body_len", smp_fetch_body_len, 0, NULL, SMP_T_UINT, SMP_USE_HRQHV }, { "req.body_len", smp_fetch_body_len, 0, NULL, SMP_T_SINT, SMP_USE_HRQHV },
{ "req.body_size", smp_fetch_body_size, 0, NULL, SMP_T_UINT, SMP_USE_HRQHV }, { "req.body_size", smp_fetch_body_size, 0, NULL, SMP_T_SINT, SMP_USE_HRQHV },
{ "req.body_param", smp_fetch_body_param, ARG1(0,STR), NULL, SMP_T_BIN, SMP_USE_HRQHV }, { "req.body_param", smp_fetch_body_param, ARG1(0,STR), NULL, SMP_T_BIN, SMP_USE_HRQHV },
/* HTTP version on the response path */ /* HTTP version on the response path */
@ -13063,51 +13067,51 @@ static struct sample_fetch_kw_list sample_fetch_keywords = {ILH, {
/* explicit req.{cook,hdr} are used to force the fetch direction to be request-only */ /* explicit req.{cook,hdr} are used to force the fetch direction to be request-only */
{ "req.cook", smp_fetch_cookie, ARG1(0,STR), NULL, SMP_T_STR, SMP_USE_HRQHV }, { "req.cook", smp_fetch_cookie, ARG1(0,STR), NULL, SMP_T_STR, SMP_USE_HRQHV },
{ "req.cook_cnt", smp_fetch_cookie_cnt, ARG1(0,STR), NULL, SMP_T_UINT, SMP_USE_HRQHV }, { "req.cook_cnt", smp_fetch_cookie_cnt, ARG1(0,STR), NULL, SMP_T_SINT, SMP_USE_HRQHV },
{ "req.cook_val", smp_fetch_cookie_val, ARG1(0,STR), NULL, SMP_T_UINT, SMP_USE_HRQHV }, { "req.cook_val", smp_fetch_cookie_val, ARG1(0,STR), NULL, SMP_T_SINT, SMP_USE_HRQHV },
{ "req.fhdr", smp_fetch_fhdr, ARG2(0,STR,SINT), val_hdr, SMP_T_STR, SMP_USE_HRQHV }, { "req.fhdr", smp_fetch_fhdr, ARG2(0,STR,SINT), val_hdr, SMP_T_STR, SMP_USE_HRQHV },
{ "req.fhdr_cnt", smp_fetch_fhdr_cnt, ARG1(0,STR), NULL, SMP_T_UINT, SMP_USE_HRQHV }, { "req.fhdr_cnt", smp_fetch_fhdr_cnt, ARG1(0,STR), NULL, SMP_T_SINT, SMP_USE_HRQHV },
{ "req.hdr", smp_fetch_hdr, ARG2(0,STR,SINT), val_hdr, SMP_T_STR, SMP_USE_HRQHV }, { "req.hdr", smp_fetch_hdr, ARG2(0,STR,SINT), val_hdr, SMP_T_STR, SMP_USE_HRQHV },
{ "req.hdr_cnt", smp_fetch_hdr_cnt, ARG1(0,STR), NULL, SMP_T_UINT, SMP_USE_HRQHV }, { "req.hdr_cnt", smp_fetch_hdr_cnt, ARG1(0,STR), NULL, SMP_T_SINT, SMP_USE_HRQHV },
{ "req.hdr_ip", smp_fetch_hdr_ip, ARG2(0,STR,SINT), val_hdr, SMP_T_IPV4, SMP_USE_HRQHV }, { "req.hdr_ip", smp_fetch_hdr_ip, ARG2(0,STR,SINT), val_hdr, SMP_T_IPV4, SMP_USE_HRQHV },
{ "req.hdr_names", smp_fetch_hdr_names, ARG1(0,STR), NULL, SMP_T_STR, SMP_USE_HRQHV }, { "req.hdr_names", smp_fetch_hdr_names, ARG1(0,STR), NULL, SMP_T_STR, SMP_USE_HRQHV },
{ "req.hdr_val", smp_fetch_hdr_val, ARG2(0,STR,SINT), val_hdr, SMP_T_UINT, SMP_USE_HRQHV }, { "req.hdr_val", smp_fetch_hdr_val, ARG2(0,STR,SINT), val_hdr, SMP_T_SINT, SMP_USE_HRQHV },
/* explicit req.{cook,hdr} are used to force the fetch direction to be response-only */ /* explicit req.{cook,hdr} are used to force the fetch direction to be response-only */
{ "res.cook", smp_fetch_cookie, ARG1(0,STR), NULL, SMP_T_STR, SMP_USE_HRSHV }, { "res.cook", smp_fetch_cookie, ARG1(0,STR), NULL, SMP_T_STR, SMP_USE_HRSHV },
{ "res.cook_cnt", smp_fetch_cookie_cnt, ARG1(0,STR), NULL, SMP_T_UINT, SMP_USE_HRSHV }, { "res.cook_cnt", smp_fetch_cookie_cnt, ARG1(0,STR), NULL, SMP_T_SINT, SMP_USE_HRSHV },
{ "res.cook_val", smp_fetch_cookie_val, ARG1(0,STR), NULL, SMP_T_UINT, SMP_USE_HRSHV }, { "res.cook_val", smp_fetch_cookie_val, ARG1(0,STR), NULL, SMP_T_SINT, SMP_USE_HRSHV },
{ "res.fhdr", smp_fetch_fhdr, ARG2(0,STR,SINT), val_hdr, SMP_T_STR, SMP_USE_HRSHV }, { "res.fhdr", smp_fetch_fhdr, ARG2(0,STR,SINT), val_hdr, SMP_T_STR, SMP_USE_HRSHV },
{ "res.fhdr_cnt", smp_fetch_fhdr_cnt, ARG1(0,STR), NULL, SMP_T_UINT, SMP_USE_HRSHV }, { "res.fhdr_cnt", smp_fetch_fhdr_cnt, ARG1(0,STR), NULL, SMP_T_SINT, SMP_USE_HRSHV },
{ "res.hdr", smp_fetch_hdr, ARG2(0,STR,SINT), val_hdr, SMP_T_STR, SMP_USE_HRSHV }, { "res.hdr", smp_fetch_hdr, ARG2(0,STR,SINT), val_hdr, SMP_T_STR, SMP_USE_HRSHV },
{ "res.hdr_cnt", smp_fetch_hdr_cnt, ARG1(0,STR), NULL, SMP_T_UINT, SMP_USE_HRSHV }, { "res.hdr_cnt", smp_fetch_hdr_cnt, ARG1(0,STR), NULL, SMP_T_SINT, SMP_USE_HRSHV },
{ "res.hdr_ip", smp_fetch_hdr_ip, ARG2(0,STR,SINT), val_hdr, SMP_T_IPV4, SMP_USE_HRSHV }, { "res.hdr_ip", smp_fetch_hdr_ip, ARG2(0,STR,SINT), val_hdr, SMP_T_IPV4, SMP_USE_HRSHV },
{ "res.hdr_names", smp_fetch_hdr_names, ARG1(0,STR), NULL, SMP_T_STR, SMP_USE_HRSHV }, { "res.hdr_names", smp_fetch_hdr_names, ARG1(0,STR), NULL, SMP_T_STR, SMP_USE_HRSHV },
{ "res.hdr_val", smp_fetch_hdr_val, ARG2(0,STR,SINT), val_hdr, SMP_T_UINT, SMP_USE_HRSHV }, { "res.hdr_val", smp_fetch_hdr_val, ARG2(0,STR,SINT), val_hdr, SMP_T_SINT, SMP_USE_HRSHV },
/* scook is valid only on the response and is used for ACL compatibility */ /* scook is valid only on the response and is used for ACL compatibility */
{ "scook", smp_fetch_cookie, ARG1(0,STR), NULL, SMP_T_STR, SMP_USE_HRSHV }, { "scook", smp_fetch_cookie, ARG1(0,STR), NULL, SMP_T_STR, SMP_USE_HRSHV },
{ "scook_cnt", smp_fetch_cookie_cnt, ARG1(0,STR), NULL, SMP_T_UINT, SMP_USE_HRSHV }, { "scook_cnt", smp_fetch_cookie_cnt, ARG1(0,STR), NULL, SMP_T_SINT, SMP_USE_HRSHV },
{ "scook_val", smp_fetch_cookie_val, ARG1(0,STR), NULL, SMP_T_UINT, SMP_USE_HRSHV }, { "scook_val", smp_fetch_cookie_val, ARG1(0,STR), NULL, SMP_T_SINT, SMP_USE_HRSHV },
{ "set-cookie", smp_fetch_cookie, ARG1(0,STR), NULL, SMP_T_STR, SMP_USE_HRSHV }, /* deprecated */ { "set-cookie", smp_fetch_cookie, ARG1(0,STR), NULL, SMP_T_STR, SMP_USE_HRSHV }, /* deprecated */
/* shdr is valid only on the response and is used for ACL compatibility */ /* shdr is valid only on the response and is used for ACL compatibility */
{ "shdr", smp_fetch_hdr, ARG2(0,STR,SINT), val_hdr, SMP_T_STR, SMP_USE_HRSHV }, { "shdr", smp_fetch_hdr, ARG2(0,STR,SINT), val_hdr, SMP_T_STR, SMP_USE_HRSHV },
{ "shdr_cnt", smp_fetch_hdr_cnt, ARG1(0,STR), NULL, SMP_T_UINT, SMP_USE_HRSHV }, { "shdr_cnt", smp_fetch_hdr_cnt, ARG1(0,STR), NULL, SMP_T_SINT, SMP_USE_HRSHV },
{ "shdr_ip", smp_fetch_hdr_ip, ARG2(0,STR,SINT), val_hdr, SMP_T_IPV4, SMP_USE_HRSHV }, { "shdr_ip", smp_fetch_hdr_ip, ARG2(0,STR,SINT), val_hdr, SMP_T_IPV4, SMP_USE_HRSHV },
{ "shdr_val", smp_fetch_hdr_val, ARG2(0,STR,SINT), val_hdr, SMP_T_UINT, SMP_USE_HRSHV }, { "shdr_val", smp_fetch_hdr_val, ARG2(0,STR,SINT), val_hdr, SMP_T_SINT, SMP_USE_HRSHV },
{ "status", smp_fetch_stcode, 0, NULL, SMP_T_UINT, SMP_USE_HRSHP }, { "status", smp_fetch_stcode, 0, NULL, SMP_T_SINT, SMP_USE_HRSHP },
{ "url", smp_fetch_url, 0, NULL, SMP_T_STR, SMP_USE_HRQHV }, { "url", smp_fetch_url, 0, NULL, SMP_T_STR, SMP_USE_HRQHV },
{ "url32", smp_fetch_url32, 0, NULL, SMP_T_UINT, SMP_USE_HRQHV }, { "url32", smp_fetch_url32, 0, NULL, SMP_T_SINT, SMP_USE_HRQHV },
{ "url32+src", smp_fetch_url32_src, 0, NULL, SMP_T_BIN, SMP_USE_HRQHV }, { "url32+src", smp_fetch_url32_src, 0, NULL, SMP_T_BIN, SMP_USE_HRQHV },
{ "url_ip", smp_fetch_url_ip, 0, NULL, SMP_T_IPV4, SMP_USE_HRQHV }, { "url_ip", smp_fetch_url_ip, 0, NULL, SMP_T_IPV4, SMP_USE_HRQHV },
{ "url_port", smp_fetch_url_port, 0, NULL, SMP_T_UINT, SMP_USE_HRQHV }, { "url_port", smp_fetch_url_port, 0, NULL, SMP_T_SINT, SMP_USE_HRQHV },
{ "url_param", smp_fetch_url_param, ARG2(0,STR,STR), NULL, SMP_T_STR, SMP_USE_HRQHV }, { "url_param", smp_fetch_url_param, ARG2(0,STR,STR), NULL, SMP_T_STR, SMP_USE_HRQHV },
{ "urlp" , smp_fetch_url_param, ARG2(0,STR,STR), NULL, SMP_T_STR, SMP_USE_HRQHV }, { "urlp" , smp_fetch_url_param, ARG2(0,STR,STR), NULL, SMP_T_STR, SMP_USE_HRQHV },
{ "urlp_val", smp_fetch_url_param_val, ARG2(0,STR,STR), NULL, SMP_T_UINT, SMP_USE_HRQHV }, { "urlp_val", smp_fetch_url_param_val, ARG2(0,STR,STR), NULL, SMP_T_SINT, SMP_USE_HRQHV },
{ /* END */ }, { /* END */ },
}}; }};
@ -13117,7 +13121,7 @@ static struct sample_fetch_kw_list sample_fetch_keywords = {ILH, {
/************************************************************************/ /************************************************************************/
/* Note: must not be declared <const> as its list will be overwritten */ /* Note: must not be declared <const> as its list will be overwritten */
static struct sample_conv_kw_list sample_conv_kws = {ILH, { static struct sample_conv_kw_list sample_conv_kws = {ILH, {
{ "http_date", sample_conv_http_date, ARG1(0,SINT), NULL, SMP_T_UINT, SMP_T_STR}, { "http_date", sample_conv_http_date, ARG1(0,SINT), NULL, SMP_T_SINT, SMP_T_STR},
{ "language", sample_conv_q_prefered, ARG2(1,STR,STR), NULL, SMP_T_STR, SMP_T_STR}, { "language", sample_conv_q_prefered, ARG2(1,STR,STR), NULL, SMP_T_STR, SMP_T_STR},
{ "capture-req", smp_conv_req_capture, ARG1(1,UINT), NULL, SMP_T_STR, SMP_T_STR}, { "capture-req", smp_conv_req_capture, ARG1(1,UINT), NULL, SMP_T_STR, SMP_T_STR},
{ "capture-res", smp_conv_res_capture, ARG1(1,UINT), NULL, SMP_T_STR, SMP_T_STR}, { "capture-res", smp_conv_res_capture, ARG1(1,UINT), NULL, SMP_T_STR, SMP_T_STR},

View File

@ -2018,8 +2018,8 @@ smp_fetch_sport(const struct arg *args, struct sample *smp, const char *k, void
if (!cli_conn) if (!cli_conn)
return 0; return 0;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
if (!(smp->data.uint = get_host_port(&cli_conn->addr.from))) if (!(smp->data.sint = get_host_port(&cli_conn->addr.from)))
return 0; return 0;
smp->flags = 0; smp->flags = 0;
@ -2065,8 +2065,8 @@ smp_fetch_dport(const struct arg *args, struct sample *smp, const char *kw, void
conn_get_to_addr(cli_conn); conn_get_to_addr(cli_conn);
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
if (!(smp->data.uint = get_host_port(&cli_conn->addr.to))) if (!(smp->data.sint = get_host_port(&cli_conn->addr.to)))
return 0; return 0;
smp->flags = 0; smp->flags = 0;
@ -2272,9 +2272,9 @@ static struct acl_kw_list acl_kws = {ILH, {
*/ */
static struct sample_fetch_kw_list sample_fetch_keywords = {ILH, { static struct sample_fetch_kw_list sample_fetch_keywords = {ILH, {
{ "dst", smp_fetch_dst, 0, NULL, SMP_T_IPV4, SMP_USE_L4CLI }, { "dst", smp_fetch_dst, 0, NULL, SMP_T_IPV4, SMP_USE_L4CLI },
{ "dst_port", smp_fetch_dport, 0, NULL, SMP_T_UINT, SMP_USE_L4CLI }, { "dst_port", smp_fetch_dport, 0, NULL, SMP_T_SINT, SMP_USE_L4CLI },
{ "src", smp_fetch_src, 0, NULL, SMP_T_IPV4, SMP_USE_L4CLI }, { "src", smp_fetch_src, 0, NULL, SMP_T_IPV4, SMP_USE_L4CLI },
{ "src_port", smp_fetch_sport, 0, NULL, SMP_T_UINT, SMP_USE_L4CLI }, { "src_port", smp_fetch_sport, 0, NULL, SMP_T_SINT, SMP_USE_L4CLI },
{ /* END */ }, { /* END */ },
}}; }};

View File

@ -36,7 +36,6 @@
const char *smp_to_type[SMP_TYPES] = { const char *smp_to_type[SMP_TYPES] = {
[SMP_T_ANY] = "any", [SMP_T_ANY] = "any",
[SMP_T_BOOL] = "bool", [SMP_T_BOOL] = "bool",
[SMP_T_UINT] = "uint",
[SMP_T_SINT] = "sint", [SMP_T_SINT] = "sint",
[SMP_T_ADDR] = "addr", [SMP_T_ADDR] = "addr",
[SMP_T_IPV4] = "ipv4", [SMP_T_IPV4] = "ipv4",
@ -499,8 +498,8 @@ struct sample_conv *find_sample_conv(const char *kw, int len)
static int c_ip2int(struct sample *smp) static int c_ip2int(struct sample *smp)
{ {
smp->data.uint = ntohl(smp->data.ipv4.s_addr); smp->data.sint = ntohl(smp->data.ipv4.s_addr);
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
return 1; return 1;
} }
@ -549,7 +548,7 @@ static int c_ipv62ip(struct sample *smp)
static int c_int2ip(struct sample *smp) static int c_int2ip(struct sample *smp)
{ {
smp->data.ipv4.s_addr = htonl(smp->data.uint); smp->data.ipv4.s_addr = htonl((unsigned int)smp->data.sint);
smp->type = SMP_T_IPV4; smp->type = SMP_T_IPV4;
return 1; return 1;
} }
@ -608,25 +607,7 @@ static int c_int2str(struct sample *smp)
struct chunk *trash = get_trash_chunk(); struct chunk *trash = get_trash_chunk();
char *pos; char *pos;
pos = ultoa_r(smp->data.uint, trash->str, trash->size); pos = lltoa_r(smp->data.sint, trash->str, trash->size);
if (!pos)
return 0;
trash->size = trash->size - (pos - trash->str);
trash->str = pos;
trash->len = strlen(pos);
smp->data.str = *trash;
smp->type = SMP_T_STR;
smp->flags &= ~SMP_F_CONST;
return 1;
}
static int c_sint2str(struct sample *smp)
{
struct chunk *trash = get_trash_chunk();
char *pos;
pos = sltoa_r(smp->data.sint, trash->str, trash->size);
if (!pos) if (!pos)
return 0; return 0;
@ -652,7 +633,6 @@ int smp_dup(struct sample *smp)
switch (smp->type) { switch (smp->type) {
case SMP_T_BOOL: case SMP_T_BOOL:
case SMP_T_UINT:
case SMP_T_SINT: case SMP_T_SINT:
case SMP_T_ADDR: case SMP_T_ADDR:
case SMP_T_IPV4: case SMP_T_IPV4:
@ -684,26 +664,17 @@ int c_none(struct sample *smp)
static int c_str2int(struct sample *smp) static int c_str2int(struct sample *smp)
{ {
int i; const char *str;
uint32_t ret = 0; const char *end;
if (smp->data.str.len == 0) if (smp->data.str.len == 0)
return 0; return 0;
for (i = 0; i < smp->data.str.len; i++) { str = smp->data.str.str;
uint32_t val = smp->data.str.str[i] - '0'; end = smp->data.str.str + smp->data.str.len;
if (val > 9) { smp->data.sint = read_int64(&str, end);
if (i == 0) smp->type = SMP_T_SINT;
return 0;
break;
}
ret = ret * 10 + val;
}
smp->data.uint = ret;
smp->type = SMP_T_UINT;
smp->flags &= ~SMP_F_CONST; smp->flags &= ~SMP_F_CONST;
return 1; return 1;
} }
@ -777,8 +748,8 @@ static int c_int2bin(struct sample *smp)
{ {
struct chunk *chk = get_trash_chunk(); struct chunk *chk = get_trash_chunk();
*(unsigned int *)chk->str = htonl(smp->data.uint); *(unsigned long long int *)chk->str = htonll(smp->data.sint);
chk->len = 4; chk->len = 8;
smp->data.str = *chk; smp->data.str = *chk;
smp->type = SMP_T_BIN; smp->type = SMP_T_BIN;
@ -793,17 +764,16 @@ static int c_int2bin(struct sample *smp)
/*****************************************************************/ /*****************************************************************/
sample_cast_fct sample_casts[SMP_TYPES][SMP_TYPES] = { sample_cast_fct sample_casts[SMP_TYPES][SMP_TYPES] = {
/* to: ANY BOOL UINT SINT ADDR IPV4 IPV6 STR BIN METH */ /* to: ANY BOOL SINT ADDR IPV4 IPV6 STR BIN METH */
/* from: ANY */ { c_none, c_none, c_none, c_none, c_none, c_none, c_none, c_none, c_none, c_none, }, /* from: ANY */ { c_none, c_none, c_none, c_none, c_none, c_none, c_none, c_none, c_none, },
/* BOOL */ { c_none, c_none, c_none, c_none, NULL, NULL, NULL, c_int2str, NULL, NULL, }, /* BOOL */ { c_none, c_none, c_none, NULL, NULL, NULL, c_int2str, NULL, NULL, },
/* UINT */ { c_none, c_none, c_none, c_none, c_int2ip, c_int2ip, NULL, c_int2str, c_int2bin, NULL, }, /* SINT */ { c_none, c_none, c_none, c_int2ip, c_int2ip, NULL, c_int2str, c_int2bin, NULL, },
/* SINT */ { c_none, c_none, c_none, c_none, c_int2ip, c_int2ip, NULL, c_sint2str, c_int2bin, NULL, }, /* ADDR */ { c_none, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, },
/* ADDR */ { c_none, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, }, /* IPV4 */ { c_none, NULL, c_ip2int, c_none, c_none, c_ip2ipv6, c_ip2str, c_addr2bin, NULL, },
/* IPV4 */ { c_none, NULL, c_ip2int, c_ip2int, c_none, c_none, c_ip2ipv6, c_ip2str, c_addr2bin, NULL, }, /* IPV6 */ { c_none, NULL, NULL, c_none, NULL, c_none, c_ipv62str, c_addr2bin, NULL, },
/* IPV6 */ { c_none, NULL, NULL, NULL, c_none, NULL, c_none, c_ipv62str, c_addr2bin, NULL, }, /* STR */ { c_none, c_str2int, c_str2int, c_str2addr, c_str2ip, c_str2ipv6, c_none, c_none, c_str2meth, },
/* STR */ { c_none, c_str2int, c_str2int, c_str2int, c_str2addr, c_str2ip, c_str2ipv6, c_none, c_none, c_str2meth, }, /* BIN */ { c_none, NULL, NULL, NULL, NULL, NULL, c_bin2str, c_none, c_str2meth, },
/* BIN */ { c_none, NULL, NULL, NULL, NULL, NULL, NULL, c_bin2str, c_none, c_str2meth, }, /* METH */ { c_none, NULL, NULL, NULL, NULL, NULL, c_meth2str, c_meth2str, c_none, }
/* METH */ { c_none, NULL, NULL, NULL, NULL, NULL, NULL, c_meth2str, c_meth2str, c_none, }
}; };
/* /*
@ -1462,10 +1432,10 @@ static int sample_conv_bin2hex(const struct arg *arg_p, struct sample *smp, void
/* hashes the binary input into a 32-bit unsigned int */ /* 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(const struct arg *arg_p, struct sample *smp, void *private)
{ {
smp->data.uint = hash_djb2(smp->data.str.str, smp->data.str.len); smp->data.sint = hash_djb2(smp->data.str.str, smp->data.str.len);
if (arg_p && arg_p->data.uint) if (arg_p && arg_p->data.uint)
smp->data.uint = full_hash(smp->data.uint); smp->data.sint = full_hash(smp->data.sint);
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
return 1; return 1;
} }
@ -1518,7 +1488,7 @@ static int sample_conv_ipmask(const struct arg *arg_p, struct sample *smp, void
static int sample_conv_ltime(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; struct chunk *temp;
time_t curr_date = smp->data.uint; time_t curr_date = smp->data.sint;
struct tm *tm; struct tm *tm;
/* add offset */ /* add offset */
@ -1538,10 +1508,10 @@ static int sample_conv_ltime(const struct arg *args, struct sample *smp, void *p
/* hashes the binary input into a 32-bit unsigned int */ /* 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(const struct arg *arg_p, struct sample *smp, void *private)
{ {
smp->data.uint = hash_sdbm(smp->data.str.str, smp->data.str.len); smp->data.sint = hash_sdbm(smp->data.str.str, smp->data.str.len);
if (arg_p && arg_p->data.uint) if (arg_p && arg_p->data.uint)
smp->data.uint = full_hash(smp->data.uint); smp->data.sint = full_hash(smp->data.sint);
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
return 1; return 1;
} }
@ -1552,7 +1522,7 @@ static int sample_conv_sdbm(const struct arg *arg_p, struct sample *smp, void *p
static int sample_conv_utime(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; struct chunk *temp;
time_t curr_date = smp->data.uint; time_t curr_date = smp->data.sint;
struct tm *tm; struct tm *tm;
/* add offset */ /* add offset */
@ -1572,20 +1542,20 @@ static int sample_conv_utime(const struct arg *args, struct sample *smp, void *p
/* hashes the binary input into a 32-bit unsigned int */ /* 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(const struct arg *arg_p, struct sample *smp, void *private)
{ {
smp->data.uint = hash_wt6(smp->data.str.str, smp->data.str.len); smp->data.sint = hash_wt6(smp->data.str.str, smp->data.str.len);
if (arg_p && arg_p->data.uint) if (arg_p && arg_p->data.uint)
smp->data.uint = full_hash(smp->data.uint); smp->data.sint = full_hash(smp->data.sint);
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
return 1; return 1;
} }
/* hashes the binary input into a 32-bit unsigned int */ /* 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(const struct arg *arg_p, struct sample *smp, void *private)
{ {
smp->data.uint = hash_crc32(smp->data.str.str, smp->data.str.len); smp->data.sint = hash_crc32(smp->data.str.str, smp->data.str.len);
if (arg_p && arg_p->data.uint) if (arg_p && arg_p->data.uint)
smp->data.uint = full_hash(smp->data.uint); smp->data.sint = full_hash(smp->data.sint);
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
return 1; return 1;
} }
@ -2045,149 +2015,149 @@ static int sample_conv_regsub(const struct arg *arg_p, struct sample *smp, void
return 1; return 1;
} }
/* Takes a UINT on input, applies a binary twos complement and returns the UINT /* Takes a SINT on input, applies a binary twos complement and returns the SINT
* result. * result.
*/ */
static int sample_conv_binary_cpl(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; smp->data.sint = ~smp->data.sint;
return 1; return 1;
} }
/* Takes a UINT on input, applies a binary "and" with the UINT in arg_p, and /* Takes a SINT on input, applies a binary "and" with the UINT in arg_p, and
* returns the UINT result. * returns the SINT result.
*/ */
static int sample_conv_binary_and(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; smp->data.sint &= arg_p->data.uint;
return 1; return 1;
} }
/* Takes a UINT on input, applies a binary "or" with the UINT in arg_p, and /* Takes a SINT on input, applies a binary "or" with the UINT in arg_p, and
* returns the UINT result. * returns the SINT result.
*/ */
static int sample_conv_binary_or(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; smp->data.sint |= arg_p->data.uint;
return 1; return 1;
} }
/* Takes a UINT on input, applies a binary "xor" with the UINT in arg_p, and /* Takes a SINT on input, applies a binary "xor" with the UINT in arg_p, and
* returns the UINT result. * returns the SINT result.
*/ */
static int sample_conv_binary_xor(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; smp->data.sint ^= arg_p->data.uint;
return 1; return 1;
} }
/* Takes a UINT on input, applies an arithmetic "add" with the UINT in arg_p, /* Takes a SINT on input, applies an arithmetic "add" with the UINT in arg_p,
* and returns the UINT result. * and returns the SINT result.
*/ */
static int sample_conv_arith_add(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; smp->data.sint += arg_p->data.uint;
return 1; return 1;
} }
/* Takes a UINT on input, applies an arithmetic "sub" with the UINT in arg_p, /* Takes a SINT on input, applies an arithmetic "sub" with the UINT in arg_p,
* and returns the UINT result. * and returns the SINT result.
*/ */
static int sample_conv_arith_sub(const struct arg *arg_p, static int sample_conv_arith_sub(const struct arg *arg_p,
struct sample *smp, void *private) struct sample *smp, void *private)
{ {
smp->data.uint -= arg_p->data.uint; smp->data.sint -= arg_p->data.uint;
return 1; return 1;
} }
/* Takes a UINT on input, applies an arithmetic "mul" with the UINT in arg_p, /* Takes a SINT on input, applies an arithmetic "mul" with the UINT in arg_p,
* and returns the UINT result. * and returns the SINT result.
*/ */
static int sample_conv_arith_mul(const struct arg *arg_p, static int sample_conv_arith_mul(const struct arg *arg_p,
struct sample *smp, void *private) struct sample *smp, void *private)
{ {
smp->data.uint *= arg_p->data.uint; smp->data.sint *= arg_p->data.uint;
return 1; return 1;
} }
/* Takes a UINT on input, applies an arithmetic "div" with the UINT in arg_p, /* Takes a SINT on input, applies an arithmetic "div" with the SINT in arg_p,
* and returns the UINT result. If arg_p makes the result overflow, then the * and returns the SINT result. If arg_p makes the result overflow, then the
* largest possible quantity is returned. * largest possible quantity is returned.
*/ */
static int sample_conv_arith_div(const struct arg *arg_p, static int sample_conv_arith_div(const struct arg *arg_p,
struct sample *smp, void *private) struct sample *smp, void *private)
{ {
if (arg_p->data.uint) if (arg_p->data.uint)
smp->data.uint /= arg_p->data.uint; smp->data.sint /= arg_p->data.uint;
else else
smp->data.uint = ~0; smp->data.sint = ~0;
return 1; return 1;
} }
/* Takes a UINT on input, applies an arithmetic "mod" with the UINT in arg_p, /* Takes a SINT on input, applies an arithmetic "mod" with the SINT in arg_p,
* and returns the UINT result. If arg_p makes the result overflow, then zero * and returns the SINT result. If arg_p makes the result overflow, then zero
* is returned. * is returned.
*/ */
static int sample_conv_arith_mod(const struct arg *arg_p, static int sample_conv_arith_mod(const struct arg *arg_p,
struct sample *smp, void *private) struct sample *smp, void *private)
{ {
if (arg_p->data.uint) if (arg_p->data.uint)
smp->data.uint %= arg_p->data.uint; smp->data.sint %= arg_p->data.uint;
else else
smp->data.uint = 0; smp->data.sint = 0;
return 1; return 1;
} }
/* Takes an UINT on input, applies an arithmetic "neg" and returns the UINT /* Takes an SINT on input, applies an arithmetic "neg" and returns the SINT
* result. * result.
*/ */
static int sample_conv_arith_neg(const struct arg *arg_p, static int sample_conv_arith_neg(const struct arg *arg_p,
struct sample *smp, void *private) struct sample *smp, void *private)
{ {
smp->data.uint = -smp->data.uint; smp->data.sint = -smp->data.sint;
return 1; return 1;
} }
/* Takes a UINT on input, returns true is the value is non-null, otherwise /* Takes a SINT on input, returns true is the value is non-null, otherwise
* false. The output is a BOOL. * false. The output is a BOOL.
*/ */
static int sample_conv_arith_bool(const struct arg *arg_p, static int sample_conv_arith_bool(const struct arg *arg_p,
struct sample *smp, void *private) struct sample *smp, void *private)
{ {
smp->data.uint = !!smp->data.uint; smp->data.sint = !!smp->data.sint;
smp->type = SMP_T_BOOL; smp->type = SMP_T_BOOL;
return 1; return 1;
} }
/* Takes a UINT on input, returns false is the value is non-null, otherwise /* Takes a SINT on input, returns false is the value is non-null, otherwise
* truee. The output is a BOOL. * truee. The output is a BOOL.
*/ */
static int sample_conv_arith_not(const struct arg *arg_p, static int sample_conv_arith_not(const struct arg *arg_p,
struct sample *smp, void *private) struct sample *smp, void *private)
{ {
smp->data.uint = !smp->data.uint; smp->data.sint = !smp->data.sint;
smp->type = SMP_T_BOOL; smp->type = SMP_T_BOOL;
return 1; return 1;
} }
/* Takes a UINT on input, returns true is the value is odd, otherwise false. /* Takes a SINT on input, returns true is the value is odd, otherwise false.
* The output is a BOOL. * The output is a BOOL.
*/ */
static int sample_conv_arith_odd(const struct arg *arg_p, static int sample_conv_arith_odd(const struct arg *arg_p,
struct sample *smp, void *private) struct sample *smp, void *private)
{ {
smp->data.uint = smp->data.uint & 1; smp->data.sint = smp->data.sint & 1;
smp->type = SMP_T_BOOL; smp->type = SMP_T_BOOL;
return 1; return 1;
} }
/* Takes a UINT on input, returns true is the value is even, otherwise false. /* Takes a SINT on input, returns true is the value is even, otherwise false.
* The output is a BOOL. * The output is a BOOL.
*/ */
static int sample_conv_arith_even(const struct arg *arg_p, static int sample_conv_arith_even(const struct arg *arg_p,
struct sample *smp, void *private) struct sample *smp, void *private)
{ {
smp->data.uint = !(smp->data.uint & 1); smp->data.sint = !(smp->data.sint & 1);
smp->type = SMP_T_BOOL; smp->type = SMP_T_BOOL;
return 1; return 1;
} }
@ -2201,7 +2171,7 @@ static int
smp_fetch_true(const struct arg *args, struct sample *smp, const char *kw, void *private) smp_fetch_true(const struct arg *args, struct sample *smp, const char *kw, void *private)
{ {
smp->type = SMP_T_BOOL; smp->type = SMP_T_BOOL;
smp->data.uint = 1; smp->data.sint = 1;
return 1; return 1;
} }
@ -2210,7 +2180,7 @@ static int
smp_fetch_false(const struct arg *args, struct sample *smp, const char *kw, void *private) smp_fetch_false(const struct arg *args, struct sample *smp, const char *kw, void *private)
{ {
smp->type = SMP_T_BOOL; smp->type = SMP_T_BOOL;
smp->data.uint = 0; smp->data.sint = 0;
return 1; return 1;
} }
@ -2240,13 +2210,13 @@ smp_fetch_env(const struct arg *args, struct sample *smp, const char *kw, void *
static int static int
smp_fetch_date(const struct arg *args, struct sample *smp, const char *kw, void *private) smp_fetch_date(const struct arg *args, struct sample *smp, const char *kw, void *private)
{ {
smp->data.uint = date.tv_sec; smp->data.sint = date.tv_sec;
/* add offset */ /* add offset */
if (args && (args[0].type == ARGT_SINT || args[0].type == ARGT_UINT)) if (args && (args[0].type == ARGT_SINT || args[0].type == ARGT_UINT))
smp->data.uint += args[0].data.sint; smp->data.sint += args[0].data.sint;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->flags |= SMP_F_VOL_TEST | SMP_F_MAY_CHANGE; smp->flags |= SMP_F_VOL_TEST | SMP_F_MAY_CHANGE;
return 1; return 1;
} }
@ -2255,8 +2225,8 @@ smp_fetch_date(const struct arg *args, struct sample *smp, const char *kw, void
static int static int
smp_fetch_nbproc(const struct arg *args, struct sample *smp, const char *kw, void *private) smp_fetch_nbproc(const struct arg *args, struct sample *smp, const char *kw, void *private)
{ {
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = global.nbproc; smp->data.sint = global.nbproc;
return 1; return 1;
} }
@ -2264,8 +2234,8 @@ smp_fetch_nbproc(const struct arg *args, struct sample *smp, const char *kw, voi
static int static int
smp_fetch_proc(const struct arg *args, struct sample *smp, const char *kw, void *private) smp_fetch_proc(const struct arg *args, struct sample *smp, const char *kw, void *private)
{ {
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = relative_pid; smp->data.sint = relative_pid;
return 1; return 1;
} }
@ -2275,13 +2245,13 @@ smp_fetch_proc(const struct arg *args, struct sample *smp, const char *kw, void
static int static int
smp_fetch_rand(const struct arg *args, struct sample *smp, const char *kw, void *private) smp_fetch_rand(const struct arg *args, struct sample *smp, const char *kw, void *private)
{ {
smp->data.uint = random(); smp->data.sint = random();
/* reduce if needed. Don't do a modulo, use all bits! */ /* reduce if needed. Don't do a modulo, use all bits! */
if (args && args[0].type == ARGT_UINT) if (args && args[0].type == ARGT_UINT)
smp->data.uint = ((uint64_t)smp->data.uint * args[0].data.uint) / ((u64)RAND_MAX+1); smp->data.sint = (smp->data.sint * args[0].data.uint) / ((u64)RAND_MAX+1);
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->flags |= SMP_F_VOL_TEST | SMP_F_MAY_CHANGE; smp->flags |= SMP_F_VOL_TEST | SMP_F_MAY_CHANGE;
return 1; return 1;
} }
@ -2291,7 +2261,7 @@ static int
smp_fetch_stopping(const struct arg *args, struct sample *smp, const char *kw, void *private) smp_fetch_stopping(const struct arg *args, struct sample *smp, const char *kw, void *private)
{ {
smp->type = SMP_T_BOOL; smp->type = SMP_T_BOOL;
smp->data.uint = stopping; smp->data.sint = stopping;
return 1; return 1;
} }
@ -2325,18 +2295,11 @@ static int smp_check_const_bool(struct arg *args, char **err)
static int smp_fetch_const_bool(const struct arg *args, struct sample *smp, const char *kw, void *private) static int smp_fetch_const_bool(const struct arg *args, struct sample *smp, const char *kw, void *private)
{ {
smp->type = SMP_T_BOOL; smp->type = SMP_T_BOOL;
smp->data.uint = args[0].data.uint; smp->data.sint = args[0].data.uint;
return 1; return 1;
} }
static int smp_fetch_const_uint(const struct arg *args, struct sample *smp, const char *kw, void *private) static int smp_fetch_const_int(const struct arg *args, struct sample *smp, const char *kw, void *private)
{
smp->type = SMP_T_UINT;
smp->data.uint = args[0].data.uint;
return 1;
}
static int smp_fetch_const_sint(const struct arg *args, struct sample *smp, const char *kw, void *private)
{ {
smp->type = SMP_T_SINT; smp->type = SMP_T_SINT;
smp->data.sint = args[0].data.sint; smp->data.sint = args[0].data.sint;
@ -2430,16 +2393,15 @@ static struct sample_fetch_kw_list smp_kws = {ILH, {
{ "always_false", smp_fetch_false, 0, NULL, SMP_T_BOOL, SMP_USE_INTRN }, { "always_false", smp_fetch_false, 0, NULL, SMP_T_BOOL, SMP_USE_INTRN },
{ "always_true", smp_fetch_true, 0, NULL, SMP_T_BOOL, SMP_USE_INTRN }, { "always_true", smp_fetch_true, 0, NULL, SMP_T_BOOL, SMP_USE_INTRN },
{ "env", smp_fetch_env, ARG1(1,STR), NULL, SMP_T_STR, SMP_USE_INTRN }, { "env", smp_fetch_env, ARG1(1,STR), NULL, SMP_T_STR, SMP_USE_INTRN },
{ "date", smp_fetch_date, ARG1(0,SINT), NULL, SMP_T_UINT, SMP_USE_INTRN }, { "date", smp_fetch_date, ARG1(0,SINT), NULL, SMP_T_SINT, SMP_USE_INTRN },
{ "nbproc", smp_fetch_nbproc,0, NULL, SMP_T_UINT, SMP_USE_INTRN }, { "nbproc", smp_fetch_nbproc,0, NULL, SMP_T_SINT, SMP_USE_INTRN },
{ "proc", smp_fetch_proc, 0, NULL, SMP_T_UINT, SMP_USE_INTRN }, { "proc", smp_fetch_proc, 0, NULL, SMP_T_SINT, SMP_USE_INTRN },
{ "rand", smp_fetch_rand, ARG1(0,UINT), NULL, SMP_T_UINT, SMP_USE_INTRN }, { "rand", smp_fetch_rand, ARG1(0,UINT), NULL, SMP_T_SINT, SMP_USE_INTRN },
{ "stopping", smp_fetch_stopping, 0, NULL, SMP_T_BOOL, SMP_USE_INTRN }, { "stopping", smp_fetch_stopping, 0, NULL, SMP_T_BOOL, SMP_USE_INTRN },
{ "str", smp_fetch_const_str, ARG1(1,STR), NULL , SMP_T_STR, SMP_USE_INTRN }, { "str", smp_fetch_const_str, ARG1(1,STR), NULL , SMP_T_STR, SMP_USE_INTRN },
{ "bool", smp_fetch_const_bool, ARG1(1,STR), smp_check_const_bool, SMP_T_BOOL, SMP_USE_INTRN }, { "bool", smp_fetch_const_bool, ARG1(1,STR), smp_check_const_bool, SMP_T_BOOL, SMP_USE_INTRN },
{ "uint", smp_fetch_const_uint, ARG1(1,UINT), NULL , SMP_T_UINT, SMP_USE_INTRN }, { "int", smp_fetch_const_int, ARG1(1,SINT), NULL , SMP_T_SINT, SMP_USE_INTRN },
{ "sint", smp_fetch_const_sint, ARG1(1,SINT), NULL , SMP_T_SINT, SMP_USE_INTRN },
{ "ipv4", smp_fetch_const_ipv4, ARG1(1,IPV4), NULL , SMP_T_IPV4, SMP_USE_INTRN }, { "ipv4", smp_fetch_const_ipv4, ARG1(1,IPV4), NULL , SMP_T_IPV4, SMP_USE_INTRN },
{ "ipv6", smp_fetch_const_ipv6, ARG1(1,IPV6), NULL , SMP_T_IPV6, SMP_USE_INTRN }, { "ipv6", smp_fetch_const_ipv6, ARG1(1,IPV6), NULL , SMP_T_IPV6, SMP_USE_INTRN },
{ "bin", smp_fetch_const_bin, ARG1(1,STR), smp_check_const_bin , SMP_T_BIN, SMP_USE_INTRN }, { "bin", smp_fetch_const_bin, ARG1(1,STR), smp_check_const_bin , SMP_T_BIN, SMP_USE_INTRN },
@ -2459,32 +2421,32 @@ static struct sample_conv_kw_list sample_conv_kws = {ILH, {
{ "lower", sample_conv_str2lower, 0, NULL, SMP_T_STR, SMP_T_STR }, { "lower", sample_conv_str2lower, 0, NULL, SMP_T_STR, SMP_T_STR },
{ "hex", sample_conv_bin2hex, 0, NULL, SMP_T_BIN, SMP_T_STR }, { "hex", sample_conv_bin2hex, 0, NULL, SMP_T_BIN, SMP_T_STR },
{ "ipmask", sample_conv_ipmask, ARG1(1,MSK4), NULL, SMP_T_IPV4, SMP_T_IPV4 }, { "ipmask", sample_conv_ipmask, ARG1(1,MSK4), NULL, SMP_T_IPV4, SMP_T_IPV4 },
{ "ltime", sample_conv_ltime, ARG2(1,STR,SINT), NULL, SMP_T_UINT, SMP_T_STR }, { "ltime", sample_conv_ltime, ARG2(1,STR,SINT), NULL, SMP_T_SINT, SMP_T_STR },
{ "utime", sample_conv_utime, ARG2(1,STR,SINT), NULL, SMP_T_UINT, SMP_T_STR }, { "utime", sample_conv_utime, ARG2(1,STR,SINT), NULL, SMP_T_SINT, SMP_T_STR },
{ "crc32", sample_conv_crc32, ARG1(0,UINT), NULL, SMP_T_BIN, SMP_T_UINT }, { "crc32", sample_conv_crc32, ARG1(0,UINT), NULL, SMP_T_BIN, SMP_T_SINT },
{ "djb2", sample_conv_djb2, ARG1(0,UINT), NULL, SMP_T_BIN, SMP_T_UINT }, { "djb2", sample_conv_djb2, ARG1(0,UINT), NULL, SMP_T_BIN, SMP_T_SINT },
{ "sdbm", sample_conv_sdbm, ARG1(0,UINT), NULL, SMP_T_BIN, SMP_T_UINT }, { "sdbm", sample_conv_sdbm, ARG1(0,UINT), NULL, SMP_T_BIN, SMP_T_SINT },
{ "wt6", sample_conv_wt6, ARG1(0,UINT), NULL, SMP_T_BIN, SMP_T_UINT }, { "wt6", sample_conv_wt6, ARG1(0,UINT), NULL, SMP_T_BIN, SMP_T_SINT },
{ "json", sample_conv_json, ARG1(1,STR), sample_conv_json_check, SMP_T_STR, SMP_T_STR }, { "json", sample_conv_json, ARG1(1,STR), sample_conv_json_check, SMP_T_STR, SMP_T_STR },
{ "bytes", sample_conv_bytes, ARG2(1,UINT,UINT), NULL, SMP_T_BIN, SMP_T_BIN }, { "bytes", sample_conv_bytes, ARG2(1,UINT,UINT), NULL, SMP_T_BIN, SMP_T_BIN },
{ "field", sample_conv_field, ARG2(2,UINT,STR), sample_conv_field_check, SMP_T_STR, SMP_T_STR }, { "field", sample_conv_field, ARG2(2,UINT,STR), sample_conv_field_check, SMP_T_STR, SMP_T_STR },
{ "word", sample_conv_word, ARG2(2,UINT,STR), sample_conv_field_check, SMP_T_STR, SMP_T_STR }, { "word", sample_conv_word, ARG2(2,UINT,STR), sample_conv_field_check, SMP_T_STR, SMP_T_STR },
{ "regsub", sample_conv_regsub, ARG3(2,REG,STR,STR), sample_conv_regsub_check, SMP_T_STR, SMP_T_STR }, { "regsub", sample_conv_regsub, ARG3(2,REG,STR,STR), sample_conv_regsub_check, SMP_T_STR, SMP_T_STR },
{ "and", sample_conv_binary_and, ARG1(1,UINT), NULL, SMP_T_UINT, SMP_T_UINT }, { "and", sample_conv_binary_and, ARG1(1,UINT), NULL, SMP_T_SINT, SMP_T_SINT },
{ "or", sample_conv_binary_or, ARG1(1,UINT), NULL, SMP_T_UINT, SMP_T_UINT }, { "or", sample_conv_binary_or, ARG1(1,UINT), NULL, SMP_T_SINT, SMP_T_SINT },
{ "xor", sample_conv_binary_xor, ARG1(1,UINT), NULL, SMP_T_UINT, SMP_T_UINT }, { "xor", sample_conv_binary_xor, ARG1(1,UINT), NULL, SMP_T_SINT, SMP_T_SINT },
{ "cpl", sample_conv_binary_cpl, 0, NULL, SMP_T_UINT, SMP_T_UINT }, { "cpl", sample_conv_binary_cpl, 0, NULL, SMP_T_SINT, SMP_T_SINT },
{ "bool", sample_conv_arith_bool, 0, NULL, SMP_T_UINT, SMP_T_BOOL }, { "bool", sample_conv_arith_bool, 0, NULL, SMP_T_SINT, SMP_T_BOOL },
{ "not", sample_conv_arith_not, 0, NULL, SMP_T_UINT, SMP_T_BOOL }, { "not", sample_conv_arith_not, 0, NULL, SMP_T_SINT, SMP_T_BOOL },
{ "odd", sample_conv_arith_odd, 0, NULL, SMP_T_UINT, SMP_T_BOOL }, { "odd", sample_conv_arith_odd, 0, NULL, SMP_T_SINT, SMP_T_BOOL },
{ "even", sample_conv_arith_even, 0, NULL, SMP_T_UINT, SMP_T_BOOL }, { "even", sample_conv_arith_even, 0, NULL, SMP_T_SINT, SMP_T_BOOL },
{ "add", sample_conv_arith_add, ARG1(1,UINT), NULL, SMP_T_UINT, SMP_T_UINT }, { "add", sample_conv_arith_add, ARG1(1,UINT), NULL, SMP_T_SINT, SMP_T_SINT },
{ "sub", sample_conv_arith_sub, ARG1(1,UINT), NULL, SMP_T_UINT, SMP_T_UINT }, { "sub", sample_conv_arith_sub, ARG1(1,UINT), NULL, SMP_T_SINT, SMP_T_SINT },
{ "mul", sample_conv_arith_mul, ARG1(1,UINT), NULL, SMP_T_UINT, SMP_T_UINT }, { "mul", sample_conv_arith_mul, ARG1(1,UINT), NULL, SMP_T_SINT, SMP_T_SINT },
{ "div", sample_conv_arith_div, ARG1(1,UINT), NULL, SMP_T_UINT, SMP_T_UINT }, { "div", sample_conv_arith_div, ARG1(1,UINT), NULL, SMP_T_SINT, SMP_T_SINT },
{ "mod", sample_conv_arith_mod, ARG1(1,UINT), NULL, SMP_T_UINT, SMP_T_UINT }, { "mod", sample_conv_arith_mod, ARG1(1,UINT), NULL, SMP_T_SINT, SMP_T_SINT },
{ "neg", sample_conv_arith_neg, 0, NULL, SMP_T_UINT, SMP_T_UINT }, { "neg", sample_conv_arith_neg, 0, NULL, SMP_T_SINT, SMP_T_SINT },
{ NULL, NULL, 0, 0, 0 }, { NULL, NULL, 0, 0, 0 },
}}; }};

View File

@ -3393,7 +3393,7 @@ smp_fetch_ssl_fc_has_crt(const struct arg *args, struct sample *smp, const char
smp->flags = 0; smp->flags = 0;
smp->type = SMP_T_BOOL; smp->type = SMP_T_BOOL;
smp->data.uint = SSL_SOCK_ST_FL_VERIFY_DONE & conn->xprt_st ? 1 : 0; smp->data.sint = SSL_SOCK_ST_FL_VERIFY_DONE & conn->xprt_st ? 1 : 0;
return 1; return 1;
} }
@ -3757,7 +3757,7 @@ smp_fetch_ssl_c_used(const struct arg *args, struct sample *smp, const char *kw,
} }
smp->type = SMP_T_BOOL; smp->type = SMP_T_BOOL;
smp->data.uint = (crt != NULL); smp->data.sint = (crt != NULL);
return 1; return 1;
} }
@ -3788,11 +3788,11 @@ smp_fetch_ssl_x_version(const struct arg *args, struct sample *smp, const char *
if (!crt) if (!crt)
return 0; return 0;
smp->data.uint = (unsigned int)(1 + X509_get_version(crt)); smp->data.sint = (unsigned int)(1 + X509_get_version(crt));
/* SSL_get_peer_certificate increase X509 * ref count */ /* SSL_get_peer_certificate increase X509 * ref count */
if (cert_peer) if (cert_peer)
X509_free(crt); X509_free(crt);
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
return 1; return 1;
} }
@ -3903,7 +3903,7 @@ smp_fetch_ssl_fc(const struct arg *args, struct sample *smp, const char *kw, voi
struct connection *conn = objt_conn(smp->strm->si[back_conn].end); struct connection *conn = objt_conn(smp->strm->si[back_conn].end);
smp->type = SMP_T_BOOL; smp->type = SMP_T_BOOL;
smp->data.uint = (conn && conn->xprt == &ssl_sock); smp->data.sint = (conn && conn->xprt == &ssl_sock);
return 1; return 1;
} }
@ -3915,7 +3915,7 @@ smp_fetch_ssl_fc_has_sni(const struct arg *args, struct sample *smp, const char
struct connection *conn = objt_conn(smp->sess->origin); struct connection *conn = objt_conn(smp->sess->origin);
smp->type = SMP_T_BOOL; smp->type = SMP_T_BOOL;
smp->data.uint = (conn && conn->xprt == &ssl_sock) && smp->data.sint = (conn && conn->xprt == &ssl_sock) &&
conn->xprt_ctx && conn->xprt_ctx &&
SSL_get_servername(conn->xprt_ctx, TLSEXT_NAMETYPE_host_name) != NULL; SSL_get_servername(conn->xprt_ctx, TLSEXT_NAMETYPE_host_name) != NULL;
return 1; return 1;
@ -3931,7 +3931,7 @@ smp_fetch_ssl_fc_is_resumed(const struct arg *args, struct sample *smp, const ch
struct connection *conn = objt_conn(smp->sess->origin); struct connection *conn = objt_conn(smp->sess->origin);
smp->type = SMP_T_BOOL; smp->type = SMP_T_BOOL;
smp->data.uint = (conn && conn->xprt == &ssl_sock) && smp->data.sint = (conn && conn->xprt == &ssl_sock) &&
conn->xprt_ctx && conn->xprt_ctx &&
SSL_session_reused(conn->xprt_ctx); SSL_session_reused(conn->xprt_ctx);
return 1; return 1;
@ -3974,6 +3974,7 @@ smp_fetch_ssl_fc_alg_keysize(const struct arg *args, struct sample *smp, const c
{ {
int back_conn = (kw[4] == 'b') ? 1 : 0; int back_conn = (kw[4] == 'b') ? 1 : 0;
struct connection *conn; struct connection *conn;
int sint;
smp->flags = 0; smp->flags = 0;
@ -3981,10 +3982,11 @@ smp_fetch_ssl_fc_alg_keysize(const struct arg *args, struct sample *smp, const c
if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock) if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
return 0; return 0;
if (!SSL_get_cipher_bits(conn->xprt_ctx, (int *)&smp->data.uint)) if (!SSL_get_cipher_bits(conn->xprt_ctx, &sint))
return 0; return 0;
smp->type = SMP_T_UINT; smp->data.sint = sint;
smp->type = SMP_T_SINT;
return 1; return 1;
} }
@ -4005,11 +4007,11 @@ smp_fetch_ssl_fc_use_keysize(const struct arg *args, struct sample *smp, const c
if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock) if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
return 0; return 0;
smp->data.uint = (unsigned int)SSL_get_cipher_bits(conn->xprt_ctx, NULL); smp->data.sint = (unsigned int)SSL_get_cipher_bits(conn->xprt_ctx, NULL);
if (!smp->data.uint) if (!smp->data.sint)
return 0; return 0;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
return 1; return 1;
} }
@ -4200,8 +4202,8 @@ smp_fetch_ssl_c_ca_err(const struct arg *args, struct sample *smp, const char *k
return 0; return 0;
} }
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = (unsigned int)SSL_SOCK_ST_TO_CA_ERROR(conn->xprt_st); smp->data.sint = (unsigned long long int)SSL_SOCK_ST_TO_CA_ERROR(conn->xprt_st);
smp->flags = 0; smp->flags = 0;
return 1; return 1;
@ -4222,8 +4224,8 @@ smp_fetch_ssl_c_ca_err_depth(const struct arg *args, struct sample *smp, const c
return 0; return 0;
} }
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = (unsigned int)SSL_SOCK_ST_TO_CAEDEPTH(conn->xprt_st); smp->data.sint = (long long int)SSL_SOCK_ST_TO_CAEDEPTH(conn->xprt_st);
smp->flags = 0; smp->flags = 0;
return 1; return 1;
@ -4244,8 +4246,8 @@ smp_fetch_ssl_c_err(const struct arg *args, struct sample *smp, const char *kw,
return 0; return 0;
} }
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = (unsigned int)SSL_SOCK_ST_TO_CRTERROR(conn->xprt_st); smp->data.sint = (long long int)SSL_SOCK_ST_TO_CRTERROR(conn->xprt_st);
smp->flags = 0; smp->flags = 0;
return 1; return 1;
@ -4269,8 +4271,8 @@ smp_fetch_ssl_c_verify(const struct arg *args, struct sample *smp, const char *k
if (!conn->xprt_ctx) if (!conn->xprt_ctx)
return 0; return 0;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = (unsigned int)SSL_get_verify_result(conn->xprt_ctx); smp->data.sint = (long long int)SSL_get_verify_result(conn->xprt_ctx);
smp->flags = 0; smp->flags = 0;
return 1; return 1;
@ -5139,16 +5141,16 @@ static int ssl_parse_default_server_options(char **args, int section_type, struc
*/ */
static struct sample_fetch_kw_list sample_fetch_keywords = {ILH, { static struct sample_fetch_kw_list sample_fetch_keywords = {ILH, {
{ "ssl_bc", smp_fetch_ssl_fc, 0, NULL, SMP_T_BOOL, SMP_USE_L5SRV }, { "ssl_bc", smp_fetch_ssl_fc, 0, NULL, SMP_T_BOOL, SMP_USE_L5SRV },
{ "ssl_bc_alg_keysize", smp_fetch_ssl_fc_alg_keysize, 0, NULL, SMP_T_UINT, SMP_USE_L5SRV }, { "ssl_bc_alg_keysize", smp_fetch_ssl_fc_alg_keysize, 0, NULL, SMP_T_SINT, SMP_USE_L5SRV },
{ "ssl_bc_cipher", smp_fetch_ssl_fc_cipher, 0, NULL, SMP_T_STR, SMP_USE_L5SRV }, { "ssl_bc_cipher", smp_fetch_ssl_fc_cipher, 0, NULL, SMP_T_STR, SMP_USE_L5SRV },
{ "ssl_bc_protocol", smp_fetch_ssl_fc_protocol, 0, NULL, SMP_T_STR, SMP_USE_L5SRV }, { "ssl_bc_protocol", smp_fetch_ssl_fc_protocol, 0, NULL, SMP_T_STR, SMP_USE_L5SRV },
{ "ssl_bc_unique_id", smp_fetch_ssl_fc_unique_id, 0, NULL, SMP_T_BIN, SMP_USE_L5SRV }, { "ssl_bc_unique_id", smp_fetch_ssl_fc_unique_id, 0, NULL, SMP_T_BIN, SMP_USE_L5SRV },
{ "ssl_bc_use_keysize", smp_fetch_ssl_fc_use_keysize, 0, NULL, SMP_T_UINT, SMP_USE_L5SRV }, { "ssl_bc_use_keysize", smp_fetch_ssl_fc_use_keysize, 0, NULL, SMP_T_SINT, SMP_USE_L5SRV },
{ "ssl_bc_session_id", smp_fetch_ssl_fc_session_id, 0, NULL, SMP_T_BIN, SMP_USE_L5SRV }, { "ssl_bc_session_id", smp_fetch_ssl_fc_session_id, 0, NULL, SMP_T_BIN, SMP_USE_L5SRV },
{ "ssl_c_ca_err", smp_fetch_ssl_c_ca_err, 0, NULL, SMP_T_UINT, SMP_USE_L5CLI }, { "ssl_c_ca_err", smp_fetch_ssl_c_ca_err, 0, NULL, SMP_T_SINT, SMP_USE_L5CLI },
{ "ssl_c_ca_err_depth", smp_fetch_ssl_c_ca_err_depth, 0, NULL, SMP_T_UINT, SMP_USE_L5CLI }, { "ssl_c_ca_err_depth", smp_fetch_ssl_c_ca_err_depth, 0, NULL, SMP_T_SINT, SMP_USE_L5CLI },
{ "ssl_c_der", smp_fetch_ssl_x_der, 0, NULL, SMP_T_BIN, SMP_USE_L5CLI }, { "ssl_c_der", smp_fetch_ssl_x_der, 0, NULL, SMP_T_BIN, SMP_USE_L5CLI },
{ "ssl_c_err", smp_fetch_ssl_c_err, 0, NULL, SMP_T_UINT, SMP_USE_L5CLI }, { "ssl_c_err", smp_fetch_ssl_c_err, 0, NULL, SMP_T_SINT, SMP_USE_L5CLI },
{ "ssl_c_i_dn", smp_fetch_ssl_x_i_dn, ARG2(0,STR,SINT), NULL, SMP_T_STR, SMP_USE_L5CLI }, { "ssl_c_i_dn", smp_fetch_ssl_x_i_dn, ARG2(0,STR,SINT), NULL, SMP_T_STR, SMP_USE_L5CLI },
{ "ssl_c_key_alg", smp_fetch_ssl_x_key_alg, 0, NULL, SMP_T_STR, SMP_USE_L5CLI }, { "ssl_c_key_alg", smp_fetch_ssl_x_key_alg, 0, NULL, SMP_T_STR, SMP_USE_L5CLI },
{ "ssl_c_notafter", smp_fetch_ssl_x_notafter, 0, NULL, SMP_T_STR, SMP_USE_L5CLI }, { "ssl_c_notafter", smp_fetch_ssl_x_notafter, 0, NULL, SMP_T_STR, SMP_USE_L5CLI },
@ -5158,8 +5160,8 @@ static struct sample_fetch_kw_list sample_fetch_keywords = {ILH, {
{ "ssl_c_serial", smp_fetch_ssl_x_serial, 0, NULL, SMP_T_BIN, SMP_USE_L5CLI }, { "ssl_c_serial", smp_fetch_ssl_x_serial, 0, NULL, SMP_T_BIN, SMP_USE_L5CLI },
{ "ssl_c_sha1", smp_fetch_ssl_x_sha1, 0, NULL, SMP_T_BIN, SMP_USE_L5CLI }, { "ssl_c_sha1", smp_fetch_ssl_x_sha1, 0, NULL, SMP_T_BIN, SMP_USE_L5CLI },
{ "ssl_c_used", smp_fetch_ssl_c_used, 0, NULL, SMP_T_BOOL, SMP_USE_L5CLI }, { "ssl_c_used", smp_fetch_ssl_c_used, 0, NULL, SMP_T_BOOL, SMP_USE_L5CLI },
{ "ssl_c_verify", smp_fetch_ssl_c_verify, 0, NULL, SMP_T_UINT, SMP_USE_L5CLI }, { "ssl_c_verify", smp_fetch_ssl_c_verify, 0, NULL, SMP_T_SINT, SMP_USE_L5CLI },
{ "ssl_c_version", smp_fetch_ssl_x_version, 0, NULL, SMP_T_UINT, SMP_USE_L5CLI }, { "ssl_c_version", smp_fetch_ssl_x_version, 0, NULL, SMP_T_SINT, SMP_USE_L5CLI },
{ "ssl_f_der", smp_fetch_ssl_x_der, 0, NULL, SMP_T_BIN, SMP_USE_L5CLI }, { "ssl_f_der", smp_fetch_ssl_x_der, 0, NULL, SMP_T_BIN, SMP_USE_L5CLI },
{ "ssl_f_i_dn", smp_fetch_ssl_x_i_dn, ARG2(0,STR,SINT), NULL, SMP_T_STR, SMP_USE_L5CLI }, { "ssl_f_i_dn", smp_fetch_ssl_x_i_dn, ARG2(0,STR,SINT), NULL, SMP_T_STR, SMP_USE_L5CLI },
{ "ssl_f_key_alg", smp_fetch_ssl_x_key_alg, 0, NULL, SMP_T_STR, SMP_USE_L5CLI }, { "ssl_f_key_alg", smp_fetch_ssl_x_key_alg, 0, NULL, SMP_T_STR, SMP_USE_L5CLI },
@ -5169,9 +5171,9 @@ static struct sample_fetch_kw_list sample_fetch_keywords = {ILH, {
{ "ssl_f_s_dn", smp_fetch_ssl_x_s_dn, ARG2(0,STR,SINT), NULL, SMP_T_STR, SMP_USE_L5CLI }, { "ssl_f_s_dn", smp_fetch_ssl_x_s_dn, ARG2(0,STR,SINT), NULL, SMP_T_STR, SMP_USE_L5CLI },
{ "ssl_f_serial", smp_fetch_ssl_x_serial, 0, NULL, SMP_T_BIN, SMP_USE_L5CLI }, { "ssl_f_serial", smp_fetch_ssl_x_serial, 0, NULL, SMP_T_BIN, SMP_USE_L5CLI },
{ "ssl_f_sha1", smp_fetch_ssl_x_sha1, 0, NULL, SMP_T_BIN, SMP_USE_L5CLI }, { "ssl_f_sha1", smp_fetch_ssl_x_sha1, 0, NULL, SMP_T_BIN, SMP_USE_L5CLI },
{ "ssl_f_version", smp_fetch_ssl_x_version, 0, NULL, SMP_T_UINT, SMP_USE_L5CLI }, { "ssl_f_version", smp_fetch_ssl_x_version, 0, NULL, SMP_T_SINT, SMP_USE_L5CLI },
{ "ssl_fc", smp_fetch_ssl_fc, 0, NULL, SMP_T_BOOL, SMP_USE_L5CLI }, { "ssl_fc", smp_fetch_ssl_fc, 0, NULL, SMP_T_BOOL, SMP_USE_L5CLI },
{ "ssl_fc_alg_keysize", smp_fetch_ssl_fc_alg_keysize, 0, NULL, SMP_T_UINT, SMP_USE_L5CLI }, { "ssl_fc_alg_keysize", smp_fetch_ssl_fc_alg_keysize, 0, NULL, SMP_T_SINT, SMP_USE_L5CLI },
{ "ssl_fc_cipher", smp_fetch_ssl_fc_cipher, 0, NULL, SMP_T_STR, SMP_USE_L5CLI }, { "ssl_fc_cipher", smp_fetch_ssl_fc_cipher, 0, NULL, SMP_T_STR, SMP_USE_L5CLI },
{ "ssl_fc_has_crt", smp_fetch_ssl_fc_has_crt, 0, NULL, SMP_T_BOOL, SMP_USE_L5CLI }, { "ssl_fc_has_crt", smp_fetch_ssl_fc_has_crt, 0, NULL, SMP_T_BOOL, SMP_USE_L5CLI },
{ "ssl_fc_has_sni", smp_fetch_ssl_fc_has_sni, 0, NULL, SMP_T_BOOL, SMP_USE_L5CLI }, { "ssl_fc_has_sni", smp_fetch_ssl_fc_has_sni, 0, NULL, SMP_T_BOOL, SMP_USE_L5CLI },
@ -5184,7 +5186,7 @@ static struct sample_fetch_kw_list sample_fetch_keywords = {ILH, {
#endif #endif
{ "ssl_fc_protocol", smp_fetch_ssl_fc_protocol, 0, NULL, SMP_T_STR, SMP_USE_L5CLI }, { "ssl_fc_protocol", smp_fetch_ssl_fc_protocol, 0, NULL, SMP_T_STR, SMP_USE_L5CLI },
{ "ssl_fc_unique_id", smp_fetch_ssl_fc_unique_id, 0, NULL, SMP_T_BIN, SMP_USE_L5CLI }, { "ssl_fc_unique_id", smp_fetch_ssl_fc_unique_id, 0, NULL, SMP_T_BIN, SMP_USE_L5CLI },
{ "ssl_fc_use_keysize", smp_fetch_ssl_fc_use_keysize, 0, NULL, SMP_T_UINT, SMP_USE_L5CLI }, { "ssl_fc_use_keysize", smp_fetch_ssl_fc_use_keysize, 0, NULL, SMP_T_SINT, SMP_USE_L5CLI },
{ "ssl_fc_session_id", smp_fetch_ssl_fc_session_id, 0, NULL, SMP_T_BIN, SMP_USE_L5CLI }, { "ssl_fc_session_id", smp_fetch_ssl_fc_session_id, 0, NULL, SMP_T_BIN, SMP_USE_L5CLI },
{ "ssl_fc_sni", smp_fetch_ssl_fc_sni, 0, NULL, SMP_T_STR, SMP_USE_L5CLI }, { "ssl_fc_sni", smp_fetch_ssl_fc_sni, 0, NULL, SMP_T_STR, SMP_USE_L5CLI },
{ NULL, NULL, 0, 0, 0 }, { NULL, NULL, 0, 0, 0 },

View File

@ -458,7 +458,8 @@ int stktable_parse_type(char **args, int *myidx, unsigned long *type, size_t *ke
static void *k_int2int(struct sample *smp, union stktable_key_data *kdata, size_t *len) static void *k_int2int(struct sample *smp, union stktable_key_data *kdata, size_t *len)
{ {
return (void *)&smp->data.uint; kdata->integer = smp->data.sint;
return (void *)&kdata->integer;
} }
static void *k_ip2ip(struct sample *smp, union stktable_key_data *kdata, size_t *len) static void *k_ip2ip(struct sample *smp, union stktable_key_data *kdata, size_t *len)
@ -498,7 +499,7 @@ static void *k_ip2int(struct sample *smp, union stktable_key_data *kdata, size_t
static void *k_int2ip(struct sample *smp, union stktable_key_data *kdata, size_t *len) static void *k_int2ip(struct sample *smp, union stktable_key_data *kdata, size_t *len)
{ {
kdata->ip.s_addr = htonl(smp->data.uint); kdata->ip.s_addr = htonl((unsigned int)smp->data.sint);
return (void *)&kdata->ip.s_addr; return (void *)&kdata->ip.s_addr;
} }
@ -560,7 +561,7 @@ static void *k_int2str(struct sample *smp, union stktable_key_data *kdata, size_
{ {
void *key; void *key;
key = (void *)ultoa_r(smp->data.uint, kdata->buf, *len); key = (void *)lltoa_r(smp->data.sint, kdata->buf, *len);
if (!key) if (!key)
return NULL; return NULL;
@ -611,7 +612,6 @@ static sample_to_key_fct sample_to_key[SMP_TYPES][STKTABLE_TYPES] = {
/* table type: IP IPV6 INTEGER STRING BINARY */ /* table type: IP IPV6 INTEGER STRING BINARY */
/* patt. type: ANY */ { k_ip2ip, k_ip2ipv6, k_int2int, k_str2str, k_str2str }, /* patt. type: ANY */ { k_ip2ip, k_ip2ipv6, k_int2int, k_str2str, k_str2str },
/* BOOL */ { NULL, NULL, k_int2int, k_int2str, NULL }, /* BOOL */ { NULL, NULL, k_int2int, k_int2str, NULL },
/* UINT */ { k_int2ip, NULL, k_int2int, k_int2str, NULL },
/* SINT */ { k_int2ip, NULL, k_int2int, k_int2str, NULL }, /* SINT */ { k_int2ip, NULL, k_int2int, k_int2str, NULL },
/* ADDR */ { k_ip2ip, k_ip2ipv6, k_ip2int, k_ip2str, NULL }, /* ADDR */ { k_ip2ip, k_ip2ipv6, k_ip2int, k_ip2str, NULL },
/* IPV4 */ { k_ip2ip, k_ip2ipv6, k_ip2int, k_ip2str, k_ip2bin }, /* IPV4 */ { k_ip2ip, k_ip2ipv6, k_ip2int, k_ip2str, k_ip2bin },
@ -812,7 +812,7 @@ static int sample_conv_in_table(const struct arg *arg_p, struct sample *smp, voi
ts = stktable_lookup_key(t, key); ts = stktable_lookup_key(t, key);
smp->type = SMP_T_BOOL; smp->type = SMP_T_BOOL;
smp->data.uint = !!ts; smp->data.sint = !!ts;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
return 1; return 1;
} }
@ -837,8 +837,8 @@ static int sample_conv_table_bytes_in_rate(const struct arg *arg_p, struct sampl
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
ts = stktable_lookup_key(t, key); ts = stktable_lookup_key(t, key);
if (!ts) /* key not present */ if (!ts) /* key not present */
@ -848,7 +848,7 @@ static int sample_conv_table_bytes_in_rate(const struct arg *arg_p, struct sampl
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_in_rate), smp->data.sint = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_in_rate),
t->data_arg[STKTABLE_DT_BYTES_IN_RATE].u); t->data_arg[STKTABLE_DT_BYTES_IN_RATE].u);
return 1; return 1;
} }
@ -873,8 +873,8 @@ static int sample_conv_table_conn_cnt(const struct arg *arg_p, struct sample *sm
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
ts = stktable_lookup_key(t, key); ts = stktable_lookup_key(t, key);
if (!ts) /* key not present */ if (!ts) /* key not present */
@ -884,7 +884,7 @@ static int sample_conv_table_conn_cnt(const struct arg *arg_p, struct sample *sm
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = stktable_data_cast(ptr, conn_cnt); smp->data.sint = stktable_data_cast(ptr, conn_cnt);
return 1; return 1;
} }
@ -908,8 +908,8 @@ static int sample_conv_table_conn_cur(const struct arg *arg_p, struct sample *sm
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
ts = stktable_lookup_key(t, key); ts = stktable_lookup_key(t, key);
if (!ts) /* key not present */ if (!ts) /* key not present */
@ -919,7 +919,7 @@ static int sample_conv_table_conn_cur(const struct arg *arg_p, struct sample *sm
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = stktable_data_cast(ptr, conn_cur); smp->data.sint = stktable_data_cast(ptr, conn_cur);
return 1; return 1;
} }
@ -943,8 +943,8 @@ static int sample_conv_table_conn_rate(const struct arg *arg_p, struct sample *s
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
ts = stktable_lookup_key(t, key); ts = stktable_lookup_key(t, key);
if (!ts) /* key not present */ if (!ts) /* key not present */
@ -954,7 +954,7 @@ static int sample_conv_table_conn_rate(const struct arg *arg_p, struct sample *s
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, conn_rate), smp->data.sint = read_freq_ctr_period(&stktable_data_cast(ptr, conn_rate),
t->data_arg[STKTABLE_DT_CONN_RATE].u); t->data_arg[STKTABLE_DT_CONN_RATE].u);
return 1; return 1;
} }
@ -979,8 +979,8 @@ static int sample_conv_table_bytes_out_rate(const struct arg *arg_p, struct samp
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
ts = stktable_lookup_key(t, key); ts = stktable_lookup_key(t, key);
if (!ts) /* key not present */ if (!ts) /* key not present */
@ -990,7 +990,7 @@ static int sample_conv_table_bytes_out_rate(const struct arg *arg_p, struct samp
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_out_rate), smp->data.sint = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_out_rate),
t->data_arg[STKTABLE_DT_BYTES_OUT_RATE].u); t->data_arg[STKTABLE_DT_BYTES_OUT_RATE].u);
return 1; return 1;
} }
@ -1015,8 +1015,8 @@ static int sample_conv_table_gpc0(const struct arg *arg_p, struct sample *smp, v
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
ts = stktable_lookup_key(t, key); ts = stktable_lookup_key(t, key);
if (!ts) /* key not present */ if (!ts) /* key not present */
@ -1026,7 +1026,7 @@ static int sample_conv_table_gpc0(const struct arg *arg_p, struct sample *smp, v
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = stktable_data_cast(ptr, gpc0); smp->data.sint = stktable_data_cast(ptr, gpc0);
return 1; return 1;
} }
@ -1050,8 +1050,8 @@ static int sample_conv_table_gpc0_rate(const struct arg *arg_p, struct sample *s
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
ts = stktable_lookup_key(t, key); ts = stktable_lookup_key(t, key);
if (!ts) /* key not present */ if (!ts) /* key not present */
@ -1061,7 +1061,7 @@ static int sample_conv_table_gpc0_rate(const struct arg *arg_p, struct sample *s
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, gpc0_rate), smp->data.sint = read_freq_ctr_period(&stktable_data_cast(ptr, gpc0_rate),
t->data_arg[STKTABLE_DT_GPC0_RATE].u); t->data_arg[STKTABLE_DT_GPC0_RATE].u);
return 1; return 1;
} }
@ -1086,8 +1086,8 @@ static int sample_conv_table_http_err_cnt(const struct arg *arg_p, struct sample
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
ts = stktable_lookup_key(t, key); ts = stktable_lookup_key(t, key);
if (!ts) /* key not present */ if (!ts) /* key not present */
@ -1097,7 +1097,7 @@ static int sample_conv_table_http_err_cnt(const struct arg *arg_p, struct sample
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = stktable_data_cast(ptr, http_err_cnt); smp->data.sint = stktable_data_cast(ptr, http_err_cnt);
return 1; return 1;
} }
@ -1121,8 +1121,8 @@ static int sample_conv_table_http_err_rate(const struct arg *arg_p, struct sampl
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
ts = stktable_lookup_key(t, key); ts = stktable_lookup_key(t, key);
if (!ts) /* key not present */ if (!ts) /* key not present */
@ -1132,7 +1132,7 @@ static int sample_conv_table_http_err_rate(const struct arg *arg_p, struct sampl
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, http_err_rate), smp->data.sint = read_freq_ctr_period(&stktable_data_cast(ptr, http_err_rate),
t->data_arg[STKTABLE_DT_HTTP_ERR_RATE].u); t->data_arg[STKTABLE_DT_HTTP_ERR_RATE].u);
return 1; return 1;
} }
@ -1157,8 +1157,8 @@ static int sample_conv_table_http_req_cnt(const struct arg *arg_p, struct sample
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
ts = stktable_lookup_key(t, key); ts = stktable_lookup_key(t, key);
if (!ts) /* key not present */ if (!ts) /* key not present */
@ -1168,7 +1168,7 @@ static int sample_conv_table_http_req_cnt(const struct arg *arg_p, struct sample
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = stktable_data_cast(ptr, http_req_cnt); smp->data.sint = stktable_data_cast(ptr, http_req_cnt);
return 1; return 1;
} }
@ -1192,8 +1192,8 @@ static int sample_conv_table_http_req_rate(const struct arg *arg_p, struct sampl
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
ts = stktable_lookup_key(t, key); ts = stktable_lookup_key(t, key);
if (!ts) /* key not present */ if (!ts) /* key not present */
@ -1203,7 +1203,7 @@ static int sample_conv_table_http_req_rate(const struct arg *arg_p, struct sampl
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, http_req_rate), smp->data.sint = read_freq_ctr_period(&stktable_data_cast(ptr, http_req_rate),
t->data_arg[STKTABLE_DT_HTTP_REQ_RATE].u); t->data_arg[STKTABLE_DT_HTTP_REQ_RATE].u);
return 1; return 1;
} }
@ -1228,8 +1228,8 @@ static int sample_conv_table_kbytes_in(const struct arg *arg_p, struct sample *s
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
ts = stktable_lookup_key(t, key); ts = stktable_lookup_key(t, key);
if (!ts) /* key not present */ if (!ts) /* key not present */
@ -1239,7 +1239,7 @@ static int sample_conv_table_kbytes_in(const struct arg *arg_p, struct sample *s
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = stktable_data_cast(ptr, bytes_in_cnt) >> 10; smp->data.sint = stktable_data_cast(ptr, bytes_in_cnt) >> 10;
return 1; return 1;
} }
@ -1263,8 +1263,8 @@ static int sample_conv_table_kbytes_out(const struct arg *arg_p, struct sample *
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
ts = stktable_lookup_key(t, key); ts = stktable_lookup_key(t, key);
if (!ts) /* key not present */ if (!ts) /* key not present */
@ -1274,7 +1274,7 @@ static int sample_conv_table_kbytes_out(const struct arg *arg_p, struct sample *
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = stktable_data_cast(ptr, bytes_out_cnt) >> 10; smp->data.sint = stktable_data_cast(ptr, bytes_out_cnt) >> 10;
return 1; return 1;
} }
@ -1298,8 +1298,8 @@ static int sample_conv_table_server_id(const struct arg *arg_p, struct sample *s
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
ts = stktable_lookup_key(t, key); ts = stktable_lookup_key(t, key);
if (!ts) /* key not present */ if (!ts) /* key not present */
@ -1309,7 +1309,7 @@ static int sample_conv_table_server_id(const struct arg *arg_p, struct sample *s
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = stktable_data_cast(ptr, server_id); smp->data.sint = stktable_data_cast(ptr, server_id);
return 1; return 1;
} }
@ -1333,8 +1333,8 @@ static int sample_conv_table_sess_cnt(const struct arg *arg_p, struct sample *sm
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
ts = stktable_lookup_key(t, key); ts = stktable_lookup_key(t, key);
if (!ts) /* key not present */ if (!ts) /* key not present */
@ -1344,7 +1344,7 @@ static int sample_conv_table_sess_cnt(const struct arg *arg_p, struct sample *sm
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = stktable_data_cast(ptr, sess_cnt); smp->data.sint = stktable_data_cast(ptr, sess_cnt);
return 1; return 1;
} }
@ -1368,8 +1368,8 @@ static int sample_conv_table_sess_rate(const struct arg *arg_p, struct sample *s
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
ts = stktable_lookup_key(t, key); ts = stktable_lookup_key(t, key);
if (!ts) /* key not present */ if (!ts) /* key not present */
@ -1379,7 +1379,7 @@ static int sample_conv_table_sess_rate(const struct arg *arg_p, struct sample *s
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, sess_rate), smp->data.sint = read_freq_ctr_period(&stktable_data_cast(ptr, sess_rate),
t->data_arg[STKTABLE_DT_SESS_RATE].u); t->data_arg[STKTABLE_DT_SESS_RATE].u);
return 1; return 1;
} }
@ -1403,12 +1403,12 @@ static int sample_conv_table_trackers(const struct arg *arg_p, struct sample *sm
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
ts = stktable_lookup_key(t, key); ts = stktable_lookup_key(t, key);
if (ts) if (ts)
smp->data.uint = ts->ref_cnt; smp->data.sint = ts->ref_cnt;
return 1; return 1;
} }
@ -1417,23 +1417,23 @@ static int sample_conv_table_trackers(const struct arg *arg_p, struct sample *sm
/* Note: must not be declared <const> as its list will be overwritten */ /* Note: must not be declared <const> as its list will be overwritten */
static struct sample_conv_kw_list sample_conv_kws = {ILH, { static struct sample_conv_kw_list sample_conv_kws = {ILH, {
{ "in_table", sample_conv_in_table, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_BOOL }, { "in_table", sample_conv_in_table, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_BOOL },
{ "table_bytes_in_rate", sample_conv_table_bytes_in_rate, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_UINT }, { "table_bytes_in_rate", sample_conv_table_bytes_in_rate, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_SINT },
{ "table_bytes_out_rate", sample_conv_table_bytes_out_rate, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_UINT }, { "table_bytes_out_rate", sample_conv_table_bytes_out_rate, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_SINT },
{ "table_conn_cnt", sample_conv_table_conn_cnt, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_UINT }, { "table_conn_cnt", sample_conv_table_conn_cnt, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_SINT },
{ "table_conn_cur", sample_conv_table_conn_cur, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_UINT }, { "table_conn_cur", sample_conv_table_conn_cur, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_SINT },
{ "table_conn_rate", sample_conv_table_conn_rate, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_UINT }, { "table_conn_rate", sample_conv_table_conn_rate, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_SINT },
{ "table_gpc0", sample_conv_table_gpc0, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_UINT }, { "table_gpc0", sample_conv_table_gpc0, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_SINT },
{ "table_gpc0_rate", sample_conv_table_gpc0_rate, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_UINT }, { "table_gpc0_rate", sample_conv_table_gpc0_rate, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_SINT },
{ "table_http_err_cnt", sample_conv_table_http_err_cnt, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_UINT }, { "table_http_err_cnt", sample_conv_table_http_err_cnt, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_SINT },
{ "table_http_err_rate", sample_conv_table_http_err_rate, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_UINT }, { "table_http_err_rate", sample_conv_table_http_err_rate, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_SINT },
{ "table_http_req_cnt", sample_conv_table_http_req_cnt, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_UINT }, { "table_http_req_cnt", sample_conv_table_http_req_cnt, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_SINT },
{ "table_http_req_rate", sample_conv_table_http_req_rate, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_UINT }, { "table_http_req_rate", sample_conv_table_http_req_rate, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_SINT },
{ "table_kbytes_in", sample_conv_table_kbytes_in, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_UINT }, { "table_kbytes_in", sample_conv_table_kbytes_in, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_SINT },
{ "table_kbytes_out", sample_conv_table_kbytes_out, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_UINT }, { "table_kbytes_out", sample_conv_table_kbytes_out, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_SINT },
{ "table_server_id", sample_conv_table_server_id, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_UINT }, { "table_server_id", sample_conv_table_server_id, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_SINT },
{ "table_sess_cnt", sample_conv_table_sess_cnt, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_UINT }, { "table_sess_cnt", sample_conv_table_sess_cnt, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_SINT },
{ "table_sess_rate", sample_conv_table_sess_rate, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_UINT }, { "table_sess_rate", sample_conv_table_sess_rate, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_SINT },
{ "table_trackers", sample_conv_table_trackers, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_UINT }, { "table_trackers", sample_conv_table_trackers, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_SINT },
{ /* END */ }, { /* END */ },
}}; }};

View File

@ -2637,7 +2637,7 @@ smp_fetch_sc_tracked(const struct arg *args, struct sample *smp, const char *kw,
{ {
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_BOOL; smp->type = SMP_T_BOOL;
smp->data.uint = !!smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw); smp->data.sint = !!smp_fetch_sc_stkctr(smp->sess, smp->strm, args, kw);
return 1; return 1;
} }
@ -2655,14 +2655,14 @@ smp_fetch_sc_get_gpc0(const struct arg *args, struct sample *smp, const char *kw
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
if (stkctr_entry(stkctr) != NULL) { if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_GPC0); void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_GPC0);
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = stktable_data_cast(ptr, gpc0); smp->data.sint = stktable_data_cast(ptr, gpc0);
} }
return 1; return 1;
} }
@ -2681,13 +2681,13 @@ smp_fetch_sc_gpc0_rate(const struct arg *args, struct sample *smp, const char *k
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
if (stkctr_entry(stkctr) != NULL) { if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_GPC0_RATE); void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_GPC0_RATE);
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, gpc0_rate), smp->data.sint = 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; return 1;
@ -2706,8 +2706,8 @@ smp_fetch_sc_inc_gpc0(const struct arg *args, struct sample *smp, const char *kw
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
if (stkctr_entry(stkctr) != NULL) { if (stkctr_entry(stkctr) != NULL) {
void *ptr1,*ptr2; void *ptr1,*ptr2;
@ -2718,12 +2718,12 @@ smp_fetch_sc_inc_gpc0(const struct arg *args, struct sample *smp, const char *kw
if (ptr1) { if (ptr1) {
update_freq_ctr_period(&stktable_data_cast(ptr1, gpc0_rate), update_freq_ctr_period(&stktable_data_cast(ptr1, gpc0_rate),
stkctr->table->data_arg[STKTABLE_DT_GPC0_RATE].u, 1); stkctr->table->data_arg[STKTABLE_DT_GPC0_RATE].u, 1);
smp->data.uint = (&stktable_data_cast(ptr1, gpc0_rate))->curr_ctr; smp->data.sint = (&stktable_data_cast(ptr1, gpc0_rate))->curr_ctr;
} }
ptr2 = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_GPC0); ptr2 = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_GPC0);
if (ptr2) if (ptr2)
smp->data.uint = ++stktable_data_cast(ptr2, gpc0); smp->data.sint = ++stktable_data_cast(ptr2, gpc0);
/* If data was modified, we need to touch to re-schedule sync */ /* If data was modified, we need to touch to re-schedule sync */
if (ptr1 || ptr2) if (ptr1 || ptr2)
@ -2745,13 +2745,13 @@ smp_fetch_sc_clr_gpc0(const struct arg *args, struct sample *smp, const char *kw
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
if (stkctr_entry(stkctr) != NULL) { if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_GPC0); void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_GPC0);
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = stktable_data_cast(ptr, gpc0); smp->data.sint = stktable_data_cast(ptr, gpc0);
stktable_data_cast(ptr, gpc0) = 0; stktable_data_cast(ptr, gpc0) = 0;
/* If data was modified, we need to touch to re-schedule sync */ /* If data was modified, we need to touch to re-schedule sync */
stktable_touch(stkctr->table, stkctr_entry(stkctr), 1); stktable_touch(stkctr->table, stkctr_entry(stkctr), 1);
@ -2772,13 +2772,13 @@ smp_fetch_sc_conn_cnt(const struct arg *args, struct sample *smp, const char *kw
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
if (stkctr_entry(stkctr) != NULL) { if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_CONN_CNT); void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_CONN_CNT);
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = stktable_data_cast(ptr, conn_cnt); smp->data.sint = stktable_data_cast(ptr, conn_cnt);
} }
return 1; return 1;
} }
@ -2796,13 +2796,13 @@ smp_fetch_sc_conn_rate(const struct arg *args, struct sample *smp, const char *k
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
if (stkctr_entry(stkctr) != NULL) { if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_CONN_RATE); void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_CONN_RATE);
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, conn_rate), smp->data.sint = read_freq_ctr_period(&stktable_data_cast(ptr, conn_rate),
stkctr->table->data_arg[STKTABLE_DT_CONN_RATE].u); stkctr->table->data_arg[STKTABLE_DT_CONN_RATE].u);
} }
return 1; return 1;
@ -2838,8 +2838,8 @@ smp_fetch_src_updt_conn_cnt(const struct arg *args, struct sample *smp, const ch
if (!ptr) if (!ptr)
return 0; /* parameter not stored in this table */ return 0; /* parameter not stored in this table */
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = ++stktable_data_cast(ptr, conn_cnt); smp->data.sint = ++stktable_data_cast(ptr, conn_cnt);
/* Touch was previously performed by stktable_update_key */ /* Touch was previously performed by stktable_update_key */
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
return 1; return 1;
@ -2858,13 +2858,13 @@ smp_fetch_sc_conn_cur(const struct arg *args, struct sample *smp, const char *kw
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
if (stkctr_entry(stkctr) != NULL) { if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_CONN_CUR); void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_CONN_CUR);
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = stktable_data_cast(ptr, conn_cur); smp->data.sint = stktable_data_cast(ptr, conn_cur);
} }
return 1; return 1;
} }
@ -2882,13 +2882,13 @@ smp_fetch_sc_sess_cnt(const struct arg *args, struct sample *smp, const char *kw
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
if (stkctr_entry(stkctr) != NULL) { if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_SESS_CNT); void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_SESS_CNT);
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = stktable_data_cast(ptr, sess_cnt); smp->data.sint = stktable_data_cast(ptr, sess_cnt);
} }
return 1; return 1;
} }
@ -2905,13 +2905,13 @@ smp_fetch_sc_sess_rate(const struct arg *args, struct sample *smp, const char *k
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
if (stkctr_entry(stkctr) != NULL) { if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_SESS_RATE); void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_SESS_RATE);
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, sess_rate), smp->data.sint = read_freq_ctr_period(&stktable_data_cast(ptr, sess_rate),
stkctr->table->data_arg[STKTABLE_DT_SESS_RATE].u); stkctr->table->data_arg[STKTABLE_DT_SESS_RATE].u);
} }
return 1; return 1;
@ -2930,13 +2930,13 @@ smp_fetch_sc_http_req_cnt(const struct arg *args, struct sample *smp, const char
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
if (stkctr_entry(stkctr) != NULL) { if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_HTTP_REQ_CNT); void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_HTTP_REQ_CNT);
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = stktable_data_cast(ptr, http_req_cnt); smp->data.sint = stktable_data_cast(ptr, http_req_cnt);
} }
return 1; return 1;
} }
@ -2954,13 +2954,13 @@ smp_fetch_sc_http_req_rate(const struct arg *args, struct sample *smp, const cha
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
if (stkctr_entry(stkctr) != NULL) { if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_HTTP_REQ_RATE); void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_HTTP_REQ_RATE);
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, http_req_rate), smp->data.sint = read_freq_ctr_period(&stktable_data_cast(ptr, http_req_rate),
stkctr->table->data_arg[STKTABLE_DT_HTTP_REQ_RATE].u); stkctr->table->data_arg[STKTABLE_DT_HTTP_REQ_RATE].u);
} }
return 1; return 1;
@ -2979,13 +2979,13 @@ smp_fetch_sc_http_err_cnt(const struct arg *args, struct sample *smp, const char
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
if (stkctr_entry(stkctr) != NULL) { if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_HTTP_ERR_CNT); void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_HTTP_ERR_CNT);
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = stktable_data_cast(ptr, http_err_cnt); smp->data.sint = stktable_data_cast(ptr, http_err_cnt);
} }
return 1; return 1;
} }
@ -3003,13 +3003,13 @@ smp_fetch_sc_http_err_rate(const struct arg *args, struct sample *smp, const cha
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
if (stkctr_entry(stkctr) != NULL) { if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_HTTP_ERR_RATE); void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_HTTP_ERR_RATE);
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, http_err_rate), smp->data.sint = read_freq_ctr_period(&stktable_data_cast(ptr, http_err_rate),
stkctr->table->data_arg[STKTABLE_DT_HTTP_ERR_RATE].u); stkctr->table->data_arg[STKTABLE_DT_HTTP_ERR_RATE].u);
} }
return 1; return 1;
@ -3028,13 +3028,13 @@ smp_fetch_sc_kbytes_in(const struct arg *args, struct sample *smp, const char *k
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
if (stkctr_entry(stkctr) != NULL) { if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_BYTES_IN_CNT); void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_BYTES_IN_CNT);
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = stktable_data_cast(ptr, bytes_in_cnt) >> 10; smp->data.sint = stktable_data_cast(ptr, bytes_in_cnt) >> 10;
} }
return 1; return 1;
} }
@ -3052,13 +3052,13 @@ smp_fetch_sc_bytes_in_rate(const struct arg *args, struct sample *smp, const cha
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
if (stkctr_entry(stkctr) != NULL) { if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_BYTES_IN_RATE); void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_BYTES_IN_RATE);
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_in_rate), smp->data.sint = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_in_rate),
stkctr->table->data_arg[STKTABLE_DT_BYTES_IN_RATE].u); stkctr->table->data_arg[STKTABLE_DT_BYTES_IN_RATE].u);
} }
return 1; return 1;
@ -3077,13 +3077,13 @@ smp_fetch_sc_kbytes_out(const struct arg *args, struct sample *smp, const char *
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
if (stkctr_entry(stkctr) != NULL) { if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_BYTES_OUT_CNT); void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_BYTES_OUT_CNT);
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = stktable_data_cast(ptr, bytes_out_cnt) >> 10; smp->data.sint = stktable_data_cast(ptr, bytes_out_cnt) >> 10;
} }
return 1; return 1;
} }
@ -3101,13 +3101,13 @@ smp_fetch_sc_bytes_out_rate(const struct arg *args, struct sample *smp, const ch
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = 0; smp->data.sint = 0;
if (stkctr_entry(stkctr) != NULL) { if (stkctr_entry(stkctr) != NULL) {
void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_BYTES_OUT_RATE); void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_BYTES_OUT_RATE);
if (!ptr) if (!ptr)
return 0; /* parameter not stored */ return 0; /* parameter not stored */
smp->data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_out_rate), smp->data.sint = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_out_rate),
stkctr->table->data_arg[STKTABLE_DT_BYTES_OUT_RATE].u); stkctr->table->data_arg[STKTABLE_DT_BYTES_OUT_RATE].u);
} }
return 1; return 1;
@ -3125,8 +3125,8 @@ smp_fetch_sc_trackers(const struct arg *args, struct sample *smp, const char *kw
return 0; return 0;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = stkctr_entry(stkctr)->ref_cnt; smp->data.sint = stkctr_entry(stkctr)->ref_cnt;
return 1; return 1;
} }
@ -3137,8 +3137,8 @@ static int
smp_fetch_table_cnt(const struct arg *args, struct sample *smp, const char *kw, void *private) smp_fetch_table_cnt(const struct arg *args, struct sample *smp, const char *kw, void *private)
{ {
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = args->data.prx->table.current; smp->data.sint = args->data.prx->table.current;
return 1; return 1;
} }
@ -3152,8 +3152,8 @@ smp_fetch_table_avl(const struct arg *args, struct sample *smp, const char *kw,
px = args->data.prx; px = args->data.prx;
smp->flags = SMP_F_VOL_TEST; smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_UINT; smp->type = SMP_T_SINT;
smp->data.uint = px->table.size - px->table.current; smp->data.sint = px->table.size - px->table.current;
return 1; return 1;
} }
@ -3168,102 +3168,102 @@ static struct acl_kw_list acl_kws = {ILH, {
* Please take care of keeping this list alphabetically sorted. * Please take care of keeping this list alphabetically sorted.
*/ */
static struct sample_fetch_kw_list smp_fetch_keywords = {ILH, { static struct sample_fetch_kw_list smp_fetch_keywords = {ILH, {
{ "sc_bytes_in_rate", smp_fetch_sc_bytes_in_rate, ARG2(1,UINT,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc_bytes_in_rate", smp_fetch_sc_bytes_in_rate, ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc_bytes_out_rate", smp_fetch_sc_bytes_out_rate, ARG2(1,UINT,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc_bytes_out_rate", smp_fetch_sc_bytes_out_rate, ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc_clr_gpc0", smp_fetch_sc_clr_gpc0, ARG2(1,UINT,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc_clr_gpc0", smp_fetch_sc_clr_gpc0, ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc_conn_cnt", smp_fetch_sc_conn_cnt, ARG2(1,UINT,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc_conn_cnt", smp_fetch_sc_conn_cnt, ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc_conn_cur", smp_fetch_sc_conn_cur, ARG2(1,UINT,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc_conn_cur", smp_fetch_sc_conn_cur, ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc_conn_rate", smp_fetch_sc_conn_rate, ARG2(1,UINT,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc_conn_rate", smp_fetch_sc_conn_rate, ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc_get_gpc0", smp_fetch_sc_get_gpc0, ARG2(1,UINT,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc_get_gpc0", smp_fetch_sc_get_gpc0, ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc_gpc0_rate", smp_fetch_sc_gpc0_rate, ARG2(1,UINT,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc_gpc0_rate", smp_fetch_sc_gpc0_rate, ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc_http_err_cnt", smp_fetch_sc_http_err_cnt, ARG2(1,UINT,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc_http_err_cnt", smp_fetch_sc_http_err_cnt, ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc_http_err_rate", smp_fetch_sc_http_err_rate, ARG2(1,UINT,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc_http_err_rate", smp_fetch_sc_http_err_rate, ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc_http_req_cnt", smp_fetch_sc_http_req_cnt, ARG2(1,UINT,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc_http_req_cnt", smp_fetch_sc_http_req_cnt, ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc_http_req_rate", smp_fetch_sc_http_req_rate, ARG2(1,UINT,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc_http_req_rate", smp_fetch_sc_http_req_rate, ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc_inc_gpc0", smp_fetch_sc_inc_gpc0, ARG2(1,UINT,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc_inc_gpc0", smp_fetch_sc_inc_gpc0, ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc_kbytes_in", smp_fetch_sc_kbytes_in, ARG2(1,UINT,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, { "sc_kbytes_in", smp_fetch_sc_kbytes_in, ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
{ "sc_kbytes_out", smp_fetch_sc_kbytes_out, ARG2(1,UINT,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, { "sc_kbytes_out", smp_fetch_sc_kbytes_out, ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
{ "sc_sess_cnt", smp_fetch_sc_sess_cnt, ARG2(1,UINT,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc_sess_cnt", smp_fetch_sc_sess_cnt, ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc_sess_rate", smp_fetch_sc_sess_rate, ARG2(1,UINT,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc_sess_rate", smp_fetch_sc_sess_rate, ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc_tracked", smp_fetch_sc_tracked, ARG2(1,UINT,TAB), NULL, SMP_T_BOOL, SMP_USE_INTRN, }, { "sc_tracked", smp_fetch_sc_tracked, ARG2(1,UINT,TAB), NULL, SMP_T_BOOL, SMP_USE_INTRN, },
{ "sc_trackers", smp_fetch_sc_trackers, ARG2(1,UINT,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc_trackers", smp_fetch_sc_trackers, ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc0_bytes_in_rate", smp_fetch_sc_bytes_in_rate, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc0_bytes_in_rate", smp_fetch_sc_bytes_in_rate, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc0_bytes_out_rate", smp_fetch_sc_bytes_out_rate, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc0_bytes_out_rate", smp_fetch_sc_bytes_out_rate, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc0_clr_gpc0", smp_fetch_sc_clr_gpc0, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc0_clr_gpc0", smp_fetch_sc_clr_gpc0, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc0_conn_cnt", smp_fetch_sc_conn_cnt, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc0_conn_cnt", smp_fetch_sc_conn_cnt, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc0_conn_cur", smp_fetch_sc_conn_cur, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc0_conn_cur", smp_fetch_sc_conn_cur, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc0_conn_rate", smp_fetch_sc_conn_rate, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc0_conn_rate", smp_fetch_sc_conn_rate, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc0_get_gpc0", smp_fetch_sc_get_gpc0, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc0_get_gpc0", smp_fetch_sc_get_gpc0, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc0_gpc0_rate", smp_fetch_sc_gpc0_rate, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc0_gpc0_rate", smp_fetch_sc_gpc0_rate, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc0_http_err_cnt", smp_fetch_sc_http_err_cnt, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc0_http_err_cnt", smp_fetch_sc_http_err_cnt, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc0_http_err_rate", smp_fetch_sc_http_err_rate, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc0_http_err_rate", smp_fetch_sc_http_err_rate, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc0_http_req_cnt", smp_fetch_sc_http_req_cnt, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc0_http_req_cnt", smp_fetch_sc_http_req_cnt, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc0_http_req_rate", smp_fetch_sc_http_req_rate, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc0_http_req_rate", smp_fetch_sc_http_req_rate, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc0_inc_gpc0", smp_fetch_sc_inc_gpc0, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc0_inc_gpc0", smp_fetch_sc_inc_gpc0, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc0_kbytes_in", smp_fetch_sc_kbytes_in, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, { "sc0_kbytes_in", smp_fetch_sc_kbytes_in, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
{ "sc0_kbytes_out", smp_fetch_sc_kbytes_out, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, { "sc0_kbytes_out", smp_fetch_sc_kbytes_out, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
{ "sc0_sess_cnt", smp_fetch_sc_sess_cnt, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc0_sess_cnt", smp_fetch_sc_sess_cnt, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc0_sess_rate", smp_fetch_sc_sess_rate, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc0_sess_rate", smp_fetch_sc_sess_rate, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc0_tracked", smp_fetch_sc_tracked, ARG1(0,TAB), NULL, SMP_T_BOOL, SMP_USE_INTRN, }, { "sc0_tracked", smp_fetch_sc_tracked, ARG1(0,TAB), NULL, SMP_T_BOOL, SMP_USE_INTRN, },
{ "sc0_trackers", smp_fetch_sc_trackers, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc0_trackers", smp_fetch_sc_trackers, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc1_bytes_in_rate", smp_fetch_sc_bytes_in_rate, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc1_bytes_in_rate", smp_fetch_sc_bytes_in_rate, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc1_bytes_out_rate", smp_fetch_sc_bytes_out_rate, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc1_bytes_out_rate", smp_fetch_sc_bytes_out_rate, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc1_clr_gpc0", smp_fetch_sc_clr_gpc0, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc1_clr_gpc0", smp_fetch_sc_clr_gpc0, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc1_conn_cnt", smp_fetch_sc_conn_cnt, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc1_conn_cnt", smp_fetch_sc_conn_cnt, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc1_conn_cur", smp_fetch_sc_conn_cur, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc1_conn_cur", smp_fetch_sc_conn_cur, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc1_conn_rate", smp_fetch_sc_conn_rate, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc1_conn_rate", smp_fetch_sc_conn_rate, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc1_get_gpc0", smp_fetch_sc_get_gpc0, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc1_get_gpc0", smp_fetch_sc_get_gpc0, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc1_gpc0_rate", smp_fetch_sc_gpc0_rate, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc1_gpc0_rate", smp_fetch_sc_gpc0_rate, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc1_http_err_cnt", smp_fetch_sc_http_err_cnt, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc1_http_err_cnt", smp_fetch_sc_http_err_cnt, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc1_http_err_rate", smp_fetch_sc_http_err_rate, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc1_http_err_rate", smp_fetch_sc_http_err_rate, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc1_http_req_cnt", smp_fetch_sc_http_req_cnt, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc1_http_req_cnt", smp_fetch_sc_http_req_cnt, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc1_http_req_rate", smp_fetch_sc_http_req_rate, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc1_http_req_rate", smp_fetch_sc_http_req_rate, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc1_inc_gpc0", smp_fetch_sc_inc_gpc0, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc1_inc_gpc0", smp_fetch_sc_inc_gpc0, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc1_kbytes_in", smp_fetch_sc_kbytes_in, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, { "sc1_kbytes_in", smp_fetch_sc_kbytes_in, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
{ "sc1_kbytes_out", smp_fetch_sc_kbytes_out, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, { "sc1_kbytes_out", smp_fetch_sc_kbytes_out, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
{ "sc1_sess_cnt", smp_fetch_sc_sess_cnt, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc1_sess_cnt", smp_fetch_sc_sess_cnt, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc1_sess_rate", smp_fetch_sc_sess_rate, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc1_sess_rate", smp_fetch_sc_sess_rate, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc1_tracked", smp_fetch_sc_tracked, ARG1(0,TAB), NULL, SMP_T_BOOL, SMP_USE_INTRN, }, { "sc1_tracked", smp_fetch_sc_tracked, ARG1(0,TAB), NULL, SMP_T_BOOL, SMP_USE_INTRN, },
{ "sc1_trackers", smp_fetch_sc_trackers, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc1_trackers", smp_fetch_sc_trackers, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc2_bytes_in_rate", smp_fetch_sc_bytes_in_rate, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc2_bytes_in_rate", smp_fetch_sc_bytes_in_rate, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc2_bytes_out_rate", smp_fetch_sc_bytes_out_rate, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc2_bytes_out_rate", smp_fetch_sc_bytes_out_rate, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc2_clr_gpc0", smp_fetch_sc_clr_gpc0, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc2_clr_gpc0", smp_fetch_sc_clr_gpc0, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc2_conn_cnt", smp_fetch_sc_conn_cnt, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc2_conn_cnt", smp_fetch_sc_conn_cnt, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc2_conn_cur", smp_fetch_sc_conn_cur, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc2_conn_cur", smp_fetch_sc_conn_cur, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc2_conn_rate", smp_fetch_sc_conn_rate, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc2_conn_rate", smp_fetch_sc_conn_rate, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc2_get_gpc0", smp_fetch_sc_get_gpc0, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc2_get_gpc0", smp_fetch_sc_get_gpc0, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc2_gpc0_rate", smp_fetch_sc_gpc0_rate, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc2_gpc0_rate", smp_fetch_sc_gpc0_rate, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc2_http_err_cnt", smp_fetch_sc_http_err_cnt, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc2_http_err_cnt", smp_fetch_sc_http_err_cnt, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc2_http_err_rate", smp_fetch_sc_http_err_rate, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc2_http_err_rate", smp_fetch_sc_http_err_rate, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc2_http_req_cnt", smp_fetch_sc_http_req_cnt, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc2_http_req_cnt", smp_fetch_sc_http_req_cnt, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc2_http_req_rate", smp_fetch_sc_http_req_rate, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc2_http_req_rate", smp_fetch_sc_http_req_rate, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc2_inc_gpc0", smp_fetch_sc_inc_gpc0, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc2_inc_gpc0", smp_fetch_sc_inc_gpc0, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc2_kbytes_in", smp_fetch_sc_kbytes_in, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, { "sc2_kbytes_in", smp_fetch_sc_kbytes_in, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
{ "sc2_kbytes_out", smp_fetch_sc_kbytes_out, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, { "sc2_kbytes_out", smp_fetch_sc_kbytes_out, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
{ "sc2_sess_cnt", smp_fetch_sc_sess_cnt, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc2_sess_cnt", smp_fetch_sc_sess_cnt, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc2_sess_rate", smp_fetch_sc_sess_rate, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc2_sess_rate", smp_fetch_sc_sess_rate, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "sc2_tracked", smp_fetch_sc_tracked, ARG1(0,TAB), NULL, SMP_T_BOOL, SMP_USE_INTRN, }, { "sc2_tracked", smp_fetch_sc_tracked, ARG1(0,TAB), NULL, SMP_T_BOOL, SMP_USE_INTRN, },
{ "sc2_trackers", smp_fetch_sc_trackers, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "sc2_trackers", smp_fetch_sc_trackers, ARG1(0,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "src_bytes_in_rate", smp_fetch_sc_bytes_in_rate, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, { "src_bytes_in_rate", smp_fetch_sc_bytes_in_rate, ARG1(1,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
{ "src_bytes_out_rate", smp_fetch_sc_bytes_out_rate, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, { "src_bytes_out_rate", smp_fetch_sc_bytes_out_rate, ARG1(1,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
{ "src_clr_gpc0", smp_fetch_sc_clr_gpc0, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, { "src_clr_gpc0", smp_fetch_sc_clr_gpc0, ARG1(1,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
{ "src_conn_cnt", smp_fetch_sc_conn_cnt, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, { "src_conn_cnt", smp_fetch_sc_conn_cnt, ARG1(1,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
{ "src_conn_cur", smp_fetch_sc_conn_cur, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, { "src_conn_cur", smp_fetch_sc_conn_cur, ARG1(1,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
{ "src_conn_rate", smp_fetch_sc_conn_rate, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, { "src_conn_rate", smp_fetch_sc_conn_rate, ARG1(1,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
{ "src_get_gpc0", smp_fetch_sc_get_gpc0, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, { "src_get_gpc0", smp_fetch_sc_get_gpc0, ARG1(1,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
{ "src_gpc0_rate", smp_fetch_sc_gpc0_rate, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, { "src_gpc0_rate", smp_fetch_sc_gpc0_rate, ARG1(1,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
{ "src_http_err_cnt", smp_fetch_sc_http_err_cnt, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, { "src_http_err_cnt", smp_fetch_sc_http_err_cnt, ARG1(1,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
{ "src_http_err_rate", smp_fetch_sc_http_err_rate, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, { "src_http_err_rate", smp_fetch_sc_http_err_rate, ARG1(1,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
{ "src_http_req_cnt", smp_fetch_sc_http_req_cnt, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, { "src_http_req_cnt", smp_fetch_sc_http_req_cnt, ARG1(1,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
{ "src_http_req_rate", smp_fetch_sc_http_req_rate, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, { "src_http_req_rate", smp_fetch_sc_http_req_rate, ARG1(1,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
{ "src_inc_gpc0", smp_fetch_sc_inc_gpc0, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, { "src_inc_gpc0", smp_fetch_sc_inc_gpc0, ARG1(1,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
{ "src_kbytes_in", smp_fetch_sc_kbytes_in, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, { "src_kbytes_in", smp_fetch_sc_kbytes_in, ARG1(1,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
{ "src_kbytes_out", smp_fetch_sc_kbytes_out, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, { "src_kbytes_out", smp_fetch_sc_kbytes_out, ARG1(1,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
{ "src_sess_cnt", smp_fetch_sc_sess_cnt, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, { "src_sess_cnt", smp_fetch_sc_sess_cnt, ARG1(1,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
{ "src_sess_rate", smp_fetch_sc_sess_rate, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, { "src_sess_rate", smp_fetch_sc_sess_rate, ARG1(1,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
{ "src_updt_conn_cnt", smp_fetch_src_updt_conn_cnt, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, { "src_updt_conn_cnt", smp_fetch_src_updt_conn_cnt, ARG1(1,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
{ "table_avl", smp_fetch_table_avl, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "table_avl", smp_fetch_table_avl, ARG1(1,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ "table_cnt", smp_fetch_table_cnt, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, { "table_cnt", smp_fetch_table_cnt, ARG1(1,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
{ /* END */ }, { /* END */ },
}}; }};

View File

@ -298,7 +298,6 @@ static int sample_store(struct vars *vars, const char *name, struct stream *strm
/* Copy data. If the data needs memory, the function can fail. */ /* Copy data. If the data needs memory, the function can fail. */
switch (var->data.type) { switch (var->data.type) {
case SMP_T_BOOL: case SMP_T_BOOL:
case SMP_T_UINT:
case SMP_T_SINT: case SMP_T_SINT:
var->data.data.sint = smp->data.sint; var->data.data.sint = smp->data.sint;
break; break;