MINOR: mux: Unlink ALPN and multiplexers to rather speak of mux protocols

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.
This commit is contained in:
Christopher Faulet 2018-04-10 14:33:41 +02:00 committed by Willy Tarreau
parent 2d5292a412
commit 32f61c0421
5 changed files with 33 additions and 33 deletions

View 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))

View 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;
};

View 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. */

View 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);

View 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);
}