Emeric Brun | 3bd697e | 2010-01-04 15:23:48 +0100 | [diff] [blame] | 1 | /* |
Willy Tarreau | 872f2ea | 2020-06-04 18:46:44 +0200 | [diff] [blame] | 2 | * include/haproxy/stick_table-t.h |
Emeric Brun | 3bd697e | 2010-01-04 15:23:48 +0100 | [diff] [blame] | 3 | * Macros, variables and structures for stick tables management. |
| 4 | * |
| 5 | * Copyright (C) 2009-2010 EXCELIANCE, Emeric Brun <ebrun@exceliance.fr> |
Willy Tarreau | 08d5f98 | 2010-06-06 13:34:54 +0200 | [diff] [blame] | 6 | * Copyright (C) 2010 Willy Tarreau <w@1wt.eu> |
Emeric Brun | 3bd697e | 2010-01-04 15:23:48 +0100 | [diff] [blame] | 7 | * |
| 8 | * This library is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU Lesser General Public |
| 10 | * License as published by the Free Software Foundation, version 2.1 |
| 11 | * exclusively. |
| 12 | * |
| 13 | * This library is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | * Lesser General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU Lesser General Public |
| 19 | * License along with this library; if not, write to the Free Software |
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 21 | */ |
| 22 | |
Willy Tarreau | 872f2ea | 2020-06-04 18:46:44 +0200 | [diff] [blame] | 23 | #ifndef _HAPROXY_STICK_TABLE_T_H |
| 24 | #define _HAPROXY_STICK_TABLE_T_H |
Emeric Brun | 3bd697e | 2010-01-04 15:23:48 +0100 | [diff] [blame] | 25 | |
| 26 | #include <sys/socket.h> |
| 27 | #include <netinet/in.h> |
| 28 | |
Willy Tarreau | 8d2b777 | 2020-05-27 10:58:19 +0200 | [diff] [blame] | 29 | #include <import/eb32tree.h> |
Willy Tarreau | 872f2ea | 2020-06-04 18:46:44 +0200 | [diff] [blame] | 30 | #include <import/ebmbtree.h> |
| 31 | #include <import/ebpttree.h> |
| 32 | |
Willy Tarreau | b255105 | 2020-06-09 09:07:15 +0200 | [diff] [blame] | 33 | #include <haproxy/api-t.h> |
Willy Tarreau | 6634794 | 2020-06-01 12:18:08 +0200 | [diff] [blame] | 34 | #include <haproxy/freq_ctr-t.h> |
Willy Tarreau | 872f2ea | 2020-06-04 18:46:44 +0200 | [diff] [blame] | 35 | #include <haproxy/thread-t.h> |
Willy Tarreau | 872f2ea | 2020-06-04 18:46:44 +0200 | [diff] [blame] | 36 | |
Emeric Brun | 3bd697e | 2010-01-04 15:23:48 +0100 | [diff] [blame] | 37 | |
Willy Tarreau | 08d5f98 | 2010-06-06 13:34:54 +0200 | [diff] [blame] | 38 | /* The types of extra data we can store in a stick table */ |
| 39 | enum { |
Willy Tarreau | 87b0966 | 2015-04-03 00:22:06 +0200 | [diff] [blame] | 40 | STKTABLE_DT_SERVER_ID, /* the server ID to use with this stream if > 0 */ |
Thierry FOURNIER | 3cf1111 | 2015-07-28 08:57:05 +0200 | [diff] [blame] | 41 | STKTABLE_DT_GPT0, /* General Purpose Flag 0. */ |
Willy Tarreau | c3bd972 | 2010-06-20 12:47:25 +0200 | [diff] [blame] | 42 | STKTABLE_DT_GPC0, /* General Purpose Counter 0 (unsigned 32-bit integer) */ |
Willy Tarreau | ba2ffd1 | 2013-05-29 15:54:14 +0200 | [diff] [blame] | 43 | STKTABLE_DT_GPC0_RATE, /* General Purpose Counter 0's event rate */ |
Willy Tarreau | 8fb12c4 | 2010-06-18 20:16:39 +0200 | [diff] [blame] | 44 | STKTABLE_DT_CONN_CNT, /* cumulated number of connections */ |
Willy Tarreau | 91c43d7 | 2010-06-20 11:19:22 +0200 | [diff] [blame] | 45 | STKTABLE_DT_CONN_RATE, /* incoming connection rate */ |
Willy Tarreau | 38285c1 | 2010-06-18 16:35:43 +0200 | [diff] [blame] | 46 | STKTABLE_DT_CONN_CUR, /* concurrent number of connections */ |
Willy Tarreau | f4d17d9 | 2010-06-18 22:10:12 +0200 | [diff] [blame] | 47 | STKTABLE_DT_SESS_CNT, /* cumulated number of sessions (accepted connections) */ |
Willy Tarreau | 91c43d7 | 2010-06-20 11:19:22 +0200 | [diff] [blame] | 48 | STKTABLE_DT_SESS_RATE, /* accepted sessions rate */ |
Willy Tarreau | da7ff64 | 2010-06-23 11:44:09 +0200 | [diff] [blame] | 49 | STKTABLE_DT_HTTP_REQ_CNT, /* cumulated number of incoming HTTP requests */ |
| 50 | STKTABLE_DT_HTTP_REQ_RATE,/* incoming HTTP request rate */ |
| 51 | STKTABLE_DT_HTTP_ERR_CNT, /* cumulated number of HTTP requests errors (4xx) */ |
| 52 | STKTABLE_DT_HTTP_ERR_RATE,/* HTTP request error rate */ |
Willy Tarreau | 855e4bb | 2010-06-18 18:33:32 +0200 | [diff] [blame] | 53 | STKTABLE_DT_BYTES_IN_CNT, /* cumulated bytes count from client to servers */ |
Willy Tarreau | 6c59e0a | 2010-06-20 11:56:30 +0200 | [diff] [blame] | 54 | STKTABLE_DT_BYTES_IN_RATE,/* bytes rate from client to servers */ |
Willy Tarreau | 855e4bb | 2010-06-18 18:33:32 +0200 | [diff] [blame] | 55 | STKTABLE_DT_BYTES_OUT_CNT,/* cumulated bytes count from servers to client */ |
Willy Tarreau | 6c59e0a | 2010-06-20 11:56:30 +0200 | [diff] [blame] | 56 | STKTABLE_DT_BYTES_OUT_RATE,/* bytes rate from servers to client */ |
Frédéric Lécaille | 6778b27 | 2018-01-29 15:22:53 +0100 | [diff] [blame] | 57 | STKTABLE_DT_GPC1, /* General Purpose Counter 1 (unsigned 32-bit integer) */ |
| 58 | STKTABLE_DT_GPC1_RATE, /* General Purpose Counter 1's event rate */ |
Thayne McCombs | 92149f9 | 2020-11-20 01:28:26 -0700 | [diff] [blame] | 59 | STKTABLE_DT_SERVER_KEY, /* The server key */ |
Willy Tarreau | 826f3ab | 2021-02-10 12:07:15 +0100 | [diff] [blame] | 60 | STKTABLE_DT_HTTP_FAIL_CNT, /* cumulated number of HTTP server failures */ |
| 61 | STKTABLE_DT_HTTP_FAIL_RATE,/* HTTP server failures rate */ |
| 62 | |
Willy Tarreau | edee1d6 | 2014-07-15 16:44:27 +0200 | [diff] [blame] | 63 | STKTABLE_STATIC_DATA_TYPES,/* number of types above */ |
| 64 | /* up to STKTABLE_EXTRA_DATA_TYPES types may be registered here, always |
| 65 | * followed by the number of data types, must always be last. |
| 66 | */ |
| 67 | STKTABLE_DATA_TYPES = STKTABLE_STATIC_DATA_TYPES + STKTABLE_EXTRA_DATA_TYPES |
Willy Tarreau | 08d5f98 | 2010-06-06 13:34:54 +0200 | [diff] [blame] | 68 | }; |
| 69 | |
Willy Tarreau | 3b9c6e0 | 2010-07-18 08:04:30 +0200 | [diff] [blame] | 70 | /* The equivalent standard types of the stored data */ |
| 71 | enum { |
| 72 | STD_T_SINT = 0, /* data is of type signed int */ |
| 73 | STD_T_UINT, /* data is of type unsigned int */ |
| 74 | STD_T_ULL, /* data is of type unsigned long long */ |
Willy Tarreau | fa1258f | 2021-04-10 23:00:53 +0200 | [diff] [blame] | 75 | STD_T_FRQP, /* data is of type freq_ctr */ |
Frédéric Lécaille | 5ad57ea | 2019-05-17 10:08:29 +0200 | [diff] [blame] | 76 | STD_T_DICT, /* data is of type key of dictionary entry */ |
Willy Tarreau | 3b9c6e0 | 2010-07-18 08:04:30 +0200 | [diff] [blame] | 77 | }; |
| 78 | |
Willy Tarreau | 888617d | 2010-06-20 09:11:39 +0200 | [diff] [blame] | 79 | /* The types of optional arguments to stored data */ |
| 80 | enum { |
| 81 | ARG_T_NONE = 0, /* data type takes no argument (default) */ |
| 82 | ARG_T_INT, /* signed integer */ |
| 83 | ARG_T_DELAY, /* a delay which supports time units */ |
| 84 | }; |
| 85 | |
Thayne McCombs | 92149f9 | 2020-11-20 01:28:26 -0700 | [diff] [blame] | 86 | /* They types of keys that servers can be identified by */ |
| 87 | enum { |
| 88 | STKTABLE_SRV_NAME = 0, |
| 89 | STKTABLE_SRV_ADDR, |
| 90 | }; |
| 91 | |
Willy Tarreau | 872f2ea | 2020-06-04 18:46:44 +0200 | [diff] [blame] | 92 | /* stick table key type flags */ |
| 93 | #define STK_F_CUSTOM_KEYSIZE 0x00000001 /* this table's key size is configurable */ |
| 94 | |
| 95 | /* WARNING: if new fields are added, they must be initialized in stream_accept() |
| 96 | * and freed in stream_free() ! |
| 97 | * |
| 98 | * What's the purpose of there two macro: |
| 99 | * - STKCTR_TRACK_BACKEND indicates that a tracking pointer was set from the backend |
| 100 | * and thus that when a keep-alive request goes to another backend, the track |
| 101 | * must cease. |
| 102 | * |
| 103 | * - STKCTR_TRACK_CONTENT indicates that the tracking pointer was set in a |
| 104 | * content-aware rule (tcp-request content or http-request) and that the |
| 105 | * tracking has to be performed in the stream and not in the session, and |
| 106 | * will cease for a new keep-alive request over the same connection. |
| 107 | * |
| 108 | * These values are mixed with the stksess pointer in stkctr->entry. |
| 109 | */ |
| 110 | #define STKCTR_TRACK_BACKEND 1 |
| 111 | #define STKCTR_TRACK_CONTENT 2 |
| 112 | |
Willy Tarreau | 08d5f98 | 2010-06-06 13:34:54 +0200 | [diff] [blame] | 113 | /* stick_table extra data. This is mainly used for casting or size computation */ |
| 114 | union stktable_data { |
Willy Tarreau | 3b9c6e0 | 2010-07-18 08:04:30 +0200 | [diff] [blame] | 115 | /* standard types for easy casting */ |
| 116 | int std_t_sint; |
| 117 | unsigned int std_t_uint; |
| 118 | unsigned long long std_t_ull; |
Willy Tarreau | fa1258f | 2021-04-10 23:00:53 +0200 | [diff] [blame] | 119 | struct freq_ctr std_t_frqp; |
Frédéric Lécaille | 5ad57ea | 2019-05-17 10:08:29 +0200 | [diff] [blame] | 120 | struct dict_entry *std_t_dict; |
Willy Tarreau | 3b9c6e0 | 2010-07-18 08:04:30 +0200 | [diff] [blame] | 121 | |
| 122 | /* types of each storable data */ |
Willy Tarreau | 13c29de | 2010-06-06 16:40:39 +0200 | [diff] [blame] | 123 | int server_id; |
Thayne McCombs | 92149f9 | 2020-11-20 01:28:26 -0700 | [diff] [blame] | 124 | struct dict_entry *server_key; |
Thierry FOURNIER | 3cf1111 | 2015-07-28 08:57:05 +0200 | [diff] [blame] | 125 | unsigned int gpt0; |
Willy Tarreau | c3bd972 | 2010-06-20 12:47:25 +0200 | [diff] [blame] | 126 | unsigned int gpc0; |
Willy Tarreau | fa1258f | 2021-04-10 23:00:53 +0200 | [diff] [blame] | 127 | struct freq_ctr gpc0_rate; |
Frédéric Lécaille | 6778b27 | 2018-01-29 15:22:53 +0100 | [diff] [blame] | 128 | unsigned int gpc1; |
Willy Tarreau | fa1258f | 2021-04-10 23:00:53 +0200 | [diff] [blame] | 129 | struct freq_ctr gpc1_rate; |
Willy Tarreau | 38285c1 | 2010-06-18 16:35:43 +0200 | [diff] [blame] | 130 | unsigned int conn_cnt; |
Willy Tarreau | fa1258f | 2021-04-10 23:00:53 +0200 | [diff] [blame] | 131 | struct freq_ctr conn_rate; |
Willy Tarreau | 38285c1 | 2010-06-18 16:35:43 +0200 | [diff] [blame] | 132 | unsigned int conn_cur; |
Willy Tarreau | f4d17d9 | 2010-06-18 22:10:12 +0200 | [diff] [blame] | 133 | unsigned int sess_cnt; |
Willy Tarreau | fa1258f | 2021-04-10 23:00:53 +0200 | [diff] [blame] | 134 | struct freq_ctr sess_rate; |
Willy Tarreau | da7ff64 | 2010-06-23 11:44:09 +0200 | [diff] [blame] | 135 | unsigned int http_req_cnt; |
Willy Tarreau | fa1258f | 2021-04-10 23:00:53 +0200 | [diff] [blame] | 136 | struct freq_ctr http_req_rate; |
Willy Tarreau | da7ff64 | 2010-06-23 11:44:09 +0200 | [diff] [blame] | 137 | unsigned int http_err_cnt; |
Willy Tarreau | fa1258f | 2021-04-10 23:00:53 +0200 | [diff] [blame] | 138 | struct freq_ctr http_err_rate; |
Willy Tarreau | 855e4bb | 2010-06-18 18:33:32 +0200 | [diff] [blame] | 139 | unsigned long long bytes_in_cnt; |
Willy Tarreau | fa1258f | 2021-04-10 23:00:53 +0200 | [diff] [blame] | 140 | struct freq_ctr bytes_in_rate; |
Willy Tarreau | 855e4bb | 2010-06-18 18:33:32 +0200 | [diff] [blame] | 141 | unsigned long long bytes_out_cnt; |
Willy Tarreau | fa1258f | 2021-04-10 23:00:53 +0200 | [diff] [blame] | 142 | struct freq_ctr bytes_out_rate; |
Willy Tarreau | 826f3ab | 2021-02-10 12:07:15 +0100 | [diff] [blame] | 143 | unsigned int http_fail_cnt; |
Willy Tarreau | fa1258f | 2021-04-10 23:00:53 +0200 | [diff] [blame] | 144 | struct freq_ctr http_fail_rate; |
Willy Tarreau | 08d5f98 | 2010-06-06 13:34:54 +0200 | [diff] [blame] | 145 | }; |
| 146 | |
Willy Tarreau | 08d5f98 | 2010-06-06 13:34:54 +0200 | [diff] [blame] | 147 | /* known data types */ |
| 148 | struct stktable_data_type { |
| 149 | const char *name; /* name of the data type */ |
Willy Tarreau | 3b9c6e0 | 2010-07-18 08:04:30 +0200 | [diff] [blame] | 150 | int std_type; /* standard type we can use for this data, STD_T_* */ |
Willy Tarreau | 888617d | 2010-06-20 09:11:39 +0200 | [diff] [blame] | 151 | int arg_type; /* type of optional argument, ARG_T_* */ |
Willy Tarreau | 08d5f98 | 2010-06-06 13:34:54 +0200 | [diff] [blame] | 152 | }; |
| 153 | |
Emeric Brun | 3bd697e | 2010-01-04 15:23:48 +0100 | [diff] [blame] | 154 | /* stick table keyword type */ |
| 155 | struct stktable_type { |
Willy Tarreau | aea940e | 2010-06-06 11:56:36 +0200 | [diff] [blame] | 156 | const char *kw; /* keyword string */ |
| 157 | int flags; /* type flags */ |
| 158 | size_t default_size; /* default key size */ |
Emeric Brun | 3bd697e | 2010-01-04 15:23:48 +0100 | [diff] [blame] | 159 | }; |
| 160 | |
Willy Tarreau | 393379c | 2010-06-06 12:11:37 +0200 | [diff] [blame] | 161 | /* Sticky session. |
| 162 | * Any additional data related to the stuck session is installed *before* |
| 163 | * stksess (with negative offsets). This allows us to run variable-sized |
| 164 | * keys and variable-sized data without making use of intermediate pointers. |
| 165 | */ |
Emeric Brun | 3bd697e | 2010-01-04 15:23:48 +0100 | [diff] [blame] | 166 | struct stksess { |
Emeric Brun | 3bd697e | 2010-01-04 15:23:48 +0100 | [diff] [blame] | 167 | unsigned int expire; /* session expiration date */ |
Willy Tarreau | e7f3d7a | 2010-06-14 14:53:07 +0200 | [diff] [blame] | 168 | unsigned int ref_cnt; /* reference count, can only purge when zero */ |
Willy Tarreau | af613e8 | 2020-06-05 08:40:51 +0200 | [diff] [blame] | 169 | __decl_thread(HA_RWLOCK_T lock); /* lock related to the table entry */ |
Willy Tarreau | 86257dc | 2010-06-06 12:57:10 +0200 | [diff] [blame] | 170 | struct eb32_node exp; /* ebtree node used to hold the session in expiration tree */ |
Emeric Brun | 85e77c7 | 2010-09-23 18:16:52 +0200 | [diff] [blame] | 171 | struct eb32_node upd; /* ebtree node used to hold the update sequence tree */ |
Willy Tarreau | 86257dc | 2010-06-06 12:57:10 +0200 | [diff] [blame] | 172 | struct ebmb_node key; /* ebtree node used to hold the session in table */ |
Willy Tarreau | aea940e | 2010-06-06 11:56:36 +0200 | [diff] [blame] | 173 | /* WARNING! do not put anything after <keys>, it's used by the key */ |
Emeric Brun | 3bd697e | 2010-01-04 15:23:48 +0100 | [diff] [blame] | 174 | }; |
| 175 | |
Emeric Brun | 85e77c7 | 2010-09-23 18:16:52 +0200 | [diff] [blame] | 176 | |
Emeric Brun | 3bd697e | 2010-01-04 15:23:48 +0100 | [diff] [blame] | 177 | /* stick table */ |
| 178 | struct stktable { |
Frédéric Lécaille | c02766a | 2019-03-20 15:06:55 +0100 | [diff] [blame] | 179 | char *id; /* local table id name. */ |
| 180 | char *nid; /* table id name sent over the network with peers protocol. */ |
Frédéric Lécaille | d456aa4 | 2019-03-08 14:47:00 +0100 | [diff] [blame] | 181 | struct stktable *next; /* The stick-table may be linked when belonging to |
| 182 | * the same configuration section. |
| 183 | */ |
Frédéric Lécaille | 1b8e68e | 2019-03-14 07:07:41 +0100 | [diff] [blame] | 184 | struct ebpt_node name; /* Stick-table are lookup by name here. */ |
Willy Tarreau | aea940e | 2010-06-06 11:56:36 +0200 | [diff] [blame] | 185 | struct eb_root keys; /* head of sticky session tree */ |
| 186 | struct eb_root exps; /* head of sticky session expiration tree */ |
Emeric Brun | 85e77c7 | 2010-09-23 18:16:52 +0200 | [diff] [blame] | 187 | struct eb_root updates; /* head of sticky updates sequence tree */ |
Willy Tarreau | aea940e | 2010-06-06 11:56:36 +0200 | [diff] [blame] | 188 | struct pool_head *pool; /* pool used to allocate sticky sessions */ |
Emeric Brun | 3bd697e | 2010-01-04 15:23:48 +0100 | [diff] [blame] | 189 | struct task *exp_task; /* expiration task */ |
Emeric Brun | 85e77c7 | 2010-09-23 18:16:52 +0200 | [diff] [blame] | 190 | struct task *sync_task; /* sync task */ |
| 191 | unsigned int update; |
| 192 | unsigned int localupdate; |
Emeric Brun | aaf5860 | 2015-06-15 17:23:30 +0200 | [diff] [blame] | 193 | unsigned int commitupdate;/* used to identify the latest local updates |
| 194 | pending for sync */ |
Emeric Brun | 2cc201f | 2021-04-23 12:21:26 +0200 | [diff] [blame] | 195 | unsigned int refcnt; /* number of local peer over all peers sections |
| 196 | attached to this table */ |
Emeric Brun | 32da3c4 | 2010-09-23 18:39:19 +0200 | [diff] [blame] | 197 | union { |
| 198 | struct peers *p; /* sync peers */ |
| 199 | char *name; |
| 200 | } peers; |
| 201 | |
Willy Tarreau | aea940e | 2010-06-06 11:56:36 +0200 | [diff] [blame] | 202 | unsigned long type; /* type of table (determines key format) */ |
Thayne McCombs | 92149f9 | 2020-11-20 01:28:26 -0700 | [diff] [blame] | 203 | unsigned int server_key_type; /* What type of key is used to identify servers */ |
Emeric Brun | 3bd697e | 2010-01-04 15:23:48 +0100 | [diff] [blame] | 204 | size_t key_size; /* size of a key, maximum size in case of string */ |
Willy Tarreau | aea940e | 2010-06-06 11:56:36 +0200 | [diff] [blame] | 205 | unsigned int size; /* maximum number of sticky sessions in table */ |
| 206 | unsigned int current; /* number of sticky sessions currently in table */ |
| 207 | int nopurge; /* if non-zero, don't purge sticky sessions when full */ |
| 208 | int exp_next; /* next expiration date (ticks) */ |
| 209 | int expire; /* time to live for sticky sessions (milliseconds) */ |
Willy Tarreau | 393379c | 2010-06-06 12:11:37 +0200 | [diff] [blame] | 210 | int data_size; /* the size of the data that is prepended *before* stksess */ |
Willy Tarreau | 08d5f98 | 2010-06-06 13:34:54 +0200 | [diff] [blame] | 211 | int data_ofs[STKTABLE_DATA_TYPES]; /* negative offsets of present data types, or 0 if absent */ |
Willy Tarreau | 888617d | 2010-06-20 09:11:39 +0200 | [diff] [blame] | 212 | union { |
| 213 | int i; |
| 214 | unsigned int u; |
| 215 | void *p; |
| 216 | } data_arg[STKTABLE_DATA_TYPES]; /* optional argument of each data type */ |
Frédéric Lécaille | d456aa4 | 2019-03-08 14:47:00 +0100 | [diff] [blame] | 217 | struct proxy *proxy; /* The proxy this stick-table is attached to, if any.*/ |
Frédéric Lécaille | 015e4d7 | 2019-03-19 14:55:01 +0100 | [diff] [blame] | 218 | struct proxy *proxies_list; /* The list of proxies which reference this stick-table. */ |
Willy Tarreau | e72a3f4 | 2020-10-18 11:08:41 +0200 | [diff] [blame] | 219 | struct { |
| 220 | const char *file; /* The file where the stick-table is declared. */ |
| 221 | int line; /* The line in this <file> the stick-table is declared. */ |
| 222 | } conf; |
| 223 | __decl_thread(HA_SPINLOCK_T lock); /* spin lock related to the table */ |
Emeric Brun | 3bd697e | 2010-01-04 15:23:48 +0100 | [diff] [blame] | 224 | }; |
| 225 | |
Willy Tarreau | 795e4a9 | 2010-07-18 07:38:17 +0200 | [diff] [blame] | 226 | extern struct stktable_data_type stktable_data_types[STKTABLE_DATA_TYPES]; |
Willy Tarreau | aea940e | 2010-06-06 11:56:36 +0200 | [diff] [blame] | 227 | |
Emeric Brun | 3bd697e | 2010-01-04 15:23:48 +0100 | [diff] [blame] | 228 | /* stick table key */ |
| 229 | struct stktable_key { |
| 230 | void *key; /* pointer on key buffer */ |
| 231 | size_t key_len; /* data len to read in buff in case of null terminated string */ |
Emeric Brun | 3bd697e | 2010-01-04 15:23:48 +0100 | [diff] [blame] | 232 | }; |
| 233 | |
Willy Tarreau | 5ed1bbf | 2014-06-25 18:30:01 +0200 | [diff] [blame] | 234 | /* stick counter. The <entry> member is a composite address (caddr) made of a |
| 235 | * pointer to an stksess struct, and two flags among STKCTR_TRACK_* above. |
| 236 | */ |
| 237 | struct stkctr { |
Willy Tarreau | 87b0966 | 2015-04-03 00:22:06 +0200 | [diff] [blame] | 238 | unsigned long entry; /* entry containing counters currently being tracked by this stream */ |
Willy Tarreau | 5ed1bbf | 2014-06-25 18:30:01 +0200 | [diff] [blame] | 239 | struct stktable *table; /* table the counters above belong to (undefined if counters are null) */ |
| 240 | }; |
| 241 | |
| 242 | /* parameters to configure tracked counters */ |
| 243 | struct track_ctr_prm { |
| 244 | struct sample_expr *expr; /* expression used as the key */ |
| 245 | union { |
| 246 | struct stktable *t; /* a pointer to the table */ |
| 247 | char *n; /* or its name during parsing. */ |
| 248 | } table; |
| 249 | }; |
| 250 | |
Willy Tarreau | 872f2ea | 2020-06-04 18:46:44 +0200 | [diff] [blame] | 251 | #endif /* _HAPROXY_STICK_TABLE_T_H */ |