]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: muxes: Rename mux_ctl_type values to use MUX_CTL_ prefix
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 28 Nov 2023 13:27:51 +0000 (14:27 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 29 Nov 2023 10:11:12 +0000 (11:11 +0100)
Instead of the generic MUX_, we now use MUX_CTL_ prefix for all mux_ctl_type
value. This will avoid any ambiguities with other enums, especially with a
new one that will be added to get information on mux streams.

include/haproxy/connection-t.h
src/backend.c
src/log.c
src/mux_fcgi.c
src/mux_h1.c
src/mux_h2.c
src/mux_pt.c
src/proto_rhttp.c
src/stream.c

index e64527de364c3fbc6451f8bd005c0c74d91b8b24..0c1fd92e08f4cd5db554f08c3fb7b5c041bf782a 100644 (file)
@@ -333,10 +333,10 @@ enum proto_proxy_side {
 
 /* ctl command used by mux->ctl() */
 enum mux_ctl_type {
-       MUX_STATUS, /* Expects an int as output, sets it to a combinaison of MUX_STATUS flags */
-       MUX_EXIT_STATUS, /* Expects an int as output, sets the mux exist/error/http status, if known or 0 */
-       MUX_REVERSE_CONN, /* Notify about an active reverse connection accepted. */
-       MUX_SUBS_RECV, /* Notify the mux it must wait for read events again  */
+       MUX_CTL_STATUS, /* Expects an int as output, sets it to a combinaison of MUX_CTL_STATUS flags */
+       MUX_CTL_EXIT_STATUS, /* Expects an int as output, sets the mux exist/error/http status, if known or 0 */
+       MUX_CTL_REVERSE_CONN, /* Notify about an active reverse connection accepted. */
+       MUX_CTL_SUBS_RECV, /* Notify the mux it must wait for read events again  */
 };
 
 /* response for ctl MUX_STATUS */
@@ -445,7 +445,7 @@ struct mux_ops {
        int (*avail_streams_uni)(struct connection *conn); /* Returns the number of unidirectional streams still available for a connection */
        int (*used_streams)(struct connection *conn);  /* Returns the number of streams in use on a connection. */
        void (*destroy)(void *ctx); /* Let the mux know one of its users left, so it may have to disappear */
-       int (*ctl)(struct connection *conn, enum mux_ctl_type mux_ctl, void *arg); /* Provides information about the mux */
+       int (*ctl)(struct connection *conn, enum mux_ctl_type mux_ctl, void *arg); /* Provides information about the mux connection */
        int (*takeover)(struct connection *conn, int orig_tid); /* Attempts to migrate the connection to the current thread */
        unsigned int flags;                           /* some flags characterizing the mux's capabilities (MX_FL_*) */
        char name[8];                                 /* mux layer name, zero-terminated */
index f4f714bc82feafacf6903fc668b0750d99cd9d32..7d79eb173e2fb8e6c5280d70d98f1ce32dc9c4fe 100644 (file)
@@ -1312,7 +1312,7 @@ static int do_connect_server(struct stream *s, struct connection *conn)
                 * confirmed once we can send on it.
                 */
                /* Is the connection really ready ? */
-               if (conn->mux->ctl(conn, MUX_STATUS, NULL) & MUX_STATUS_READY)
+               if (conn->mux->ctl(conn, MUX_CTL_STATUS, NULL) & MUX_STATUS_READY)
                        s->scb->state = SC_ST_RDY;
                else
                        s->scb->state = SC_ST_CON;
@@ -1717,7 +1717,7 @@ skip_reuse:
                 */
                BUG_ON(!srv_conn->mux);
 
-               if (!(srv_conn->mux->ctl(srv_conn, MUX_STATUS, NULL) & MUX_STATUS_READY))
+               if (!(srv_conn->mux->ctl(srv_conn, MUX_CTL_STATUS, NULL) & MUX_STATUS_READY))
                        s->flags |= SF_SRV_REUSED_ANTICIPATED;
        }
 
index 156bf61cb6be8348c5bbb7f3540fe1549f9adb1b..010ace9dcb9082e070024c6a48398cf44c19b4e1 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -2654,7 +2654,7 @@ int sess_build_logline(struct session *sess, struct stream *s, char *dst, size_t
                logs = &tmp_strm_log;
 
                if ((fe->mode == PR_MODE_HTTP) && fe_conn && fe_conn->mux && fe_conn->mux->ctl) {
-                       enum mux_exit_status es = fe_conn->mux->ctl(fe_conn, MUX_EXIT_STATUS, &status);
+                       enum mux_exit_status es = fe_conn->mux->ctl(fe_conn, MUX_CTL_EXIT_STATUS, &status);
 
                        switch (es) {
                        case MUX_ES_SUCCESS:
index d41318bb3fea93e2d838dc6a52ffb410b492e782..73437be8a74a9998ed3f82b426c11f063b0619b3 100644 (file)
@@ -3091,11 +3091,11 @@ static int fcgi_ctl(struct connection *conn, enum mux_ctl_type mux_ctl, void *ou
 {
        int ret = 0;
        switch (mux_ctl) {
-       case MUX_STATUS:
+       case MUX_CTL_STATUS:
                if (!(conn->flags & CO_FL_WAIT_XPRT))
                        ret |= MUX_STATUS_READY;
                return ret;
-       case MUX_EXIT_STATUS:
+       case MUX_CTL_EXIT_STATUS:
                return MUX_ES_UNKNOWN;
        default:
                return -1;
index 73338774cb2d2addb1fe94bb8a3fa35d7207d7da..9be77a177e06b0dae99a4c47498f3c2e3f4bd26f 100644 (file)
@@ -4812,11 +4812,11 @@ static int h1_ctl(struct connection *conn, enum mux_ctl_type mux_ctl, void *outp
        int ret = 0;
 
        switch (mux_ctl) {
-       case MUX_STATUS:
+       case MUX_CTL_STATUS:
                if (!(conn->flags & CO_FL_WAIT_XPRT))
                        ret |= MUX_STATUS_READY;
                return ret;
-       case MUX_EXIT_STATUS:
+       case MUX_CTL_EXIT_STATUS:
                if (output)
                        *((int *)output) = h1c->errcode;
                ret = (h1c->errcode == 408 ? MUX_ES_TOUT_ERR :
@@ -4825,7 +4825,7 @@ static int h1_ctl(struct connection *conn, enum mux_ctl_type mux_ctl, void *outp
                         ((h1c->errcode >= 400 && h1c->errcode <= 499) ? MUX_ES_INVALID_ERR :
                          MUX_ES_SUCCESS))));
                return ret;
-       case MUX_SUBS_RECV:
+       case MUX_CTL_SUBS_RECV:
                if (!(h1c->wait_event.events & SUB_RETRY_RECV))
                        h1c->conn->xprt->subscribe(h1c->conn, h1c->conn->xprt_ctx, SUB_RETRY_RECV, &h1c->wait_event);
                return 0;
index ff6a85a2f9b68d3d869b346fbee0460a31fac332..5f85c00113f5cd785a2a96c9c3d10ada181ceb0a 100644 (file)
@@ -4503,17 +4503,17 @@ static int h2_ctl(struct connection *conn, enum mux_ctl_type mux_ctl, void *outp
        struct h2c *h2c = conn->ctx;
 
        switch (mux_ctl) {
-       case MUX_STATUS:
+       case MUX_CTL_STATUS:
                /* Only consider the mux to be ready if we're done with
                 * the preface and settings, and we had no error.
                 */
                if (h2c->st0 >= H2_CS_FRAME_H && h2c->st0 < H2_CS_ERROR)
                        ret |= MUX_STATUS_READY;
                return ret;
-       case MUX_EXIT_STATUS:
+       case MUX_CTL_EXIT_STATUS:
                return MUX_ES_UNKNOWN;
 
-       case MUX_REVERSE_CONN:
+       case MUX_CTL_REVERSE_CONN:
                BUG_ON(h2c->flags & H2_CF_IS_BACK);
 
                TRACE_DEVEL("connection reverse done, restart demux", H2_EV_H2C_WAKE, h2c->conn);
index f79e3c8e45390846aa0f6fd2616868ad919282f2..47aa5e645a2a7bfd4a3c5f70e4544f1c29bf8f7c 100644 (file)
@@ -784,11 +784,11 @@ static int mux_pt_ctl(struct connection *conn, enum mux_ctl_type mux_ctl, void *
 {
        int ret = 0;
        switch (mux_ctl) {
-       case MUX_STATUS:
+       case MUX_CTL_STATUS:
                if (!(conn->flags & CO_FL_WAIT_XPRT))
                        ret |= MUX_STATUS_READY;
                return ret;
-       case MUX_EXIT_STATUS:
+       case MUX_CTL_EXIT_STATUS:
                return MUX_ES_UNKNOWN;
        default:
                return -1;
index 9acc41143805fbe638c352168876d7be3e503d50..452ee32d796dd74affd5154d282aafef529f3672 100644 (file)
@@ -422,7 +422,7 @@ struct connection *rhttp_accept_conn(struct listener *l, int *status)
        BUG_ON(!(conn->flags & CO_FL_ACT_REVERSING));
        conn->flags &= ~CO_FL_ACT_REVERSING;
        conn->flags |= CO_FL_REVERSED;
-       conn->mux->ctl(conn, MUX_REVERSE_CONN, NULL);
+       conn->mux->ctl(conn, MUX_CTL_REVERSE_CONN, NULL);
 
        l->rx.rhttp.pend_conn = NULL;
        *status = CO_AC_NONE;
index 819564c0af118988e87df4a7171565c961f7ae58..aceae19e36cb7390f705dd221bce7547d2b39506 100644 (file)
@@ -2297,7 +2297,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
                                        struct connection *conn = sc_conn(scf);
 
                                        if (conn && conn->mux && conn->mux->ctl)
-                                               conn->mux->ctl(conn, MUX_SUBS_RECV, NULL);
+                                               conn->mux->ctl(conn, MUX_CTL_SUBS_RECV, NULL);
                                }
                        }
                }