wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
Loading...
Searching...
No Matches
pnspace.h
1#ifndef QUIC_CONN_PNSPACE_H
2#define QUIC_CONN_PNSPACE_H
3
5
9typedef enum {
10 QUIC_PNS_INITIAL = 0,
11 QUIC_PNS_HANDSHAKE,
12 QUIC_PNS_APP,
13 QUIC_PNS_COUNT
14} quic_pns_space;
15
17typedef struct {
18 u64 next[QUIC_PNS_COUNT];
21
22/* RFC 9000 12.3: 2^62-1 is the highest packet number a sender may ever use;
23 * once issued, that space must not send another packet in it (and MUST
24 * close the connection without sending a CONNECTION_CLOSE frame). */
25#define QUIC_PN_LIMIT (((u64)1 << 62) - 1)
26
27/* Initialize all spaces to packet number 0. */
28void quic_pnspace_init(quic_pnspace* s);
29
30/* Return the next packet number for `space` and advance that space's counter.
31 * Each space is strictly monotonic and independent of the others. */
32u64 quic_pnspace_next(quic_pnspace* s, quic_pns_space space);
33
34/* RFC 9000 12.3: 1 once `space` has issued QUIC_PN_LIMIT (its highest legal
35 * packet number), meaning the sender must stop sending in it -- silently,
36 * without a CONNECTION_CLOSE. 0 while more packet numbers remain. */
37int quic_pnspace_exhausted(const quic_pnspace* s, quic_pns_space space);
38
39#endif
Per-space next-packet-number counters (RFC 9000 12.3).
Definition pnspace.h:17
u64 next[QUIC_PNS_COUNT]
next packet number, indexed by quic_pns_space
Definition pnspace.h:18
x86_64 Linux direct syscalls.
unsigned long u64
unsigned 64-bit integer
Definition syscall.h:12