diff --git a/include/haproxy/mux_quic-t.h b/include/haproxy/mux_quic-t.h index 4ce088e61..2141506fe 100644 --- a/include/haproxy/mux_quic-t.h +++ b/include/haproxy/mux_quic-t.h @@ -185,12 +185,19 @@ struct qcs { int start; /* base timestamp for http-request timeout */ }; +/* Used as qcc_app_ops.close callback argument. */ +enum qcc_app_ops_close_side { + QCC_APP_OPS_CLOSE_SIDE_RD, /* Read channel closed (RESET_STREAM received). */ + QCC_APP_OPS_CLOSE_SIDE_WR /* Write channel closed (STOP_SENDING received). */ +}; + /* QUIC application layer operations */ struct qcc_app_ops { int (*init)(struct qcc *qcc); int (*attach)(struct qcs *qcs, void *conn_ctx); ssize_t (*decode_qcs)(struct qcs *qcs, struct buffer *b, int fin); size_t (*snd_buf)(struct qcs *qcs, struct htx *htx, size_t count); + int (*close)(struct qcs *qcs, enum qcc_app_ops_close_side side); void (*detach)(struct qcs *qcs); int (*finalize)(void *ctx); void (*shutdown)(void *ctx); /* Close a connection. */ diff --git a/src/h3.c b/src/h3.c index 14637e5be..e802d299c 100644 --- a/src/h3.c +++ b/src/h3.c @@ -1601,6 +1601,24 @@ static size_t h3_snd_buf(struct qcs *qcs, struct htx *htx, size_t count) return total; } +/* Notify about a closure on stream requested by the remote peer. + * + * Stream channel is explained relative to our endpoint : WR for + * STOP_SENDING or RD for RESET_STREAM reception. Callback decode_qcs() is used + * instead for closure performed using a STREAM frame with FIN bit. + * + * The main objective of this function is to check if closure is valid + * according to HTTP/3 specification. + * + * Returns 0 on success else non-zero. A CONNECTION_CLOSE is generated on + * error. + */ +static int h3_close(struct qcs *qcs, enum qcc_app_ops_close_side side) +{ + /* TODO */ + return 0; +} + static int h3_attach(struct qcs *qcs, void *conn_ctx) { struct h3s *h3s; @@ -1795,6 +1813,7 @@ const struct qcc_app_ops h3_ops = { .attach = h3_attach, .decode_qcs = h3_decode_qcs, .snd_buf = h3_snd_buf, + .close = h3_close, .detach = h3_detach, .finalize = h3_finalize, .shutdown = h3_shutdown,