]> git.kaiwu.me - haproxy.git/commitdiff
MINOR: obj_type: add OBJ_TYPE_HXLOAD for haload stream objects
authorFrederic Lecaille <flecaille@haproxy.com>
Thu, 19 Mar 2026 13:43:50 +0000 (14:43 +0100)
committerFrederic Lecaille <flecaille@haproxy.com>
Fri, 24 Apr 2026 09:32:45 +0000 (11:32 +0200)
This patch introduces the OBJ_TYPE_HXLOAD object type to represent
haload stream objects (struct hastream).

It also adds the associated inline helper functions objt_hastream()
and __objt_hastream() to allow safe casting and retrieval of
hastream contexts from a generic object pointer, following the
standard container_of pattern.

include/haproxy/obj_type-t.h
include/haproxy/obj_type.h

index f57fbf01a1cce6fc73465fb532bfd60f3a76aa82..6ffca9be368622e808ecbd2b396c8eb5e34c8297 100644 (file)
@@ -47,6 +47,7 @@ enum obj_type {
        OBJ_TYPE_DGRAM,        /* object is a struct quic_dgram */
 #endif
        OBJ_TYPE_HATERM,       /* object is a struct hstream */
+       OBJ_TYPE_HALOAD,       /* object is a struct hxstream */
        OBJ_TYPE_ACME_RSLV,   /* object is a struct acme_rslv */
        OBJ_TYPE_ENTRIES       /* last one : number of entries */
 } __attribute__((packed)) ;
index d10a3296900009c1efff7d4e52321a9f15ed5d37..653a187c067090c008def764edf5988ca84cb30e 100644 (file)
@@ -28,6 +28,7 @@
 #include <haproxy/check-t.h>
 #include <haproxy/connection-t.h>
 #include <haproxy/hstream-t.h>
+#include <haproxy/hldstream-t.h>
 #include <haproxy/listener-t.h>
 #include <haproxy/obj_type-t.h>
 #include <haproxy/pool.h>
@@ -217,6 +218,19 @@ static inline struct acme_rslv *objt_acme_rslv(enum obj_type *t)
        return __objt_acme_rslv(t);
 }
 
+static inline struct hldstream *__objt_hldstream(enum obj_type *t)
+{
+       return container_of(t, struct hldstream, obj_type);
+}
+
+static inline struct hldstream *objt_hldstream(enum obj_type *t)
+{
+       if (!t || *t != OBJ_TYPE_HALOAD)
+               return NULL;
+
+       return __objt_hldstream(t);
+}
+
 #ifdef USE_QUIC
 static inline struct quic_dgram *__objt_dgram(enum obj_type *t)
 {