wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
Loading...
Searching...
No Matches
moqtrel.h
Go to the documentation of this file.
1#ifndef WIRED_MOQTREL_H
2#define WIRED_MOQTREL_H
3
8
23
26#define WIRED_MOQTREL_POOL 4
27
31#define WIRED_MOQTREL_CAP ((u64)3 * WIRED_SRVLOOP_WT_BUF_CAP)
32
34#define WIRED_MOQTREL_ROUND_MAX 16384
35
38#define WIRED_MOQTREL_STALL_MS 10000
39
51#define WIRED_MOQTREL_HEADROOM \
52 (WIRED_MOQTRUN_RELAY_FRAG_MAX + WIRED_SRVLOOP_WT_BUF_CAP + 16)
53
58#define WIRED_MOQTREL_MAX_SUBS 31
59
61#define WIRED_MOQTREL_MARKS 8
62
89
122
126
134
142
149void moqtrel_note_sent(moqtrel_buf* b, u32 sub, usz n, u64 now_ms);
150
160void moqtrel_mark(moqtrel_buf* b, u64 now_ms);
161
169u64 moqtrel_age_ms(const moqtrel_buf* b, u32 sub, u64 now_ms);
170
175
181
187
195int moqtrel_stalled(const moqtrel_buf* b, u32 sub, u64 now_ms);
196
205int moqtrel_awaits_sub(const moqtrel_buf* b, u64 now_ms);
206
212
213#endif
int moqtrel_all_done(const moqtrel_buf *b)
Completion check: 1 when every active cursor is shed or fin_done (so the ring can go back to the pool...
void moqtrel_reclaim(moqtrel_buf *b)
Advance head to the slowest pinning cursor: min(sent) over cursors that are active and not shed,...
#define WIRED_MOQTREL_MARKS
Arrival marks a ring keeps (moqtrel_mark).
Definition moqtrel.h:61
void moqtrel_mark(moqtrel_buf *b, u64 now_ms)
Record that every byte up to tail has arrived by now_ms; call after each moqtrel_append.
int moqtrel_awaits_sub(const moqtrel_buf *b, u64 now_ms)
Late-subscriber wait: 1 while no cursor ever attached (head is still 0, so the ring holds the stream ...
void moqtrel_note_sent(moqtrel_buf *b, u32 sub, usz n, u64 now_ms)
Record an accepted send: sub's cursor advances by n and its stall clock restarts at now_ms.
int moqtrel_should_hold(const moqtrel_buf *b)
Decide publisher backpressure: 1 when free space fell below two receive windows (2 * WIRED_SRVLOOP_WT...
void moqtrel_reset(moqtrel_buf *b)
Empty b: offsets zero, no publisher, every cursor inactive.
int moqtrel_stalled(const moqtrel_buf *b, u32 sub, u64 now_ms)
Stall check for subscriber sub: 1 when it is active, not shed, has pending bytes, and its last accept...
u64 moqtrel_age_ms(const moqtrel_buf *b, u32 sub, u64 now_ms)
How long ago subscriber sub's next unsent byte arrived (draft-ietf- moq-transport-19 8,...
#define WIRED_MOQTREL_MAX_SUBS
Fixed capacity: subscriber cursors per ring.
Definition moqtrel.h:58
wired_span moqtrel_next_round(const moqtrel_buf *b, u32 sub)
The next contiguous slice to send to subscriber sub: starts at its sent cursor, length capped by pend...
#define WIRED_MOQTREL_CAP
Ring capacity in bytes.
Definition moqtrel.h:31
int moqtrel_append(moqtrel_buf *b, wired_span src)
Append src's bytes at tail (wrapping physically at CAP).
int moqtrel_should_release(const moqtrel_buf *b)
Decide backpressure release: 1 when a hold is applied and used bytes drained to at most half a receiv...
draft-ietf-webtrans-http3-15 SS4: the WebTransport session state machine, independent of any specific...
Value-type views that fold the SDK's recurring argument shapes into single parameters,...
RFC 9001 4 / 5 / RFC 9000 17.2: the socket-free core of the server wire loop.
One reliable-relay ring: the publisher's relayed bytes plus every subscriber's cursor and the publish...
Definition moqtrel.h:92
u64 tail
Absolute offset one past the last appended byte.
Definition moqtrel.h:98
wired_wt_session * pub
Publisher session, kept so the hub can hold/release its credit.
Definition moqtrel.h:106
u64 mark_end[WIRED_MOQTREL_MARKS]
Arrival marks, oldest first: bytes below mark_end[k] and at or past mark_end[k-1] reached the hub at ...
Definition moqtrel.h:116
u64 mark_ms[WIRED_MOQTREL_MARKS]
Arrival time (ms) of each mark, parallel to mark_end.
Definition moqtrel.h:118
u64 head
Absolute offset below which bytes have been reclaimed (rewritable).
Definition moqtrel.h:96
int fin_seen
1 once the publisher's stream FIN arrived.
Definition moqtrel.h:102
int held
1 while the publisher's receive credit is held by the hub.
Definition moqtrel.h:104
u64 pub_stream
Publisher's stream id for the same hold/release calls.
Definition moqtrel.h:108
int in_use
1 while this pool entry is bound to a relayed track.
Definition moqtrel.h:100
u64 bound_ms
Time (ms) the ring was bound; bounds the wait for a first cursor.
Definition moqtrel.h:110
u8 buf[WIRED_MOQTREL_CAP]
Ring storage; byte at absolute offset o lives at o % CAP.
Definition moqtrel.h:94
moqtrel_sub subs[WIRED_MOQTREL_MAX_SUBS]
Per-subscriber read cursors, indexed like the hub's sub table.
Definition moqtrel.h:112
u32 marks
Marks in use (mark_end[0..marks), mark_ms[0..marks)).
Definition moqtrel.h:120
One subscriber's read cursor into a ring.
Definition moqtrel.h:64
int fin_done
1 once the closing FIN for this subscriber was accepted.
Definition moqtrel.h:75
u64 sent
Absolute offset of the next byte to send to this subscriber.
Definition moqtrel.h:66
u64 lead_id
Absolute Object ID the Object at sent goes out with; valid iff lead_skip.
Definition moqtrel.h:81
u64 end
Absolute offset this subscriber's stream ends at (its End Object); 0 when only the publisher's FIN en...
Definition moqtrel.h:78
u32 lead_skip
Bytes of the Object ID Delta at sent that lead_id replaces; 0 when nothing is re-framed.
Definition moqtrel.h:84
int shed
1 once the hub gave up on this subscriber (stall shed); a shed cursor never pins head again.
Definition moqtrel.h:73
u64 last_ok_ms
Time (ms) of the last accepted send; the stall clock's anchor.
Definition moqtrel.h:68
int active
1 while this cursor tracks a live subscriber stream.
Definition moqtrel.h:70
int before_start
1 while no Object at or past the subscriber's start Object arrived: each append moves sent past the O...
Definition moqtrel.h:87
Read-only view of a byte range.
Definition span.h:30
A WebTransport session.
Definition session.h:77
Linux direct syscalls.
unsigned int u32
unsigned 32-bit integer
Definition types.h:15
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