MEDIUM: conn_stream: Add a way to get mux's info on a CS from the upper layer

Time to time, the need arises to get some info owned by the multiplexer about a
connection stream from the upper layer. Today we really need to get some dates
and durations specific to the conn_stream. It is only true for the mux H1 and
H2. Otherwise it will be impossible to have correct times reported in the logs.

To do so, the structure cs_info has been defined to provide all info we ever
need on a conn_stream from the upper layer. Of course, it is the first step. So
this structure will certainly envloved. But for now, only the bare minimum is
referenced. On the mux side, the callback get_cs_info() has been added in the
structure mux_ops. Multiplexers can now implement it, if necessary, to return a
pointer on a structure cs_info. And finally, the function si_get_cs_info()
should be used from the upper layer. If the stream interface is not attached to
a connection stream, this function returns NULL, likewise if the callback
get_cs_info() is not defined for the corresponding mux.
diff --git a/include/proto/stream_interface.h b/include/proto/stream_interface.h
index a091439..da37f73 100644
--- a/include/proto/stream_interface.h
+++ b/include/proto/stream_interface.h
@@ -491,6 +491,18 @@
 	return ret;
 }
 
+/* Returns info about the conn_stream <cs>, if not NULL. It call the mux layer's
+ * get_cs_info() function, if it exists. On success, it returns a cs_info
+ * structure. Otherwise, on error, if the mux does not implement get_cs_info()
+ * or if conn_stream is NULL, NULL is returned.
+ */
+static inline const struct cs_info *si_get_cs_info(struct conn_stream *cs)
+{
+	if (cs && cs->conn->mux->get_cs_info)
+		return cs->conn->mux->get_cs_info(cs);
+	return NULL;
+}
+
 /* for debugging, reports the stream interface state name */
 static inline const char *si_state_str(int state)
 {
diff --git a/include/types/connection.h b/include/types/connection.h
index 85afca0..0d7bba2 100644
--- a/include/types/connection.h
+++ b/include/types/connection.h
@@ -40,6 +40,7 @@
 /* referenced below */
 struct connection;
 struct conn_stream;
+struct cs_info;
 struct buffer;
 struct proxy;
 struct server;
@@ -334,6 +335,7 @@
 	int (*unsubscribe)(struct conn_stream *cs, int event_type, void *param); /* Unsubscribe to events */
 	int (*avail_streams)(struct connection *conn); /* Returns the number of streams still available for a connection */
 	void (*destroy)(struct connection *conn); /* Let the mux know one of its users left, so it may have to disappear */
+	const struct cs_info *(*get_cs_info)(struct conn_stream *cs); /* Return info on the specified conn_stream or NULL if not defined */
 	unsigned int flags;                           /* some flags characterizing the mux's capabilities (MX_FL_*) */
 	char name[8];                                 /* mux layer name, zero-terminated */
 };
@@ -386,6 +388,19 @@
 	void *ctx;                           /* mux-specific context */
 };
 
+/*
+ * This structure describes the info related to a conn_stream known by the mux
+ * only but usefull for the upper layer.
+ * For now, only some dates and durations are reported. This structure will
+ * envolved. But for now, only the bare minimum is referenced.
+ */
+struct cs_info {
+	struct timeval create_date;  /* Creation date of the conn_stream in user date */
+	struct timeval tv_create;    /* Creation date of the conn_stream in internal date (monotonic) */
+	long t_handshake;            /* hanshake duration, -1 if never occurs */
+	long t_idle;                 /* idle duration, -1 if never occurs */
+};
+
 /* 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