MINOR: config: Extract the code of "stick-table" line parsing.
With this patch we move the code responsible of parsing "stick-table"
lines to implement parse_stick_table() function in src/stick-tabble.c
so that to be able to parse "stick-table" elsewhere than in proxy sections.
We have have also added a conf struct to stktable struct to store the filename
and the line in the file the stick-table has been parsed to help in
diagnosing and displaying any configuration issue.
diff --git a/include/proto/stick_table.h b/include/proto/stick_table.h
index 40bb8ca..962c95a 100644
--- a/include/proto/stick_table.h
+++ b/include/proto/stick_table.h
@@ -38,6 +38,8 @@
int stktable_init(struct stktable *t);
int stktable_parse_type(char **args, int *idx, unsigned long *type, size_t *key_size);
+int parse_stick_table(const char *file, int linenum, char **args,
+ struct stktable *t, char *id, struct peers *peers);
struct stksess *stktable_get_entry(struct stktable *table, struct stktable_key *key);
struct stksess *stktable_set_entry(struct stktable *table, struct stksess *nts);
void stktable_touch_with_exp(struct stktable *t, struct stksess *ts, int decrefcount, int expire);
diff --git a/include/types/stick_table.h b/include/types/stick_table.h
index 28e255f..695a75c 100644
--- a/include/types/stick_table.h
+++ b/include/types/stick_table.h
@@ -144,6 +144,13 @@
/* stick table */
struct stktable {
char *id; /* table id name */
+ struct stktable *next; /* The stick-table may be linked when belonging to
+ * the same configuration section.
+ */
+ struct {
+ const char *file; /* The file where the stick-table is declared. */
+ int line; /* The line in this <file> the stick-table is declared. */
+ } conf;
struct eb_root keys; /* head of sticky session tree */
struct eb_root exps; /* head of sticky session expiration tree */
struct eb_root updates; /* head of sticky updates sequence tree */
@@ -175,6 +182,7 @@
unsigned int u;
void *p;
} data_arg[STKTABLE_DATA_TYPES]; /* optional argument of each data type */
+ struct proxy *proxy; /* The proxy this stick-table is attached to, if any.*/
};
extern struct stktable_data_type stktable_data_types[STKTABLE_DATA_TYPES];