]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: connection: add a .get_alpn() method to xprt_ops
authorWilly Tarreau <w@1wt.eu>
Sun, 4 Dec 2016 17:42:09 +0000 (18:42 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 27 Jun 2017 12:38:02 +0000 (14:38 +0200)
This will be used to retrieve the ALPN negociated over SSL (or possibly
via the proxy protocol later). It's likely that this information should
be stored in the connection itself, but it requires adding an extra
pointer and an extra integer. Thus better rely on the transport layer
to pass this info for now.

include/proto/connection.h
include/types/connection.h

index e8674462bee4702c872af70c5a0a6bceec664d13..09467ba504f239cf7aec56acfea6fce791b19505 100644 (file)
@@ -650,6 +650,13 @@ static inline struct xprt_ops *xprt_get(int id)
        return registered_xprt[id];
 }
 
+static inline int conn_get_alpn(const struct connection *conn, const char **str, int *len)
+{
+       if (!conn_xprt_ready(conn) || !conn->xprt->get_alpn)
+               return 0;
+       return conn->xprt->get_alpn(conn, str, len);
+}
+
 #endif /* _PROTO_CONNECTION_H */
 
 /*
index 60d977218e27cfbd4c14a460d31d16953c52fa50..1e3fb738995d7578e5a76bf00cb05c4988d64873 100644 (file)
@@ -228,6 +228,7 @@ struct xprt_ops {
        void (*destroy_bind_conf)(struct bind_conf *conf); /* destroy a whole bind_conf */
        int  (*prepare_srv)(struct server *srv);    /* prepare a server context */
        void (*destroy_srv)(struct server *srv);    /* destroy a server context */
+       int  (*get_alpn)(const struct connection *conn, const char **str, int *len); /* get application layer name */
        char name[8];                               /* transport layer name, zero-terminated */
 };