mirror of
https://github.com/haproxy/haproxy.git
synced 2026-04-22 14:49:45 -04:00
MINOR: mux-quic: add function for ALPN to app-ops conversion
Extract the conversion from ALPN to qcc_app_ops type from quic_conn source file into QUIC MUX. The newly created function is named quic_alpn_to_app_ops(). This will serve as a central point to identify which ALPNs are currently supported in our QUIC stack. This patch is purely a small refactoring. It will be useful for the next one which rework MUX app-ops layer init. The current cleanup allows notably to remove H3/hq-interop headers from quic_conn source file.
This commit is contained in:
parent
4120faf289
commit
9c7cf1c684
2 changed files with 15 additions and 7 deletions
|
|
@ -12,6 +12,9 @@
|
|||
#include <haproxy/mux_quic-t.h>
|
||||
#include <haproxy/stconn.h>
|
||||
|
||||
#include <haproxy/h3.h>
|
||||
#include <haproxy/hq_interop.h>
|
||||
|
||||
#define qcc_report_glitch(qcc, inc, ...) ({ \
|
||||
COUNT_GLITCH(__VA_ARGS__); \
|
||||
_qcc_report_glitch(qcc, inc); \
|
||||
|
|
@ -115,6 +118,16 @@ void qcc_show_quic(struct qcc *qcc);
|
|||
|
||||
void qcc_wakeup(struct qcc *qcc);
|
||||
|
||||
static inline const struct qcc_app_ops *quic_alpn_to_app_ops(const char *alpn, int alpn_len)
|
||||
{
|
||||
if (alpn_len >= 2 && memcmp(alpn, "h3", 2) == 0)
|
||||
return &h3_ops;
|
||||
else if (alpn_len >= 10 && memcmp(alpn, "hq-interop", 10) == 0)
|
||||
return &hq_interop_ops;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* USE_QUIC */
|
||||
|
||||
#endif /* _HAPROXY_MUX_QUIC_H */
|
||||
|
|
|
|||
|
|
@ -38,8 +38,6 @@
|
|||
#include <haproxy/freq_ctr.h>
|
||||
#include <haproxy/frontend.h>
|
||||
#include <haproxy/global.h>
|
||||
#include <haproxy/h3.h>
|
||||
#include <haproxy/hq_interop.h>
|
||||
#include <haproxy/log.h>
|
||||
#include <haproxy/mux_quic.h>
|
||||
#include <haproxy/ncbuf.h>
|
||||
|
|
@ -274,14 +272,11 @@ void quic_set_tls_alert(struct quic_conn *qc, int alert)
|
|||
*/
|
||||
int quic_set_app_ops(struct quic_conn *qc, const char *alpn, int alpn_len)
|
||||
{
|
||||
if (alpn_len >= 2 && memcmp(alpn, "h3", 2) == 0)
|
||||
qc->app_ops = &h3_ops;
|
||||
else if (alpn_len >= 10 && memcmp(alpn, "hq-interop", 10) == 0)
|
||||
qc->app_ops = &hq_interop_ops;
|
||||
else
|
||||
if (!(qc->app_ops = quic_alpn_to_app_ops(alpn, alpn_len)))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
/* Try to reuse <alpn> ALPN and <etps> early transport parameters.
|
||||
|
|
|
|||
Loading…
Reference in a new issue