From: Willy Tarreau Date: Thu, 4 Jun 2020 20:35:49 +0000 (+0200) Subject: REORG: include: move spoe.h to haproxy/spoe{,-t}.h X-Git-Tag: v2.2-dev9~23 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6c58ab03043da2fd618b0ad91ac4f632cf347f48;p=thirdparty%2Fhaproxy.git REORG: include: move spoe.h to haproxy/spoe{,-t}.h Only minor change was to make sure all defines were before the structs in spoe-t.h, everything else went smoothly. --- diff --git a/contrib/mod_defender/defender.c b/contrib/mod_defender/defender.c index 8bc3e9735d..5e759b50ab 100644 --- a/contrib/mod_defender/defender.c +++ b/contrib/mod_defender/defender.c @@ -21,10 +21,9 @@ #include #include #include +#include #include -#include - #include #include #include diff --git a/contrib/mod_defender/spoa.c b/contrib/mod_defender/spoa.c index b4c990b4a6..35b3dd8ab7 100644 --- a/contrib/mod_defender/spoa.c +++ b/contrib/mod_defender/spoa.c @@ -33,8 +33,7 @@ #include #include - -#include +#include #include "spoa.h" #include "defender.h" diff --git a/contrib/modsecurity/modsec_wrapper.c b/contrib/modsecurity/modsec_wrapper.c index 7407674547..b5840c348d 100644 --- a/contrib/modsecurity/modsec_wrapper.c +++ b/contrib/modsecurity/modsec_wrapper.c @@ -19,12 +19,12 @@ #include #include #include +#include #include #include #include -#include #include diff --git a/contrib/modsecurity/spoa.c b/contrib/modsecurity/spoa.c index b9d61ed4be..2c0b5459ca 100644 --- a/contrib/modsecurity/spoa.c +++ b/contrib/modsecurity/spoa.c @@ -38,8 +38,7 @@ #include #include - -#include +#include #include "spoa.h" #include "modsec_wrapper.h" diff --git a/include/types/spoe.h b/include/haproxy/spoe-t.h similarity index 98% rename from include/types/spoe.h rename to include/haproxy/spoe-t.h index f3edf862dd..9b0df17ee1 100644 --- a/include/types/spoe.h +++ b/include/haproxy/spoe-t.h @@ -1,5 +1,5 @@ /* - * include/types/spoe.h + * include/haproxy/spoe-t.h * Macros, variables and structures for the SPOE filter. * * Copyright (C) 2017 HAProxy Technologies, Christopher Faulet @@ -19,21 +19,21 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef _TYPES_SPOE_H -#define _TYPES_SPOE_H +#ifndef _HAPROXY_SPOE_T_H +#define _HAPROXY_SPOE_T_H #include +#include #include #include +#include #include #include -#include - -#include #include -#include #include +#include +#include /* Type of list of messages */ #define SPOE_MSGS_BY_EVENT 0x01 @@ -68,6 +68,14 @@ #define SPOE_FRM_FL_FIN 0x00000001 #define SPOE_FRM_FL_ABRT 0x00000002 +/* Masks to get data type or flags value */ +#define SPOE_DATA_T_MASK 0x0F +#define SPOE_DATA_FL_MASK 0xF0 + +/* Flags to set Boolean values */ +#define SPOE_DATA_FL_FALSE 0x00 +#define SPOE_DATA_FL_TRUE 0x10 + /* All possible states for a SPOE context */ enum spoe_ctx_state { SPOE_CTX_ST_NONE = 0, @@ -161,6 +169,36 @@ enum spoe_vars_scope { SPOE_SCOPE_RES, /* <=> SCOPE_RES */ }; +/* Frame Types sent by HAProxy and by agents */ +enum spoe_frame_type { + SPOE_FRM_T_UNSET = 0, + + /* Frames sent by HAProxy */ + SPOE_FRM_T_HAPROXY_HELLO = 1, + SPOE_FRM_T_HAPROXY_DISCON, + SPOE_FRM_T_HAPROXY_NOTIFY, + + /* Frames sent by the agents */ + SPOE_FRM_T_AGENT_HELLO = 101, + SPOE_FRM_T_AGENT_DISCON, + SPOE_FRM_T_AGENT_ACK +}; + +/* All supported data types */ +enum spoe_data_type { + SPOE_DATA_T_NULL = 0, + SPOE_DATA_T_BOOL, + SPOE_DATA_T_INT32, + SPOE_DATA_T_UINT32, + SPOE_DATA_T_INT64, + SPOE_DATA_T_UINT64, + SPOE_DATA_T_IPV4, + SPOE_DATA_T_IPV6, + SPOE_DATA_T_STR, + SPOE_DATA_T_BIN, + SPOE_DATA_TYPES +}; + /* Describe an argument that will be linked to a message. It is a sample fetch, * with an optional name. */ @@ -371,43 +409,4 @@ struct spoe_appctx { } frag_ctx; /* Info about fragmented frames, unused for unfragmented frames */ }; -/* Frame Types sent by HAProxy and by agents */ -enum spoe_frame_type { - SPOE_FRM_T_UNSET = 0, - - /* Frames sent by HAProxy */ - SPOE_FRM_T_HAPROXY_HELLO = 1, - SPOE_FRM_T_HAPROXY_DISCON, - SPOE_FRM_T_HAPROXY_NOTIFY, - - /* Frames sent by the agents */ - SPOE_FRM_T_AGENT_HELLO = 101, - SPOE_FRM_T_AGENT_DISCON, - SPOE_FRM_T_AGENT_ACK -}; - -/* All supported data types */ -enum spoe_data_type { - SPOE_DATA_T_NULL = 0, - SPOE_DATA_T_BOOL, - SPOE_DATA_T_INT32, - SPOE_DATA_T_UINT32, - SPOE_DATA_T_INT64, - SPOE_DATA_T_UINT64, - SPOE_DATA_T_IPV4, - SPOE_DATA_T_IPV6, - SPOE_DATA_T_STR, - SPOE_DATA_T_BIN, - SPOE_DATA_TYPES -}; - -/* Masks to get data type or flags value */ -#define SPOE_DATA_T_MASK 0x0F -#define SPOE_DATA_FL_MASK 0xF0 - -/* Flags to set Boolean values */ -#define SPOE_DATA_FL_FALSE 0x00 -#define SPOE_DATA_FL_TRUE 0x10 - - -#endif /* _TYPES_SPOE_H */ +#endif /* _HAPROXY_SPOE_T_H */ diff --git a/include/proto/spoe.h b/include/haproxy/spoe.h similarity index 98% rename from include/proto/spoe.h rename to include/haproxy/spoe.h index d9e9098201..8e123e3049 100644 --- a/include/proto/spoe.h +++ b/include/haproxy/spoe.h @@ -1,5 +1,5 @@ /* - * include/proto/spoe.h + * include/haproxy/spoe.h * Encoding/Decoding functions for the SPOE filters (and other helpers). * * Copyright (C) 2017 HAProxy Technologies, Christopher Faulet @@ -19,13 +19,13 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef _PROTO_SPOE_H -#define _PROTO_SPOE_H +#ifndef _HAPROXY_SPOE_H +#define _HAPROXY_SPOE_H +#include #include #include - -#include +#include /* Encode a buffer. Its length is encoded as a varint, followed by a copy @@ -348,4 +348,4 @@ spoe_decode_data(char **buf, char *end, struct sample *smp) return r; } -#endif /* _PROTO_SPOE_H */ +#endif /* _HAPROXY_SPOE_H */ diff --git a/src/flt_spoe.c b/src/flt_spoe.c index ec393b20ab..35a99c6c7c 100644 --- a/src/flt_spoe.c +++ b/src/flt_spoe.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -34,12 +35,10 @@ #include #include -#include #include #include #include -#include #include #if defined(DEBUG_SPOE) || defined(DEBUG_FULL)