wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
Loading...
Searching...
No Matches
wired_moqt_hub Struct Reference

The hub's whole state: fixed peer table plus the io table it sends through. More...

#include <moqtrun.h>

Data Fields

wired_moqtrun_peer peers [WIRED_MOQTRUN_MAX_SESSIONS]
 One slot per connected session (wired_moqtrun_peer.in_use).
wired_moqt_io io
 Transport callbacks every send goes through (wired_moqt_init).
u64 join_seq_next
 Next wired_moqtrun_peer.join_seq to hand out.
wired_moqt_authorize_fn authorize_subscribe
 Subscriber authorizer (SS13.3); 0 (the wired_moqt_init default) means an open hub that grants every SUBSCRIBE – the sample-room policy, not one for a public relay, which sets this.
void * authorize_ctx
 Opaque first argument handed to authorize_subscribe.
wired_moqt_authorize_fn authorize_publish
 Publisher authorizer (draft-22 16.3 "Preventing Impersonation": a relay MUST verify the publisher may claim the PUBLISH's Full Track Name – the same MUST in every draft this SDK speaks); 0 (the wired_moqt_init default) grants every PUBLISH, like authorize_subscribe.
void * authorize_pub_ctx
 Opaque first argument handed to authorize_publish.
wired_moqtrun_track blob_track
 The hub's own static track (wired_moqt_publish_blob): in_use once a blob is published, name/own_alias as given there, subs[] recording which peers have already been sent it (relays[] unused).
wired_span blob_wire
 The published blob's framed bytes – a view into the caller's wire buffer, handed verbatim to io.send_uni for each new subscriber.
wired_moqtrun_live live
 The hub's live track (wired_moqt_publish_live); track.in_use once published.
u64 stat_live_sent
 Live Groups accepted by io.send_uni2.
u64 stat_live_drop
 Live Groups abandoned because the clock left the Group before a refused send could be retried (never sent late).
u8 relay_scratch [WIRED_MOQTRUN_RELAY_FRAG_MAX+WIRED_SRVLOOP_WT_BUF_CAP]
 Scratch for moqtrun_relay_normalize: one relay's held fragment prepended to one delivery (a delivery is at most srvloop's whole WT receive window).
u8 alias_scratch [WIRED_MOQTRUN_RELAY_FRAG_MAX+WIRED_SRVLOOP_WT_BUF_CAP+8]
 Scratch for moqtrun_alias_splice: one relayed stream head or datagram (at most a relay_scratch round) re-spelled with its destination's Track Alias, which may take up to 8 more bytes.
u64 stat_frag_drop
 Cumulative undelivered tails dropped because they exceeded WIRED_MOQTRUN_RELAY_FRAG_MAX (each degrades to a torn frame on that one stream – moqtrun_relay_save_frag).
u64 stat_relay_sent
 Cumulative relay-round outcomes at the true loss site (moqtrun_relay_forward_one): rounds appended to a subscriber stream (sent) vs rounds dropped for one subscriber because stream_send refused them (drop – the previous round was still unACKed).
