wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
Loading...
Searching...
No Matches
recvpn.h
1#ifndef QUIC_RECVPN_RECVPN_H
2#define QUIC_RECVPN_RECVPN_H
3
5
6/* RFC 9000 13.2: a receiver tracks which packet numbers it has seen so it can
7 * drop duplicates and acknowledge the rest. We keep the largest number seen
8 * and a sliding bitmap of the window below it, which is enough to detect
9 * duplicates and to find the contiguous run for the ACK's first range. */
10
11#define QUIC_RECVPN_WINDOW \
12 64 /* packets below `largest` tracked in the bitmap */
13
15typedef struct {
18 int any;
20
21void quic_recvpn_init(quic_recvpn* r);
22
23/* Whether packet number pn has already been recorded (a duplicate). */
24int quic_recvpn_seen(const quic_recvpn* r, u64 pn);
25
26/* Record packet number pn as received. Numbers older than the window are
27 * ignored (treated as already acknowledged). */
28void quic_recvpn_record(quic_recvpn* r, u64 pn);
29
30/* The first ACK range: the count of contiguous packets ending at `largest`
31 * that have been received (0 if none recorded). */
32u64 quic_recvpn_first_range(const quic_recvpn* r);
33
34#endif
Sliding window of received packet numbers for one packet number space.
Definition recvpn.h:15
u64 bitmap
bit i set => (largest - 1 - i) was received
Definition recvpn.h:17
u64 largest
highest packet number recorded (valid once any seen)
Definition recvpn.h:16
int any
whether anything has been recorded yet
Definition recvpn.h:18
x86_64 Linux direct syscalls.
unsigned long u64
unsigned 64-bit integer
Definition syscall.h:12