]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux: Unlink ALPN and multiplexers to rather speak of mux protocols
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 10 Apr 2018 12:33:41 +0000 (14:33 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 8 Aug 2018 07:54:22 +0000 (09:54 +0200)
Multiplexers are not necessarily associated to an ALPN. ALPN is a TLS extension,
so it is not always defined or used. Instead, we now rather speak of
multiplexer's protocols. So in this patch, there are no significative changes,
some structures and functions are just renamed.

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

index 580ae9a32df26bda7113a83d53024ab35af52c09..4e54bcfaf2ebb77a28382c94f9c3c08c971a6f61 100644 (file)
@@ -34,7 +34,7 @@
 extern struct pool_head *pool_head_connection;
 extern struct pool_head *pool_head_connstream;
 extern struct xprt_ops *registered_xprt[XPRT_ENTRIES];
-extern struct alpn_mux_list alpn_mux_list;
+extern struct mux_proto_list mux_proto_list;
 
 /* perform minimal intializations, report 0 in case of error, 1 if OK. */
 int init_connection();
@@ -949,14 +949,14 @@ static inline int conn_get_alpn(const struct connection *conn, const char **str,
        return conn->xprt->get_alpn(conn, str, len);
 }
 
-/* registers alpn mux list <list>. Modifies the list element! */
-static inline void alpn_register_mux(struct alpn_mux_list *list)
+/* registers proto mux list <list>. Modifies the list element! */
+static inline void register_mux_proto(struct mux_proto_list *list)
 {
-       LIST_ADDQ(&alpn_mux_list.list, &list->list);
+       LIST_ADDQ(&mux_proto_list.list, &list->list);
 }
 
-/* unregisters alpn mux list <list> */
-static inline void alpn_unregister_mux(struct alpn_mux_list *list)
+/* unregisters proto mux list <list> */
+static inline void unregister_mux_proto(struct mux_proto_list *list)
 {
        LIST_DEL(&list->list);
        LIST_INIT(&list->list);
@@ -970,12 +970,12 @@ static inline void alpn_unregister_mux(struct alpn_mux_list *list)
  */
 static inline const struct mux_ops *alpn_get_mux(const struct ist token, int http_mode)
 {
-       struct alpn_mux_list *item;
+       struct mux_proto_list *item;
        const struct mux_ops *fallback = NULL;
 
        http_mode = 1 << !!http_mode;
 
-       list_for_each_entry(item, &alpn_mux_list.list, list) {
+       list_for_each_entry(item, &mux_proto_list.list, list) {
                if (!(item->mode & http_mode))
                        continue;
                if (isteq(token, item->token))
index 46d74fecf4ebe4f62477e5f46dcf3c40e8c25c18..cff41c431f168eee8226e7a7122566eeca4ea806 100644 (file)
@@ -421,25 +421,25 @@ struct connection {
        } addr; /* addresses of the remote side, client for producer and server for consumer */
 };
 
-/* ALPN token registration */
-enum alpn_proxy_mode {
-       ALPN_MODE_NONE = 0,
-       ALPN_MODE_TCP  = 1 << 0, // must not be changed!
-       ALPN_MODE_HTTP = 1 << 1, // must not be changed!
-       ALPN_MODE_ANY  = ALPN_MODE_TCP | ALPN_MODE_HTTP,
+/* PROTO token registration */
+enum proto_proxy_mode {
+       PROTO_MODE_NONE = 0,
+       PROTO_MODE_TCP  = 1 << 0, // must not be changed!
+       PROTO_MODE_HTTP = 1 << 1, // must not be changed!
+       PROTO_MODE_ANY  = PROTO_MODE_TCP | PROTO_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,
+enum proto_proxy_side {
+       PROTO_SIDE_NONE = 0,
+       PROTO_SIDE_FE   = 1, // same as PR_CAP_FE
+       PROTO_SIDE_BE   = 2, // same as PR_CAP_BE
+       PROTO_SIDE_BOTH = PROTO_SIDE_FE | PROTO_SIDE_BE,
 };
 
-struct alpn_mux_list {
+struct mux_proto_list {
        const struct ist token;    /* token name and length. Empty is catch-all */
-       enum alpn_proxy_mode mode;
-       enum alpn_proxy_side side;
+       enum proto_proxy_mode mode;
+       enum proto_proxy_side side;
        const struct mux_ops *mux;
        struct list list;
 };
index 5d7f788ef60c83874ae969ba6e44109f4f7b9b97..f750e3c99ba37a35e897b4c03013c8a2be03bff3 100644 (file)
@@ -33,9 +33,9 @@ struct pool_head *pool_head_connection;
 struct pool_head *pool_head_connstream;
 struct xprt_ops *registered_xprt[XPRT_ENTRIES] = { NULL, };
 
-/* List head of all known muxes for ALPN */
-struct alpn_mux_list alpn_mux_list = {
-        .list = LIST_HEAD_INIT(alpn_mux_list.list)
+/* List head of all known muxes for PROTO */
+struct mux_proto_list mux_proto_list = {
+        .list = LIST_HEAD_INIT(mux_proto_list.list)
 };
 
 /* perform minimal intializations, report 0 in case of error, 1 if OK. */
index 192578bba831e20316515aa78dd54f48abc934c9..a986b5a932af2e94b982865829e8abe8915915bd 100644 (file)
@@ -3601,9 +3601,9 @@ const struct mux_ops h2_ops = {
        .name = "H2",
 };
 
-/* ALPN selection : this mux registers ALPN tolen "h2" */
-static struct alpn_mux_list alpn_mux_h2 =
-       { .token = IST("h2"), .mode = ALPN_MODE_HTTP, .side = ALPN_SIDE_FE, .mux = &h2_ops };
+/* PROTO selection : this mux registers PROTO token "h2" */
+static struct mux_proto_list mux_proto_h2 =
+       { .token = IST("h2"), .mode = PROTO_MODE_HTTP, .side = PROTO_SIDE_FE, .mux = &h2_ops };
 
 /* config keyword parsers */
 static struct cfg_kw_list cfg_kws = {ILH, {
@@ -3622,7 +3622,7 @@ static void __h2_deinit(void)
 __attribute__((constructor))
 static void __h2_init(void)
 {
-       alpn_register_mux(&alpn_mux_h2);
+       register_mux_proto(&mux_proto_h2);
        cfg_register_keywords(&cfg_kws);
        hap_register_post_deinit(__h2_deinit);
        pool_head_h2c = create_pool("h2c", sizeof(struct h2c), MEM_F_SHARED);
index 131b0708320dea4dfcc822ae69b86f8b4b9aa664..dbdd78b0949c4fc94f33d5039886fdcf2ede2e74 100644 (file)
@@ -215,12 +215,12 @@ const struct mux_ops mux_pt_ops = {
        .name = "PASS",
 };
 
-/* ALPN selection : default mux has empty name */
-static struct alpn_mux_list alpn_mux_pt =
-       { .token = IST(""), .mode = ALPN_MODE_ANY, .side = ALPN_SIDE_BOTH, .mux = &mux_pt_ops };
+/* PROT selection : default mux has empty name */
+static struct mux_proto_list mux_proto_pt =
+       { .token = IST(""), .mode = PROTO_MODE_ANY, .side = PROTO_SIDE_BOTH, .mux = &mux_pt_ops };
 
 __attribute__((constructor))
 static void __mux_pt_init(void)
 {
-       alpn_register_mux(&alpn_mux_pt);
+       register_mux_proto(&mux_proto_pt);
 }