MINOR: h3: define stream type

Define a new enum h3s_t. This is used to differentiate between the
different stream types used in a HTTP/3 connection, including the QPACK
encoder/decoder streams.

For the moment, only bidirectional streams is positioned. This patch
will be useful to unify reception of uni streams with bidirectional
ones.
This commit is contained in:
Amaury Denoyelle 2022-05-24 15:24:03 +02:00
parent 6b92394973
commit 3236a8e85c
3 changed files with 24 additions and 1 deletions

View File

@ -84,6 +84,20 @@ enum h3_ft {
H3_FT_MAX_PUSH_ID = 0x07,
};
/* Stream types */
enum h3s_t {
/* unidirectional streams */
H3S_T_CTRL,
H3S_T_PUSH,
H3S_T_QPACK_DEC,
H3S_T_QPACK_ENC,
/* bidirectional streams */
H3S_T_REQ,
H3S_T_UNKNOWN
};
/* H3 unidirectional QUIC stream */
struct h3_uqs {
/* Underlying incoming QUIC uni-stream */

View File

@ -70,6 +70,7 @@ struct h3c {
DECLARE_STATIC_POOL(pool_head_h3c, "h3c", sizeof(struct h3c));
struct h3s {
enum h3s_t type;
int demux_frame_len;
int demux_frame_type;
};
@ -778,6 +779,14 @@ static int h3_attach(struct qcs *qcs)
h3s->demux_frame_len = 0;
h3s->demux_frame_type = 0;
if (quic_stream_is_bidi(qcs->id)) {
h3s->type = H3S_T_REQ;
}
else {
/* stream type must be decoded for unidirectional streams */
h3s->type = H3S_T_UNKNOWN;
}
return 0;
}

View File

@ -136,12 +136,12 @@ struct qcs *qcs_new(struct qcc *qcc, uint64_t id, enum qcs_type type)
goto err;
}
qcs->id = qcs->by_id.key = id;
if (qcc->app_ops->attach) {
if (qcc->app_ops->attach(qcs))
goto err;
}
qcs->id = qcs->by_id.key = id;
/* store transport layer stream descriptor in qcc tree */
eb64_insert(&qcc->streams_by_id, &qcs->by_id);