MEDIUM: conn-stream: Pre-allocate endpoint to create CS from muxes and applets

It is a transient commit to prepare next changes. Now, when a conn-stream is
created from an applet or a multiplexer, an endpoint is always provided. In
addition, the API to create a conn-stream was specialized to have one
function per type.

The next step will be to share the endpoint structure.
diff --git a/src/mux_h2.c b/src/mux_h2.c
index 98a837d..39e5ece 100644
--- a/src/mux_h2.c
+++ b/src/mux_h2.c
@@ -1591,7 +1591,6 @@
 {
 	struct session *sess = h2c->conn->owner;
 	struct cs_endpoint *endp;
-	struct conn_stream *cs;
 	struct h2s *h2s;
 
 	TRACE_ENTER(H2_EV_H2S_NEW, h2c->conn);
@@ -1608,30 +1607,26 @@
 		goto out_close;
 	endp->target = h2s;
 	endp->ctx = h2c->conn;
-	endp->flags |= CS_EP_NOT_FIRST;
+	endp->flags |= (CS_EP_T_MUX|CS_EP_NOT_FIRST);
 	/* FIXME wrong analogy between ext-connect and websocket, this need to
 	 * be refine.
 	 */
 	if (flags & H2_SF_EXT_CONNECT_RCVD)
 		endp->flags |= CS_EP_WEBSOCKET;
 
-	cs = cs_new(endp);
-	if (!cs) {
-		cs_endpoint_free(endp);
-		goto out_close;
-	}
-	cs_attach_endp_mux(cs, h2s, h2c->conn);
-	h2s->cs = cs;
-	h2c->nb_cs++;
-
 	/* The stream will record the request's accept date (which is either the
 	 * end of the connection's or the date immediately after the previous
 	 * request) and the idle time, which is the delay since the previous
 	 * request. We can set the value now, it will be copied by stream_new().
 	 */
 	sess->t_idle = tv_ms_elapsed(&sess->tv_accept, &now) - sess->t_handshake;
-	if (!stream_new(h2c->conn->owner, cs, input))
-		goto out_free_cs;
+
+	h2s->cs = cs_new_from_mux(endp, sess, input);
+	if (!h2s->cs) {
+		cs_endpoint_free(endp);
+		goto out_close;
+	}
+	h2c->nb_cs++;
 
 	/* We want the accept date presented to the next stream to be the one
 	 * we have now, the handshake time to be null (since the next stream
@@ -1649,12 +1644,6 @@
 	TRACE_LEAVE(H2_EV_H2S_NEW, h2c->conn);
 	return h2s;
 
- out_free_cs:
-	h2c->nb_cs--;
-	if (!h2c->nb_cs)
-		h2c->idle_start = now_ms;
-	cs_free(cs);
-	h2s->cs = NULL;
  out_close:
 	h2s_destroy(h2s);
  out:
@@ -1684,7 +1673,7 @@
 	if (!h2s)
 		goto out;
 
-	cs_attach_endp_mux(cs, h2s, h2c->conn);
+	cs_attach_mux(cs, h2s, h2c->conn);
 	h2s->cs = cs;
 	h2s->sess = sess;
 	h2c->nb_cs++;