]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: muxes: Add a callback function to send commands to mux streams
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 28 Nov 2023 13:53:58 +0000 (14:53 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 29 Nov 2023 10:11:12 +0000 (11:11 +0100)
Just like the ->ctl() callback function, used to send commands to mux
connections, the ->sctl() callback function can now be used to send commands
to mux streams. The first command, MUX_SCTL_SID, is a way to request the mux
stream ID.

It will be implemented later for each mux.

include/haproxy/connection-t.h

index 0c1fd92e08f4cd5db554f08c3fb7b5c041bf782a..2619fd66def51019c1949e021a90505f0ba7e969 100644 (file)
@@ -339,6 +339,11 @@ enum mux_ctl_type {
        MUX_CTL_SUBS_RECV, /* Notify the mux it must wait for read events again  */
 };
 
+/* sctl command used by mux->sctl() */
+enum mux_sctl_type {
+       MUX_SCTL_SID, /* Return the mux stream ID as ouput, as a signed 64bits integer */
+};
+
 /* response for ctl MUX_STATUS */
 #define MUX_STATUS_READY (1 << 0)
 
@@ -440,6 +445,7 @@ struct mux_ops {
        int (*show_sd)(struct buffer *, struct sedesc *, const char *pfx); /* append some data about the mux stream into chunk for "show sess"; returns non-zero if suspicious */
        int (*subscribe)(struct stconn *sc, int event_type,  struct wait_event *es); /* Subscribe <es> to events, such as "being able to send" */
        int (*unsubscribe)(struct stconn *sc, int event_type,  struct wait_event *es); /* Unsubscribe <es> from events */
+       int (*sctl)(struct stconn *sc, enum mux_sctl_type mux_sctl, void *arg); /* Provides information about the mux stream */
        int (*avail_streams)(struct connection *conn); /* Returns the number of streams still available for a connection */
        int (*avail_streams_bidi)(struct connection *conn); /* Returns the number of bidirectional streams still available for a connection */
        int (*avail_streams_uni)(struct connection *conn); /* Returns the number of unidirectional streams still available for a connection */