MINOR: obj_type: new object type for struct stream
This patch creates a new obj_type for the struct stream in HAProxy.
diff --git a/include/proto/obj_type.h b/include/proto/obj_type.h
index 47273ca..afb8d90 100644
--- a/include/proto/obj_type.h
+++ b/include/proto/obj_type.h
@@ -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 @@
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 @@
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)) {