wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
Loading...
Searching...
No Matches
body_window.h
1#ifndef WIRED_SRVLOOP_BODY_WINDOW_H
2#define WIRED_SRVLOOP_BODY_WINDOW_H
3
6
12#define BODYWIN_CAP 2048
13
15enum {
16 BODYWIN_OPEN = 0,
17 BODYWIN_DONE,
18 BODYWIN_REJECTED,
19 BODYWIN_FRAME_ERROR,
21 BODYWIN_FRAME_UNEXPECTED,
22};
23
25typedef int (*bodywin_sink)(void* ctx, wired_span chunk, int fin);
26
44
47void bodywin_land(bodywin* w, u8* buf, u64 off, wired_span data, int fin);
48
50usz bodywin_frontier(const bodywin* w);
51
53void bodywin_consume(bodywin* w, u8* buf, usz n);
54
64int bodywin_pump(bodywin* w, u8* buf, bodywin_sink fn, void* ctx);
65
67typedef int (*bodywin_capsule_fn)(void* ctx, u64 type, wired_span value);
68
73#define BODYWIN_CAPSULE_CAP (16 + 4 + 1024)
74
77typedef struct {
80 u8 buf[BODYWIN_CAPSULE_CAP];
82
93int bodywin_capsules(
94 bodywin* w, u8* buf, bodywin_capq* q, bodywin_capsule_fn fn, void* ctx);
95
99u64 bodywin_credit_due(bodywin* w);
100
101#endif
Value-type views that fold the SDK's recurring argument shapes into single parameters,...
Capsule bytes carried over between DATA frames and calls: a capsule may straddle any number of them.
Definition body_window.h:77
u64 skip
value bytes of an oversized capsule still to drop
Definition body_window.h:78
usz n
bytes held in buf
Definition body_window.h:79
u8 buf[BODYWIN_CAPSULE_CAP]
the held capsule bytes
Definition body_window.h:80
One request stream's receive window over a caller-owned BODYWIN_CAP buffer: buf[0] is stream offset b...
Definition body_window.h:33
u64 left
payload bytes left in the frame being parsed
Definition body_window.h:35
u8 state
BODYWIN_*.
Definition body_window.h:42
u64 base
stream offset of buf[0]
Definition body_window.h:34
u8 fin
final size known
Definition body_window.h:39
u8 have[BODYWIN_CAP/8]
bit i: buf[i] received
Definition body_window.h:38
u64 fin_off
final size, valid once fin
Definition body_window.h:36
u8 is_data
the frame being parsed is DATA
Definition body_window.h:41
u64 granted
base at the last credit raise (0: initial credit only)
Definition body_window.h:37
u8 on
HEADERS consumed, body streaming.
Definition body_window.h:40
Read-only view of a byte range.
Definition span.h:30
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