u64 stat_relay_drop
 Relay rounds dropped (stat_relay_sent's doc).
u64 stat_open_drop
 Failed relay-stream OPENS (io.open_uni_stream returned failure – send-slot exhaustion or the peer's stream limit).
u64 stat_relay_reset
 Relay streams abandoned (io.stream_reset accepted) after WIRED_MOQTRUN_RESET_AFTER_BUSY consecutive busy refusals – each is one subscriber's stale backlog shed in favor of a fresh stream at the newest frame.
u64 stat_relay_full
 Fresh publisher streams NOT relayed because every relay entry of their track was busy (moqtrun_relay_start finding no free WIRED_MOQTRUN_MAX_RELAYS slot) – unlike stat_open_drop's one-subscriber copy loss, each of these loses the stream's whole payload for EVERY subscriber.
u64 stat_dg_sent
 OBJECT_DATAGRAM copies accepted by io.send_datagram (one count per subscriber, wired_moqt_on_datagram).
u64 stat_dg_drop
 OBJECT_DATAGRAM copies refused by io.send_datagram – that one subscriber's copy is lost for good (a datagram is never retransmitted; live audio wants the next frame, not this one).
u64 stat_dg_bad
 Received datagrams dropped whole: moqdg_take refused them (VIOLATION/INSUFFICIENT) or their Track Alias matched none of the sending peer's tracks.
u64 reliable_alias_limit
 A track whose own_alias is below this relays reliably (refused sends retried from a moqtrel ring, publisher held back instead of dropping).
moqtrel_buf rel_pool [WIRED_MOQTREL_POOL]
 Ring pool for the reliable relays: one ring per concurrently relayed reliable publisher stream, bound via wired_moqtrun_relay.rel_idx.
u64 stat_rel_stall
 Reliable-relay subscribers given up on after WIRED_MOQTREL_STALL_MS without an accepted send (their stream is reset and their cursor stops pinning the ring).
u64 stat_rel_overflow
 Reliable-relay ring appends refused for lack of space.
u64 stat_rel_wait
 Reliable-relay rounds deferred because the subscriber session's remaining send credit (io.send_budget) could not carry the round and still leave WIRED_MOQTREL_HEADROOM for the session's lossy traffic.
u64 stat_rel_sent
 Reliable-relay rounds the subscriber's transport accepted (the attachment bytes that actually left the hub; stat_relay_sent counts only the lossy path).
u64 stat_rel_refused
 Reliable-relay rounds the subscriber's transport refused (send slot busy or session credit exhausted); each retries on a later tick.
u64 stat_rel_rings
 Reliable-relay rings bound to a fresh publisher stream (one per attachment stream a reliable track's publisher opened).
u64 stat_rel_in_bytes
 Bytes the reliable relay appended from publishers (header and whole Objects; the ring's own overflow refusals are not included).
u64 stat_rel_fin_in
 Publisher FINs the reliable relay recorded (the attachment stream's last byte reached the hub).
u64 stat_rel_fin_out
 Subscriber streams the reliable relay closed with a FIN (the attachment's last byte was accepted by that subscriber's transport).
u64 stat_rel_hold
 Times the reliable relay froze a publisher's receive credit because its ring filled past the hold watermark.
u64 stat_rel_early_return
 Rings returned to the pool before the publisher's FIN because no subscriber cursor was left (none attached at the start, or all were given up): the rest of that stream relays on the lossy path.
wired_moqtrun_req reqs [WIRED_MOQTRUN_MAX_REQS]
 Peer-opened request streams in flight, all sessions.
u8 frag_pool [WIRED_MOQTRUN_FRAG_POOL][WIRED_MOQTRUN_RELAY_FRAG_MAX]
 Held-fragment buffers shared by every relay (relay frag_idx).
wired_moqtrun_relay * frag_owner [WIRED_MOQTRUN_FRAG_POOL]
 The relay that last took each buffer; the buffer is free unless that relay is still in use and still names it (moqtrun_frag_slot_free).
moqcache cache
 Object cache over the app's arena (wired_moqt_cache_attach); empty, caching nothing, until one is attached.
u64 cache_tag_next
 Last wired_moqtrun_track.cache_tag handed out.
wired_moqtrun_fetch fetches [WIRED_MOQTRUN_MAX_FETCHES]
 FETCH responses in progress, all sessions.
wired_moqtrun_fetch fetch_waits [WIRED_MOQTRUN_MAX_FETCHES]
 Fill fetch streams accepted while every serving slot above was busy (draft-22 SS9.20.15: a fill is held, never silently dropped).
wired_moqtrun_upf_leg upf_legs [WIRED_MOQTRUN_MAX_FETCHES]
 The upstream FETCH state of fetches[i] beyond the slot's own fields (index i too).
u8 upf_buf [WIRED_MOQTRUN_RELAY_FRAG_MAX+WIRED_SRVLOOP_WT_BUF_CAP]
 What one upstream fetch leg keeps between deliveries, followed by the next delivery while it decodes: a torn Object under WIRED_MOQTRUN_RELAY_FRAG_MAX (held whole), a torn head of a larger one (whose payload passes through as it arrives), or a passed-through payload the transport refused and all after it (retried on the next tick or delivery).
usz upf_len
 Bytes of upf_buf held.
wired_moqtrun_fetch * upf_owner
 The fetch slot whose tail upf_buf holds, 0 when none.
wired_moqtrun_rdv rdv [WIRED_MOQTRUN_MAX_RDV]
 SUBSCRIBEs held for a publisher (RENDEZVOUS_TIMEOUT, draft-19 10.2.6), all sessions.
wired_moqtrun_up ups [WIRED_MOQTRUN_MAX_UP]
 SUBSCRIBEs the hub sent upstream to namespace publishers (draft-19 9.5), all sessions.
wired_moqt_authorize_ns_fn authorize_namespace
 Namespace authorizer (draft-ietf-moq-transport-19 10.15, 10.18); 0 (the wired_moqt_init default) grants every PUBLISH_NAMESPACE and SUBSCRIBE_NAMESPACE, like authorize_subscribe.
void * authorize_ns_ctx
 Opaque first argument handed to authorize_namespace.
u64 stat_timeout_reset
 Subscriber streams reset with DELIVERY_TIMEOUT because an Object outlived the subscription's OBJECT_DELIVERY_TIMEOUT (draft 8).
moqraw_policy raw_policy
 Raw-QUIC PATH/AUTHORITY policy (draft-ietf-moq-transport-22 9.1.1-2): zero (the wired_moqt_init default) accepts every well-formed value; set its hooks after wired_moqt_init to refuse some with INVALID_PATH / INVALID_AUTHORITY.
const u64 * ssts_algs
 SSTS algorithm ids this hub runs (moqtail –ssts-algorithms), in the order its draft-22 SETUP advertises them (option 0x09; at most MOQCTL_SSTS_MAX_ALGS are sent); ids moqssts does not implement are never negotiated.
usz ssts_alg_n
 Entries at ssts_algs; 0 turns SSTS off.
u64 ssts_cap_kbps
 Default algorithm (0) budget cap in kbps; 0 = uncapped.
u8 switch_track
 1 turns on SWITCH_FROM (0x24) on draft-22 sessions; 0 (the wired_moqt_init default) keeps the parameter a PROTOCOL_VIOLATION close, as before the extension.
u32 sw_live
 Switches whose old subscription may still be waiting to end (a hint moqtsw_step recounts; 0 skips its walk).

Detailed Description

The hub's whole state: fixed peer table plus the io table it sends through.

Zero-initialize with wired_moqt_init before first use.

Field Documentation

◆ alias_scratch

u8 wired_moqt_hub::alias_scratch[WIRED_MOQTRUN_RELAY_FRAG_MAX+WIRED_SRVLOOP_WT_BUF_CAP+8]

Scratch for moqtrun_alias_splice: one relayed stream head or datagram (at most a relay_scratch round) re-spelled with its destination's Track Alias, which may take up to 8 more bytes.

Used per io call only (the transport copies each accepted round).

◆ fetch_waits

wired_moqtrun_fetch wired_moqt_hub::fetch_waits[WIRED_MOQTRUN_MAX_FETCHES]

Fill fetch streams accepted while every serving slot above was busy (draft-22 SS9.20.15: a fill is held, never silently dropped).

An entry keeps the resolved range in cursor/end with nothing open and moves into fetches[] the moment a serving slot frees; its only other exit is the owning subscription's cancel.

◆ raw_policy

moqraw_policy wired_moqt_hub::raw_policy

Raw-QUIC PATH/AUTHORITY policy (draft-ietf-moq-transport-22 9.1.1-2): zero (the wired_moqt_init default) accepts every well-formed value; set its hooks after wired_moqt_init to refuse some with INVALID_PATH / INVALID_AUTHORITY.

Unused for WebTransport sessions, where either option is itself a close.

◆ rel_pool

moqtrel_buf wired_moqt_hub::rel_pool[WIRED_MOQTREL_POOL]

Ring pool for the reliable relays: one ring per concurrently relayed reliable publisher stream, bound via wired_moqtrun_relay.rel_idx.

An exhausted pool falls back to the lossy path (stat_relay_full).

◆ relay_scratch

Scratch for moqtrun_relay_normalize: one relay's held fragment prepended to one delivery (a delivery is at most srvloop's whole WT receive window).

Only ever used within a single wired_moqt_on_stream_data call, so one shared buffer suffices. A FETCH round (one fetch Object: MOQCACHE_OBJ_MAX payload plus at most 64 bytes of framing) is staged here too, never during a relay round: the transport copies each accepted round, so nothing outlives the call.

◆ reliable_alias_limit

u64 wired_moqt_hub::reliable_alias_limit

A track whose own_alias is below this relays reliably (refused sends retried from a moqtrel ring, publisher held back instead of dropping).

The wired_moqt_init default 0 keeps every track on the lossy path.

◆ ssts_algs

const u64* wired_moqt_hub::ssts_algs

SSTS algorithm ids this hub runs (moqtail –ssts-algorithms), in the order its draft-22 SETUP advertises them (option 0x09; at most MOQCTL_SSTS_MAX_ALGS are sent); ids moqssts does not implement are never negotiated.

A caller-owned view; ssts_alg_n 0 (the wired_moqt_init default) turns SSTS off: no option is sent and a SUBSCRIBE / REQUEST_UPDATE carrying SWITCHING_SET_ASSIGNMENT closes the session PROTOCOL_VIOLATION (an unknown parameter, draft-22 9.20). With SSTS on, an assignment the session cannot take is refused REQUEST_ERROR UNSUPPORTED_EXTENSION (0x33).

◆ ssts_cap_kbps

u64 wired_moqt_hub::ssts_cap_kbps

Default algorithm (0) budget cap in kbps; 0 = uncapped.

The budget is the stricter of this cap and the subscriber connection's estimate (io.est_kbps; moqssts_budget_kbps(est, cap)).

◆ stat_dg_bad

u64 wired_moqt_hub::stat_dg_bad

Received datagrams dropped whole: moqdg_take refused them (VIOLATION/INSUFFICIENT) or their Track Alias matched none of the sending peer's tracks.

Diagnostic only.

◆ stat_dg_sent

u64 wired_moqt_hub::stat_dg_sent

OBJECT_DATAGRAM copies accepted by io.send_datagram (one count per subscriber, wired_moqt_on_datagram).

Diagnostic only.

◆ stat_frag_drop

u64 wired_moqt_hub::stat_frag_drop

Cumulative undelivered tails dropped because they exceeded WIRED_MOQTRUN_RELAY_FRAG_MAX (each degrades to a torn frame on that one stream – moqtrun_relay_save_frag).

Diagnostic only, never reset.

◆ stat_live_drop

u64 wired_moqt_hub::stat_live_drop

Live Groups abandoned because the clock left the Group before a refused send could be retried (never sent late).

Counted only on the subscriber's NEXT accepted send: a refused Group never followed by another accepted send for that subscriber (it closes, or every retry stays refused) is not counted.

◆ stat_open_drop

u64 wired_moqt_hub::stat_open_drop

Failed relay-stream OPENS (io.open_uni_stream returned failure – send-slot exhaustion or the peer's stream limit).

A failed open loses the round exactly like stat_relay_drop's append rejection, and for a one-stream-per-message track (chat) that round is the whole message – counted so the loss is never silent again.

◆ stat_rel_overflow

u64 wired_moqt_hub::stat_rel_overflow

Reliable-relay ring appends refused for lack of space.

By design 0: the publisher hold lands before the ring can fill, so a nonzero count is an invariant violation worth investigating, not normal loss.

◆ stat_rel_sent

u64 wired_moqt_hub::stat_rel_sent

Reliable-relay rounds the subscriber's transport accepted (the attachment bytes that actually left the hub; stat_relay_sent counts only the lossy path).

Diagnostic only.

◆ stat_rel_stall

u64 wired_moqt_hub::stat_rel_stall

Reliable-relay subscribers given up on after WIRED_MOQTREL_STALL_MS without an accepted send (their stream is reset and their cursor stops pinning the ring).

Diagnostic only.

◆ stat_rel_wait

u64 wired_moqt_hub::stat_rel_wait

Reliable-relay rounds deferred because the subscriber session's remaining send credit (io.send_budget) could not carry the round and still leave WIRED_MOQTREL_HEADROOM for the session's lossy traffic.

Each deferral retries on a later tick, and none restarts the subscriber's stall clock: a credit drought outlasting WIRED_MOQTREL_STALL_MS sheds it like sustained refusals do.

◆ stat_relay_full

u64 wired_moqt_hub::stat_relay_full

Fresh publisher streams NOT relayed because every relay entry of their track was busy (moqtrun_relay_start finding no free WIRED_MOQTRUN_MAX_RELAYS slot) – unlike stat_open_drop's one-subscriber copy loss, each of these loses the stream's whole payload for EVERY subscriber.

Diagnostic only.

◆ stat_relay_reset

u64 wired_moqt_hub::stat_relay_reset

Relay streams abandoned (io.stream_reset accepted) after WIRED_MOQTRUN_RESET_AFTER_BUSY consecutive busy refusals – each is one subscriber's stale backlog shed in favor of a fresh stream at the newest frame.

Diagnostic only.

◆ stat_relay_sent

u64 wired_moqt_hub::stat_relay_sent

Cumulative relay-round outcomes at the true loss site (moqtrun_relay_forward_one): rounds appended to a subscriber stream (sent) vs rounds dropped for one subscriber because stream_send refused them (drop – the previous round was still unACKed).

Diagnostic only.

◆ stat_timeout_reset

u64 wired_moqt_hub::stat_timeout_reset

Subscriber streams reset with DELIVERY_TIMEOUT because an Object outlived the subscription's OBJECT_DELIVERY_TIMEOUT (draft 8).

Diagnostic only.

◆ upf_buf

What one upstream fetch leg keeps between deliveries, followed by the next delivery while it decodes: a torn Object under WIRED_MOQTRUN_RELAY_FRAG_MAX (held whole), a torn head of a larger one (whose payload passes through as it arrives), or a passed-through payload the transport refused and all after it (retried on the next tick or delivery).

ponytail: one buffer hub-wide; a second leg needing it at the same time gives up its upstream FETCH – a pool if that happens.


The documentation for this struct was generated from the following file: