MINOR: mux: Add a new method to get informations about a mux.

Add a new method, ctl(), to muxes. It uses a "enum mux_ctl_type" to
let it know which information we're asking for, and can output it either
directly by returning the expected value, or by using an optional argument.
"output" argument.
Right now, the only known mux_ctl_type is MUX_STATUS, that will return 0 if
the mux is not ready, or MUX_STATUS_READY if the mux is ready.

We probably want to backport this to 1.9 and 2.0.

(cherry picked from commit 9b8e11e691619b9cc0336f57bcdfacb015864a97)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/mux_pt.c b/src/mux_pt.c
index 813c5fa..c66b746 100644
--- a/src/mux_pt.c
+++ b/src/mux_pt.c
@@ -333,6 +333,19 @@
 }
 #endif
 
+static int mux_pt_ctl(struct connection *conn, enum mux_ctl_type mux_ctl, void *output)
+{
+	int ret = 0;
+	switch (mux_ctl) {
+	case MUX_STATUS:
+		if (conn->flags & CO_FL_CONNECTED)
+			ret |= MUX_STATUS_READY;
+		return ret;
+	default:
+		return -1;
+	}
+}
+
 /* The mux operations */
 const struct mux_ops mux_pt_ops = {
 	.init = mux_pt_init,
@@ -351,6 +364,7 @@
 	.avail_streams = mux_pt_avail_streams,
 	.used_streams = mux_pt_used_streams,
 	.destroy = mux_pt_destroy_meth,
+	.ctl = mux_pt_ctl,
 	.shutr = mux_pt_shutr,
 	.shutw = mux_pt_shutw,
 	.flags = MX_FL_NONE,