diff --git a/doc/configuration.txt b/doc/configuration.txt index 7c90ff4fe..2782c2046 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -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 : add() - Adds to the input value of type unsigned integer, and returns the - result as an unsigned integer. + Adds to the input value of type signed integer, and returns the + result as a signed integer. and() - Performs a bitwise "AND" between and the input value of type unsigned - integer, and returns the result as an unsigned integer. + Performs a bitwise "AND" between and the input value of type signed + integer, and returns the result as an signed integer. base64 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). 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 used to report true/false for bit testing on input values (eg: verify the presence of a flag). @@ -11054,8 +11054,8 @@ bytes([,]) optionnaly truncated at the given length. cpl - Takes the input value of type unsigned integer, applies a twos-complement - (flips all bits) and returns the result as an unsigned integer. + Takes the input value of type signed integer, applies a ones-complement + (flips all bits) and returns the result as an signed integer. 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. div() - Divides the input value of type unsigned integer by , and returns the - result as an unsigned integer. If is null, the largest unsigned - integer is returned (typically 2^32-1). + Divides the input value of type signed integer by , and returns the + result as an signed integer. If is null, the largest unsigned + integer is returned (typically 2^63-1). djb2([]) Hashes a binary input sample into an unsigned 32-bit quantity using the DJB2 @@ -11106,7 +11106,7 @@ djb2([]) "hash-type" directive. 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". field(,) @@ -11285,33 +11285,33 @@ map__([,]) `------------------------------------ leading spaces ignored mod() - Divides the input value of type unsigned integer by , and returns the - remainder as an unsigned integer. If is null, then zero is returned. + Divides the input value of type signed integer by , and returns the + remainder as an signed integer. If is null, then zero is returned. mul() - Multiplies the input value of type unsigned integer by , and returns - the product as an unsigned integer. In case of overflow, the higher bits are + Multiplies the input value of type signed integer by , and returns + the product as an signed integer. In case of overflow, the higher bits are lost, leading to seemingly strange values. neg - Takes the input value of type unsigned integer, computes the opposite value, - and returns the remainder as an unsigned integer. 0 is identity. This - operator is provided for reversed subtracts : in order to subtract the input - from a constant, simply perform a "neg,add(value)". + Takes the input value of type signed integer, computes the opposite value, + and returns the remainder as an signed integer. 0 is identity. This operator + is provided for reversed subtracts : in order to subtract the input from a + constant, simply perform a "neg,add(value)". 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 used to report true/false for bit testing on input values (eg: verify the absence of a flag). 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". or() - Performs a bitwise "OR" between and the input value of type unsigned - integer, and returns the result as an unsigned integer. + Performs a bitwise "OR" between and the input value of type signed + integer, and returns the result as an signed integer. regsub(,[,]) Applies a regex-based substitution to the input string. It does the same @@ -11375,8 +11375,8 @@ set-var() contain characters 'a-z', 'A-Z', '0-9' and '_'. sub() - Subtracts from the input value of type unsigned integer, and returns - the result as an unsigned integer. Note: in order to subtract the input from + Subtracts from the input value of type signed integer, and returns + the result as an signed integer. Note: in order to subtract the input from a constant, simply perform a "neg,add(value)". table_bytes_in_rate() @@ -11558,7 +11558,7 @@ wt6([]) xor() Performs a bitwise "XOR" (exclusive OR) between 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 @@ -11709,6 +11709,9 @@ fe_sess_rate([]) : integer tcp-request content accept if ! too_fast tcp-request content accept if WAIT_END +int() : signed integer + Returns a signed integer. + ipv4() : ipv4 Returns an ipv4. @@ -11753,9 +11756,6 @@ rand([]) : integer needed to take some routing decisions for example, or just for debugging purposes. This random must not be used for security purposes. -sint() : signed integer - Returns a signed integer. - srv_conn([/]) : integer Returns an integer value corresponding to the number of currently established connections on the designated server, possibly including the connection being @@ -11806,9 +11806,6 @@ table_cnt([
]) : integer stick-table or in the designated stick-table. See also src_conn_cnt and table_avl for other entry counting methods. -uint() : unsigned integer - Returns an unsigned integer. - var() : undefined 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 diff --git a/include/types/sample.h b/include/types/sample.h index 22dfe599d..8f67cfb32 100644 --- a/include/types/sample.h +++ b/include/types/sample.h @@ -36,8 +36,7 @@ struct arg; enum { SMP_T_ANY = 0, /* any type */ SMP_T_BOOL, /* boolean */ - SMP_T_UINT, /* unsigned 32bits integer type */ - SMP_T_SINT, /* signed 32bits integer type */ + SMP_T_SINT, /* signed 64bits integer type */ SMP_T_ADDR, /* ipv4 or ipv6, only used for input type compatibility */ SMP_T_IPV4, /* ipv4 type */ SMP_T_IPV6, /* ipv6 type */ @@ -237,8 +236,7 @@ struct sample { unsigned int flags; /* SMP_F_* */ int type; /* SMP_T_* */ union { - unsigned int uint; /* used for unsigned 32bits integers and booleans */ - int sint; /* used for signed 32bits integers */ + long long int sint; /* used for signed 64bits integers */ struct in_addr ipv4; /* used for ipv4 addresses */ struct in6_addr ipv6; /* used for ipv6 addresses */ struct chunk str; /* used for char strings or buffers */ @@ -261,8 +259,7 @@ struct sample { struct sample_storage { int type; /* SMP_T_* */ union { - unsigned int uint; /* used for unsigned 32bits integers and booleans */ - int sint; /* used for signed 32bits integers */ + long long int sint; /* used for signed 64bits integers */ struct in_addr ipv4; /* used for ipv4 addresses */ struct in6_addr ipv6; /* used for ipv6 addresses */ struct chunk str; /* used for char strings or buffers */ diff --git a/src/acl.c b/src/acl.c index d51bd9976..2ee4d5096 100644 --- a/src/acl.c +++ b/src/acl.c @@ -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]; break; case SMP_T_SINT: - case SMP_T_UINT: expr->pat.parse = pat_parse_fcts[PAT_MATCH_INT]; expr->pat.index = pat_index_fcts[PAT_MATCH_INT]; expr->pat.match = pat_match_fcts[PAT_MATCH_INT]; diff --git a/src/backend.c b/src/backend.c index 48c5e79d3..35ff17545 100644 --- a/src/backend.c +++ b/src/backend.c @@ -1525,15 +1525,15 @@ smp_fetch_nbsrv(const struct arg *args, struct sample *smp, const char *kw, void struct proxy *px; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; + smp->type = SMP_T_SINT; px = args->data.prx; if (px->srv_act) - smp->data.uint = px->srv_act; + smp->data.sint = px->srv_act; else if (px->lbprm.fbck) - smp->data.uint = 1; + smp->data.sint = 1; else - smp->data.uint = px->srv_bck; + smp->data.sint = px->srv_bck; 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; if (!(srv->admin & SRV_ADMF_MAINT) && (!(srv->check.state & CHK_ST_CONFIGURED) || (srv->state != SRV_ST_STOPPED))) - smp->data.uint = 1; + smp->data.sint = 1; else - smp->data.uint = 0; + smp->data.sint = 0; return 1; } @@ -1568,8 +1568,8 @@ smp_fetch_connslots(const struct arg *args, struct sample *smp, const char *kw, struct server *iterator; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; for (iterator = args->data.prx->srv; iterator; iterator = iterator->next) { 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) { /* configuration is stupid */ - smp->data.uint = -1; /* FIXME: stupid value! */ + smp->data.sint = -1; /* FIXME: stupid value! */ return 1; } - smp->data.uint += (iterator->maxconn - iterator->cur_sess) + smp->data.sint += (iterator->maxconn - iterator->cur_sess) + (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->flags = SMP_F_VOL_TXN; - smp->type = SMP_T_UINT; - smp->data.uint = smp->strm->be->uuid; + smp->type = SMP_T_SINT; + smp->data.sint = smp->strm->be->uuid; 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)) return 0; - smp->type = SMP_T_UINT; - smp->data.uint = objt_server(smp->strm->target)->puid; + smp->type = SMP_T_SINT; + smp->data.sint = objt_server(smp->strm->target)->puid; 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->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = read_freq_ctr(&args->data.prx->be_sess_per_sec); + smp->type = SMP_T_SINT; + smp->data.sint = read_freq_ctr(&args->data.prx->be_sess_per_sec); 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->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = args->data.prx->beconn; + smp->type = SMP_T_SINT; + smp->data.sint = args->data.prx->beconn; 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->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = args->data.prx->totpend; + smp->type = SMP_T_SINT; + smp->data.sint = args->data.prx->totpend; return 1; } @@ -1665,7 +1665,7 @@ smp_fetch_avg_queue_size(const struct arg *args, struct sample *smp, const char struct proxy *px; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; + smp->type = SMP_T_SINT; px = args->data.prx; 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; if (nbsrv > 0) - smp->data.uint = (px->totpend + nbsrv - 1) / nbsrv; + smp->data.sint = (px->totpend + nbsrv - 1) / nbsrv; else - smp->data.uint = px->totpend * 2; + smp->data.sint = px->totpend * 2; 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->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = args->data.srv->cur_sess; + smp->type = SMP_T_SINT; + smp->data.sint = args->data.srv->cur_sess; 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->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = read_freq_ctr(&args->data.srv->sess_per_sec); + smp->type = SMP_T_SINT; + smp->data.sint = read_freq_ctr(&args->data.srv->sess_per_sec); 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. */ 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, }, - { "be_conn", smp_fetch_be_conn, ARG1(1,BE), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "be_id", smp_fetch_be_id, 0, NULL, SMP_T_UINT, SMP_USE_BKEND, }, - { "be_sess_rate", smp_fetch_be_sess_rate, ARG1(1,BE), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "connslots", smp_fetch_connslots, ARG1(1,BE), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "nbsrv", smp_fetch_nbsrv, ARG1(1,BE), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "queue", smp_fetch_queue_size, ARG1(1,BE), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "srv_conn", smp_fetch_srv_conn, ARG1(1,SRV), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "srv_id", smp_fetch_srv_id, 0, NULL, SMP_T_UINT, SMP_USE_SERVR, }, + { "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_SINT, SMP_USE_INTRN, }, + { "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_SINT, 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_SINT, 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_SINT, SMP_USE_INTRN, }, + { "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_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 */ }, }}; diff --git a/src/compression.c b/src/compression.c index e8f13bbb0..ec5ab33b9 100644 --- a/src/compression.c +++ b/src/compression.c @@ -841,7 +841,7 @@ static int smp_fetch_res_comp(const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->type = SMP_T_BOOL; - smp->data.uint = (smp->strm->comp_algo != NULL); + smp->data.sint = (smp->strm->comp_algo != NULL); return 1; } diff --git a/src/frontend.c b/src/frontend.c index efd6383b4..83e842564 100644 --- a/src/frontend.c +++ b/src/frontend.c @@ -162,8 +162,8 @@ static int smp_fetch_fe_id(const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->flags = SMP_F_VOL_SESS; - smp->type = SMP_T_UINT; - smp->data.uint = smp->sess->fe->uuid; + smp->type = SMP_T_SINT; + smp->data.sint = smp->sess->fe->uuid; 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->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = read_freq_ctr(&args->data.prx->fe_sess_per_sec); + smp->type = SMP_T_SINT; + smp->data.sint = read_freq_ctr(&args->data.prx->fe_sess_per_sec); 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->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = args->data.prx->feconn; + smp->type = SMP_T_SINT; + smp->data.sint = args->data.prx->feconn; 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. */ 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_id", smp_fetch_fe_id, 0, NULL, SMP_T_UINT, SMP_USE_FTEND, }, - { "fe_sess_rate", smp_fetch_fe_sess_rate, 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_SINT, SMP_USE_FTEND, }, + { "fe_sess_rate", smp_fetch_fe_sess_rate, ARG1(1,FE), NULL, SMP_T_SINT, SMP_USE_INTRN, }, { /* END */ }, }}; diff --git a/src/hlua.c b/src/hlua.c index a5df204e0..34e14e87d 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -389,7 +389,6 @@ static int hlua_smp2lua(lua_State *L, struct sample *smp) switch (smp->type) { case SMP_T_SINT: case SMP_T_BOOL: - case SMP_T_UINT: lua_pushinteger(L, smp->data.sint); break; @@ -467,7 +466,6 @@ static int hlua_smp2lua_str(lua_State *L, struct sample *smp) case SMP_T_SINT: case SMP_T_BOOL: - case SMP_T_UINT: case SMP_T_IPV4: case SMP_T_IPV6: 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: smp->type = SMP_T_BOOL; - smp->data.uint = lua_toboolean(L, ud); + smp->data.sint = lua_toboolean(L, ud); break; case LUA_TSTRING: @@ -516,7 +514,7 @@ static int hlua_lua2smp(lua_State *L, int ud, struct sample *smp) case LUA_TTHREAD: case LUA_TLIGHTUSERDATA: smp->type = SMP_T_BOOL; - smp->data.uint = 0; + smp->data.sint = 0; break; } 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_END: 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; default: 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")); desc = MAY_LJMP(hlua_checkmap(L, 1)); - if (desc->pat.expect_type == SMP_T_UINT) { - smp.type = SMP_T_UINT; - smp.data.uint = MAY_LJMP(luaL_checkinteger(L, 2)); + if (desc->pat.expect_type == SMP_T_SINT) { + smp.type = SMP_T_SINT; + smp.data.sint = MAY_LJMP(luaL_checkinteger(L, 2)); } else { smp.type = SMP_T_STR; diff --git a/src/listener.c b/src/listener.c index 4d070317c..254907c95 100644 --- a/src/listener.c +++ b/src/listener.c @@ -593,8 +593,8 @@ void bind_dump_kws(char **out) static int smp_fetch_dconn(const struct arg *args, struct sample *smp, const char *kw, void *private) { - smp->type = SMP_T_UINT; - smp->data.uint = smp->sess->listener->nbconn; + smp->type = SMP_T_SINT; + smp->data.sint = smp->sess->listener->nbconn; return 1; } @@ -602,8 +602,8 @@ smp_fetch_dconn(const struct arg *args, struct sample *smp, const char *kw, void static int smp_fetch_so_id(const struct arg *args, struct sample *smp, const char *kw, void *private) { - smp->type = SMP_T_UINT; - smp->data.uint = smp->sess->listener->luid; + smp->type = SMP_T_SINT; + smp->data.sint = smp->sess->listener->luid; 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. */ static struct sample_fetch_kw_list smp_kws = {ILH, { - { "dst_conn", smp_fetch_dconn, 0, NULL, SMP_T_UINT, SMP_USE_FTEND, }, - { "so_id", smp_fetch_so_id, 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_SINT, SMP_USE_FTEND, }, { /* END */ }, }}; diff --git a/src/map.c b/src/map.c index a75605c7c..be33c2cc2 100644 --- a/src/map.c +++ b/src/map.c @@ -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) { - long long int value; - char *error; - - /* parse interger and convert it. Return the value in 64 format. */ - value = strtoll(text, &error, 10); - if (*error != '\0') + smp->type = SMP_T_SINT; + smp->data.sint = read_int64(&text, text + strlen(text)); + if (*text != '\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; } @@ -143,7 +125,7 @@ int sample_load_map(struct arg *arg, struct sample_conv *conv, /* Set the output parse method. */ switch (desc->conv->out_type) { 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_IPV6: desc->pat.parse_smp = map_parse_ip6; break; 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. */ - smp->type = SMP_T_UINT; - smp->data.uint= 1; + smp->type = SMP_T_SINT; + smp->data.sint = 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; break; - case SMP_T_UINT: - smp->type = SMP_T_UINT; - smp->data.uint = arg_p[1].data.uint; + case SMP_T_SINT: + smp->type = SMP_T_SINT; + smp->data.sint = arg_p[1].data.uint; break; 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_end", sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR, SMP_T_STR, (void *)PAT_MATCH_END }, { "map_reg", sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_STR, SMP_T_STR, (void *)PAT_MATCH_REG }, - { "map_int", sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_UINT, SMP_T_STR, (void *)PAT_MATCH_INT }, + { "map_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_str_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_STR, SMP_T_UINT, (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_sub_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_STR, SMP_T_UINT, (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_dom_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_STR, SMP_T_UINT, (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_reg_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_STR, SMP_T_UINT, (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_ip_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_ADDR, SMP_T_UINT, (void *)PAT_MATCH_IP }, + { "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_SINT, (void *)PAT_MATCH_BEG }, + { "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_SINT, (void *)PAT_MATCH_DIR }, + { "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_SINT, (void *)PAT_MATCH_END }, + { "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_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_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_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_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_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 }, { /* END */ }, diff --git a/src/pattern.c b/src/pattern.c index 9626c6537..7691b935b 100644 --- a/src/pattern.c +++ b/src/pattern.c @@ -125,9 +125,9 @@ struct pattern *(*pat_match_fcts[PAT_MATCH_NUM])(struct sample *, struct pattern /* Just used for checking configuration compatibility */ int pat_match_types[PAT_MATCH_NUM] = { - [PAT_MATCH_FOUND] = SMP_T_UINT, - [PAT_MATCH_BOOL] = SMP_T_UINT, - [PAT_MATCH_INT] = SMP_T_UINT, + [PAT_MATCH_FOUND] = SMP_T_SINT, + [PAT_MATCH_BOOL] = SMP_T_SINT, + [PAT_MATCH_INT] = SMP_T_SINT, [PAT_MATCH_IP] = SMP_T_ADDR, [PAT_MATCH_BIN] = SMP_T_BIN, [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; - pattern->type = SMP_T_UINT; + pattern->type = SMP_T_SINT; /* Empty string is not valid */ if (!*text) @@ -332,7 +332,7 @@ int pat_parse_dotted_ver(const char *text, struct pattern *pattern, int mflags, { const char *ptr = text; - pattern->type = SMP_T_UINT; + pattern->type = SMP_T_SINT; /* Search ':' or '-' separator. */ 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 */ struct pattern *pat_match_nothing(struct sample *smp, struct pattern_expr *expr, int fill) { - if (smp->data.uint) { + if (smp->data.sint) { if (fill) { static_pattern.smp = 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) { pattern = &lst->pat; - if ((!pattern->val.range.min_set || pattern->val.range.min <= smp->data.uint) && - (!pattern->val.range.max_set || smp->data.uint <= pattern->val.range.max)) + if ((!pattern->val.range.min_set || pattern->val.range.min <= smp->data.sint) && + (!pattern->val.range.max_set || smp->data.sint <= pattern->val.range.max)) return pattern; } return NULL; @@ -2337,7 +2337,7 @@ struct pattern *pattern_exec_match(struct pattern_head *head, struct sample *smp static_pattern.smp = NULL; static_pattern.ref = NULL; static_pattern.sflags = 0; - static_pattern.type = SMP_T_UINT; + static_pattern.type = SMP_T_SINT; static_pattern.val.i = 1; } return &static_pattern; diff --git a/src/payload.c b/src/payload.c index 852727a63..c81c0b42e 100644 --- a/src/payload.c +++ b/src/payload.c @@ -36,7 +36,7 @@ smp_fetch_wait_end(const struct arg *args, struct sample *smp, const char *kw, v return 0; } smp->type = SMP_T_BOOL; - smp->data.uint = 1; + smp->data.sint = 1; return 1; } @@ -50,8 +50,8 @@ smp_fetch_len(const struct arg *args, struct sample *smp, const char *kw, void * if (!chn->buf) return 0; - smp->type = SMP_T_UINT; - smp->data.uint = chn->buf->i; + smp->type = SMP_T_SINT; + smp->data.sint = chn->buf->i; smp->flags = SMP_F_VOLATILE | SMP_F_MAY_CHANGE; return 1; } @@ -160,7 +160,7 @@ smp_fetch_req_ssl_ec_ext(const struct arg *args, struct sample *smp, const char /* Elliptic curves extension */ if (ext_type == 10) { smp->type = SMP_T_BOOL; - smp->data.uint = 1; + smp->data.sint = 1; smp->flags = SMP_F_VOLATILE; return 1; } @@ -224,8 +224,8 @@ smp_fetch_ssl_hello_type(const struct arg *args, struct sample *smp, const char goto not_ssl_hello; } - smp->type = SMP_T_UINT; - smp->data.uint = hs_type; + smp->type = SMP_T_SINT; + smp->data.sint = hs_type; smp->flags = SMP_F_VOLATILE; 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 * the protocol version. */ - smp->type = SMP_T_UINT; - smp->data.uint = version; + smp->type = SMP_T_SINT; + smp->data.sint = version; smp->flags = SMP_F_VOLATILE; return 1; @@ -628,8 +628,8 @@ smp_fetch_rdp_cookie_cnt(const struct arg *args, struct sample *smp, const char return 0; smp->flags = SMP_F_VOLATILE; - smp->type = SMP_T_UINT; - smp->data.uint = ret; + smp->type = SMP_T_SINT; + smp->data.sint = ret; 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, { { "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_cnt", smp_fetch_rdp_cookie_cnt, ARG1(0,STR), NULL, SMP_T_UINT, SMP_USE_L6REQ }, - { "rep_ssl_hello_type", smp_fetch_ssl_hello_type, 0, NULL, SMP_T_UINT, SMP_USE_L6RES }, - { "req_len", smp_fetch_len, 0, NULL, SMP_T_UINT, SMP_USE_L6REQ }, - { "req_ssl_hello_type", smp_fetch_ssl_hello_type, 0, 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_SINT, SMP_USE_L6RES }, + { "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_SINT, 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_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_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_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_ver", smp_fetch_req_ssl_ver, 0, NULL, SMP_T_UINT, SMP_USE_L6REQ }, - { "res.len", smp_fetch_len, 0, NULL, SMP_T_UINT, SMP_USE_L6RES }, + { "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_SINT, 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.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 }, { /* END */ }, }}; diff --git a/src/proto_http.c b/src/proto_http.c index 69ad908de..c35e6a1ef 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -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 > s->req.buf->data + s->req.buf->size - global.tune.maxrewrite)) { msg->msg_state = HTTP_MSG_ERROR; - smp->data.uint = 1; + smp->data.sint = 1; return 1; } @@ -10249,7 +10249,7 @@ smp_prefetch_http(struct proxy *px, struct stream *s, unsigned int opt, } /* everything's OK */ - smp->data.uint = 1; + smp->data.sint = 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; ptr = txn->rsp.chn->buf->p + txn->rsp.sl.st.c; - smp->type = SMP_T_UINT; - smp->data.uint = __strl2ui(ptr, len); + smp->type = SMP_T_SINT; + smp->data.sint = __strl2ui(ptr, len); smp->flags = SMP_F_VOL_1ST; return 1; } @@ -10486,8 +10486,8 @@ smp_fetch_body_len(const struct arg *args, struct sample *smp, const char *kw, v else msg = &txn->rsp; - smp->type = SMP_T_UINT; - smp->data.uint = http_body_bytes(msg); + smp->type = SMP_T_SINT; + smp->data.sint = http_body_bytes(msg); smp->flags = SMP_F_VOL_TEST; return 1; @@ -10511,8 +10511,8 @@ smp_fetch_body_size(const struct arg *args, struct sample *smp, const char *kw, else msg = &txn->rsp; - smp->type = SMP_T_UINT; - smp->data.uint = msg->body_len; + smp->type = SMP_T_SINT; + smp->data.sint = msg->body_len; smp->flags = SMP_F_VOL_TEST; 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) return 0; - smp->type = SMP_T_UINT; - smp->data.uint = ntohs(((struct sockaddr_in *)&addr)->sin_port); + smp->type = SMP_T_SINT; + smp->data.sint = ntohs(((struct sockaddr_in *)&addr)->sin_port); smp->flags = 0; 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)) cnt++; - smp->type = SMP_T_UINT; - smp->data.uint = cnt; + smp->type = SMP_T_SINT; + smp->data.sint = cnt; smp->flags = SMP_F_VOL_HDR; 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)) cnt++; - smp->type = SMP_T_UINT; - smp->data.uint = cnt; + smp->type = SMP_T_SINT; + smp->data.sint = cnt; smp->flags = SMP_F_VOL_HDR; 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); if (ret > 0) { - smp->type = SMP_T_UINT; - smp->data.uint = strl2ic(smp->data.str.str, smp->data.str.len); + smp->type = SMP_T_SINT; + smp->data.sint = strl2ic(smp->data.str.str, smp->data.str.len); } return ret; @@ -10963,8 +10963,8 @@ smp_fetch_base32(const struct arg *args, struct sample *smp, const char *kw, voi } hash = full_hash(hash); - smp->type = SMP_T_UINT; - smp->data.uint = hash; + smp->type = SMP_T_SINT; + smp->data.sint = hash; smp->flags = SMP_F_VOL_1ST; return 1; } @@ -10989,7 +10989,7 @@ smp_fetch_base32_src(const struct arg *args, struct sample *smp, const char *kw, return 0; 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); 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(); smp->type = SMP_T_BOOL; - smp->data.uint = 1; + smp->data.sint = 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->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; } @@ -11076,7 +11076,7 @@ smp_fetch_http_auth(const struct arg *args, struct sample *smp, const char *kw, return 0; 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); 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->data.uint = cnt; + smp->type = SMP_T_SINT; + smp->data.sint = cnt; smp->flags |= SMP_F_VOL_HDR; 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); if (ret > 0) { - smp->type = SMP_T_UINT; - smp->data.uint = strl2ic(smp->data.str.str, smp->data.str.len); + smp->type = SMP_T_SINT; + smp->data.sint = strl2ic(smp->data.str.str, smp->data.str.len); } 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); if (ret > 0) { - smp->type = SMP_T_UINT; - smp->data.uint = strl2ic(smp->data.str.str, smp->data.str.len); + smp->type = SMP_T_SINT; + smp->data.sint = strl2ic(smp->data.str.str, smp->data.str.len); } return ret; @@ -12006,8 +12006,8 @@ smp_fetch_url32(const struct arg *args, struct sample *smp, const char *kw, void } hash = full_hash(hash); - smp->type = SMP_T_UINT; - smp->data.uint = hash; + smp->type = SMP_T_SINT; + smp->data.sint = hash; smp->flags = SMP_F_VOL_1ST; return 1; } @@ -12024,13 +12024,17 @@ smp_fetch_url32_src(const struct arg *args, struct sample *smp, const char *kw, { struct chunk *temp; struct connection *cli_conn = objt_conn(smp->sess->origin); + unsigned int hash; if (!smp_fetch_url32(args, smp, kw, private)) return 0; + /* The returned hash is a 32 bytes integer. */ + hash = smp->data.sint; + temp = get_trash_chunk(); - memcpy(temp->str + temp->len, &smp->data.uint, sizeof(smp->data.uint)); - temp->len += sizeof(smp->data.uint); + memcpy(temp->str + temp->len, &hash, sizeof(hash)); + temp->len += sizeof(hash); switch (cli_conn->addr.from.ss_family) { 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" }; struct chunk *temp; struct tm *tm; - time_t curr_date = smp->data.uint; + time_t curr_date = smp->data.sint; /* add offset */ 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 as its list will be overwritten */ static struct sample_fetch_kw_list sample_fetch_keywords = {ILH, { { "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 }, /* 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 }, { "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_val", smp_fetch_cookie_val, 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_SINT, SMP_USE_HRQHV }, /* 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 * ACL compatibility only. */ { "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_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_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.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_size", smp_fetch_body_size, 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_SINT, 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 */ @@ -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 */ { "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_val", smp_fetch_cookie_val, 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_SINT, 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_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_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 */ { "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_val", smp_fetch_cookie_val, 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_SINT, 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_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_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", 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_val", smp_fetch_cookie_val, 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_SINT, SMP_USE_HRSHV }, { "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", 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_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 }, - { "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 }, { "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 }, { "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 */ }, }}; @@ -13117,7 +13121,7 @@ static struct sample_fetch_kw_list sample_fetch_keywords = {ILH, { /************************************************************************/ /* Note: must not be declared as its list will be overwritten */ 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}, { "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}, diff --git a/src/proto_tcp.c b/src/proto_tcp.c index 9f9de9bae..734d469bd 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -2018,8 +2018,8 @@ smp_fetch_sport(const struct arg *args, struct sample *smp, const char *k, void if (!cli_conn) return 0; - smp->type = SMP_T_UINT; - if (!(smp->data.uint = get_host_port(&cli_conn->addr.from))) + smp->type = SMP_T_SINT; + if (!(smp->data.sint = get_host_port(&cli_conn->addr.from))) return 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); - smp->type = SMP_T_UINT; - if (!(smp->data.uint = get_host_port(&cli_conn->addr.to))) + smp->type = SMP_T_SINT; + if (!(smp->data.sint = get_host_port(&cli_conn->addr.to))) return 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, { { "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_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 */ }, }}; diff --git a/src/sample.c b/src/sample.c index 0a09012ad..17e331acc 100644 --- a/src/sample.c +++ b/src/sample.c @@ -36,7 +36,6 @@ const char *smp_to_type[SMP_TYPES] = { [SMP_T_ANY] = "any", [SMP_T_BOOL] = "bool", - [SMP_T_UINT] = "uint", [SMP_T_SINT] = "sint", [SMP_T_ADDR] = "addr", [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) { - smp->data.uint = ntohl(smp->data.ipv4.s_addr); - smp->type = SMP_T_UINT; + smp->data.sint = ntohl(smp->data.ipv4.s_addr); + smp->type = SMP_T_SINT; return 1; } @@ -549,7 +548,7 @@ static int c_ipv62ip(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; return 1; } @@ -608,25 +607,7 @@ static int c_int2str(struct sample *smp) struct chunk *trash = get_trash_chunk(); char *pos; - pos = ultoa_r(smp->data.uint, 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); + pos = lltoa_r(smp->data.sint, trash->str, trash->size); if (!pos) return 0; @@ -652,7 +633,6 @@ int smp_dup(struct sample *smp) switch (smp->type) { case SMP_T_BOOL: - case SMP_T_UINT: case SMP_T_SINT: case SMP_T_ADDR: case SMP_T_IPV4: @@ -684,26 +664,17 @@ int c_none(struct sample *smp) static int c_str2int(struct sample *smp) { - int i; - uint32_t ret = 0; + const char *str; + const char *end; if (smp->data.str.len == 0) return 0; - for (i = 0; i < smp->data.str.len; i++) { - uint32_t val = smp->data.str.str[i] - '0'; + str = smp->data.str.str; + end = smp->data.str.str + smp->data.str.len; - if (val > 9) { - if (i == 0) - return 0; - break; - } - - ret = ret * 10 + val; - } - - smp->data.uint = ret; - smp->type = SMP_T_UINT; + smp->data.sint = read_int64(&str, end); + smp->type = SMP_T_SINT; smp->flags &= ~SMP_F_CONST; return 1; } @@ -777,8 +748,8 @@ static int c_int2bin(struct sample *smp) { struct chunk *chk = get_trash_chunk(); - *(unsigned int *)chk->str = htonl(smp->data.uint); - chk->len = 4; + *(unsigned long long int *)chk->str = htonll(smp->data.sint); + chk->len = 8; smp->data.str = *chk; 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] = { -/* to: ANY BOOL UINT 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, }, -/* BOOL */ { c_none, 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_none, c_int2ip, c_int2ip, NULL, c_sint2str, c_int2bin, NULL, }, -/* ADDR */ { c_none, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 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, NULL, c_none, NULL, c_none, c_ipv62str, c_addr2bin, NULL, }, -/* 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, NULL, c_bin2str, c_none, c_str2meth, }, -/* METH */ { c_none, NULL, NULL, NULL, NULL, NULL, NULL, c_meth2str, c_meth2str, c_none, } +/* 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, }, +/* BOOL */ { c_none, c_none, c_none, NULL, NULL, NULL, c_int2str, NULL, NULL, }, +/* SINT */ { c_none, c_none, c_none, c_int2ip, c_int2ip, NULL, c_int2str, c_int2bin, NULL, }, +/* ADDR */ { c_none, 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, }, +/* IPV6 */ { c_none, 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, }, +/* BIN */ { c_none, 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, } }; /* @@ -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 */ 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) - smp->data.uint = full_hash(smp->data.uint); - smp->type = SMP_T_UINT; + smp->data.sint = full_hash(smp->data.sint); + smp->type = SMP_T_SINT; 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) { struct chunk *temp; - time_t curr_date = smp->data.uint; + time_t curr_date = smp->data.sint; struct tm *tm; /* 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 */ 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) - smp->data.uint = full_hash(smp->data.uint); - smp->type = SMP_T_UINT; + smp->data.sint = full_hash(smp->data.sint); + smp->type = SMP_T_SINT; 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) { struct chunk *temp; - time_t curr_date = smp->data.uint; + time_t curr_date = smp->data.sint; struct tm *tm; /* 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 */ 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) - smp->data.uint = full_hash(smp->data.uint); - smp->type = SMP_T_UINT; + smp->data.sint = full_hash(smp->data.sint); + smp->type = SMP_T_SINT; return 1; } /* 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) { - 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) - smp->data.uint = full_hash(smp->data.uint); - smp->type = SMP_T_UINT; + smp->data.sint = full_hash(smp->data.sint); + smp->type = SMP_T_SINT; return 1; } @@ -2045,149 +2015,149 @@ static int sample_conv_regsub(const struct arg *arg_p, struct sample *smp, void 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. */ 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; } -/* Takes a UINT on input, applies a binary "and" with the UINT in arg_p, and - * returns the UINT result. +/* Takes a SINT on input, applies a binary "and" with the UINT in arg_p, and + * returns the SINT result. */ 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; } -/* Takes a UINT on input, applies a binary "or" with the UINT in arg_p, and - * returns the UINT result. +/* Takes a SINT on input, applies a binary "or" with the UINT in arg_p, and + * returns the SINT result. */ 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; } -/* Takes a UINT on input, applies a binary "xor" with the UINT in arg_p, and - * returns the UINT result. +/* Takes a SINT on input, applies a binary "xor" with the UINT in arg_p, and + * returns the SINT result. */ 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; } -/* Takes a UINT on input, applies an arithmetic "add" with the UINT in arg_p, - * and returns the UINT result. +/* Takes a SINT on input, applies an arithmetic "add" with the UINT in arg_p, + * and returns the SINT result. */ 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; } -/* Takes a UINT on input, applies an arithmetic "sub" with the UINT in arg_p, - * and returns the UINT result. +/* Takes a SINT on input, applies an arithmetic "sub" with the UINT in arg_p, + * and returns the SINT result. */ static int sample_conv_arith_sub(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; } -/* Takes a UINT on input, applies an arithmetic "mul" with the UINT in arg_p, - * and returns the UINT result. +/* Takes a SINT on input, applies an arithmetic "mul" with the UINT in arg_p, + * and returns the SINT result. */ static int sample_conv_arith_mul(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; } -/* Takes a UINT on input, applies an arithmetic "div" with the UINT in arg_p, - * and returns the UINT result. If arg_p makes the result overflow, then the +/* Takes a SINT on input, applies an arithmetic "div" with the SINT in arg_p, + * and returns the SINT result. If arg_p makes the result overflow, then the * largest possible quantity is returned. */ static int sample_conv_arith_div(const struct arg *arg_p, struct sample *smp, void *private) { if (arg_p->data.uint) - smp->data.uint /= arg_p->data.uint; + smp->data.sint /= arg_p->data.uint; else - smp->data.uint = ~0; + smp->data.sint = ~0; return 1; } -/* Takes a UINT on input, applies an arithmetic "mod" with the UINT in arg_p, - * and returns the UINT result. If arg_p makes the result overflow, then zero +/* Takes a SINT on input, applies an arithmetic "mod" with the SINT in arg_p, + * and returns the SINT result. If arg_p makes the result overflow, then zero * is returned. */ static int sample_conv_arith_mod(const struct arg *arg_p, struct sample *smp, void *private) { if (arg_p->data.uint) - smp->data.uint %= arg_p->data.uint; + smp->data.sint %= arg_p->data.uint; else - smp->data.uint = 0; + smp->data.sint = 0; 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. */ static int sample_conv_arith_neg(const struct arg *arg_p, struct sample *smp, void *private) { - smp->data.uint = -smp->data.uint; + smp->data.sint = -smp->data.sint; 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. */ static int sample_conv_arith_bool(const struct arg *arg_p, struct sample *smp, void *private) { - smp->data.uint = !!smp->data.uint; + smp->data.sint = !!smp->data.sint; smp->type = SMP_T_BOOL; 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. */ static int sample_conv_arith_not(const struct arg *arg_p, struct sample *smp, void *private) { - smp->data.uint = !smp->data.uint; + smp->data.sint = !smp->data.sint; smp->type = SMP_T_BOOL; 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. */ static int sample_conv_arith_odd(const struct arg *arg_p, struct sample *smp, void *private) { - smp->data.uint = smp->data.uint & 1; + smp->data.sint = smp->data.sint & 1; smp->type = SMP_T_BOOL; 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. */ static int sample_conv_arith_even(const struct arg *arg_p, struct sample *smp, void *private) { - smp->data.uint = !(smp->data.uint & 1); + smp->data.sint = !(smp->data.sint & 1); smp->type = SMP_T_BOOL; return 1; } @@ -2201,7 +2171,7 @@ static int smp_fetch_true(const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->type = SMP_T_BOOL; - smp->data.uint = 1; + smp->data.sint = 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->type = SMP_T_BOOL; - smp->data.uint = 0; + smp->data.sint = 0; return 1; } @@ -2240,13 +2210,13 @@ smp_fetch_env(const struct arg *args, struct sample *smp, const char *kw, void * static int 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 */ 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; return 1; } @@ -2255,8 +2225,8 @@ smp_fetch_date(const struct arg *args, struct sample *smp, const char *kw, void static int smp_fetch_nbproc(const struct arg *args, struct sample *smp, const char *kw, void *private) { - smp->type = SMP_T_UINT; - smp->data.uint = global.nbproc; + smp->type = SMP_T_SINT; + smp->data.sint = global.nbproc; return 1; } @@ -2264,8 +2234,8 @@ smp_fetch_nbproc(const struct arg *args, struct sample *smp, const char *kw, voi static int smp_fetch_proc(const struct arg *args, struct sample *smp, const char *kw, void *private) { - smp->type = SMP_T_UINT; - smp->data.uint = relative_pid; + smp->type = SMP_T_SINT; + smp->data.sint = relative_pid; return 1; } @@ -2275,13 +2245,13 @@ smp_fetch_proc(const struct arg *args, struct sample *smp, const char *kw, void static int 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! */ 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; return 1; } @@ -2291,7 +2261,7 @@ static int smp_fetch_stopping(const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->type = SMP_T_BOOL; - smp->data.uint = stopping; + smp->data.sint = stopping; 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) { smp->type = SMP_T_BOOL; - smp->data.uint = args[0].data.uint; + smp->data.sint = args[0].data.uint; return 1; } -static int smp_fetch_const_uint(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) +static int smp_fetch_const_int(const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->type = SMP_T_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_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 }, - { "date", smp_fetch_date, ARG1(0,SINT), NULL, SMP_T_UINT, SMP_USE_INTRN }, - { "nbproc", smp_fetch_nbproc,0, NULL, SMP_T_UINT, SMP_USE_INTRN }, - { "proc", smp_fetch_proc, 0, NULL, SMP_T_UINT, SMP_USE_INTRN }, - { "rand", smp_fetch_rand, ARG1(0,UINT), 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_SINT, 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_SINT, 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 }, { "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 }, - { "sint", smp_fetch_const_sint, ARG1(1,SINT), NULL , SMP_T_SINT, SMP_USE_INTRN }, + { "int", smp_fetch_const_int, 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 }, { "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 }, @@ -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 }, { "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 }, - { "ltime", sample_conv_ltime, ARG2(1,STR,SINT), NULL, SMP_T_UINT, SMP_T_STR }, - { "utime", sample_conv_utime, ARG2(1,STR,SINT), NULL, SMP_T_UINT, SMP_T_STR }, - { "crc32", sample_conv_crc32, ARG1(0,UINT), NULL, SMP_T_BIN, SMP_T_UINT }, - { "djb2", sample_conv_djb2, ARG1(0,UINT), NULL, SMP_T_BIN, SMP_T_UINT }, - { "sdbm", sample_conv_sdbm, ARG1(0,UINT), NULL, SMP_T_BIN, SMP_T_UINT }, - { "wt6", sample_conv_wt6, ARG1(0,UINT), NULL, SMP_T_BIN, SMP_T_UINT }, + { "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_SINT, SMP_T_STR }, + { "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_SINT }, + { "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_SINT }, { "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 }, { "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 }, { "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 }, - { "or", sample_conv_binary_or, ARG1(1,UINT), NULL, SMP_T_UINT, SMP_T_UINT }, - { "xor", sample_conv_binary_xor, ARG1(1,UINT), NULL, SMP_T_UINT, SMP_T_UINT }, - { "cpl", sample_conv_binary_cpl, 0, NULL, SMP_T_UINT, SMP_T_UINT }, - { "bool", sample_conv_arith_bool, 0, NULL, SMP_T_UINT, SMP_T_BOOL }, - { "not", sample_conv_arith_not, 0, NULL, SMP_T_UINT, SMP_T_BOOL }, - { "odd", sample_conv_arith_odd, 0, NULL, SMP_T_UINT, SMP_T_BOOL }, - { "even", sample_conv_arith_even, 0, NULL, SMP_T_UINT, SMP_T_BOOL }, - { "add", sample_conv_arith_add, ARG1(1,UINT), NULL, SMP_T_UINT, SMP_T_UINT }, - { "sub", sample_conv_arith_sub, ARG1(1,UINT), NULL, SMP_T_UINT, SMP_T_UINT }, - { "mul", sample_conv_arith_mul, ARG1(1,UINT), NULL, SMP_T_UINT, SMP_T_UINT }, - { "div", sample_conv_arith_div, ARG1(1,UINT), NULL, SMP_T_UINT, SMP_T_UINT }, - { "mod", sample_conv_arith_mod, ARG1(1,UINT), NULL, SMP_T_UINT, SMP_T_UINT }, - { "neg", sample_conv_arith_neg, 0, 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_SINT, SMP_T_SINT }, + { "xor", sample_conv_binary_xor, ARG1(1,UINT), NULL, SMP_T_SINT, SMP_T_SINT }, + { "cpl", sample_conv_binary_cpl, 0, NULL, SMP_T_SINT, SMP_T_SINT }, + { "bool", sample_conv_arith_bool, 0, NULL, SMP_T_SINT, 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_SINT, 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_SINT, SMP_T_SINT }, + { "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_SINT, SMP_T_SINT }, + { "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_SINT, SMP_T_SINT }, + { "neg", sample_conv_arith_neg, 0, NULL, SMP_T_SINT, SMP_T_SINT }, { NULL, NULL, 0, 0, 0 }, }}; diff --git a/src/ssl_sock.c b/src/ssl_sock.c index 4e7554942..520c866e9 100644 --- a/src/ssl_sock.c +++ b/src/ssl_sock.c @@ -3393,7 +3393,7 @@ smp_fetch_ssl_fc_has_crt(const struct arg *args, struct sample *smp, const char smp->flags = 0; 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; } @@ -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->data.uint = (crt != NULL); + smp->data.sint = (crt != NULL); return 1; } @@ -3788,11 +3788,11 @@ smp_fetch_ssl_x_version(const struct arg *args, struct sample *smp, const char * if (!crt) 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 */ if (cert_peer) X509_free(crt); - smp->type = SMP_T_UINT; + smp->type = SMP_T_SINT; 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); smp->type = SMP_T_BOOL; - smp->data.uint = (conn && conn->xprt == &ssl_sock); + smp->data.sint = (conn && conn->xprt == &ssl_sock); 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); smp->type = SMP_T_BOOL; - smp->data.uint = (conn && conn->xprt == &ssl_sock) && + smp->data.sint = (conn && conn->xprt == &ssl_sock) && conn->xprt_ctx && SSL_get_servername(conn->xprt_ctx, TLSEXT_NAMETYPE_host_name) != NULL; 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); smp->type = SMP_T_BOOL; - smp->data.uint = (conn && conn->xprt == &ssl_sock) && + smp->data.sint = (conn && conn->xprt == &ssl_sock) && conn->xprt_ctx && SSL_session_reused(conn->xprt_ctx); 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; struct connection *conn; + int sint; 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) 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; - smp->type = SMP_T_UINT; + smp->data.sint = sint; + smp->type = SMP_T_SINT; 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) return 0; - smp->data.uint = (unsigned int)SSL_get_cipher_bits(conn->xprt_ctx, NULL); - if (!smp->data.uint) + smp->data.sint = (unsigned int)SSL_get_cipher_bits(conn->xprt_ctx, NULL); + if (!smp->data.sint) return 0; - smp->type = SMP_T_UINT; + smp->type = SMP_T_SINT; return 1; } @@ -4200,8 +4202,8 @@ smp_fetch_ssl_c_ca_err(const struct arg *args, struct sample *smp, const char *k return 0; } - smp->type = SMP_T_UINT; - smp->data.uint = (unsigned int)SSL_SOCK_ST_TO_CA_ERROR(conn->xprt_st); + smp->type = SMP_T_SINT; + smp->data.sint = (unsigned long long int)SSL_SOCK_ST_TO_CA_ERROR(conn->xprt_st); smp->flags = 0; return 1; @@ -4222,8 +4224,8 @@ smp_fetch_ssl_c_ca_err_depth(const struct arg *args, struct sample *smp, const c return 0; } - smp->type = SMP_T_UINT; - smp->data.uint = (unsigned int)SSL_SOCK_ST_TO_CAEDEPTH(conn->xprt_st); + smp->type = SMP_T_SINT; + smp->data.sint = (long long int)SSL_SOCK_ST_TO_CAEDEPTH(conn->xprt_st); smp->flags = 0; return 1; @@ -4244,8 +4246,8 @@ smp_fetch_ssl_c_err(const struct arg *args, struct sample *smp, const char *kw, return 0; } - smp->type = SMP_T_UINT; - smp->data.uint = (unsigned int)SSL_SOCK_ST_TO_CRTERROR(conn->xprt_st); + smp->type = SMP_T_SINT; + smp->data.sint = (long long int)SSL_SOCK_ST_TO_CRTERROR(conn->xprt_st); smp->flags = 0; 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) return 0; - smp->type = SMP_T_UINT; - smp->data.uint = (unsigned int)SSL_get_verify_result(conn->xprt_ctx); + smp->type = SMP_T_SINT; + smp->data.sint = (long long int)SSL_get_verify_result(conn->xprt_ctx); smp->flags = 0; 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, { { "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_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_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_c_ca_err", smp_fetch_ssl_c_ca_err, 0, NULL, SMP_T_UINT, 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", 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_SINT, 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_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 }, @@ -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_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_verify", smp_fetch_ssl_c_verify, 0, NULL, SMP_T_UINT, SMP_USE_L5CLI }, - { "ssl_c_version", smp_fetch_ssl_x_version, 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_SINT, 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_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_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_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_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_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 }, @@ -5184,7 +5186,7 @@ static struct sample_fetch_kw_list sample_fetch_keywords = {ILH, { #endif { "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_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_sni", smp_fetch_ssl_fc_sni, 0, NULL, SMP_T_STR, SMP_USE_L5CLI }, { NULL, NULL, 0, 0, 0 }, diff --git a/src/stick_table.c b/src/stick_table.c index 2792960bd..243066e59 100644 --- a/src/stick_table.c +++ b/src/stick_table.c @@ -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) { - 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) @@ -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) { - kdata->ip.s_addr = htonl(smp->data.uint); + kdata->ip.s_addr = htonl((unsigned int)smp->data.sint); 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; - key = (void *)ultoa_r(smp->data.uint, kdata->buf, *len); + key = (void *)lltoa_r(smp->data.sint, kdata->buf, *len); if (!key) 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 */ /* patt. type: ANY */ { k_ip2ip, k_ip2ipv6, k_int2int, k_str2str, k_str2str }, /* 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 }, /* ADDR */ { k_ip2ip, k_ip2ipv6, k_ip2int, k_ip2str, NULL }, /* 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); smp->type = SMP_T_BOOL; - smp->data.uint = !!ts; + smp->data.sint = !!ts; smp->flags = SMP_F_VOL_TEST; return 1; } @@ -837,8 +837,8 @@ static int sample_conv_table_bytes_in_rate(const struct arg *arg_p, struct sampl return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; ts = stktable_lookup_key(t, key); 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) 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); return 1; } @@ -873,8 +873,8 @@ static int sample_conv_table_conn_cnt(const struct arg *arg_p, struct sample *sm return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; ts = stktable_lookup_key(t, key); 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) 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; } @@ -908,8 +908,8 @@ static int sample_conv_table_conn_cur(const struct arg *arg_p, struct sample *sm return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; ts = stktable_lookup_key(t, key); 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) 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; } @@ -943,8 +943,8 @@ static int sample_conv_table_conn_rate(const struct arg *arg_p, struct sample *s return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; ts = stktable_lookup_key(t, key); 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) 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); return 1; } @@ -979,8 +979,8 @@ static int sample_conv_table_bytes_out_rate(const struct arg *arg_p, struct samp return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; ts = stktable_lookup_key(t, key); 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) 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); return 1; } @@ -1015,8 +1015,8 @@ static int sample_conv_table_gpc0(const struct arg *arg_p, struct sample *smp, v return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; ts = stktable_lookup_key(t, key); 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) return 0; /* parameter not stored */ - smp->data.uint = stktable_data_cast(ptr, gpc0); + smp->data.sint = stktable_data_cast(ptr, gpc0); return 1; } @@ -1050,8 +1050,8 @@ static int sample_conv_table_gpc0_rate(const struct arg *arg_p, struct sample *s return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; ts = stktable_lookup_key(t, key); 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) 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); return 1; } @@ -1086,8 +1086,8 @@ static int sample_conv_table_http_err_cnt(const struct arg *arg_p, struct sample return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; ts = stktable_lookup_key(t, key); 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) 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; } @@ -1121,8 +1121,8 @@ static int sample_conv_table_http_err_rate(const struct arg *arg_p, struct sampl return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; ts = stktable_lookup_key(t, key); 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) 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); return 1; } @@ -1157,8 +1157,8 @@ static int sample_conv_table_http_req_cnt(const struct arg *arg_p, struct sample return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; ts = stktable_lookup_key(t, key); 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) 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; } @@ -1192,8 +1192,8 @@ static int sample_conv_table_http_req_rate(const struct arg *arg_p, struct sampl return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; ts = stktable_lookup_key(t, key); 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) 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); return 1; } @@ -1228,8 +1228,8 @@ static int sample_conv_table_kbytes_in(const struct arg *arg_p, struct sample *s return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; ts = stktable_lookup_key(t, key); 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) 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; } @@ -1263,8 +1263,8 @@ static int sample_conv_table_kbytes_out(const struct arg *arg_p, struct sample * return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; ts = stktable_lookup_key(t, key); 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) 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; } @@ -1298,8 +1298,8 @@ static int sample_conv_table_server_id(const struct arg *arg_p, struct sample *s return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; ts = stktable_lookup_key(t, key); 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) 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; } @@ -1333,8 +1333,8 @@ static int sample_conv_table_sess_cnt(const struct arg *arg_p, struct sample *sm return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; ts = stktable_lookup_key(t, key); 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) 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; } @@ -1368,8 +1368,8 @@ static int sample_conv_table_sess_rate(const struct arg *arg_p, struct sample *s return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; ts = stktable_lookup_key(t, key); 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) 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); return 1; } @@ -1403,12 +1403,12 @@ static int sample_conv_table_trackers(const struct arg *arg_p, struct sample *sm return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; ts = stktable_lookup_key(t, key); if (ts) - smp->data.uint = ts->ref_cnt; + smp->data.sint = ts->ref_cnt; 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 as its list will be overwritten */ 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 }, - { "table_bytes_in_rate", sample_conv_table_bytes_in_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_UINT }, - { "table_conn_cnt", sample_conv_table_conn_cnt, 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_UINT }, - { "table_conn_rate", sample_conv_table_conn_rate, 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_UINT }, - { "table_gpc0_rate", sample_conv_table_gpc0_rate, 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_UINT }, - { "table_http_err_rate", sample_conv_table_http_err_rate, 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_UINT }, - { "table_http_req_rate", sample_conv_table_http_req_rate, 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_UINT }, - { "table_kbytes_out", sample_conv_table_kbytes_out, 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_UINT }, - { "table_sess_cnt", sample_conv_table_sess_cnt, 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_UINT }, - { "table_trackers", sample_conv_table_trackers, 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_SINT }, + { "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_SINT }, + { "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_SINT }, + { "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_SINT }, + { "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_SINT }, + { "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_SINT }, + { "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_SINT }, + { "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_SINT }, + { "table_trackers", sample_conv_table_trackers, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_SINT }, { /* END */ }, }}; diff --git a/src/stream.c b/src/stream.c index d7b8e9f5d..baab845e4 100644 --- a/src/stream.c +++ b/src/stream.c @@ -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->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; } @@ -2655,14 +2655,14 @@ smp_fetch_sc_get_gpc0(const struct arg *args, struct sample *smp, const char *kw return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; if (stkctr_entry(stkctr) != NULL) { void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_GPC0); if (!ptr) return 0; /* parameter not stored */ - smp->data.uint = stktable_data_cast(ptr, gpc0); + smp->data.sint = stktable_data_cast(ptr, gpc0); } return 1; } @@ -2681,13 +2681,13 @@ smp_fetch_sc_gpc0_rate(const struct arg *args, struct sample *smp, const char *k return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; if (stkctr_entry(stkctr) != NULL) { void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_GPC0_RATE); if (!ptr) 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); } return 1; @@ -2706,8 +2706,8 @@ smp_fetch_sc_inc_gpc0(const struct arg *args, struct sample *smp, const char *kw return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; if (stkctr_entry(stkctr) != NULL) { void *ptr1,*ptr2; @@ -2718,12 +2718,12 @@ smp_fetch_sc_inc_gpc0(const struct arg *args, struct sample *smp, const char *kw if (ptr1) { update_freq_ctr_period(&stktable_data_cast(ptr1, gpc0_rate), 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); 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 (ptr1 || ptr2) @@ -2745,13 +2745,13 @@ smp_fetch_sc_clr_gpc0(const struct arg *args, struct sample *smp, const char *kw return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; if (stkctr_entry(stkctr) != NULL) { void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_GPC0); if (!ptr) 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; /* If data was modified, we need to touch to re-schedule sync */ 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; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; if (stkctr_entry(stkctr) != NULL) { void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_CONN_CNT); if (!ptr) 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; } @@ -2796,13 +2796,13 @@ smp_fetch_sc_conn_rate(const struct arg *args, struct sample *smp, const char *k return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; if (stkctr_entry(stkctr) != NULL) { void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_CONN_RATE); if (!ptr) 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); } return 1; @@ -2838,8 +2838,8 @@ smp_fetch_src_updt_conn_cnt(const struct arg *args, struct sample *smp, const ch if (!ptr) return 0; /* parameter not stored in this table */ - smp->type = SMP_T_UINT; - smp->data.uint = ++stktable_data_cast(ptr, conn_cnt); + smp->type = SMP_T_SINT; + smp->data.sint = ++stktable_data_cast(ptr, conn_cnt); /* Touch was previously performed by stktable_update_key */ smp->flags = SMP_F_VOL_TEST; return 1; @@ -2858,13 +2858,13 @@ smp_fetch_sc_conn_cur(const struct arg *args, struct sample *smp, const char *kw return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; if (stkctr_entry(stkctr) != NULL) { void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_CONN_CUR); if (!ptr) 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; } @@ -2882,13 +2882,13 @@ smp_fetch_sc_sess_cnt(const struct arg *args, struct sample *smp, const char *kw return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; if (stkctr_entry(stkctr) != NULL) { void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_SESS_CNT); if (!ptr) 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; } @@ -2905,13 +2905,13 @@ smp_fetch_sc_sess_rate(const struct arg *args, struct sample *smp, const char *k return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; if (stkctr_entry(stkctr) != NULL) { void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_SESS_RATE); if (!ptr) 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); } return 1; @@ -2930,13 +2930,13 @@ smp_fetch_sc_http_req_cnt(const struct arg *args, struct sample *smp, const char return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; if (stkctr_entry(stkctr) != NULL) { void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_HTTP_REQ_CNT); if (!ptr) 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; } @@ -2954,13 +2954,13 @@ smp_fetch_sc_http_req_rate(const struct arg *args, struct sample *smp, const cha return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; if (stkctr_entry(stkctr) != NULL) { void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_HTTP_REQ_RATE); if (!ptr) 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); } return 1; @@ -2979,13 +2979,13 @@ smp_fetch_sc_http_err_cnt(const struct arg *args, struct sample *smp, const char return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; if (stkctr_entry(stkctr) != NULL) { void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_HTTP_ERR_CNT); if (!ptr) 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; } @@ -3003,13 +3003,13 @@ smp_fetch_sc_http_err_rate(const struct arg *args, struct sample *smp, const cha return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; if (stkctr_entry(stkctr) != NULL) { void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_HTTP_ERR_RATE); if (!ptr) 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); } return 1; @@ -3028,13 +3028,13 @@ smp_fetch_sc_kbytes_in(const struct arg *args, struct sample *smp, const char *k return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; if (stkctr_entry(stkctr) != NULL) { void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_BYTES_IN_CNT); if (!ptr) 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; } @@ -3052,13 +3052,13 @@ smp_fetch_sc_bytes_in_rate(const struct arg *args, struct sample *smp, const cha return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; if (stkctr_entry(stkctr) != NULL) { void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_BYTES_IN_RATE); if (!ptr) 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); } return 1; @@ -3077,13 +3077,13 @@ smp_fetch_sc_kbytes_out(const struct arg *args, struct sample *smp, const char * return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; if (stkctr_entry(stkctr) != NULL) { void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_BYTES_OUT_CNT); if (!ptr) 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; } @@ -3101,13 +3101,13 @@ smp_fetch_sc_bytes_out_rate(const struct arg *args, struct sample *smp, const ch return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = 0; + smp->type = SMP_T_SINT; + smp->data.sint = 0; if (stkctr_entry(stkctr) != NULL) { void *ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_BYTES_OUT_RATE); if (!ptr) 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); } return 1; @@ -3125,8 +3125,8 @@ smp_fetch_sc_trackers(const struct arg *args, struct sample *smp, const char *kw return 0; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = stkctr_entry(stkctr)->ref_cnt; + smp->type = SMP_T_SINT; + smp->data.sint = stkctr_entry(stkctr)->ref_cnt; 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->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = args->data.prx->table.current; + smp->type = SMP_T_SINT; + smp->data.sint = args->data.prx->table.current; return 1; } @@ -3152,8 +3152,8 @@ smp_fetch_table_avl(const struct arg *args, struct sample *smp, const char *kw, px = args->data.prx; smp->flags = SMP_F_VOL_TEST; - smp->type = SMP_T_UINT; - smp->data.uint = px->table.size - px->table.current; + smp->type = SMP_T_SINT; + smp->data.sint = px->table.size - px->table.current; return 1; } @@ -3168,102 +3168,102 @@ static struct acl_kw_list acl_kws = {ILH, { * Please take care of keeping this list alphabetically sorted. */ 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_out_rate", smp_fetch_sc_bytes_out_rate, 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_UINT, SMP_USE_INTRN, }, - { "sc_conn_cnt", smp_fetch_sc_conn_cnt, 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_UINT, SMP_USE_INTRN, }, - { "sc_conn_rate", smp_fetch_sc_conn_rate, 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_UINT, SMP_USE_INTRN, }, - { "sc_gpc0_rate", smp_fetch_sc_gpc0_rate, 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_UINT, 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_req_cnt", smp_fetch_sc_http_req_cnt, 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_UINT, SMP_USE_INTRN, }, - { "sc_inc_gpc0", smp_fetch_sc_inc_gpc0, ARG2(1,UINT,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "sc_kbytes_in", smp_fetch_sc_kbytes_in, 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_UINT, SMP_USE_L4CLI, }, - { "sc_sess_cnt", smp_fetch_sc_sess_cnt, 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_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_SINT, 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_SINT, 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_SINT, 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_SINT, 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_SINT, 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_SINT, 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_SINT, 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_SINT, 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_trackers", smp_fetch_sc_trackers, ARG2(1,UINT,TAB), NULL, SMP_T_UINT, 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_out_rate", smp_fetch_sc_bytes_out_rate, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "sc0_clr_gpc0", smp_fetch_sc_clr_gpc0, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "sc0_conn_cnt", smp_fetch_sc_conn_cnt, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "sc0_conn_cur", smp_fetch_sc_conn_cur, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "sc0_conn_rate", smp_fetch_sc_conn_rate, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "sc0_get_gpc0", smp_fetch_sc_get_gpc0, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "sc0_gpc0_rate", smp_fetch_sc_gpc0_rate, 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_UINT, 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_req_cnt", smp_fetch_sc_http_req_cnt, 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_UINT, SMP_USE_INTRN, }, - { "sc0_inc_gpc0", smp_fetch_sc_inc_gpc0, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "sc0_kbytes_in", smp_fetch_sc_kbytes_in, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, - { "sc0_kbytes_out", smp_fetch_sc_kbytes_out, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, - { "sc0_sess_cnt", smp_fetch_sc_sess_cnt, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "sc0_sess_rate", smp_fetch_sc_sess_rate, ARG1(0,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_SINT, 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_SINT, 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_SINT, 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_SINT, 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_SINT, 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_SINT, 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_SINT, SMP_USE_INTRN, }, + { "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_SINT, SMP_USE_L4CLI, }, + { "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_SINT, 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, }, - { "sc1_bytes_in_rate", smp_fetch_sc_bytes_in_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_UINT, SMP_USE_INTRN, }, - { "sc1_clr_gpc0", smp_fetch_sc_clr_gpc0, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "sc1_conn_cnt", smp_fetch_sc_conn_cnt, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "sc1_conn_cur", smp_fetch_sc_conn_cur, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "sc1_conn_rate", smp_fetch_sc_conn_rate, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "sc1_get_gpc0", smp_fetch_sc_get_gpc0, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "sc1_gpc0_rate", smp_fetch_sc_gpc0_rate, 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_UINT, 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_req_cnt", smp_fetch_sc_http_req_cnt, 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_UINT, SMP_USE_INTRN, }, - { "sc1_inc_gpc0", smp_fetch_sc_inc_gpc0, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "sc1_kbytes_in", smp_fetch_sc_kbytes_in, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, - { "sc1_kbytes_out", smp_fetch_sc_kbytes_out, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, - { "sc1_sess_cnt", smp_fetch_sc_sess_cnt, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "sc1_sess_rate", smp_fetch_sc_sess_rate, 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_SINT, 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_SINT, 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_SINT, 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_SINT, 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_SINT, 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_SINT, 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_SINT, SMP_USE_INTRN, }, + { "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_SINT, SMP_USE_L4CLI, }, + { "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_SINT, 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, }, - { "sc2_bytes_in_rate", smp_fetch_sc_bytes_in_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_UINT, SMP_USE_INTRN, }, - { "sc2_clr_gpc0", smp_fetch_sc_clr_gpc0, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "sc2_conn_cnt", smp_fetch_sc_conn_cnt, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "sc2_conn_cur", smp_fetch_sc_conn_cur, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "sc2_conn_rate", smp_fetch_sc_conn_rate, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "sc2_get_gpc0", smp_fetch_sc_get_gpc0, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "sc2_gpc0_rate", smp_fetch_sc_gpc0_rate, 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_UINT, 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_req_cnt", smp_fetch_sc_http_req_cnt, 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_UINT, SMP_USE_INTRN, }, - { "sc2_inc_gpc0", smp_fetch_sc_inc_gpc0, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "sc2_kbytes_in", smp_fetch_sc_kbytes_in, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, - { "sc2_kbytes_out", smp_fetch_sc_kbytes_out, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, - { "sc2_sess_cnt", smp_fetch_sc_sess_cnt, ARG1(0,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "sc2_sess_rate", smp_fetch_sc_sess_rate, 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_SINT, 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_SINT, 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_SINT, 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_SINT, 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_SINT, 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_SINT, 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_SINT, SMP_USE_INTRN, }, + { "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_SINT, SMP_USE_L4CLI, }, + { "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_SINT, 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, }, - { "src_bytes_in_rate", smp_fetch_sc_bytes_in_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_UINT, SMP_USE_L4CLI, }, - { "src_clr_gpc0", smp_fetch_sc_clr_gpc0, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, - { "src_conn_cnt", smp_fetch_sc_conn_cnt, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, - { "src_conn_cur", smp_fetch_sc_conn_cur, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, - { "src_conn_rate", smp_fetch_sc_conn_rate, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, - { "src_get_gpc0", smp_fetch_sc_get_gpc0, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, - { "src_gpc0_rate", smp_fetch_sc_gpc0_rate, 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_UINT, 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_req_cnt", smp_fetch_sc_http_req_cnt, 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_UINT, SMP_USE_L4CLI, }, - { "src_inc_gpc0", smp_fetch_sc_inc_gpc0, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, - { "src_kbytes_in", smp_fetch_sc_kbytes_in, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, - { "src_kbytes_out", smp_fetch_sc_kbytes_out, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, - { "src_sess_cnt", smp_fetch_sc_sess_cnt, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_L4CLI, }, - { "src_sess_rate", smp_fetch_sc_sess_rate, 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_UINT, SMP_USE_L4CLI, }, - { "table_avl", smp_fetch_table_avl, ARG1(1,TAB), NULL, SMP_T_UINT, SMP_USE_INTRN, }, - { "table_cnt", smp_fetch_table_cnt, ARG1(1,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_SINT, 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_SINT, 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_SINT, 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_SINT, 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_SINT, 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_SINT, 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_SINT, 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_SINT, 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_SINT, 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_SINT, SMP_USE_INTRN, }, + { "table_cnt", smp_fetch_table_cnt, ARG1(1,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, }, { /* END */ }, }}; diff --git a/src/vars.c b/src/vars.c index 74a6ec8ff..da675cce1 100644 --- a/src/vars.c +++ b/src/vars.c @@ -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. */ switch (var->data.type) { case SMP_T_BOOL: - case SMP_T_UINT: case SMP_T_SINT: var->data.data.sint = smp->data.sint; break;