]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux: Add info about the supported side in alpn_mux_list structure
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 6 Mar 2018 13:43:47 +0000 (14:43 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 8 Aug 2018 07:54:22 +0000 (09:54 +0200)
Now, a multiplexer can specify if it can be install on incoming connections
(ALPN_SIDE_FE), on outgoing connections (ALPN_SIDE_BE) or both
(ALPN_SIDE_BOTH). These flags are compatible with proxies' ones.

include/types/connection.h
src/mux_h2.c
src/mux_pt.c

index cf5dbb6b7faa36353f55102d2368c753cc9c4622..46d74fecf4ebe4f62477e5f46dcf3c40e8c25c18 100644 (file)
@@ -429,9 +429,17 @@ enum alpn_proxy_mode {
        ALPN_MODE_ANY  = ALPN_MODE_TCP | ALPN_MODE_HTTP,
 };
 
+enum alpn_proxy_side {
+       ALPN_SIDE_NONE = 0,
+       ALPN_SIDE_FE   = 1, // same as PR_CAP_FE
+       ALPN_SIDE_BE   = 2, // same as PR_CAP_BE
+       ALPN_SIDE_BOTH = ALPN_SIDE_FE | ALPN_SIDE_BE,
+};
+
 struct alpn_mux_list {
        const struct ist token;    /* token name and length. Empty is catch-all */
        enum alpn_proxy_mode mode;
+       enum alpn_proxy_side side;
        const struct mux_ops *mux;
        struct list list;
 };
index f46504cab26b9ea92877a7804f40602bfb492766..192578bba831e20316515aa78dd54f48abc934c9 100644 (file)
@@ -3603,7 +3603,7 @@ const struct mux_ops h2_ops = {
 
 /* ALPN selection : this mux registers ALPN tolen "h2" */
 static struct alpn_mux_list alpn_mux_h2 =
-       { .token = IST("h2"), .mode = ALPN_MODE_HTTP, .mux = &h2_ops };
+       { .token = IST("h2"), .mode = ALPN_MODE_HTTP, .side = ALPN_SIDE_FE, .mux = &h2_ops };
 
 /* config keyword parsers */
 static struct cfg_kw_list cfg_kws = {ILH, {
index d6c1f83ab3f98b9fd70f5c8cc3a2d7df9a26e69e..131b0708320dea4dfcc822ae69b86f8b4b9aa664 100644 (file)
@@ -217,7 +217,7 @@ const struct mux_ops mux_pt_ops = {
 
 /* ALPN selection : default mux has empty name */
 static struct alpn_mux_list alpn_mux_pt =
-       { .token = IST(""), .mode = ALPN_MODE_ANY, .mux = &mux_pt_ops };
+       { .token = IST(""), .mode = ALPN_MODE_ANY, .side = ALPN_SIDE_BOTH, .mux = &mux_pt_ops };
 
 __attribute__((constructor))
 static void __mux_pt_init(void)