MINOR: stream_interface: add a pointer to the listener for TARG_TYPE_CLIENT
When the target is a client, it will be convenient to have a pointer to the
original listener so that we can retrieve some configuration information at
the stream interface level.
diff --git a/include/proto/stream_interface.h b/include/proto/stream_interface.h
index efdb1c4..7f1cb9e 100644
--- a/include/proto/stream_interface.h
+++ b/include/proto/stream_interface.h
@@ -63,10 +63,10 @@
dest->ptr.v = NULL;
}
-static inline void set_target_client(struct target *dest)
+static inline void set_target_client(struct target *dest, struct listener *l)
{
dest->type = TARG_TYPE_CLIENT;
- dest->ptr.v = NULL;
+ dest->ptr.l = l;
}
static inline void set_target_server(struct target *dest, struct server *s)
@@ -111,6 +111,13 @@
return t->ptr.s;
}
+static inline struct listener *target_client(struct target *t)
+{
+ if (!t || t->type != TARG_TYPE_CLIENT)
+ return NULL;
+ return t->ptr.l;
+}
+
static inline void stream_interface_prepare(struct stream_interface *si, const struct sock_ops *ops)
{
si->conn.data = ops;
diff --git a/include/types/stream_interface.h b/include/types/stream_interface.h
index 8e9e64b..8218eda 100644
--- a/include/types/stream_interface.h
+++ b/include/types/stream_interface.h
@@ -122,6 +122,7 @@
struct server *s; /* when type is TARG_TYPE_SERVER */
struct si_applet *a; /* when type is TARG_TYPE_APPLET */
struct task *t; /* when type is TARG_TYPE_TASK */
+ struct listener *l; /* when type is TARG_TYPE_CLIENT */
} ptr;
};