]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: spoe: Rename some flags and constant to use SPOP prefix
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 4 Jul 2024 08:53:43 +0000 (10:53 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 12 Jul 2024 13:27:04 +0000 (15:27 +0200)
A SPOP multiplexer will be added. Many flags, constants and structures will
be remove from the applet scope. So the "SPOP" prefix is used instead of
"SPOE", to be consistent.

The related issue is #2502.

include/haproxy/spoe-t.h
include/haproxy/spoe.h
src/flt_spoe.c

index 5f30050f425f8c6d6c9805f5f719b85dab3384eb..40ba373d651d8bd46a5f5f87be13f4d784ecc5c1 100644 (file)
 #include <haproxy/task-t.h>
 #include <haproxy/thread-t.h>
 
-/* Type of list of messages */
-#define SPOE_MSGS_BY_EVENT 0x01
-#define SPOE_MSGS_BY_GROUP 0x02
+/* Reserved 4 bytes to the frame size. So a frame and its size can be written
+ * together in a buffer */
+#define SPOP_MAX_FRAME_SIZE     global.tune.bufsize - 4
+
+/* The minimum size for a frame */
+#define SPOP_MIN_FRAME_SIZE     256
+
+/* Reserved for the metadata and the frame type.
+ * So <SPOP_MAX_FRAME_SIZE> - <FRAME_HDR_SIZE> is the maximum payload size */
+#define SPOP_FRAME_HDR_SIZE     32
+
+/* Flags set on the SPOP frame */
+#define SPOP_FRM_FL_FIN         0x00000001
+#define SPOP_FRM_FL_ABRT        0x00000002
+
 
-/* Flags set on the SPOE agent */
+/* All supported SPOP actions */
+enum spoe_action_type {
+       SPOP_ACT_T_SET_VAR = 1,
+       SPOP_ACT_T_UNSET_VAR,
+       SPOP_ACT_TYPES,
+};
+
+/* SPOP Errors */
+enum spop_error {
+        SPOP_ERR_NONE               = 0x00,
+        SPOP_ERR_IO                 = 0x01,
+        SPOP_ERR_TOUT               = 0x02,
+        SPOP_ERR_TOO_BIG            = 0x03,
+        SPOP_ERR_INVALID            = 0x04,
+        SPOP_ERR_NO_VSN             = 0x05,
+        SPOP_ERR_NO_FRAME_SIZE      = 0x06,
+        SPOP_ERR_NO_CAP             = 0x07,
+        SPOP_ERR_BAD_VSN            = 0x08,
+        SPOP_ERR_BAD_FRAME_SIZE     = 0x09,
+        SPOP_ERR_FRAG_NOT_SUPPORTED = 0x0a,
+        SPOP_ERR_INTERLACED_FRAMES  = 0x0b,
+        SPOP_ERR_FRAMEID_NOTFOUND   = 0x0c,
+        SPOP_ERR_RES                = 0x0d,
+        SPOP_ERR_UNKNOWN            = 0x63,
+       SPOP_ERR_ENTRIES,
+};
+
+/* Scopes used for variables set by agents. It is a way to be agnotic to vars
+ * scope. */
+enum spop_vars_scope {
+       SPOP_SCOPE_PROC = 0, /* <=> SCOPE_PROC  */
+       SPOP_SCOPE_SESS,     /* <=> SCOPE_SESS */
+       SPOP_SCOPE_TXN,      /* <=> SCOPE_TXN  */
+       SPOP_SCOPE_REQ,      /* <=> SCOPE_REQ  */
+       SPOP_SCOPE_RES,      /* <=> SCOPE_RES  */
+};
+
+/* Masks to get SPOP data type or flags value */
+#define SPOP_DATA_T_MASK  0x0F
+#define SPOP_DATA_FL_MASK 0xF0
+
+/* SPOP data flags to set Boolean values */
+#define SPOP_DATA_FL_FALSE 0x00
+#define SPOP_DATA_FL_TRUE  0x10
+
+/* All supported SPOP data types */
+enum spop_data_type {
+       SPOP_DATA_T_NULL = 0,
+       SPOP_DATA_T_BOOL,
+       SPOP_DATA_T_INT32,
+       SPOP_DATA_T_UINT32,
+       SPOP_DATA_T_INT64,
+       SPOP_DATA_T_UINT64,
+       SPOP_DATA_T_IPV4,
+       SPOP_DATA_T_IPV6,
+       SPOP_DATA_T_STR,
+       SPOP_DATA_T_BIN,
+       SPOP_DATA_TYPES
+};
+
+/* SPOP Frame Types */
+enum spop_frame_type {
+       SPOP_FRM_T_UNSET = 0,
+
+       /* Frames sent by HAProxy */
+       SPOP_FRM_T_HAPROXY_HELLO = 1,
+       SPOP_FRM_T_HAPROXY_DISCON,
+       SPOP_FRM_T_HAPROXY_NOTIFY,
+
+       /* Frames sent by the agents */
+       SPOP_FRM_T_AGENT_HELLO = 101,
+       SPOP_FRM_T_AGENT_DISCON,
+       SPOP_FRM_T_AGENT_ACK
+};
+
+/* SPOE agent flags */
 #define SPOE_FL_CONT_ON_ERR       0x00000001 /* Do not stop events processing when an error occurred */
 #define SPOE_FL_PIPELINING        0x00000002 /* Set when SPOE agent supports pipelining (set by default) */
-/* unused 0x00000004 */
-/* unsused 0x00000008 */
-/* unused 0x00000010 */
+/* unused 0x00000004..0x00000010 */
 #define SPOE_FL_FORCE_SET_VAR     0x00000020 /* Set when SPOE agent will set all variables from agent (and not only known variables) */
 
+/* Type of list of messages */
+#define SPOE_MSGS_BY_EVENT 0x01
+#define SPOE_MSGS_BY_GROUP 0x02
+
 /* Flags set on the SPOE context */
 #define SPOE_CTX_FL_CLI_CONNECTED 0x00000001 /* Set after that on-client-session event was processed */
 #define SPOE_CTX_FL_SRV_CONNECTED 0x00000002 /* Set after that on-server-session event was processed */
 #define SPOE_APPCTX_ERR_NONE    0x00000000 /* no error yet, leave it to zero */
 #define SPOE_APPCTX_ERR_TOUT    0x00000001 /* SPOE applet timeout */
 
-/* Flags set on the SPOE frame */
-#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 {
@@ -99,13 +177,6 @@ enum spoe_appctx_state {
        SPOE_APPCTX_ST_END,
 };
 
-/* All supported SPOE actions */
-enum spoe_action_type {
-       SPOE_ACT_T_SET_VAR = 1,
-       SPOE_ACT_T_UNSET_VAR,
-       SPOE_ACT_TYPES,
-};
-
 /* All supported SPOE events */
 enum spoe_event {
        SPOE_EV_NONE = 0,
@@ -136,67 +207,6 @@ enum spoe_context_error {
        SPOE_CTX_ERRS,
 };
 
-/* Errors triggered by SPOE applet */
-enum spoe_frame_error {
-       SPOE_FRM_ERR_NONE = 0,
-       SPOE_FRM_ERR_IO,
-       SPOE_FRM_ERR_TOUT,
-       SPOE_FRM_ERR_TOO_BIG,
-       SPOE_FRM_ERR_INVALID,
-       SPOE_FRM_ERR_NO_VSN,
-       SPOE_FRM_ERR_NO_FRAME_SIZE,
-       SPOE_FRM_ERR_NO_CAP,
-       SPOE_FRM_ERR_BAD_VSN,
-       SPOE_FRM_ERR_BAD_FRAME_SIZE,
-       SPOE_FRM_ERR_FRAG_NOT_SUPPORTED,
-       SPOE_FRM_ERR_INTERLACED_FRAMES,
-       SPOE_FRM_ERR_FRAMEID_NOTFOUND,
-       SPOE_FRM_ERR_RES,
-       SPOE_FRM_ERR_UNKNOWN = 99,
-       SPOE_FRM_ERRS,
-};
-
-/* Scopes used for variables set by agents. It is a way to be agnotic to vars
- * scope. */
-enum spoe_vars_scope {
-       SPOE_SCOPE_PROC = 0, /* <=> SCOPE_PROC  */
-       SPOE_SCOPE_SESS,     /* <=> SCOPE_SESS */
-       SPOE_SCOPE_TXN,      /* <=> SCOPE_TXN  */
-       SPOE_SCOPE_REQ,      /* <=> SCOPE_REQ  */
-       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. */
 struct spoe_arg {
index a799d614373ffa194335f3c6f0235664576ffd0d..6721d9777faee9e43b38be79dca87bef84171a59 100644 (file)
@@ -98,18 +98,18 @@ spoe_encode_data(struct sample *smp, char **buf, char *end)
                return -1;
 
        if (smp == NULL) {
-               *p++ = SPOE_DATA_T_NULL;
+               *p++ = SPOP_DATA_T_NULL;
                goto end;
        }
 
        switch (smp->data.type) {
                case SMP_T_BOOL:
-                       *p    = SPOE_DATA_T_BOOL;
-                       *p++ |= ((!smp->data.u.sint) ? SPOE_DATA_FL_FALSE : SPOE_DATA_FL_TRUE);
+                       *p    = SPOP_DATA_T_BOOL;
+                       *p++ |= ((!smp->data.u.sint) ? SPOP_DATA_FL_FALSE : SPOP_DATA_FL_TRUE);
                        break;
 
                case SMP_T_SINT:
-                       *p++ = SPOE_DATA_T_INT64;
+                       *p++ = SPOP_DATA_T_INT64;
                        if (encode_varint(smp->data.u.sint, &p, end) == -1)
                                return -1;
                        break;
@@ -117,7 +117,7 @@ spoe_encode_data(struct sample *smp, char **buf, char *end)
                case SMP_T_IPV4:
                        if (p + 5 > end)
                                return -1;
-                       *p++ = SPOE_DATA_T_IPV4;
+                       *p++ = SPOP_DATA_T_IPV4;
                        memcpy(p, &smp->data.u.ipv4, 4);
                        p += 4;
                        break;
@@ -125,7 +125,7 @@ spoe_encode_data(struct sample *smp, char **buf, char *end)
                case SMP_T_IPV6:
                        if (p + 17 > end)
                                return -1;
-                       *p++ = SPOE_DATA_T_IPV6;
+                       *p++ = SPOP_DATA_T_IPV6;
                        memcpy(p, &smp->data.u.ipv6, 16);
                        p += 16;
                        break;
@@ -134,7 +134,7 @@ spoe_encode_data(struct sample *smp, char **buf, char *end)
                case SMP_T_BIN: {
                        struct buffer *chk = &smp->data.u.str;
 
-                       *p++ = (smp->data.type == SMP_T_STR) ? SPOE_DATA_T_STR : SPOE_DATA_T_BIN;
+                       *p++ = (smp->data.type == SMP_T_STR) ? SPOP_DATA_T_STR : SPOP_DATA_T_BIN;
                        ret = spoe_encode_buffer(chk->area, chk->data, &p, end);
                        if (ret == -1)
                                return -1;
@@ -145,7 +145,7 @@ spoe_encode_data(struct sample *smp, char **buf, char *end)
                        char   *m;
                        size_t  len;
 
-                       *p++ = SPOE_DATA_T_STR;
+                       *p++ = SPOP_DATA_T_STR;
                        switch (smp->data.u.meth.meth) {
                                case HTTP_METH_OPTIONS: m = "OPTIONS"; len = 7; break;
                                case HTTP_METH_GET    : m = "GET";     len = 3; break;
@@ -166,7 +166,7 @@ spoe_encode_data(struct sample *smp, char **buf, char *end)
                }
 
                default:
-                       *p++ = SPOE_DATA_T_NULL;
+                       *p++ = SPOP_DATA_T_NULL;
                        break;
        }
 
@@ -197,28 +197,28 @@ spoe_skip_data(char **buf, char *end)
                return -1;
 
        type = *p++;
-       switch (type & SPOE_DATA_T_MASK) {
-               case SPOE_DATA_T_BOOL:
+       switch (type & SPOP_DATA_T_MASK) {
+               case SPOP_DATA_T_BOOL:
                        break;
-               case SPOE_DATA_T_INT32:
-               case SPOE_DATA_T_INT64:
-               case SPOE_DATA_T_UINT32:
-               case SPOE_DATA_T_UINT64:
+               case SPOP_DATA_T_INT32:
+               case SPOP_DATA_T_INT64:
+               case SPOP_DATA_T_UINT32:
+               case SPOP_DATA_T_UINT64:
                        if (decode_varint(&p, end, &v) == -1)
                                return -1;
                        break;
-               case SPOE_DATA_T_IPV4:
+               case SPOP_DATA_T_IPV4:
                        if (p+4 > end)
                                return -1;
                        p += 4;
                        break;
-               case SPOE_DATA_T_IPV6:
+               case SPOP_DATA_T_IPV6:
                        if (p+16 > end)
                                return -1;
                        p += 16;
                        break;
-               case SPOE_DATA_T_STR:
-               case SPOE_DATA_T_BIN:
+               case SPOP_DATA_T_STR:
+               case SPOP_DATA_T_BIN:
                        /* All the buffer must be skipped */
                        if (spoe_decode_buffer(&p, end, &str, &sz) == -1)
                                return -1;
@@ -244,41 +244,41 @@ spoe_decode_data(char **buf, char *end, struct sample *smp)
                return -1;
 
        type = *p++;
-       switch (type & SPOE_DATA_T_MASK) {
-               case SPOE_DATA_T_BOOL:
-                       smp->data.u.sint = ((type & SPOE_DATA_FL_MASK) == SPOE_DATA_FL_TRUE);
+       switch (type & SPOP_DATA_T_MASK) {
+               case SPOP_DATA_T_BOOL:
+                       smp->data.u.sint = ((type & SPOP_DATA_FL_MASK) == SPOP_DATA_FL_TRUE);
                        smp->data.type = SMP_T_BOOL;
                        break;
-               case SPOE_DATA_T_INT32:
-               case SPOE_DATA_T_INT64:
-               case SPOE_DATA_T_UINT32:
-               case SPOE_DATA_T_UINT64:
+               case SPOP_DATA_T_INT32:
+               case SPOP_DATA_T_INT64:
+               case SPOP_DATA_T_UINT32:
+               case SPOP_DATA_T_UINT64:
                        if (decode_varint(&p, end, (uint64_t *)&smp->data.u.sint) == -1)
                                return -1;
                        smp->data.type = SMP_T_SINT;
                        break;
-               case SPOE_DATA_T_IPV4:
+               case SPOP_DATA_T_IPV4:
                        if (p+4 > end)
                                return -1;
                        smp->data.type = SMP_T_IPV4;
                        memcpy(&smp->data.u.ipv4, p, 4);
                        p += 4;
                        break;
-               case SPOE_DATA_T_IPV6:
+               case SPOP_DATA_T_IPV6:
                        if (p+16 > end)
                                return -1;
                        memcpy(&smp->data.u.ipv6, p, 16);
                        smp->data.type = SMP_T_IPV6;
                        p += 16;
                        break;
-               case SPOE_DATA_T_STR:
-               case SPOE_DATA_T_BIN:
+               case SPOP_DATA_T_STR:
+               case SPOP_DATA_T_BIN:
                        /* All the buffer must be decoded */
                        if (spoe_decode_buffer(&p, end, &str, &sz) == -1)
                                return -1;
                        smp->data.u.str.area = str;
                        smp->data.u.str.data = sz;
-                       smp->data.type = (type == SPOE_DATA_T_STR) ? SMP_T_STR : SMP_T_BIN;
+                       smp->data.type = (type == SPOP_DATA_T_STR) ? SMP_T_STR : SMP_T_BIN;
                        break;
        }
 
index b0c8064bd3c02899924bde684fd26a0253d25ed4..df85cabd574defa6aa6f1ac20cb8e309396d01f2 100644 (file)
 #include <haproxy/vars.h>
 
 
-/* Reserved 4 bytes to the frame size. So a frame and its size can be written
- * together in a buffer */
-#define MAX_FRAME_SIZE     global.tune.bufsize - 4
-
-/* The minimum size for a frame */
-#define MIN_FRAME_SIZE     256
-
-/* Reserved for the metadata and the frame type.
- * So <MAX_FRAME_SIZE> - <FRAME_HDR_SIZE> is the maximum payload size */
-#define FRAME_HDR_SIZE     32
-
 /* Helper to get SPOE ctx inside an appctx */
 #define SPOE_APPCTX(appctx) ((struct spoe_appctx *)((appctx)->svcctx))
 
@@ -166,22 +155,22 @@ spoe_release_agent(struct spoe_agent *agent)
        free(agent);
 }
 
-static const char *spoe_frm_err_reasons[SPOE_FRM_ERRS] = {
-       [SPOE_FRM_ERR_NONE]               = "normal",
-       [SPOE_FRM_ERR_IO]                 = "I/O error",
-       [SPOE_FRM_ERR_TOUT]               = "a timeout occurred",
-       [SPOE_FRM_ERR_TOO_BIG]            = "frame is too big",
-       [SPOE_FRM_ERR_INVALID]            = "invalid frame received",
-       [SPOE_FRM_ERR_NO_VSN]             = "version value not found",
-       [SPOE_FRM_ERR_NO_FRAME_SIZE]      = "max-frame-size value not found",
-       [SPOE_FRM_ERR_NO_CAP]             = "capabilities value not found",
-       [SPOE_FRM_ERR_BAD_VSN]            = "unsupported version",
-       [SPOE_FRM_ERR_BAD_FRAME_SIZE]     = "max-frame-size too big or too small",
-       [SPOE_FRM_ERR_FRAG_NOT_SUPPORTED] = "fragmentation not supported",
-       [SPOE_FRM_ERR_INTERLACED_FRAMES]  = "invalid interlaced frames",
-       [SPOE_FRM_ERR_FRAMEID_NOTFOUND]   = "frame-id not found",
-       [SPOE_FRM_ERR_RES]                = "resource allocation error",
-       [SPOE_FRM_ERR_UNKNOWN]            = "an unknown error occurred",
+static const char *spoe_frm_err_reasons[SPOP_ERR_ENTRIES] = {
+       [SPOP_ERR_NONE]               = "normal",
+       [SPOP_ERR_IO]                 = "I/O error",
+       [SPOP_ERR_TOUT]               = "a timeout occurred",
+       [SPOP_ERR_TOO_BIG]            = "frame is too big",
+       [SPOP_ERR_INVALID]            = "invalid frame received",
+       [SPOP_ERR_NO_VSN]             = "version value not found",
+       [SPOP_ERR_NO_FRAME_SIZE]      = "max-frame-size value not found",
+       [SPOP_ERR_NO_CAP]             = "capabilities value not found",
+       [SPOP_ERR_BAD_VSN]            = "unsupported version",
+       [SPOP_ERR_BAD_FRAME_SIZE]     = "max-frame-size too big or too small",
+       [SPOP_ERR_FRAG_NOT_SUPPORTED] = "fragmentation not supported",
+       [SPOP_ERR_INTERLACED_FRAMES]  = "invalid interlaced frames",
+       [SPOP_ERR_FRAMEID_NOTFOUND]   = "frame-id not found",
+       [SPOP_ERR_RES]                = "resource allocation error",
+       [SPOP_ERR_UNKNOWN]            = "an unknown error occurred",
 };
 
 static const char *spoe_event_str[SPOE_EV_EVENTS] = {
@@ -227,7 +216,7 @@ spoe_update_stat_time(ullong *since, long *t)
 /* Predefined key used in HELLO/DISCONNECT frames */
 #define SUPPORTED_VERSIONS_KEY     "supported-versions"
 #define VERSION_KEY                "version"
-#define MAX_FRAME_SIZE_KEY         "max-frame-size"
+#define SPOP_MAX_FRAME_SIZE_KEY         "max-frame-size"
 #define CAPABILITIES_KEY           "capabilities"
 #define ENGINE_ID_KEY              "engine-id"
 #define HEALTHCHECK_KEY            "healthcheck"
@@ -318,14 +307,14 @@ spoe_prepare_hahello_frame(struct appctx *appctx, char *frame, size_t size)
        struct buffer      *chk;
        struct spoe_agent *agent = SPOE_APPCTX(appctx)->agent;
        char              *p, *end;
-       unsigned int       flags = SPOE_FRM_FL_FIN;
+       unsigned int       flags = SPOP_FRM_FL_FIN;
        size_t             sz;
 
        p   = frame;
        end = frame+size;
 
        /* Set Frame type */
-       *p++ = SPOE_FRM_T_HAPROXY_HELLO;
+       *p++ = SPOP_FRM_T_HAPROXY_HELLO;
 
        /* Set flags */
        flags = htonl(flags);
@@ -343,17 +332,17 @@ spoe_prepare_hahello_frame(struct appctx *appctx, char *frame, size_t size)
        if (spoe_encode_buffer(SUPPORTED_VERSIONS_KEY, sz, &p, end) == -1)
                goto too_big;
 
-       *p++ = SPOE_DATA_T_STR;
+       *p++ = SPOP_DATA_T_STR;
        sz = SLEN(SUPPORTED_VERSIONS_VAL);
        if (spoe_encode_buffer(SUPPORTED_VERSIONS_VAL, sz, &p, end) == -1)
                goto too_big;
 
        /* "max-fram-size" K/V item */
-       sz = SLEN(MAX_FRAME_SIZE_KEY);
-       if (spoe_encode_buffer(MAX_FRAME_SIZE_KEY, sz, &p, end) == -1)
+       sz = SLEN(SPOP_MAX_FRAME_SIZE_KEY);
+       if (spoe_encode_buffer(SPOP_MAX_FRAME_SIZE_KEY, sz, &p, end) == -1)
                goto too_big;
 
-       *p++ = SPOE_DATA_T_UINT32;
+       *p++ = SPOP_DATA_T_UINT32;
        if (encode_varint(SPOE_APPCTX(appctx)->max_frame_size, &p, end) == -1)
                goto too_big;
 
@@ -362,7 +351,7 @@ spoe_prepare_hahello_frame(struct appctx *appctx, char *frame, size_t size)
        if (spoe_encode_buffer(CAPABILITIES_KEY, sz, &p, end) == -1)
                goto too_big;
 
-       *p++ = SPOE_DATA_T_STR;
+       *p++ = SPOP_DATA_T_STR;
        chk = get_trash_chunk();
        if (agent != NULL && (agent->flags & SPOE_FL_PIPELINING)) {
                memcpy(chk->area, "pipelining", 10);
@@ -377,7 +366,7 @@ spoe_prepare_hahello_frame(struct appctx *appctx, char *frame, size_t size)
                if (spoe_encode_buffer(ENGINE_ID_KEY, sz, &p, end) == -1)
                        goto too_big;
 
-               *p++ = SPOE_DATA_T_STR;
+               *p++ = SPOP_DATA_T_STR;
                sz = strlen(agent->engine_id);
                if (spoe_encode_buffer(agent->engine_id, sz, &p, end) == -1)
                        goto too_big;
@@ -386,7 +375,7 @@ spoe_prepare_hahello_frame(struct appctx *appctx, char *frame, size_t size)
        return (p - frame);
 
   too_big:
-       SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_TOO_BIG;
+       SPOE_APPCTX(appctx)->status_code = SPOP_ERR_TOO_BIG;
        return 0;
 }
 
@@ -398,14 +387,14 @@ spoe_prepare_hadiscon_frame(struct appctx *appctx, char *frame, size_t size)
 {
        const char  *reason;
        char        *p, *end;
-       unsigned int flags = SPOE_FRM_FL_FIN;
+       unsigned int flags = SPOP_FRM_FL_FIN;
        size_t       sz;
 
        p   = frame;
        end = frame+size;
 
         /* Set Frame type */
-       *p++ = SPOE_FRM_T_HAPROXY_DISCON;
+       *p++ = SPOP_FRM_T_HAPROXY_DISCON;
 
        /* Set flags */
        flags = htonl(flags);
@@ -415,8 +404,8 @@ spoe_prepare_hadiscon_frame(struct appctx *appctx, char *frame, size_t size)
        /* No stream-id and frame-id for DISCONNECT frames */
        *p++ = 0; *p++ = 0;
 
-       if (SPOE_APPCTX(appctx)->status_code >= SPOE_FRM_ERRS)
-               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_UNKNOWN;
+       if (SPOE_APPCTX(appctx)->status_code >= SPOP_ERR_ENTRIES)
+               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_UNKNOWN;
 
        /* There are 2 mandatory items: "status-code" and "message" */
 
@@ -425,7 +414,7 @@ spoe_prepare_hadiscon_frame(struct appctx *appctx, char *frame, size_t size)
        if (spoe_encode_buffer(STATUS_CODE_KEY, sz, &p, end) == -1)
                goto too_big;
 
-       *p++ = SPOE_DATA_T_UINT32;
+       *p++ = SPOP_DATA_T_UINT32;
        if (encode_varint(SPOE_APPCTX(appctx)->status_code, &p, end) == -1)
                goto too_big;
 
@@ -437,7 +426,7 @@ spoe_prepare_hadiscon_frame(struct appctx *appctx, char *frame, size_t size)
        /*Get the message corresponding to the status code */
        reason = spoe_frm_err_reasons[SPOE_APPCTX(appctx)->status_code];
 
-       *p++ = SPOE_DATA_T_STR;
+       *p++ = SPOP_DATA_T_STR;
        sz = strlen(reason);
        if (spoe_encode_buffer(reason, sz, &p, end) == -1)
                goto too_big;
@@ -445,7 +434,7 @@ spoe_prepare_hadiscon_frame(struct appctx *appctx, char *frame, size_t size)
        return (p - frame);
 
   too_big:
-       SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_TOO_BIG;
+       SPOE_APPCTX(appctx)->status_code = SPOP_ERR_TOO_BIG;
        return 0;
 }
 
@@ -457,7 +446,7 @@ spoe_prepare_hanotify_frame(struct appctx *appctx, char *frame, size_t size)
 {
        char        *p, *end;
        unsigned int stream_id, frame_id;
-       unsigned int flags = SPOE_FRM_FL_FIN;
+       unsigned int flags = SPOP_FRM_FL_FIN;
        size_t       sz;
 
        p   = frame;
@@ -467,7 +456,7 @@ spoe_prepare_hanotify_frame(struct appctx *appctx, char *frame, size_t size)
        frame_id  = SPOE_APPCTX(appctx)->spoe_ctx->frame_id;
 
        /* Set Frame type */
-       *p++ = SPOE_FRM_T_HAPROXY_NOTIFY;
+       *p++ = SPOP_FRM_T_HAPROXY_NOTIFY;
 
        /* Set flags */
        flags = htonl(flags);
@@ -490,7 +479,7 @@ spoe_prepare_hanotify_frame(struct appctx *appctx, char *frame, size_t size)
        return (p - frame);
 
   too_big:
-       SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_TOO_BIG;
+       SPOE_APPCTX(appctx)->status_code = SPOP_ERR_TOO_BIG;
        return 0;
 }
 
@@ -509,13 +498,13 @@ spoe_handle_agenthello_frame(struct appctx *appctx, char *frame, size_t size)
        end = frame + size;
 
        /* Check frame type */
-       if (*p++ != SPOE_FRM_T_AGENT_HELLO) {
-               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_INVALID;
+       if (*p++ != SPOP_FRM_T_AGENT_HELLO) {
+               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_INVALID;
                return 0;
        }
 
        if (size < 7 /* TYPE + METADATA */) {
-               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_INVALID;
+               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_INVALID;
                return 0;
        }
 
@@ -525,14 +514,14 @@ spoe_handle_agenthello_frame(struct appctx *appctx, char *frame, size_t size)
        p += 4;
 
        /* Fragmentation is not supported for HELLO frame */
-       if (!(flags & SPOE_FRM_FL_FIN)) {
-               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_FRAG_NOT_SUPPORTED;
+       if (!(flags & SPOP_FRM_FL_FIN)) {
+               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_FRAG_NOT_SUPPORTED;
                return -1;
        }
 
        /* stream-id and frame-id must be cleared */
        if (*p != 0 || *(p+1) != 0) {
-               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_INVALID;
+               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_INVALID;
                return 0;
        }
        p += 2;
@@ -550,7 +539,7 @@ spoe_handle_agenthello_frame(struct appctx *appctx, char *frame, size_t size)
                /* Decode the item key */
                ret = spoe_decode_buffer(&p, end, &str, &sz);
                if (ret == -1 || !sz) {
-                       SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_INVALID;
+                       SPOE_APPCTX(appctx)->status_code = SPOP_ERR_INVALID;
                        return 0;
                }
 
@@ -559,18 +548,18 @@ spoe_handle_agenthello_frame(struct appctx *appctx, char *frame, size_t size)
                        int i, type = *p++;
 
                        /* The value must be a string */
-                       if ((type & SPOE_DATA_T_MASK) != SPOE_DATA_T_STR) {
-                               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_INVALID;
+                       if ((type & SPOP_DATA_T_MASK) != SPOP_DATA_T_STR) {
+                               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_INVALID;
                                return 0;
                        }
                        if (spoe_decode_buffer(&p, end, &str, &sz) == -1) {
-                               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_INVALID;
+                               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_INVALID;
                                return 0;
                        }
 
                        vsn = spoe_str_to_vsn(str, sz);
                        if (vsn == -1) {
-                               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_BAD_VSN;
+                               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_BAD_VSN;
                                return -1;
                        }
                        for (i = 0; supported_versions[i].str != NULL; ++i) {
@@ -579,29 +568,29 @@ spoe_handle_agenthello_frame(struct appctx *appctx, char *frame, size_t size)
                                        break;
                        }
                        if (supported_versions[i].str == NULL) {
-                               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_BAD_VSN;
+                               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_BAD_VSN;
                                return -1;
                        }
                }
                /* Check "max-frame-size" K/V item */
-               else if (sz >= strlen(MAX_FRAME_SIZE_KEY) && !memcmp(str, MAX_FRAME_SIZE_KEY, strlen(MAX_FRAME_SIZE_KEY))) {
+               else if (sz >= strlen(SPOP_MAX_FRAME_SIZE_KEY) && !memcmp(str, SPOP_MAX_FRAME_SIZE_KEY, strlen(SPOP_MAX_FRAME_SIZE_KEY))) {
                        int type = *p++;
 
                        /* The value must be integer */
-                       if ((type & SPOE_DATA_T_MASK) != SPOE_DATA_T_INT32 &&
-                           (type & SPOE_DATA_T_MASK) != SPOE_DATA_T_INT64 &&
-                           (type & SPOE_DATA_T_MASK) != SPOE_DATA_T_UINT32 &&
-                           (type & SPOE_DATA_T_MASK) != SPOE_DATA_T_UINT64) {
-                               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_INVALID;
+                       if ((type & SPOP_DATA_T_MASK) != SPOP_DATA_T_INT32 &&
+                           (type & SPOP_DATA_T_MASK) != SPOP_DATA_T_INT64 &&
+                           (type & SPOP_DATA_T_MASK) != SPOP_DATA_T_UINT32 &&
+                           (type & SPOP_DATA_T_MASK) != SPOP_DATA_T_UINT64) {
+                               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_INVALID;
                                return 0;
                        }
                        if (decode_varint(&p, end, &sz) == -1) {
-                               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_INVALID;
+                               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_INVALID;
                                return 0;
                        }
-                       if (sz < MIN_FRAME_SIZE ||
+                       if (sz < SPOP_MIN_FRAME_SIZE ||
                            sz > SPOE_APPCTX(appctx)->max_frame_size) {
-                               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_BAD_FRAME_SIZE;
+                               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_BAD_FRAME_SIZE;
                                return -1;
                        }
                        max_frame_size = sz;
@@ -611,12 +600,12 @@ spoe_handle_agenthello_frame(struct appctx *appctx, char *frame, size_t size)
                        int type = *p++;
 
                        /* The value must be a string */
-                       if ((type & SPOE_DATA_T_MASK) != SPOE_DATA_T_STR) {
-                               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_INVALID;
+                       if ((type & SPOP_DATA_T_MASK) != SPOP_DATA_T_STR) {
+                               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_INVALID;
                                return 0;
                        }
                        if (spoe_decode_buffer(&p, end, &str, &sz) == -1) {
-                               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_INVALID;
+                               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_INVALID;
                                return 0;
                        }
 
@@ -643,7 +632,7 @@ spoe_handle_agenthello_frame(struct appctx *appctx, char *frame, size_t size)
                else {
                        /* Silently ignore unknown item */
                        if (spoe_skip_data(&p, end) == -1) {
-                               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_INVALID;
+                               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_INVALID;
                                return 0;
                        }
                }
@@ -651,11 +640,11 @@ spoe_handle_agenthello_frame(struct appctx *appctx, char *frame, size_t size)
 
        /* Final checks */
        if (!vsn) {
-               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_NO_VSN;
+               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_NO_VSN;
                return -1;
        }
        if (!max_frame_size) {
-               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_NO_FRAME_SIZE;
+               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_NO_FRAME_SIZE;
                return -1;
        }
        if (!agent)
@@ -685,13 +674,13 @@ spoe_handle_agentdiscon_frame(struct appctx *appctx, char *frame, size_t size)
        end = frame + size;
 
        /* Check frame type */
-       if (*p++ != SPOE_FRM_T_AGENT_DISCON) {
-               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_INVALID;
+       if (*p++ != SPOP_FRM_T_AGENT_DISCON) {
+               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_INVALID;
                return 0;
        }
 
        if (size < 7 /* TYPE + METADATA */) {
-               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_INVALID;
+               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_INVALID;
                return 0;
        }
 
@@ -701,14 +690,14 @@ spoe_handle_agentdiscon_frame(struct appctx *appctx, char *frame, size_t size)
        p += 4;
 
        /* Fragmentation is not supported for DISCONNECT frame */
-       if (!(flags & SPOE_FRM_FL_FIN)) {
-               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_FRAG_NOT_SUPPORTED;
+       if (!(flags & SPOP_FRM_FL_FIN)) {
+               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_FRAG_NOT_SUPPORTED;
                return -1;
        }
 
        /* stream-id and frame-id must be cleared */
        if (*p != 0 || *(p+1) != 0) {
-               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_INVALID;
+               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_INVALID;
                return 0;
        }
        p += 2;
@@ -724,7 +713,7 @@ spoe_handle_agentdiscon_frame(struct appctx *appctx, char *frame, size_t size)
                /* Decode the item key */
                ret = spoe_decode_buffer(&p, end, &str, &sz);
                if (ret == -1 || !sz) {
-                       SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_INVALID;
+                       SPOE_APPCTX(appctx)->status_code = SPOP_ERR_INVALID;
                        return 0;
                }
 
@@ -733,15 +722,15 @@ spoe_handle_agentdiscon_frame(struct appctx *appctx, char *frame, size_t size)
                        int type = *p++;
 
                        /* The value must be an integer */
-                       if ((type & SPOE_DATA_T_MASK) != SPOE_DATA_T_INT32 &&
-                           (type & SPOE_DATA_T_MASK) != SPOE_DATA_T_INT64 &&
-                           (type & SPOE_DATA_T_MASK) != SPOE_DATA_T_UINT32 &&
-                           (type & SPOE_DATA_T_MASK) != SPOE_DATA_T_UINT64) {
-                               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_INVALID;
+                       if ((type & SPOP_DATA_T_MASK) != SPOP_DATA_T_INT32 &&
+                           (type & SPOP_DATA_T_MASK) != SPOP_DATA_T_INT64 &&
+                           (type & SPOP_DATA_T_MASK) != SPOP_DATA_T_UINT32 &&
+                           (type & SPOP_DATA_T_MASK) != SPOP_DATA_T_UINT64) {
+                               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_INVALID;
                                return 0;
                        }
                        if (decode_varint(&p, end, &sz) == -1) {
-                               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_INVALID;
+                               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_INVALID;
                                return 0;
                        }
                        SPOE_APPCTX(appctx)->status_code = sz;
@@ -752,20 +741,20 @@ spoe_handle_agentdiscon_frame(struct appctx *appctx, char *frame, size_t size)
                        int type = *p++;
 
                        /* The value must be a string */
-                       if ((type & SPOE_DATA_T_MASK) != SPOE_DATA_T_STR) {
-                               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_INVALID;
+                       if ((type & SPOP_DATA_T_MASK) != SPOP_DATA_T_STR) {
+                               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_INVALID;
                                return 0;
                        }
                        ret = spoe_decode_buffer(&p, end, &str, &sz);
                        if (ret == -1 || sz > 255) {
-                               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_INVALID;
+                               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_INVALID;
                                return 0;
                        }
                }
                else {
                        /* Silently ignore unknown item */
                        if (spoe_skip_data(&p, end) == -1) {
-                               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_INVALID;
+                               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_INVALID;
                                return 0;
                        }
                }
@@ -789,13 +778,13 @@ spoe_handle_agentack_frame(struct appctx *appctx, char *frame, size_t size)
        end  = frame + size;
 
        /* Check frame type */
-       if (*p++ != SPOE_FRM_T_AGENT_ACK) {
-               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_INVALID;
+       if (*p++ != SPOP_FRM_T_AGENT_ACK) {
+               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_INVALID;
                return -1;
        }
 
        if (size < 7 /* TYPE + METADATA */) {
-               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_INVALID;
+               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_INVALID;
                return -1;
        }
 
@@ -805,18 +794,18 @@ spoe_handle_agentack_frame(struct appctx *appctx, char *frame, size_t size)
        p += 4;
 
        /* Fragmentation is not supported for now */
-       if (!(flags & SPOE_FRM_FL_FIN)) {
-               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_FRAG_NOT_SUPPORTED;
+       if (!(flags & SPOP_FRM_FL_FIN)) {
+               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_FRAG_NOT_SUPPORTED;
                return -1;
        }
 
        /* Get the stream-id and the frame-id */
        if (decode_varint(&p, end, &stream_id) == -1) {
-               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_INVALID;
+               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_INVALID;
                return -1;
        }
        if (decode_varint(&p, end, &frame_id) == -1) {
-               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_INVALID;
+               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_INVALID;
                return -1;
        }
 
@@ -825,7 +814,7 @@ spoe_handle_agentack_frame(struct appctx *appctx, char *frame, size_t size)
                        goto found;
 
        /* No Stream found, ignore the frame */
-       SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_FRAMEID_NOTFOUND;
+       SPOE_APPCTX(appctx)->status_code = SPOP_ERR_FRAMEID_NOTFOUND;
        return -1;
 
   found:
@@ -852,7 +841,7 @@ spoe_prepare_healthcheck_request(char **req, int *len)
 {
        struct appctx      appctx;
        struct spoe_appctx spoe_appctx;
-       char  *frame, *end, buf[MAX_FRAME_SIZE+4];
+       char  *frame, *end, buf[SPOP_MAX_FRAME_SIZE+4];
        size_t sz;
        int    ret;
 
@@ -861,12 +850,12 @@ spoe_prepare_healthcheck_request(char **req, int *len)
        memset(buf, 0, sizeof(buf));
 
        appctx.svcctx = &spoe_appctx;
-       SPOE_APPCTX(&appctx)->max_frame_size = MAX_FRAME_SIZE;
+       SPOE_APPCTX(&appctx)->max_frame_size = SPOP_MAX_FRAME_SIZE;
 
        frame = buf+4; /* Reserved the 4 first bytes for the frame size */
-       end   = frame + MAX_FRAME_SIZE;
+       end   = frame + SPOP_MAX_FRAME_SIZE;
 
-       ret = spoe_prepare_hahello_frame(&appctx, frame, MAX_FRAME_SIZE);
+       ret = spoe_prepare_hahello_frame(&appctx, frame, SPOP_MAX_FRAME_SIZE);
        if (ret <= 0)
                return -1;
        frame += ret;
@@ -875,7 +864,7 @@ spoe_prepare_healthcheck_request(char **req, int *len)
        sz = SLEN(HEALTHCHECK_KEY);
        if (spoe_encode_buffer(HEALTHCHECK_KEY, sz, &frame, end) == -1)
                return -1;
-       *frame++ = (SPOE_DATA_T_BOOL | SPOE_DATA_FL_TRUE);
+       *frame++ = (SPOP_DATA_T_BOOL | SPOP_DATA_FL_TRUE);
 
        *len = frame - buf;
        sz   = htonl(*len - 4);
@@ -900,9 +889,9 @@ spoe_handle_healthcheck_response(char *frame, size_t size, char *err, int errlen
        memset(&spoe_appctx, 0, sizeof(spoe_appctx));
 
        appctx.svcctx = &spoe_appctx;
-       SPOE_APPCTX(&appctx)->max_frame_size = MAX_FRAME_SIZE;
+       SPOE_APPCTX(&appctx)->max_frame_size = SPOP_MAX_FRAME_SIZE;
 
-       if (*frame == SPOE_FRM_T_AGENT_DISCON) {
+       if (*frame == SPOP_FRM_T_AGENT_DISCON) {
                spoe_handle_agentdiscon_frame(&appctx, frame, size);
                goto error;
        }
@@ -912,8 +901,8 @@ spoe_handle_healthcheck_response(char *frame, size_t size, char *err, int errlen
        return 0;
 
   error:
-       if (SPOE_APPCTX(&appctx)->status_code >= SPOE_FRM_ERRS)
-               SPOE_APPCTX(&appctx)->status_code = SPOE_FRM_ERR_UNKNOWN;
+       if (SPOE_APPCTX(&appctx)->status_code >= SPOP_ERR_ENTRIES)
+               SPOE_APPCTX(&appctx)->status_code = SPOP_ERR_UNKNOWN;
        strncpy(err, spoe_frm_err_reasons[SPOE_APPCTX(&appctx)->status_code], errlen);
        return -1;
 }
@@ -951,11 +940,11 @@ spoe_recv_frame(struct appctx *appctx, char *buf, size_t framesz)
        if (ret > 0) {
                framesz = ntohl(netint);
                if (framesz < 7)  {
-                       SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_INVALID;
+                       SPOE_APPCTX(appctx)->status_code = SPOP_ERR_INVALID;
                        return -1;
                }
                if (framesz > SPOE_APPCTX(appctx)->max_frame_size) {
-                       SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_TOO_BIG;
+                       SPOE_APPCTX(appctx)->status_code = SPOP_ERR_TOO_BIG;
                        return -1;
                }
                ret = co_getblk(sc_oc(sc), buf, framesz, 4);
@@ -964,7 +953,7 @@ spoe_recv_frame(struct appctx *appctx, char *buf, size_t framesz)
                if (ret == 0) {
                        return 1; /* retry */
                }
-               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_IO;
+               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_IO;
                return -1; /* error */
        }
        return framesz;
@@ -1030,8 +1019,8 @@ spoe_release_appctx(struct appctx *appctx)
        /* Shutdown the server connection, if needed */
        if (appctx->st0 != SPOE_APPCTX_ST_END) {
                appctx->st0 = SPOE_APPCTX_ST_END;
-               if (spoe_appctx->status_code == SPOE_FRM_ERR_NONE)
-                       spoe_appctx->status_code = SPOE_FRM_ERR_IO;
+               if (spoe_appctx->status_code == SPOP_ERR_NONE)
+                       spoe_appctx->status_code = SPOP_ERR_IO;
        }
 
        if (spoe_appctx->spoe_ctx)  {
@@ -1067,7 +1056,7 @@ spoe_handle_connect_appctx(struct appctx *appctx)
         }
 
        if (appctx->st1 == SPOE_APPCTX_ERR_TOUT) {
-               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_TOUT;
+               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_TOUT;
                goto exit;
        }
 
@@ -1111,7 +1100,7 @@ spoe_handle_connecting_appctx(struct appctx *appctx)
        int    ret;
 
        if (appctx->st1 == SPOE_APPCTX_ERR_TOUT) {
-               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_TOUT;
+               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_TOUT;
                goto exit;
        }
 
@@ -1119,7 +1108,7 @@ spoe_handle_connecting_appctx(struct appctx *appctx)
        ret = spoe_recv_frame(appctx, frame,
                              SPOE_APPCTX(appctx)->max_frame_size);
        if (ret > 1) {
-               if (*frame == SPOE_FRM_T_AGENT_DISCON) {
+               if (*frame == SPOP_FRM_T_AGENT_DISCON) {
                        appctx->st0 = SPOE_APPCTX_ST_DISCONNECTING;
                        goto next;
                }
@@ -1210,7 +1199,7 @@ spoe_handle_receiving_frame_appctx(struct appctx *appctx)
        ret = spoe_recv_frame(appctx, frame,
                              SPOE_APPCTX(appctx)->max_frame_size);
        if (ret > 1) {
-               if (*frame == SPOE_FRM_T_AGENT_DISCON) {
+               if (*frame == SPOP_FRM_T_AGENT_DISCON) {
                        appctx->st0 = SPOE_APPCTX_ST_DISCONNECTING;
                        ret = -1;
                        goto end;
@@ -1350,7 +1339,7 @@ spoe_handle_disconnecting_appctx(struct appctx *appctx)
        int    ret;
 
        if (appctx->st1 == SPOE_APPCTX_ERR_TOUT) {
-               SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_TOUT;
+               SPOE_APPCTX(appctx)->status_code = SPOP_ERR_TOUT;
                goto exit;
        }
 
@@ -1403,7 +1392,7 @@ spoe_handle_appctx(struct appctx *appctx)
                return;
        }
 
-       SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_NONE;
+       SPOE_APPCTX(appctx)->status_code = SPOP_ERR_NONE;
        if (!SPOE_APPCTX(appctx)->spoe_ctx) {
                if (appctx->st0 == SPOE_APPCTX_ST_CONNECT)
                        appctx->st0 =  SPOE_APPCTX_ST_EXIT;
@@ -1446,7 +1435,7 @@ spoe_handle_appctx(struct appctx *appctx)
                case SPOE_APPCTX_ST_EXIT:
                        appctx->st0 = SPOE_APPCTX_ST_END;
                        se_fl_set(appctx->sedesc, SE_FL_EOS);
-                       if (SPOE_APPCTX(appctx)->status_code != SPOE_FRM_ERR_NONE)
+                       if (SPOE_APPCTX(appctx)->status_code != SPOP_ERR_NONE)
                                se_fl_set(appctx->sedesc, SE_FL_ERROR);
                        else
                                se_fl_set(appctx->sedesc, SE_FL_EOI);
@@ -1483,7 +1472,7 @@ spoe_create_appctx(struct spoe_config *conf)
        spoe_appctx->version         = 0;
        spoe_appctx->max_frame_size  = agent->max_frame_size;
        spoe_appctx->flags           = 0;
-       spoe_appctx->status_code     = SPOE_FRM_ERR_NONE;
+       spoe_appctx->status_code     = SPOP_ERR_NONE;
        spoe_appctx->buffer          = BUF_NULL;
 
 
@@ -1580,7 +1569,7 @@ spoe_encode_messages(struct stream *s, struct spoe_context *ctx,
        char   *p, *end;
 
        p   = b_head(&ctx->buffer);
-       end =  p + agent->max_frame_size - FRAME_HDR_SIZE;
+       end =  p + agent->max_frame_size - SPOP_FRAME_HDR_SIZE;
 
        if (type == SPOE_MSGS_BY_EVENT) { /* Loop on messages by event */
                list_for_each_entry(msg, messages, by_evt) {
@@ -1670,11 +1659,11 @@ spoe_decode_action_set_var(struct stream *s, struct spoe_context *ctx,
                goto skip;
 
        switch (*p++) {
-               case SPOE_SCOPE_PROC: scope = "proc"; break;
-               case SPOE_SCOPE_SESS: scope = "sess"; break;
-               case SPOE_SCOPE_TXN : scope = "txn";  break;
-               case SPOE_SCOPE_REQ : scope = "req";  break;
-               case SPOE_SCOPE_RES : scope = "res";  break;
+               case SPOP_SCOPE_PROC: scope = "proc"; break;
+               case SPOP_SCOPE_SESS: scope = "sess"; break;
+               case SPOP_SCOPE_TXN : scope = "txn";  break;
+               case SPOP_SCOPE_REQ : scope = "req";  break;
+               case SPOP_SCOPE_RES : scope = "res";  break;
                default: goto skip;
        }
 
@@ -1715,11 +1704,11 @@ spoe_decode_action_unset_var(struct stream *s, struct spoe_context *ctx,
                goto skip;
 
        switch (*p++) {
-               case SPOE_SCOPE_PROC: scope = "proc"; break;
-               case SPOE_SCOPE_SESS: scope = "sess"; break;
-               case SPOE_SCOPE_TXN : scope = "txn";  break;
-               case SPOE_SCOPE_REQ : scope = "req";  break;
-               case SPOE_SCOPE_RES : scope = "res";  break;
+               case SPOP_SCOPE_PROC: scope = "proc"; break;
+               case SPOP_SCOPE_SESS: scope = "sess"; break;
+               case SPOP_SCOPE_TXN : scope = "txn";  break;
+               case SPOP_SCOPE_REQ : scope = "req";  break;
+               case SPOP_SCOPE_RES : scope = "res";  break;
                default: goto skip;
        }
 
@@ -1753,13 +1742,13 @@ spoe_process_actions(struct stream *s, struct spoe_context *ctx, int dir)
 
                type = *p++;
                switch (type) {
-                       case SPOE_ACT_T_SET_VAR:
+                       case SPOP_ACT_T_SET_VAR:
                                ret = spoe_decode_action_set_var(s, ctx, &p, end, dir);
                                if (!ret)
                                        goto skip;
                                break;
 
-                       case SPOE_ACT_T_UNSET_VAR:
+                       case SPOP_ACT_T_UNSET_VAR:
                                ret = spoe_decode_action_unset_var(s, ctx, &p, end, dir);
                                if (!ret)
                                        goto skip;
@@ -2460,7 +2449,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
                curagent->var_t_process  = NULL;
                curagent->var_t_total    = NULL;
                curagent->flags          = SPOE_FL_PIPELINING;
-               curagent->max_frame_size = MAX_FRAME_SIZE;
+               curagent->max_frame_size = SPOP_MAX_FRAME_SIZE;
 
                for (i = 0; i < SPOE_EV_EVENTS; ++i)
                        LIST_INIT(&curagent->events[i]);
@@ -2771,10 +2760,10 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
                if (alertif_too_many_args(1, file, linenum, args, &err_code))
                        goto out;
                curagent->max_frame_size = atol(args[1]);
-               if (curagent->max_frame_size < MIN_FRAME_SIZE ||
-                   curagent->max_frame_size > MAX_FRAME_SIZE) {
+               if (curagent->max_frame_size < SPOP_MIN_FRAME_SIZE ||
+                   curagent->max_frame_size > SPOP_MAX_FRAME_SIZE) {
                        ha_alert("parsing [%s:%d] : '%s' expects a positive integer argument in the range [%d, %d].\n",
-                                file, linenum, args[0], MIN_FRAME_SIZE, MAX_FRAME_SIZE);
+                                file, linenum, args[0], SPOP_MIN_FRAME_SIZE, SPOP_MAX_FRAME_SIZE);
                        err_code |= ERR_ALERT | ERR_FATAL;
                        goto out;
                }