MAJOR: stream/conn_stream: Move the stream-interface into the conn-stream

Thanks to all previous changes, it is now possible to move the
stream-interface into the conn-stream. To do so, some SI functions are
removed and their conn-stream counterparts are added. In addition, the
conn-stream is now responsible to create and release the
stream-interface. While the stream-interfaces were inlined in the stream
structure, there is now a pointer in the conn-stream. stream-interfaces are
now dynamically allocated. Thus a dedicated pool is added. It is a temporary
change because, at the end, the stream-interface structure will most
probably disappear.
diff --git a/src/stream_interface.c b/src/stream_interface.c
index 5b86bf8..aa3b6d8 100644
--- a/src/stream_interface.c
+++ b/src/stream_interface.c
@@ -28,6 +28,7 @@
 #include <haproxy/http_htx.h>
 #include <haproxy/pipe-t.h>
 #include <haproxy/pipe.h>
+#include <haproxy/pool.h>
 #include <haproxy/proxy.h>
 #include <haproxy/stream-t.h>
 #include <haproxy/stream_interface.h>
@@ -36,6 +37,9 @@
 #include <haproxy/tools.h>
 
 
+DECLARE_POOL(pool_head_streaminterface, "stream_interface", sizeof(struct stream_interface));
+
+
 /* functions used by default on a detached stream-interface */
 static void stream_int_shutr(struct stream_interface *si);
 static void stream_int_shutw(struct stream_interface *si);
@@ -98,6 +102,35 @@
 	.name    = "STRM",
 };
 
+
+struct stream_interface *si_new(struct conn_stream *cs)
+{
+	struct stream_interface *si;
+
+	si = pool_alloc(pool_head_streaminterface);
+	if (unlikely(!si))
+		return NULL;
+	si->flags = SI_FL_NONE;
+	if (si_reset(si) < 0) {
+		pool_free(pool_head_streaminterface, si);
+		return NULL;
+	}
+	si->cs = cs;
+	return si;
+}
+
+void si_free(struct stream_interface *si)
+{
+	if (!si)
+		return;
+
+	b_free(&si->l7_buffer);
+	tasklet_free(si->wait_event.tasklet);
+	sockaddr_free(&si->src);
+	sockaddr_free(&si->dst);
+	pool_free(pool_head_streaminterface, si);
+}
+
 /*
  * This function only has to be called once after a wakeup event in case of
  * suspected timeout. It controls the stream interface timeouts and sets
@@ -309,7 +342,7 @@
 	appctx = appctx_new(app);
 	if (!appctx)
 		return NULL;
-	si_attach_appctx(si, appctx);
+	cs_attach_endp(si->cs, &appctx->obj_type, appctx);
 	appctx->t->nice = si_strm(si)->task->nice;
 	si_cant_get(si);
 	appctx_wakeup(appctx);