From: Willy Tarreau Date: Thu, 4 Jun 2020 16:46:44 +0000 (+0200) Subject: REORG: include: move stick_table.h to haproxy/stick_table{,-t}.h X-Git-Tag: v2.2-dev9~40 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=872f2ea209adfbd3b90f2987398619bc551ab4b4;p=thirdparty%2Fhaproxy.git REORG: include: move stick_table.h to haproxy/stick_table{,-t}.h The stktable_types[] array declaration was moved to the main file as it had nothing to do in the types. A few declarations were reordered in the types file so that defines were before the structs. Thread-t was added since there are a few __decl_thread(). The loss of peers.h revealed that cfgparse-listen needed it. --- diff --git a/include/haproxy/action-t.h b/include/haproxy/action-t.h index 54dd63b9e0..9a7636674a 100644 --- a/include/haproxy/action-t.h +++ b/include/haproxy/action-t.h @@ -25,7 +25,7 @@ #include #include -#include +#include enum act_from { ACT_F_TCP_REQ_CON, /* tcp-request connection */ diff --git a/include/haproxy/arg-t.h b/include/haproxy/arg-t.h index a283eff812..c5a95d387e 100644 --- a/include/haproxy/arg-t.h +++ b/include/haproxy/arg-t.h @@ -30,7 +30,7 @@ #include #include -#include +#include /* encoding of each arg type : up to 31 types are supported */ #define ARGT_BITS 5 diff --git a/include/haproxy/hlua-t.h b/include/haproxy/hlua-t.h index a49de51196..0f992236ee 100644 --- a/include/haproxy/hlua-t.h +++ b/include/haproxy/hlua-t.h @@ -36,7 +36,7 @@ #include #include #include -#include +#include #define CLASS_CORE "Core" #define CLASS_TXN "TXN" diff --git a/include/haproxy/peers.h b/include/haproxy/peers.h index 10fd8d8951..c07ee6d335 100644 --- a/include/haproxy/peers.h +++ b/include/haproxy/peers.h @@ -29,7 +29,7 @@ #include #include -#include +#include #include extern struct peers *cfg_peers; diff --git a/include/haproxy/sample.h b/include/haproxy/sample.h index 1c30fd4a43..970dc1b6e8 100644 --- a/include/haproxy/sample.h +++ b/include/haproxy/sample.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include extern sample_cast_fct sample_casts[SMP_TYPES][SMP_TYPES]; extern const unsigned int fetch_cap[SMP_SRC_ENTRIES]; diff --git a/include/types/stick_table.h b/include/haproxy/stick_table-t.h similarity index 96% rename from include/types/stick_table.h rename to include/haproxy/stick_table-t.h index 2918381db5..86d8dad1fb 100644 --- a/include/types/stick_table.h +++ b/include/haproxy/stick_table-t.h @@ -1,5 +1,5 @@ /* - * include/types/stick_table.h + * include/haproxy/stick_table-t.h * Macros, variables and structures for stick tables management. * * Copyright (C) 2009-2010 EXCELIANCE, Emeric Brun @@ -20,20 +20,20 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef _TYPES_STICK_TABLE_H -#define _TYPES_STICK_TABLE_H +#ifndef _HAPROXY_STICK_TABLE_T_H +#define _HAPROXY_STICK_TABLE_T_H #include #include -#include -#include #include -#include -#include +#include +#include + #include -#include -#include +#include +#include + /* The types of extra data we can store in a stick table */ enum { @@ -80,6 +80,27 @@ enum { ARG_T_DELAY, /* a delay which supports time units */ }; +/* stick table key type flags */ +#define STK_F_CUSTOM_KEYSIZE 0x00000001 /* this table's key size is configurable */ + +/* WARNING: if new fields are added, they must be initialized in stream_accept() + * and freed in stream_free() ! + * + * What's the purpose of there two macro: + * - STKCTR_TRACK_BACKEND indicates that a tracking pointer was set from the backend + * and thus that when a keep-alive request goes to another backend, the track + * must cease. + * + * - STKCTR_TRACK_CONTENT indicates that the tracking pointer was set in a + * content-aware rule (tcp-request content or http-request) and that the + * tracking has to be performed in the stream and not in the session, and + * will cease for a new keep-alive request over the same connection. + * + * These values are mixed with the stksess pointer in stkctr->entry. + */ +#define STKCTR_TRACK_BACKEND 1 +#define STKCTR_TRACK_CONTENT 2 + /* stick_table extra data. This is mainly used for casting or size computation */ union stktable_data { /* standard types for easy casting */ @@ -119,9 +140,6 @@ struct stktable_data_type { int arg_type; /* type of optional argument, ARG_T_* */ }; -/* stick table key type flags */ -#define STK_F_CUSTOM_KEYSIZE 0x00000001 /* this table's key size is configurable */ - /* stick table keyword type */ struct stktable_type { const char *kw; /* keyword string */ @@ -129,8 +147,6 @@ struct stktable_type { size_t default_size; /* default key size */ }; -extern struct stktable_type stktable_types[]; - /* Sticky session. * Any additional data related to the stuck session is installed *before* * stksess (with negative offsets). This allows us to run variable-sized @@ -202,22 +218,6 @@ struct stktable_key { size_t key_len; /* data len to read in buff in case of null terminated string */ }; -/* WARNING: if new fields are added, they must be initialized in stream_accept() - * and freed in stream_free() ! - * - * What's the purpose of there two macro: - * - STKCTR_TRACK_BACKEND indicates that a tracking pointer was set from the backend - * and thus that when a keep-alive request goes to another backend, the track - * must cease. - * - * - STKCTR_TRACK_CONTENT indicates that the tracking pointer was set in a - * content-aware rule (tcp-request content or http-request) and that the - * tracking has to be performed in the stream and not in the session, and - * will cease for a new keep-alive request over the same connection. - */ -#define STKCTR_TRACK_BACKEND 1 -#define STKCTR_TRACK_CONTENT 2 - /* stick counter. The member is a composite address (caddr) made of a * pointer to an stksess struct, and two flags among STKCTR_TRACK_* above. */ @@ -235,4 +235,4 @@ struct track_ctr_prm { } table; }; -#endif /* _TYPES_STICK_TABLE_H */ +#endif /* _HAPROXY_STICK_TABLE_T_H */ diff --git a/include/proto/stick_table.h b/include/haproxy/stick_table.h similarity index 96% rename from include/proto/stick_table.h rename to include/haproxy/stick_table.h index ebc4d67544..c77988f4f9 100644 --- a/include/proto/stick_table.h +++ b/include/haproxy/stick_table.h @@ -1,5 +1,5 @@ /* - * include/proto/stick_table.h + * include/haproxy/stick_table.h * Functions for stick tables management. * * Copyright (C) 2009-2010 EXCELIANCE, Emeric Brun @@ -20,17 +20,20 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef _PROTO_STICK_TABLE_H -#define _PROTO_STICK_TABLE_H +#ifndef _HAPROXY_STICK_TABLE_H +#define _HAPROXY_STICK_TABLE_H +#include #include #include +#include +#include #include #include #include -#include extern struct stktable *stktables_list; +extern struct stktable_type stktable_types[]; #define stktable_data_size(type) (sizeof(((union stktable_data*)0)->type)) #define stktable_data_cast(ptr, type) ((union stktable_data*)(ptr))->type @@ -200,4 +203,4 @@ static inline void stkctr_clr_flags(struct stkctr *stkctr, unsigned int flags) stkctr->entry = caddr_clr_flags(stkctr->entry, flags); } -#endif /* _PROTO_STICK_TABLE_H */ +#endif /* _HAPROXY_STICK_TABLE_H */ diff --git a/include/proto/session.h b/include/proto/session.h index 01e2d94a74..45bfedb137 100644 --- a/include/proto/session.h +++ b/include/proto/session.h @@ -29,7 +29,7 @@ #include #include -#include +#include #include extern struct pool_head *pool_head_session; diff --git a/include/proto/stream.h b/include/proto/stream.h index 9be8d46475..80a616b6e1 100644 --- a/include/proto/stream.h +++ b/include/proto/stream.h @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include diff --git a/include/types/proxy.h b/include/types/proxy.h index 5ba68c7b92..7579d8a273 100644 --- a/include/types/proxy.h +++ b/include/types/proxy.h @@ -46,7 +46,7 @@ #include #include #include -#include +#include /* values for proxy->state */ enum pr_state { diff --git a/include/types/session.h b/include/types/session.h index 559e786467..3942d62b56 100644 --- a/include/types/session.h +++ b/include/types/session.h @@ -33,7 +33,7 @@ #include #include -#include +#include #include struct sess_srv_list { diff --git a/include/types/stream.h b/include/types/stream.h index e2e01db051..1a99429ec8 100644 --- a/include/types/stream.h +++ b/include/types/stream.h @@ -44,7 +44,7 @@ #include #include #include -#include +#include /* Various Stream Flags, bits values 0x01 to 0x100 (shift 0) */ #define SF_DIRECT 0x00000001 /* connection made on the server matching the client cookie */ diff --git a/src/acl.c b/src/acl.c index caa9dd1520..c0b698550f 100644 --- a/src/acl.c +++ b/src/acl.c @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include diff --git a/src/action.c b/src/action.c index 4889a4b16c..fa3b4f7774 100644 --- a/src/action.c +++ b/src/action.c @@ -20,7 +20,7 @@ #include #include -#include +#include /* Find and check the target table used by an action track-sc*. This diff --git a/src/cfgparse-listen.c b/src/cfgparse-listen.c index 943c4c8113..51e118c4d8 100644 --- a/src/cfgparse-listen.c +++ b/src/cfgparse-listen.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -28,7 +29,7 @@ #include #include #include -#include +#include /* Report a warning if a rule is placed after a 'tcp-request session' rule. * Return 1 if the warning has been emitted, otherwise 0. diff --git a/src/cfgparse.c b/src/cfgparse.c index 0a0c315e59..0fc9bfea27 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -80,7 +80,7 @@ #include #include #include -#include +#include #include diff --git a/src/hlua_fcn.c b/src/hlua_fcn.c index 36a54e4d32..48a0514f40 100644 --- a/src/hlua_fcn.c +++ b/src/hlua_fcn.c @@ -32,7 +32,7 @@ #include #include #include -#include +#include /* Contains the class reference of the concat object. */ static int class_concat_ref; diff --git a/src/peers.c b/src/peers.c index 8ffe42167f..45e438d875 100644 --- a/src/peers.c +++ b/src/peers.c @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include diff --git a/src/sample.c b/src/sample.c index 828cf26f71..8fd043b8e3 100644 --- a/src/sample.c +++ b/src/sample.c @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/stick_table.c b/src/stick_table.c index 835b0a6ffc..ebb9033710 100644 --- a/src/stick_table.c +++ b/src/stick_table.c @@ -42,7 +42,7 @@ #include #include #include -#include +#include /* structure used to return a table key built from a sample */ static THREAD_LOCAL struct stktable_key static_table_key; diff --git a/src/stream.c b/src/stream.c index 2f6ff043e3..8a3ed6f869 100644 --- a/src/stream.c +++ b/src/stream.c @@ -58,7 +58,7 @@ #include #include #include -#include +#include #include DECLARE_POOL(pool_head_stream, "stream", sizeof(struct stream)); diff --git a/src/tcp_rules.c b/src/tcp_rules.c index 6b51be4796..9b4977d9da 100644 --- a/src/tcp_rules.c +++ b/src/tcp_rules.c @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include