MINOR: mux: Print the list of existing mux protocols during HA startup

This is done in verbose/debug mode and when build options are reported.
This commit is contained in:
Christopher Faulet 2018-04-10 14:37:32 +02:00 committed by Willy Tarreau
parent 32f61c0421
commit 98d9fe21e0
2 changed files with 48 additions and 0 deletions

View File

@ -962,6 +962,52 @@ static inline void unregister_mux_proto(struct mux_proto_list *list)
LIST_INIT(&list->list);
}
static inline struct mux_proto_list *get_mux_proto(char *str, int len)
{
struct mux_proto_list *item;
struct ist proto = ist2(str, len);
list_for_each_entry(item, &mux_proto_list.list, list) {
if (isteq(proto, item->token))
return item;
}
return NULL;
}
/* Lists the known proto mux on <out> */
static inline void list_mux_proto(FILE *out)
{
struct mux_proto_list *item;
struct ist proto;
char *mode, *side;
fprintf(out, "Available multiplexer protocols :\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";
fprintf(out, " %15s : mode=%-10s side=%s\n",
(proto.len ? proto.ptr : "pass-through"), mode, side);
}
}
/* returns the first mux in the list matching the exact same token and
* compatible with the proxy's mode (http or tcp). Mode "health" has to be
* considered as TCP here. Ie passing "px->mode == PR_MODE_HTTP" is fine. Will

View File

@ -390,6 +390,8 @@ static void display_build_opts()
list_pollers(stdout);
putchar('\n');
list_mux_proto(stdout);
putchar('\n');
list_filters(stdout);
putchar('\n');
}