mirror of
https://github.com/haproxy/haproxy.git
synced 2026-04-04 00:25:08 -04:00
MINOR: obj_type: add OBJ_TYPE_HXLOAD for haload stream objects
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.
This commit is contained in:
parent
e244287072
commit
431fc98ce5
2 changed files with 15 additions and 0 deletions
|
|
@ -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_HXLOAD, /* object is a struct hxstream */
|
||||
OBJ_TYPE_ENTRIES /* last one : number of entries */
|
||||
} __attribute__((packed)) ;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include <haproxy/check-t.h>
|
||||
#include <haproxy/connection-t.h>
|
||||
#include <haproxy/hstream-t.h>
|
||||
#include <haproxy/hastream-t.h>
|
||||
#include <haproxy/listener-t.h>
|
||||
#include <haproxy/obj_type-t.h>
|
||||
#include <haproxy/pool.h>
|
||||
|
|
@ -203,6 +204,19 @@ static inline struct hstream *objt_hstream(enum obj_type *t)
|
|||
return __objt_hstream(t);
|
||||
}
|
||||
|
||||
static inline struct hastream *__objt_hastream(enum obj_type *t)
|
||||
{
|
||||
return container_of(t, struct hastream, obj_type);
|
||||
}
|
||||
|
||||
static inline struct hastream *objt_hastream(enum obj_type *t)
|
||||
{
|
||||
if (!t || *t != OBJ_TYPE_HXLOAD)
|
||||
return NULL;
|
||||
|
||||
return __objt_hastream(t);
|
||||
}
|
||||
|
||||
#ifdef USE_QUIC
|
||||
static inline struct quic_dgram *__objt_dgram(enum obj_type *t)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue