wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
Loading...
Searching...
No Matches
control.h
1#ifndef QUIC_H3_CONTROL_H
2#define QUIC_H3_CONTROL_H
3
5
6/* RFC 9114 6.2.1/7.2.4/5.2: the HTTP/3 control stream, SETTINGS ordering, and
7 * GOAWAY graceful shutdown. A peer opens at most one control stream which is
8 * never closed; its first frame must be SETTINGS (once); GOAWAY ids are
9 * monotonically non-increasing and forbid new requests at or above the
10 * limit. Any violation latches a connection error (terminal). */
11
14typedef enum {
15 QUIC_H3_ERR_NONE = 0,
16 QUIC_H3_ERR_STREAM_CREATION, /* 2nd control stream */
17 QUIC_H3_ERR_CLOSED_CRITICAL, /* control stream closed */
18 QUIC_H3_ERR_MISSING_SETTINGS, /* first control frame not SETTINGS */
19 QUIC_H3_ERR_FRAME_UNEXPECTED, /* a second SETTINGS */
20 QUIC_H3_ERR_ID /* GOAWAY id increased */
21} quic_h3_error;
22
33
34void quic_h3_control_init(quic_h3_control* c);
35
36/* A peer opened its control stream. The second one is a STREAM_CREATION error.
37 */
38void quic_h3_control_open(quic_h3_control* c);
39
40/* The control stream closed: a CLOSED_CRITICAL_STREAM error. */
41void quic_h3_control_closed(quic_h3_control* c);
42
43/* A control-stream frame arrived; is_settings marks the SETTINGS type. The
44 * first frame must be SETTINGS (else MISSING_SETTINGS); a later SETTINGS is
45 * FRAME_UNEXPECTED. */
46void quic_h3_control_frame(quic_h3_control* c, int is_settings);
47
48/* A GOAWAY with `id` arrived. Accepted if not greater than a prior GOAWAY id;
49 * an increase is an ID error. */
50void quic_h3_control_goaway(quic_h3_control* c, u64 id);
51
52/* Whether a new request with `id` may be accepted: not after a GOAWAY whose
53 * limit it reaches (RFC 9114 5.2). Existing requests are unaffected. */
54int quic_h3_control_accept_request(const quic_h3_control* c, u64 id);
55
56#endif
RFC 9114 6.2.1/7.2.4/5.2: this connection's control-stream state — whether it is open,...
Definition control.h:26
u8 goaway_seen
a GOAWAY has been received
Definition control.h:29
quic_h3_error error
latched; nonzero means the connection failed
Definition control.h:31
u8 control_open
a control stream is open
Definition control.h:27
u8 settings_seen
SETTINGS was the first control frame.
Definition control.h:28
u64 goaway_limit
highest request id still accepted is below this
Definition control.h:30
x86_64 Linux direct syscalls.
unsigned char u8
unsigned 8-bit integer / byte
Definition syscall.h:17
unsigned long u64
unsigned 64-bit integer
Definition syscall.h:12