wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
Loading...
Searching...
No Matches
connctl.h
1#ifndef FRAME_CONNCTL_H
2#define FRAME_CONNCTL_H
3
5
6/* RFC 9000 19: connection and path management frames. */
7
8#define FRAME_NEW_TOKEN 0x07 /* 19.7 */
9#define FRAME_RETIRE_CID 0x19 /* 19.16 */
10#define FRAME_PATH_CHALLENGE 0x1a /* 19.17 */
11#define FRAME_PATH_RESPONSE 0x1b /* 19.18 */
12#define FRAME_HANDSHAKE_DONE 0x1e /* 19.20 */
13
14#define PATH_DATA 8 /* PATH_CHALLENGE/RESPONSE payload length */
15
18typedef struct {
22 const u8* token;
24
25/* Encode/decode NEW_TOKEN. Returns bytes written/consumed, 0 on
26 * overflow or malformed/truncated input. */
27usz new_token_encode(u8* buf, usz cap, const new_token_frame* f);
28usz new_token_decode(const u8* buf, usz n, new_token_frame* f);
29
30/* RETIRE_CONNECTION_ID (19.16): a single sequence number. */
31usz retire_cid_encode(u8* buf, usz cap, u64 seq);
32usz retire_cid_decode(const u8* buf, usz n, u64* seq);
33
34/* PATH_CHALLENGE/PATH_RESPONSE (19.17/19.18): an 8-byte payload. type is
35 * FRAME_PATH_CHALLENGE or FRAME_PATH_RESPONSE. */
36usz path_encode(u8* buf, usz cap, u8 type, const u8 data[PATH_DATA]);
37usz path_decode(const u8* buf, usz n, u8 type, u8 data[PATH_DATA]);
38
39/* HANDSHAKE_DONE (19.20): type byte only, no body. */
40usz handshake_done_encode(u8* buf, usz cap);
41usz handshake_done_decode(const u8* buf, usz n);
42
43#endif
NEW_TOKEN (19.7): a token length and a view into the token (not copied).
Definition connctl.h:18
u64 length
Token length in bytes (0 is permitted).
Definition connctl.h:20
const u8 * token
View into the token bytes; not copied, the buffer must outlive uses.
Definition connctl.h:22
Linux direct syscalls.
u64 usz
unsigned size (size_t equivalent)
Definition types.h:20
unsigned char u8
unsigned 8-bit integer / byte
Definition types.h:18
unsigned long u64
unsigned 64-bit integer
Definition types.h:13