From 69b870f862a1ead14e53943befb019187d043c28 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sun, 6 Jun 2010 14:30:13 +0200 Subject: [PATCH] [MINOR] stick_table: add support for "conn_cum" data type. This one can be parsed on the "stick-table" after with the "store" keyword. It will hold the number of connections matching the entry, for use with ACLs or anything else. --- doc/configuration.txt | 4 +++- include/types/stick_table.h | 2 ++ src/stick_table.c | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/configuration.txt b/doc/configuration.txt index ad4a3ceb05..fb2f48d82f 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -5053,7 +5053,9 @@ stick-table type {ip | integer | string [len ] } size may be used by ACLs in order to control various criteria related to the activity of the client matching the stick-table. For each item specified here, the size of each entry will be inflated so - that the additional data can fit. + that the additional data can fit. At the moment, only "conn_cum" + is supported, which can be used to store and retrieve the total + number of connections matching the entry since it was created. The is only one stick-table per backend. At the moment of writing this doc, it does not seem useful to have multiple tables per backend. If this happens diff --git a/include/types/stick_table.h b/include/types/stick_table.h index dda9edbc01..a43c110136 100644 --- a/include/types/stick_table.h +++ b/include/types/stick_table.h @@ -41,11 +41,13 @@ enum { /* The types of extra data we can store in a stick table */ enum { + STKTABLE_DT_CONN_CUM, /* cumulated number of connections */ STKTABLE_DATA_TYPES /* Number of data types, must always be last */ }; /* stick_table extra data. This is mainly used for casting or size computation */ union stktable_data { + unsigned int conn_cum; }; #define stktable_data_size(type) (sizeof(((union stktable_data*)0)->type)) diff --git a/src/stick_table.c b/src/stick_table.c index 158056e1cc..4cd6c75962 100644 --- a/src/stick_table.c +++ b/src/stick_table.c @@ -477,6 +477,7 @@ int stktable_compatible_pattern(struct pattern_expr *expr, unsigned long table_t /* Extra data types processing */ struct stktable_data_type stktable_data_types[STKTABLE_DATA_TYPES] = { + [STKTABLE_DT_CONN_CUM] = { .name = "conn_cum", .data_length = stktable_data_size(conn_cum) }, }; /*