Skip to main content

moqtap_client/
lib.rs

1#![deny(missing_docs)]
2
3//! MoQT client library.
4//!
5//! Provides a full MoQT client stack with per-draft modules. Each enabled
6//! draft lives under its own module (e.g. [`draft14`]) containing its own
7//! connection, endpoint state machine, and per-flow state machines.
8//!
9//! The [`transport`] module is shared across drafts because it sits below
10//! the MoQT protocol layer (raw QUIC / WebTransport streams and datagrams).
11//!
12//! # Feature flags
13//!
14//! Enable a draft with `--features draft14` (or any of `draft07`..`draft20`).
15//! The default is `all-drafts`, which enables every one; select individual
16//! drafts with `default-features = false`. `webtransport` adds the
17//! WebTransport transport.
18//!
19//! # Modules
20//!
21//! - [`dispatch`] — Multi-draft entry-point types (`AnyConnection`,
22//!   `AnyClientEvent`, `AnyConnectionObserver`, `AnyRequest`)
23//! - [`transport`] — Transport abstraction (QUIC, WebTransport)
24//! - `forwarding_preference` — The Object Forwarding Preference each track's
25//!   objects have been framed as, on the drafts where that is a property of
26//!   the track
27//! - `track_locations` — How far each track's objects have reached, on the
28//!   drafts that make an end-of-track object's placement a protocol error
29//! - `malformed_tracks` — Which tracks this endpoint has withdrawn from, on
30//!   the drafts that answer a malformed one with control messages
31//! - `draft07`..`draft20` — One module per supported MoQT draft, each
32//!   enabled via the matching `draftNN` feature flag.
33
34#[cfg(feature = "draft07")]
35pub mod draft07;
36
37#[cfg(feature = "draft08")]
38pub mod draft08;
39
40#[cfg(feature = "draft09")]
41pub mod draft09;
42
43#[cfg(feature = "draft10")]
44pub mod draft10;
45
46#[cfg(feature = "draft11")]
47pub mod draft11;
48
49#[cfg(feature = "draft12")]
50pub mod draft12;
51
52#[cfg(feature = "draft13")]
53pub mod draft13;
54
55#[cfg(feature = "draft14")]
56pub mod draft14;
57
58#[cfg(feature = "draft15")]
59pub mod draft15;
60
61#[cfg(feature = "draft16")]
62pub mod draft16;
63
64#[cfg(feature = "draft17")]
65pub mod draft17;
66
67#[cfg(feature = "draft18")]
68pub mod draft18;
69
70#[cfg(feature = "draft19")]
71pub mod draft19;
72
73#[cfg(feature = "draft20")]
74pub mod draft20;
75
76pub mod transport;
77
78/// What a track's objects have been framed as, for the nine drafts that make
79/// the Object Forwarding Preference a property of the track rather than of one
80/// object. Shared across those drafts because the observation is identical on
81/// all nine and only the answer to it differs.
82#[cfg(any(
83    feature = "draft07",
84    feature = "draft08",
85    feature = "draft09",
86    feature = "draft10",
87    feature = "draft11",
88    feature = "draft12",
89    feature = "draft13",
90    feature = "draft14",
91    feature = "draft15"
92))]
93pub mod forwarding_preference;
94
95/// How far each track's objects have reached, and where each one ended.
96///
97/// **Two rules, and the drafts that state them are not the same set.** Drafts
98/// 08 through 13 make an end-of-track object's Group and Object ID a protocol
99/// error when they name a place the track has already passed, which takes a
100/// record of where the track has reached; drafts 07 and 14 through 20 have no
101/// such sentence, draft-07 having no ordering condition on the status at all
102/// and draft-14 having replaced it with a prohibition on the publisher. Drafts
103/// 12 through 20 make an object *past* where an end-of-track object put the end
104/// a Malformed Track, which takes a record of that place instead.
105///
106/// So the module is compiled wherever either rule is, and which of its two
107/// entry points a draft calls is what says which rule it states. The overlap is
108/// drafts 12 and 13, where both hold.
109#[cfg(any(
110    feature = "draft08",
111    feature = "draft09",
112    feature = "draft10",
113    feature = "draft11",
114    feature = "draft12",
115    feature = "draft13",
116    feature = "draft14",
117    feature = "draft15",
118    feature = "draft16",
119    feature = "draft17",
120    feature = "draft18",
121    feature = "draft19",
122    feature = "draft20"
123))]
124pub mod track_locations;
125
126/// What a Malformed Track is, for the drafts whose answer to one is a control
127/// message.
128///
129/// Drafts 12 and 13 Section 2.5 list the conditions that make a track
130/// malformed and give all of them one answer: "When a subscriber detects a
131/// Malformed Track, it MUST UNSUBSCRIBE from the Track and SHOULD deliver an
132/// error to the application." Drafts 14, 15 and 16 widen the same sentence to
133/// fetches — "it MUST UNSUBSCRIBE any subscription and FETCH_CANCEL any fetch
134/// for that Track from that publisher" — which is a second message and the
135/// same record. Drafts 17 through 20 replace both with a cancellation of the
136/// request's own stream — a reset rather than a message — and the record is
137/// compiled there too, because what it holds is *which track was given up and
138/// what for*, which is the same question whichever shape the answer takes. It
139/// is the conditions that vary by draft, not the record of them; the answer
140/// lives on each draft's connection.
141#[cfg(any(
142    feature = "draft12",
143    feature = "draft13",
144    feature = "draft14",
145    feature = "draft15",
146    feature = "draft16",
147    feature = "draft17",
148    feature = "draft18",
149    feature = "draft19",
150    feature = "draft20"
151))]
152pub mod malformed_tracks;
153
154pub mod dispatch;