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.
This commit is contained in:
Willy Tarreau 2020-06-04 18:46:44 +02:00
parent 3c2a7c2788
commit 872f2ea209
22 changed files with 60 additions and 56 deletions

View File

@ -25,7 +25,7 @@
#include <haproxy/regex-t.h>
#include <types/applet.h>
#include <types/stick_table.h>
#include <haproxy/stick_table-t.h>
enum act_from {
ACT_F_TCP_REQ_CON, /* tcp-request connection */

View File

@ -30,7 +30,7 @@
#include <haproxy/protobuf-t.h>
#include <haproxy/vars-t.h>
#include <types/stick_table.h>
#include <haproxy/stick_table-t.h>
/* encoding of each arg type : up to 31 types are supported */
#define ARGT_BITS 5

View File

@ -36,7 +36,7 @@
#include <types/http_ana.h>
#include <types/proxy.h>
#include <types/server.h>
#include <types/stick_table.h>
#include <haproxy/stick_table-t.h>
#define CLASS_CORE "Core"
#define CLASS_TXN "TXN"

View File

@ -29,7 +29,7 @@
#include <haproxy/time.h>
#include <types/proxy.h>
#include <types/stick_table.h>
#include <haproxy/stick_table-t.h>
#include <types/stream.h>
extern struct peers *cfg_peers;

View File

@ -26,7 +26,7 @@
#include <haproxy/arg-t.h>
#include <haproxy/api.h>
#include <haproxy/sample-t.h>
#include <types/stick_table.h>
#include <haproxy/stick_table-t.h>
extern sample_cast_fct sample_casts[SMP_TYPES][SMP_TYPES];
extern const unsigned int fetch_cap[SMP_SRC_ENTRIES];

View File

@ -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 <ebrun@exceliance.fr>
@ -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 <sys/socket.h>
#include <netinet/in.h>
#include <import/ebtree.h>
#include <import/ebmbtree.h>
#include <import/eb32tree.h>
#include <haproxy/dict-t.h>
#include <haproxy/pool-t.h>
#include <import/ebmbtree.h>
#include <import/ebpttree.h>
#include <haproxy/freq_ctr-t.h>
#include <haproxy/peers-t.h>
#include <haproxy/sample-t.h>
#include <haproxy/thread-t.h>
#include <haproxy/api-t.h>
/* 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 <entry> 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 */

View File

@ -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 <ebrun@exceliance.fr>
@ -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 <haproxy/api.h>
#include <haproxy/dict-t.h>
#include <haproxy/errors.h>
#include <haproxy/sample-t.h>
#include <haproxy/stick_table-t.h>
#include <haproxy/tools.h>
#include <haproxy/ticks.h>
#include <haproxy/time.h>
#include <types/stick_table.h>
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 */

View File

@ -29,7 +29,7 @@
#include <haproxy/global-t.h>
#include <types/session.h>
#include <proto/stick_table.h>
#include <haproxy/stick_table.h>
#include <proto/server.h>
extern struct pool_head *pool_head_session;

View File

@ -30,7 +30,7 @@
#include <haproxy/freq_ctr.h>
#include <haproxy/obj_type.h>
#include <proto/queue.h>
#include <proto/stick_table.h>
#include <haproxy/stick_table.h>
#include <haproxy/task.h>
#include <proto/trace.h>

View File

@ -46,7 +46,7 @@
#include <types/log.h>
#include <haproxy/sample-t.h>
#include <types/server.h>
#include <types/stick_table.h>
#include <haproxy/stick_table-t.h>
/* values for proxy->state */
enum pr_state {

View File

@ -33,7 +33,7 @@
#include <haproxy/obj_type-t.h>
#include <haproxy/vars-t.h>
#include <types/stick_table.h>
#include <haproxy/stick_table-t.h>
#include <haproxy/task-t.h>
struct sess_srv_list {

View File

@ -44,7 +44,7 @@
#include <types/session.h>
#include <types/stream_interface.h>
#include <haproxy/task-t.h>
#include <types/stick_table.h>
#include <haproxy/stick_table-t.h>
/* Various Stream Flags, bits values 0x01 to 0x100 (shift 0) */
#define SF_DIRECT 0x00000001 /* connection made on the server matching the client cookie */

View File

@ -29,7 +29,7 @@
#include <proto/log.h>
#include <proto/proxy.h>
#include <haproxy/sample.h>
#include <proto/stick_table.h>
#include <haproxy/stick_table.h>
#include <import/ebsttree.h>

View File

@ -20,7 +20,7 @@
#include <proto/log.h>
#include <proto/proxy.h>
#include <proto/stick_table.h>
#include <haproxy/stick_table.h>
/* Find and check the target table used by an action track-sc*. This

View File

@ -21,6 +21,7 @@
#include <haproxy/http_htx.h>
#include <haproxy/http_rules.h>
#include <haproxy/listener.h>
#include <haproxy/peers.h>
#include <haproxy/sample.h>
#include <types/stats.h>
@ -28,7 +29,7 @@
#include <haproxy/protocol.h>
#include <proto/proxy.h>
#include <proto/server.h>
#include <proto/stick_table.h>
#include <haproxy/stick_table.h>
/* Report a warning if a rule is placed after a 'tcp-request session' rule.
* Return 1 if the warning has been emitted, otherwise 0.

View File

@ -80,7 +80,7 @@
#include <proto/session.h>
#include <proto/server.h>
#include <proto/stream.h>
#include <proto/stick_table.h>
#include <haproxy/stick_table.h>
#include <haproxy/tcp_rules.h>

View File

@ -32,7 +32,7 @@
#include <proto/proxy.h>
#include <proto/server.h>
#include <proto/stats.h>
#include <proto/stick_table.h>
#include <haproxy/stick_table.h>
/* Contains the class reference of the concat object. */
static int class_concat_ref;

View File

@ -43,7 +43,7 @@
#include <proto/proxy.h>
#include <proto/session.h>
#include <proto/stream.h>
#include <proto/stick_table.h>
#include <haproxy/stick_table.h>
#include <proto/stream_interface.h>

View File

@ -37,7 +37,7 @@
#include <proto/log.h>
#include <proto/proxy.h>
#include <haproxy/sink.h>
#include <proto/stick_table.h>
#include <haproxy/stick_table.h>
#include <import/sha1.h>
#include <import/xxhash.h>

View File

@ -42,7 +42,7 @@
#include <haproxy/sample.h>
#include <proto/stream.h>
#include <proto/stream_interface.h>
#include <proto/stick_table.h>
#include <haproxy/stick_table.h>
/* structure used to return a table key built from a sample */
static THREAD_LOCAL struct stktable_key static_table_key;

View File

@ -58,7 +58,7 @@
#include <proto/proxy.h>
#include <proto/queue.h>
#include <proto/server.h>
#include <proto/stick_table.h>
#include <haproxy/stick_table.h>
#include <proto/stream_interface.h>
DECLARE_POOL(pool_head_stream, "stream", sizeof(struct stream));

View File

@ -28,7 +28,7 @@
#include <proto/channel.h>
#include <proto/log.h>
#include <proto/proxy.h>
#include <proto/stick_table.h>
#include <haproxy/stick_table.h>
#include <proto/stream.h>
#include <proto/stream_interface.h>