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 8bc3e97..5e759b5 100644
--- a/contrib/mod_defender/defender.c
+++ b/contrib/mod_defender/defender.c
@@ -21,10 +21,9 @@
#include <haproxy/api.h>
#include <haproxy/tools.h>
#include <haproxy/chunk.h>
+#include <haproxy/spoe.h>
#include <haproxy/time.h>
-#include <proto/spoe.h>
-
#include <http_core.h>
#include <http_main.h>
#include <http_log.h>
diff --git a/contrib/mod_defender/spoa.c b/contrib/mod_defender/spoa.c
index b4c990b..35b3dd8 100644
--- a/contrib/mod_defender/spoa.c
+++ b/contrib/mod_defender/spoa.c
@@ -33,8 +33,7 @@
#include <haproxy/list.h>
#include <haproxy/chunk.h>
-
-#include <proto/spoe.h>
+#include <haproxy/spoe.h>
#include "spoa.h"
#include "defender.h"
diff --git a/contrib/modsecurity/modsec_wrapper.c b/contrib/modsecurity/modsec_wrapper.c
index 7407674..b5840c3 100644
--- a/contrib/modsecurity/modsec_wrapper.c
+++ b/contrib/modsecurity/modsec_wrapper.c
@@ -19,12 +19,12 @@
#include <haproxy/global.h>
#include <haproxy/hlua.h>
#include <haproxy/log.h>
+#include <haproxy/spoe.h>
#include <haproxy/time.h>
#include <types/stream.h>
#include <haproxy/arg.h>
-#include <proto/spoe.h>
#include <api.h>
diff --git a/contrib/modsecurity/spoa.c b/contrib/modsecurity/spoa.c
index b9d61ed..2c0b545 100644
--- a/contrib/modsecurity/spoa.c
+++ b/contrib/modsecurity/spoa.c
@@ -38,8 +38,7 @@
#include <haproxy/list.h>
#include <haproxy/chunk.h>
-
-#include <proto/spoe.h>
+#include <haproxy/spoe.h>
#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 f3edf86..9b0df17 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 <cfaulet@haproxy.com>
@@ -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 <sys/time.h>
+#include <haproxy/buf-t.h>
#include <haproxy/dynbuf-t.h>
#include <haproxy/filters-t.h>
+#include <haproxy/freq_ctr-t.h>
#include <haproxy/list-t.h>
#include <haproxy/proxy-t.h>
-#include <haproxy/thread.h>
-
-#include <haproxy/freq_ctr-t.h>
#include <haproxy/sample-t.h>
-#include <types/stream.h>
#include <haproxy/task-t.h>
+#include <haproxy/thread-t.h>
+#include <types/stream.h>
/* 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 @@
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 @@
} 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 97%
rename from include/proto/spoe.h
rename to include/haproxy/spoe.h
index d9e9098..8e123e3 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 <cfaulet@haproxy.com>
@@ -19,14 +19,14 @@
* 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 <haproxy/api.h>
#include <haproxy/intops.h>
#include <haproxy/sample-t.h>
+#include <haproxy/spoe-t.h>
-#include <types/spoe.h>
-
/* Encode a buffer. Its length <len> is encoded as a varint, followed by a copy
* of <str>. It must have enough space in <*buf> to encode the buffer, else an
@@ -348,4 +348,4 @@
return r;
}
-#endif /* _PROTO_SPOE_H */
+#endif /* _HAPROXY_SPOE_H */
diff --git a/src/flt_spoe.c b/src/flt_spoe.c
index ec393b2..35a99c6 100644
--- a/src/flt_spoe.c
+++ b/src/flt_spoe.c
@@ -26,6 +26,7 @@
#include <haproxy/pool.h>
#include <haproxy/proxy.h>
#include <haproxy/session.h>
+#include <haproxy/spoe.h>
#include <haproxy/stream_interface.h>
#include <haproxy/task.h>
#include <haproxy/tcp_rules.h>
@@ -34,12 +35,10 @@
#include <haproxy/arg-t.h>
#include <haproxy/global.h>
-#include <types/spoe.h>
#include <haproxy/arg.h>
#include <proto/backend.h>
#include <haproxy/freq_ctr.h>
-#include <proto/spoe.h>
#include <proto/stream.h>
#if defined(DEBUG_SPOE) || defined(DEBUG_FULL)