mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-09 00:27:08 +02:00
MINOR: h3: implement h3 stream context
Define a new structure h3s used to provide context for a H3 stream. This structure is allocated and stored in the qcs thanks to previous commit which provides app-layer context storage. For now, h3s is empty. It will soon be completed to be able to support stateful demux : this is required to be able to demux an incomplete frame if the rx buffer is full.
This commit is contained in:
parent
47447af1ef
commit
67e92d3652
26
src/h3.c
26
src/h3.c
@ -68,6 +68,11 @@ struct h3 {
|
||||
|
||||
DECLARE_STATIC_POOL(pool_head_h3, "h3", sizeof(struct h3));
|
||||
|
||||
struct h3s {
|
||||
};
|
||||
|
||||
DECLARE_STATIC_POOL(pool_head_h3s, "h3s", sizeof(struct h3s));
|
||||
|
||||
/* Simple function to duplicate a buffer */
|
||||
static inline struct buffer h3_b_dup(struct buffer *b)
|
||||
{
|
||||
@ -720,6 +725,18 @@ size_t h3_snd_buf(struct conn_stream *cs, struct buffer *buf, size_t count, int
|
||||
return total;
|
||||
}
|
||||
|
||||
static int h3_attach(struct qcs *qcs)
|
||||
{
|
||||
struct h3s *h3s;
|
||||
|
||||
h3s = pool_alloc(pool_head_h3s);
|
||||
if (!h3s)
|
||||
return 1;
|
||||
|
||||
qcs->ctx = h3s;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Finalize the initialization of remotely initiated uni-stream <qcs>.
|
||||
* Return 1 if succeeded, 0 if not. In this latter case, set the ->err h3 error
|
||||
* to inform the QUIC mux layer of the encountered error.
|
||||
@ -780,6 +797,13 @@ static int h3_attach_ruqs(struct qcs *qcs, void *ctx)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void h3_detach(struct qcs *qcs)
|
||||
{
|
||||
struct h3s *h3s = qcs->ctx;
|
||||
pool_free(pool_head_h3s, h3s);
|
||||
qcs->ctx = NULL;
|
||||
}
|
||||
|
||||
static int h3_finalize(void *ctx)
|
||||
{
|
||||
struct h3 *h3 = ctx;
|
||||
@ -928,9 +952,11 @@ static int h3_is_active(const struct qcc *qcc, void *ctx)
|
||||
/* HTTP/3 application layer operations */
|
||||
const struct qcc_app_ops h3_ops = {
|
||||
.init = h3_init,
|
||||
.attach = h3_attach,
|
||||
.attach_ruqs = h3_attach_ruqs,
|
||||
.decode_qcs = h3_decode_qcs,
|
||||
.snd_buf = h3_snd_buf,
|
||||
.detach = h3_detach,
|
||||
.finalize = h3_finalize,
|
||||
.is_active = h3_is_active,
|
||||
.release = h3_release,
|
||||
|
Loading…
Reference in New Issue
Block a user