mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-09 16:47:18 +02:00
MINOR: stick-table: Add "server_name" new data type.
This simple patch only adds definitions to create a new stick-table data type ID and a new standard type to store information in relation wich dictionary entries (STD_T_DICT).
This commit is contained in:
parent
74167b25f7
commit
5ad57ea85f
@ -27,6 +27,7 @@
|
|||||||
#include <common/ticks.h>
|
#include <common/ticks.h>
|
||||||
#include <common/time.h>
|
#include <common/time.h>
|
||||||
#include <types/stick_table.h>
|
#include <types/stick_table.h>
|
||||||
|
#include <types/dict.h>
|
||||||
|
|
||||||
extern struct stktable *stktables_list;
|
extern struct stktable *stktables_list;
|
||||||
|
|
||||||
@ -75,6 +76,8 @@ static inline int stktable_type_size(int type)
|
|||||||
return sizeof(unsigned long long);
|
return sizeof(unsigned long long);
|
||||||
case STD_T_FRQP:
|
case STD_T_FRQP:
|
||||||
return sizeof(struct freq_ctr_period);
|
return sizeof(struct freq_ctr_period);
|
||||||
|
case STD_T_DICT:
|
||||||
|
return sizeof(struct dict_entry *);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include <ebmbtree.h>
|
#include <ebmbtree.h>
|
||||||
#include <eb32tree.h>
|
#include <eb32tree.h>
|
||||||
#include <common/memory.h>
|
#include <common/memory.h>
|
||||||
|
#include <types/dict.h>
|
||||||
#include <types/freq_ctr.h>
|
#include <types/freq_ctr.h>
|
||||||
#include <types/peers.h>
|
#include <types/peers.h>
|
||||||
#include <types/sample.h>
|
#include <types/sample.h>
|
||||||
@ -55,6 +56,7 @@ enum {
|
|||||||
STKTABLE_DT_BYTES_OUT_RATE,/* bytes rate from servers to client */
|
STKTABLE_DT_BYTES_OUT_RATE,/* bytes rate from servers to client */
|
||||||
STKTABLE_DT_GPC1, /* General Purpose Counter 1 (unsigned 32-bit integer) */
|
STKTABLE_DT_GPC1, /* General Purpose Counter 1 (unsigned 32-bit integer) */
|
||||||
STKTABLE_DT_GPC1_RATE, /* General Purpose Counter 1's event rate */
|
STKTABLE_DT_GPC1_RATE, /* General Purpose Counter 1's event rate */
|
||||||
|
STKTABLE_DT_SERVER_NAME, /* The server name */
|
||||||
STKTABLE_STATIC_DATA_TYPES,/* number of types above */
|
STKTABLE_STATIC_DATA_TYPES,/* number of types above */
|
||||||
/* up to STKTABLE_EXTRA_DATA_TYPES types may be registered here, always
|
/* up to STKTABLE_EXTRA_DATA_TYPES types may be registered here, always
|
||||||
* followed by the number of data types, must always be last.
|
* followed by the number of data types, must always be last.
|
||||||
@ -68,6 +70,7 @@ enum {
|
|||||||
STD_T_UINT, /* data is of type unsigned int */
|
STD_T_UINT, /* data is of type unsigned int */
|
||||||
STD_T_ULL, /* data is of type unsigned long long */
|
STD_T_ULL, /* data is of type unsigned long long */
|
||||||
STD_T_FRQP, /* data is of type freq_ctr_period */
|
STD_T_FRQP, /* data is of type freq_ctr_period */
|
||||||
|
STD_T_DICT, /* data is of type key of dictionary entry */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The types of optional arguments to stored data */
|
/* The types of optional arguments to stored data */
|
||||||
@ -84,9 +87,11 @@ union stktable_data {
|
|||||||
unsigned int std_t_uint;
|
unsigned int std_t_uint;
|
||||||
unsigned long long std_t_ull;
|
unsigned long long std_t_ull;
|
||||||
struct freq_ctr_period std_t_frqp;
|
struct freq_ctr_period std_t_frqp;
|
||||||
|
struct dict_entry *std_t_dict;
|
||||||
|
|
||||||
/* types of each storable data */
|
/* types of each storable data */
|
||||||
int server_id;
|
int server_id;
|
||||||
|
struct dict_entry *server_name;
|
||||||
unsigned int gpt0;
|
unsigned int gpt0;
|
||||||
unsigned int gpc0;
|
unsigned int gpc0;
|
||||||
struct freq_ctr_period gpc0_rate;
|
struct freq_ctr_period gpc0_rate;
|
||||||
|
@ -1036,6 +1036,7 @@ struct stktable_data_type stktable_data_types[STKTABLE_DATA_TYPES] = {
|
|||||||
[STKTABLE_DT_BYTES_OUT_RATE]= { .name = "bytes_out_rate", .std_type = STD_T_FRQP, .arg_type = ARG_T_DELAY },
|
[STKTABLE_DT_BYTES_OUT_RATE]= { .name = "bytes_out_rate", .std_type = STD_T_FRQP, .arg_type = ARG_T_DELAY },
|
||||||
[STKTABLE_DT_GPC1] = { .name = "gpc1", .std_type = STD_T_UINT },
|
[STKTABLE_DT_GPC1] = { .name = "gpc1", .std_type = STD_T_UINT },
|
||||||
[STKTABLE_DT_GPC1_RATE] = { .name = "gpc1_rate", .std_type = STD_T_FRQP, .arg_type = ARG_T_DELAY },
|
[STKTABLE_DT_GPC1_RATE] = { .name = "gpc1_rate", .std_type = STD_T_FRQP, .arg_type = ARG_T_DELAY },
|
||||||
|
[STKTABLE_DT_SERVER_NAME] = { .name = "server_name", .std_type = STD_T_DICT },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Registers stick-table extra data type with index <idx>, name <name>, type
|
/* Registers stick-table extra data type with index <idx>, name <name>, type
|
||||||
|
Loading…
Reference in New Issue
Block a user