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.
This commit is contained in:
Christopher Faulet 2023-11-28 14:53:58 +01:00
parent d982a37e4c
commit 0f15dcd9a7

View 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 */