From: Christopher Faulet Date: Tue, 28 Nov 2023 13:53:58 +0000 (+0100) Subject: MINOR: muxes: Add a callback function to send commands to mux streams X-Git-Tag: v2.9-dev12~23 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0f15dcd9a7c1be4615f1d0f635853765544e3727;p=thirdparty%2Fhaproxy.git MINOR: muxes: Add a callback function to send commands to mux streams 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. --- diff --git a/include/haproxy/connection-t.h b/include/haproxy/connection-t.h index 0c1fd92e08..2619fd66de 100644 --- a/include/haproxy/connection-t.h +++ b/include/haproxy/connection-t.h @@ -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 to events, such as "being able to send" */ int (*unsubscribe)(struct stconn *sc, int event_type, struct wait_event *es); /* Unsubscribe 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 */