wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
Loading...
Searching...
No Matches
ackrange.h
1#ifndef ACKGEN_ACKRANGE_H
2#define ACKGEN_ACKRANGE_H
3
5
7typedef struct {
8 const u64* p;
9 usz n;
10} u64view;
11
13typedef struct {
14 u64* p;
17} u64obuf;
18
19/* RFC 9000 19.3: an ACK frame reports the Largest Acknowledged packet number
20 * and a descending list of contiguous ranges separated by gaps. This builds
21 * those ranges from an ascending, deduplicated array of received packet
22 * numbers (received_pns).
23 *
24 * Output layout (descending, matching wire order), written into ranges->p:
25 * largest = highest received packet number
26 * ranges->p[0] = First ACK Range length (count-1 of the top block)
27 * ranges->p[2k-1] = Gap to the next block (RFC 19.3.1 encoding)
28 * ranges->p[2k] = ACK Range Length of block k (count-1)
29 * ranges->len = number of u64 values written
30 *
31 * ranges->cap bounds the write. Returns 1 on success, 0 if received_pns is
32 * empty or ranges->cap is too small. */
33int ackgen_build_ranges(u64view received_pns, u64* largest, u64obuf* ranges);
34
35#endif
A fixed-capacity u64 output buffer; the callee fills *len.
Definition ackrange.h:13
usz len
out: elements actually written
Definition ackrange.h:16
u64 * p
destination buffer
Definition ackrange.h:14
usz cap
capacity in elements
Definition ackrange.h:15
A read-only view of a u64 array.
Definition ackrange.h:7
usz n
element count
Definition ackrange.h:9
const u64 * p
pointer to the first element
Definition ackrange.h:8
Linux direct syscalls.
u64 usz
unsigned size (size_t equivalent)
Definition types.h:20
unsigned long u64
unsigned 64-bit integer
Definition types.h:13