]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: obj_type: new object type for struct stream
authorBaptiste Assmann <bedis9@gmail.com>
Tue, 30 Jan 2018 07:10:20 +0000 (08:10 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 23 Apr 2019 09:35:56 +0000 (11:35 +0200)
This patch creates a new obj_type for the struct stream in HAProxy.

include/proto/obj_type.h
include/types/obj_type.h
include/types/stream.h

index 47273caa5ff1ea39bf80159295ed7342fa0e64db..afb8d90475f570a0b62aad8e377ed74aa8461220 100644 (file)
@@ -30,6 +30,7 @@
 #include <types/obj_type.h>
 #include <types/proxy.h>
 #include <types/server.h>
+#include <types/stream.h>
 #include <types/stream_interface.h>
 
 static inline enum obj_type obj_type(enum obj_type *t)
@@ -51,6 +52,7 @@ static inline const char *obj_type_name(enum obj_type *t)
        case OBJ_TYPE_CONN:     return "CONN";
        case OBJ_TYPE_SRVRQ:    return "SRVRQ";
        case OBJ_TYPE_CS:       return "CS";
+       case OBJ_TYPE_STREAM:   return "STREAM";
        default:                return "!INVAL!";
        }
 }
@@ -158,6 +160,18 @@ static inline struct dns_srvrq *objt_dns_srvrq(enum obj_type *t)
        return __objt_dns_srvrq(t);
 }
 
+static inline struct stream *__objt_stream(enum obj_type *t)
+{
+       return container_of(t, struct stream, obj_type);
+}
+
+static inline struct stream *objt_stream(enum obj_type *t)
+{
+       if (!t || *t != OBJ_TYPE_STREAM)
+               return NULL;
+       return __objt_stream(t);
+}
+
 static inline void *obj_base_ptr(enum obj_type *t)
 {
        switch (obj_type(t)) {
index e141d69e554b4a6d8baab68f6569caba9f062d4e..94107181ec57314d714fbf17b4f6b14709c7c5fe 100644 (file)
@@ -41,6 +41,7 @@ enum obj_type {
        OBJ_TYPE_CONN,         /* object is a struct connection */
        OBJ_TYPE_SRVRQ,        /* object is a struct dns_srvrq */
        OBJ_TYPE_CS,           /* object is a struct conn_stream */
+       OBJ_TYPE_STREAM,       /* object is a struct stream */
        OBJ_TYPE_ENTRIES       /* last one : number of entries */
 } __attribute__((packed)) ;
 
index 93a39a3ecc7bb3a216cbcaf5bf7e19a66c077567..b6a3e849516ae911b27249173edae3b81752cee2 100644 (file)
@@ -151,7 +151,9 @@ struct stream {
                struct stktable *table;
        } store[8];                     /* tracked stickiness values to store */
        int store_count;
-       /* 4 unused bytes here */
+
+       enum obj_type obj_type;         /* object type == OBJ_TYPE_STREAM */
+       /* 3 unused bytes here */
 
        struct stkctr stkctr[MAX_SESS_STKCTR];  /* content-aware stick counters */