MINOR: connection: introduce conn_stream
This patch introduces a new struct conn_stream. It's the stream-side of
a multiplexed connection. A pool is created and destroyed on exit. For
now the conn_streams are not used at all.
diff --git a/include/types/connection.h b/include/types/connection.h
index b925f65..9561406 100644
--- a/include/types/connection.h
+++ b/include/types/connection.h
@@ -39,6 +39,7 @@
/* referenced below */
struct connection;
+struct conn_stream;
struct buffer;
struct server;
struct pipe;
@@ -51,6 +52,15 @@
int fd; /* file descriptor, for regular sockets */
};
+/* conn_stream flags */
+enum {
+ CS_FL_NONE = 0x00000000, /* Just for initialization purposes */
+ CS_FL_DATA_RD_ENA = 0x00000001, /* receiving data is allowed */
+ CS_FL_DATA_WR_ENA = 0x00000002, /* sending data is desired */
+
+ CS_FL_ERROR = 0x00000100, /* a fatal error was reported */
+ CS_FL_EOS = 0x00001000, /* End of stream */
+};
/* For each direction, we have a CO_FL_{SOCK,DATA}_<DIR>_ENA flag, which
* indicates if read or write is desired in that direction for the respective
@@ -297,6 +307,18 @@
#endif
};
+/*
+ * This structure describes the elements of a connection relevant to a stream
+ */
+struct conn_stream {
+ enum obj_type obj_type; /* differentiates connection from applet context */
+ struct connection *conn; /* xprt-level connection */
+ unsigned int flags; /* CS_FL_* */
+ void *data; /* pointer to upper layer's entity (eg: stream interface) */
+ const struct data_cb *data_cb; /* data layer callbacks. Must be set before xprt->init() */
+ void *ctx; /* mux-specific context */
+};
+
/* This structure describes a connection with its methods and data.
* A connection may be performed to proxy or server via a local or remote
* socket, and can also be made to an internal applet. It can support
diff --git a/include/types/obj_type.h b/include/types/obj_type.h
index a6310cf..e141d69 100644
--- a/include/types/obj_type.h
+++ b/include/types/obj_type.h
@@ -40,6 +40,7 @@
OBJ_TYPE_APPCTX, /* object is a struct appctx */
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_ENTRIES /* last one : number of entries */
} __attribute__((packed)) ;