From: Willy Tarreau Date: Sat, 8 May 2021 12:06:09 +0000 (+0200) Subject: BUILD: connection: move list_mux_proto() to connection.c X-Git-Tag: v2.4-dev19~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e59b5169b39c79f9a6ee478fcf6f622954d75722;p=thirdparty%2Fhaproxy.git BUILD: connection: move list_mux_proto() to connection.c No idea why this was put inlined into connection.h, it's used only once for haproxy -vv, and requires tools.h, causing an undesired dependency from connection.h. Let's move it to connection.c instead where it ought to have been. --- diff --git a/include/haproxy/connection.h b/include/haproxy/connection.h index b0b855e2c0..aeef840a6e 100644 --- a/include/haproxy/connection.h +++ b/include/haproxy/connection.h @@ -929,53 +929,7 @@ static inline struct mux_proto_list *get_mux_proto(const struct ist proto) return NULL; } -/* Lists the known proto mux on */ -static inline void list_mux_proto(FILE *out) -{ - struct mux_proto_list *item; - struct buffer *chk = get_trash_chunk(); - struct ist proto; - char *mode, *side; - - fprintf(out, "Available multiplexer protocols :\n" - "(protocols marked as cannot be specified using 'proto' keyword)\n"); - list_for_each_entry(item, &mux_proto_list.list, list) { - proto = item->token; - - if (item->mode == PROTO_MODE_ANY) - mode = "TCP|HTTP"; - else if (item->mode == PROTO_MODE_TCP) - mode = "TCP"; - else if (item->mode == PROTO_MODE_HTTP) - mode = "HTTP"; - else - mode = "NONE"; - - if (item->side == PROTO_SIDE_BOTH) - side = "FE|BE"; - else if (item->side == PROTO_SIDE_FE) - side = "FE"; - else if (item->side == PROTO_SIDE_BE) - side = "BE"; - else - side = "NONE"; - - chunk_reset(chk); - if (item->mux->flags & MX_FL_HTX) - chunk_strcpy(chk, "HTX"); - if (item->mux->flags & MX_FL_CLEAN_ABRT) - chunk_appendf(chk, "%sCLEAN_ABRT", (b_data(chk) ? "|": "")); - if (item->mux->flags & MX_FL_HOL_RISK) - chunk_appendf(chk, "%sHOL_RISK", (b_data(chk) ? "|": "")); - if (item->mux->flags & MX_FL_NO_UPG) - chunk_appendf(chk, "%sNO_UPG", (b_data(chk) ? "|": "")); - - fprintf(out, " %15s : mode=%-10s side=%-8s mux=%-8s flags=%.*s\n", - (proto.len ? proto.ptr : ""), mode, side, item->mux->name, - (int)b_data(chk), b_orig(chk)); - } -} - +void list_mux_proto(FILE *out); /* returns the first mux entry in the list matching the exact same * and compatible with the (FE or BE) and the (TCP or * HTTP). can be empty. Will fall back to the first compatible mux diff --git a/src/connection.c b/src/connection.c index 3e3fb007f8..73a326dd57 100644 --- a/src/connection.c +++ b/src/connection.c @@ -987,6 +987,53 @@ int conn_recv_socks4_proxy_response(struct connection *conn) return 0; } +/* Lists the known proto mux on */ +void list_mux_proto(FILE *out) +{ + struct mux_proto_list *item; + struct buffer *chk = get_trash_chunk(); + struct ist proto; + char *mode, *side; + + fprintf(out, "Available multiplexer protocols :\n" + "(protocols marked as cannot be specified using 'proto' keyword)\n"); + list_for_each_entry(item, &mux_proto_list.list, list) { + proto = item->token; + + if (item->mode == PROTO_MODE_ANY) + mode = "TCP|HTTP"; + else if (item->mode == PROTO_MODE_TCP) + mode = "TCP"; + else if (item->mode == PROTO_MODE_HTTP) + mode = "HTTP"; + else + mode = "NONE"; + + if (item->side == PROTO_SIDE_BOTH) + side = "FE|BE"; + else if (item->side == PROTO_SIDE_FE) + side = "FE"; + else if (item->side == PROTO_SIDE_BE) + side = "BE"; + else + side = "NONE"; + + chunk_reset(chk); + if (item->mux->flags & MX_FL_HTX) + chunk_strcpy(chk, "HTX"); + if (item->mux->flags & MX_FL_CLEAN_ABRT) + chunk_appendf(chk, "%sCLEAN_ABRT", (b_data(chk) ? "|": "")); + if (item->mux->flags & MX_FL_HOL_RISK) + chunk_appendf(chk, "%sHOL_RISK", (b_data(chk) ? "|": "")); + if (item->mux->flags & MX_FL_NO_UPG) + chunk_appendf(chk, "%sNO_UPG", (b_data(chk) ? "|": "")); + + fprintf(out, " %15s : mode=%-10s side=%-8s mux=%-8s flags=%.*s\n", + (proto.len ? proto.ptr : ""), mode, side, item->mux->name, + (int)b_data(chk), b_orig(chk)); + } +} + /* Note: is explicitly allowed to be NULL */ int make_proxy_line(char *buf, int buf_len, struct server *srv, struct connection *remote, struct stream *strm) {