MINOR: quic: define QMux transport parameters frame type

Define a new frame type for QMux transport parameter exchange. Frame
type is 0x3f5153300d0a0d0a and is declared as an extra frame, outside of
quic_frame_parsers / quic_frame_builders.

The next patch will implement parsing/encoding of this frame payload.
This commit is contained in:
Amaury Denoyelle 2025-02-12 17:54:13 +01:00
parent 9a2db73e32
commit ea5cb23307
2 changed files with 39 additions and 1 deletions

View File

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

View File

@ -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 <pos> buffer position with <end> as end into <frm> 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 <type> 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;