diff --git a/include/haproxy/quic_frame-t.h b/include/haproxy/quic_frame-t.h index c71bc7411..86705e36c 100644 --- a/include/haproxy/quic_frame-t.h +++ b/include/haproxy/quic_frame-t.h @@ -87,6 +87,7 @@ enum quic_frame_type { * defined in quic_frame.c. Do not forget to complete the associated function * quic_frame_type_is_known() and both qf_builder()/qf_parser(). */ +extern const uint64_t QUIC_FT_QX_TRANSPORT_PARAMETERS; #define QUIC_FT_PKT_TYPE_I_BITMASK (1 << QUIC_PACKET_TYPE_INITIAL) #define QUIC_FT_PKT_TYPE_0_BITMASK (1 << QUIC_PACKET_TYPE_0RTT) @@ -252,6 +253,10 @@ struct qf_connection_close_app { unsigned char reason_phrase[QUIC_CC_REASON_PHRASE_MAXLEN]; }; +struct qf_qx_transport_parameters { + struct quic_transport_params params; +}; + struct quic_frame { struct list list; /* List elem from parent elem (typically a Tx packet instance, a PKTNS or a MUX element). */ struct quic_tx_packet *pkt; /* Last Tx packet used to send the frame. */ @@ -279,6 +284,7 @@ struct quic_frame { struct qf_path_challenge_response path_challenge_response; struct qf_connection_close connection_close; struct qf_connection_close_app connection_close_app; + struct qf_qx_transport_parameters qmux_transport_params; }; struct quic_frame *origin; /* Parent frame. Set if frame is a duplicate (used for retransmission). */ struct list reflist; /* List head containing duplicated children frames. */ diff --git a/src/quic_frame.c b/src/quic_frame.c index a7bb95ddb..09bb0ac29 100644 --- a/src/quic_frame.c +++ b/src/quic_frame.c @@ -1011,6 +1011,13 @@ static int quic_build_handshake_done_frame(unsigned char **pos, const unsigned c return 1; } +static int quic_build_qmux_transport_parameters(unsigned char **pos, const unsigned char *end, + struct quic_frame *frm, struct quic_conn *conn) +{ + /* TODO */ + return 1; +} + /* Parse a HANDSHAKE_DONE frame at QUIC layer at buffer position with as end into frame. * Always succeed. */ @@ -1021,6 +1028,13 @@ static int quic_parse_handshake_done_frame(struct quic_frame *frm, struct quic_c return 1; } +static int quic_parse_qmux_transport_parameters(struct quic_frame *frm, struct quic_conn *qc, + const unsigned char **pos, const unsigned char *end) +{ + /* TODO */ + return 1; +} + struct quic_frame_builder { int (*func)(unsigned char **pos, const unsigned char *end, struct quic_frame *frm, struct quic_conn *conn); @@ -1121,11 +1135,25 @@ const struct quic_frame_parser quic_frame_parsers[] = { * }; */ +/* quic-on-streams transport parameters frame. */ +const uint64_t QUIC_FT_QX_TRANSPORT_PARAMETERS = 0x3f5153300d0a0d0a; +const struct quic_frame_parser qf_parser_qx_transport_parameters = { + .func = quic_parse_qmux_transport_parameters, + .mask = 0, + .flags = 0, +}; +const struct quic_frame_builder qf_builder_qx_transport_parameters = { + .func = quic_build_qmux_transport_parameters, + .mask = 0, + .flags = 0, +}; + /* Returns true if frame is supported. */ static inline int quic_frame_type_is_known(uint64_t type) { /* Complete here for extra frame types greater than QUIC_FT_MAX. */ - return type < QUIC_FT_MAX; + return type < QUIC_FT_MAX || + (type == QUIC_FT_QX_TRANSPORT_PARAMETERS); } static const struct quic_frame_parser *qf_parser(uint64_t type) @@ -1134,6 +1162,8 @@ static const struct quic_frame_parser *qf_parser(uint64_t type) return &quic_frame_parsers[type]; /* Complete here for extra frame types greater than QUIC_FT_MAX. */ + if (type == QUIC_FT_QX_TRANSPORT_PARAMETERS) + return &qf_parser_qx_transport_parameters; ABORT_NOW(); return NULL; @@ -1145,6 +1175,8 @@ const struct quic_frame_builder *qf_builder(uint64_t type) return &quic_frame_builders[type]; /* Complete here for extra frame types greater than QUIC_FT_MAX. */ + if (type == QUIC_FT_QX_TRANSPORT_PARAMETERS) + return &qf_builder_qx_transport_parameters; ABORT_NOW(); return NULL;