moqtap_codec/draft20/mod.rs
1//! MoQT wire codec for draft-20.
2//!
3//! Key changes from draft-19:
4//! - **FETCH (0x16) is rewritten.** The `Fetch Type` field, the Standalone
5//! Fetch and Joining Fetch structures and the Fetch Type registry are all
6//! gone. Track Namespace and Track Name are inline fields of FETCH itself, in
7//! the positions they occupied inside the old Standalone Fetch, and the range
8//! travels in the `LOCATION_FILTER` message parameter. The codepoint did not
9//! change, so a draft-19 decoder reads the Number of Track Namespace Fields
10//! count as a Fetch Type and mis-parses in silence; there is no in-band
11//! version signal to catch it (Section 10.13)
12//! - **PUBLISH_STATE_NOTIFY (0x22) is new.** A publisher-only, unilateral
13//! report that a subscription's state changed for a reason other than a
14//! subscriber-sent REQUEST_UPDATE. It has no Request ID field — the message
15//! is identified by the bidirectional request stream it arrives on, like
16//! SUBSCRIBE_OK, PUBLISH_DONE and FETCH_OK (Section 10.10)
17//! - **`LOCATION_FILTER` (0x21) is restructured.** The Filter Type enum
18//! (draft-19's 0x1 Next Group Start / 0x2 Largest Object / 0x3 AbsoluteStart
19//! / 0x4 AbsoluteRange) is gone; the filter's shape now comes from how many
20//! `vi64` fields its value holds (Section 5.1.2)
21//! - **Ranges are inclusive at both ends**, on subscriptions and on fetches.
22//! Draft-19's fetch end was "the last Object, plus 1; or 0 to indicate the
23//! entire Group"; both conventions are deleted. This change is absent from
24//! the draft's own change log, and a draft-19 encoder ported forward with its
25//! end-location arithmetic intact fetches one object too many
26//! (Sections 5.1.2, 10.13, 10.14)
27//! - **`FILL_PARAMETERS` (0x23) is new**: a length-prefixed parameter whose
28//! value is a nested parameter block, and whose mere presence on a SUBSCRIBE
29//! or a REQUEST_UPDATE asks the publisher to open a fill fetch stream
30//! (Section 10.2.15)
31//! - **`INCLUDE_PROPERTIES` (0x35) is new**: a uint8 opt-out from Track
32//! Properties on the responding OK, default 1 (Section 10.2.21)
33//! - Three code points are removed: `SUBSCRIPTION_ENDED` (PUBLISH_DONE 0x3),
34//! `VERSION_NEGOTIATION_FAILED` (session 0x15) and
35//! `INVALID_JOINING_REQUEST_ID` (REQUEST_ERROR 0x32). Two whole enumerations
36//! go with them: the Fetch Type registry and the Location Filter Type enum
37//! - `PUBLISH_DONE.Stream Count`'s "unknown" sentinel moves from `2^62 - 1` to
38//! `2^64 - 1`, and the count now includes fill fetch streams (Section 10.12)
39//! - Subscription parameters moved off `PUBLISH_OK`. Six parameter definitions
40//! dropped it from their "MAY appear in" list and several gained `PUBLISH`;
41//! `EXPIRES` (0x08) is the only one that still names it (Section 10.2)
42//! - The data-plane headers rename their leading field `Type` to `Type Flags`
43//! and move the validity rules out of the figure into prose. The field list,
44//! order, widths and the set of valid values are all unchanged; what changed
45//! is the receive path. Sections 11.3.1 and 11.4.2 give **different** rule
46//! sets — subgroup's reserved bit 4 must be 1, datagram's must be 0, and
47//! subgroup has no "unspecified bit" clause because bits 0-6 are all
48//! specified for it
49//! - A fetch stream gains a third End of Range marker, `End of Timed-Out
50//! Range` (Serialization Flags `0x20C`), for the Objects a relay abandoned
51//! when its `FILL_TIMEOUT` budget ran out. Draft-19 reported those as Unknown
52//! gaps (Section 11.4.4, Table 7)
53//! - Section numbering: everything from Section 10.10 on shifted by one, because
54//! PUBLISH_STATE_NOTIFY was inserted there. Range Filters moved 5.1.3 to
55//! 5.1.4, and five parameter subsections shifted (`EXPIRES` 10.2.15 to
56//! 10.2.16, `LARGEST_OBJECT` 10.2.16 to 10.2.17, `FORWARD` 10.2.17 to
57//! 10.2.18, `NEW_GROUP_REQUEST` 10.2.18 to 10.2.19,
58//! `TRACK_NAMESPACE_PREFIX` 10.2.19 to 10.2.20). Every section reference in
59//! this module is draft-20's own
60//!
61//! # Where this codec had to choose
62//!
63//! Draft-20 leaves several wire questions open. Each decision is recorded at
64//! the encode or decode site that makes it, and each says that the draft does
65//! not state it. They are, with the site that carries the comment:
66//!
67//! - `FILL_PARAMETERS`'s value begins with a `Number of Parameters` count —
68//! [`message::decode_fill_parameters`]
69//! - the `Type Delta` chain restarts inside `FILL_PARAMETERS` and the outer
70//! chain is unaffected — [`message::decode_fill_parameters`]
71//! - a `LOCATION_FILTER`'s field count comes from parsing, never from the byte
72//! length — [`message::decode_location_filter`]
73//! - a non-minimally encoded `Type Flags` is accepted on receive and never
74//! emitted — [`data_stream::SubgroupHeader::decode`](crate::draft20::data_stream::SubgroupHeader::decode) and
75//! [`data_stream::DatagramHeader::decode`](crate::draft20::data_stream::DatagramHeader::decode)
76//! - `PUBLISH_DONE.Stream Count`'s `2^64 - 1` sentinel is indistinguishable
77//! from a well-formed exact count —
78//! [`message::publish_done_codes::STREAM_COUNT_UNKNOWN`]
79//! - `PUBLISH_STATE_NOTIFY`'s parameter allow-list is treated as closed —
80//! [`message::parameter_in_scope`]
81//! - `Object Payload Length` is present on an End-of-Range marker record,
82//! encoded as 0, and the ordinary delta arithmetic applies to the marker's
83//! two fields — [`data_stream::FetchObjectHeader`]
84
85#[allow(missing_docs)]
86pub mod data_stream;
87pub mod error_codes;
88/// This draft's field names for a decoded control message.
89pub mod fields;
90#[allow(missing_docs)]
91pub mod message;
92#[allow(missing_docs)]
93pub mod types;