Expand description
Draft-23 data stream header encoding and decoding.
Subgroup Type Flags: form 0b0XX1XXXX, so bit 4 is set and bit 7 is clear; the ranges are 0x10..0x1F, 0x30..0x3F, 0x50..0x5F, 0x70..0x7F.
- bit 0 (0x01): PROPERTIES
- bits 1-2 (0x06): SUBGROUP_ID_MODE (0=zero, 1=first_obj, 2=explicit, 3=reserved)
- bit 3 (0x08): END_OF_GROUP
- bit 5 (0x20): DEFAULT_PRIORITY (no priority byte)
- bit 6 (0x40): FIRST_OBJECT
Datagram Type Flags: 0b00X0XXXX, so bits 4, 6 and 7 are clear; the ranges are 0x00..0x0F and 0x20..0x2F.
- bit 0 (0x01): PROPERTIES
- bit 1 (0x02): END_OF_GROUP
- bit 2 (0x04): ZERO_OBJECT_ID (object_id=0, field omitted)
- bit 3 (0x08): DEFAULT_PRIORITY (no priority byte)
- bit 5 (0x20): STATUS (status byte replaces payload)
Section 11.3.1 and Section 11.2.1 each list the Type Flags values an endpoint refuses with INVALID_STREAM_HEADER, and the two lists differ: bit 4 MUST be 1 on a subgroup header and 0 on a datagram. A non-minimally encoded Type Flags value is accepted on receive and never emitted.
An Object has an empty payload unless its status is registered as
permitting one (Section 11.1.1); SubgroupObjectReader::write_object
refuses a payload its status forbids.
Fetch stream: stream type 0x05 + Request ID, then entries whose leading
Serialization Flags say which fields follow (Section 11.4.1).
FetchObjectHeader decodes one entry and FetchObjectReader resolves
its IDs. Table 8 has six indicators: four End of Range values and End of
Group and End of Track.
Re-exportsΒ§
use bytes::Buf;πuse bytes::BufMut;πuse super::types::ObjectStatus;πuse super::types::PayloadPermission;πuse crate::error::CodecError;πuse crate::object_properties::ObjectProperty;πuse crate::object_properties::PropertyValue;πuse crate::varint::Moqt18 as Wire;πuse crate::varint::VarInt;π
StructsΒ§
- Datagram
Header - Fetch
Gaps - The Prior Group ID Gap and Prior Object ID Gap conditions of draft-23 Section 10.8 and draft-23 Section 10.9 that one fetch stream shows.
- Fetch
Header - The head of a fetch stream: the stream type
0x05and a Request ID. - Fetch
Object - One entry from a FETCH stream with its delta-encoded fields resolved.
- Fetch
Object Header - One entry on a draft-23 fetch stream, up to but not including its payload.
- Fetch
Object πLayout - Which fields a Serialization Flags value puts on the wire.
- Fetch
Object Reader - Resolves the delta-encoded fields of the entries on one FETCH stream.
- Fetch
Object Writer - Re-encodes resolved fetch entries onto one FETCH stream.
- Prior
Gaps - The Prior Group ID Gap and Prior Object ID Gap one Object carries.
- Subgroup
Header - Subgroup
Object - One object within a draft-23 subgroup stream. Object IDs are
delta-encoded; whether a per-object βpropertiesβ block (the draft-23
equivalent of extension headers) is present depends on the PROPERTIES
bit on the enclosing
SubgroupHeader. UseSubgroupObjectReaderto encode/decode. - Subgroup
Object Meta - The framing of one draft-23 subgroup object, without its payload.
- Subgroup
Object Reader
EnumsΒ§
- Fetch
EndMarker - An indicator that ends a Group or the Track rather than a range.
- Fetch
EndOf Range - What an End of Range indicator says about the Locations it covers.
- Group
Order - The order a FETCH responseβs Groups arrive in, which decides how a Group ID Delta is applied.
ConstantsΒ§
- DATAGRAM_
DEFAULT_ πPRIORITY_ BIT - DATAGRAM_
END_ πOF_ GROUP_ BIT - DATAGRAM_
PROPERTIES_ πBIT - DATAGRAM_
RESERVED_ πBIT - Bit 4. Draft-23 Section 11.2.1: βThis bit is reserved and MUST be zero.β The opposite of Section 11.3.1, where the same bit MUST be 1.
- DATAGRAM_
SPECIFIED_ πBITS - Every bit draft-23 Section 11.2.1 gives a datagram
Type Flagsvalue a meaning for: PROPERTIES, END_OF_GROUP, ZERO_OBJECT_ID, DEFAULT_PRIORITY and STATUS. Bit 4 is reserved and bits 6 and up are unspecified, so both fail the mask. - DATAGRAM_
STATUS_ πBIT - DATAGRAM_
ZERO_ πOBJECT_ ID_ BIT - FETCH_
DATAGRAM_ πBIT - Table 10 flag: the Objectβs Delivery Mode is Datagram, so it has no Subgroup ID and the two low bits are to be ignored.
- FETCH_
END_ πOF_ GONE_ RANGE - Table 8: End of Gone Range. The two-byte
84 0C. - FETCH_
END_ πOF_ GROUP - Table 8: End of Group.
- FETCH_
END_ πOF_ NON_ EXISTENT_ RANGE - Table 8: End of Non-Existent Range.
- FETCH_
END_ πOF_ TIMED_ OUT_ RANGE - Table 8: End of Timed-Out Range.
- FETCH_
END_ πOF_ TRACK - Table 8: End of Track.
- FETCH_
END_ πOF_ UNKNOWN_ RANGE - Table 8: End of Unknown Range.
- FETCH_
FLAGS_ πMAX - The largest Serialization Flags value whose bits are flags. Section 11.4.1: βWhen less than 128, the bits represent flags described in Section 11.4.1.1.β
- FETCH_
GROUP_ πID_ DELTA_ BIT - Table 10 flag: a Group ID Delta field is present.
- FETCH_
OBJECT_ πID_ DELTA_ BIT - Table 10 flag: an Object ID Delta field is present.
- FETCH_
PRIORITY_ πBIT - Table 10 flag: a Publisher Priority field is present.
- FETCH_
PROPERTIES_ πBIT - Table 10 flag: a Properties field is present.
- FETCH_
STREAM_ πTYPE - FETCH_
SUBGROUP_ πID_ EXPLICIT - Subgroup ID mode 0b11: an explicit Subgroup ID field is on the wire.
- FETCH_
SUBGROUP_ πID_ MODE_ MASK - Serialization Flags bits 0-1, the Subgroup ID encoding (draft-23 Section 11.4.1.1, Table 9).
- PADDING_
DATAGRAM_ TYPE - Datagram type for padding, draft-23 Section 11.5.2: βAn endpoint MAY send a datagram with a type of 0x132B3E29 to send padding data. The datagram contains the type followed by zero or more bytes that MUST all be set to zero.β
- PADDING_
STREAM_ TYPE - Unidirectional stream type for padding, draft-23 Section 11.5.1: βAn endpoint MAY open a unidirectional stream with a stream type of 0x132B3E28 to send padding data. The stream begins with the stream type, followed by zero or more bytes that MUST all be set to zero.β
- PRIOR_
GROUP_ ID_ GAP - Prior Group ID Gap, Object Property Type 0x3C (Section 10.8).
- PRIOR_
OBJECT_ ID_ GAP - Prior Object ID Gap, Object Property Type 0x3E (Section 10.9).
- SETUP_
STREAM_ πTYPE - The unidirectional stream Type draft-23 Section 9.1 gives the control stream.
- SUBGROUP_
BASE_ πBIT - SUBGROUP_
DEFAULT_ πPRIORITY_ BIT - SUBGROUP_
END_ πOF_ GROUP_ BIT - SUBGROUP_
FIRST_ πOBJECT_ BIT - SUBGROUP_
ID_ πMODE_ MASK - SUBGROUP_
ID_ πMODE_ RESERVED - The SUBGROUP_ID_MODE value draft-23 reserves, once the mask is applied and the field shifted down.
- SUBGROUP_
PROPERTIES_ πBIT
FunctionsΒ§
- collect_
gaps π - datagram_
type_ πerror - Which failure a leading datagram
Type Flagsvalue that is not one a reader wants is. - datagram_
type_ πis_ valid - Whether
rawis a datagramType Flagsvalue draft-23 admits. - decoded_
status π - Turn a wire Object Status code into an
ObjectStatus, refusing one draft-23 does not assign. - malformed π
- overflow π
- skip π
- Advance
bufpastlenbytes without copying them. - step_
group π priormoved bydelta + extrainorderβs direction.- stream_
type_ πerror - Which failure a leading unidirectional stream Type that is not the one a reader wants is.
- subgroup_
type_ πis_ valid - Whether
rawis a subgroupType Flagsvalue draft-23 admits: below 128, bit 4 set, and not the reserved SUBGROUP_ID_MODE. - validate_
datagram_ πtype - Refuse a datagram
Type Flagsvalue draft-23 Section 11.2.1 lists as invalid. - validate_
subgroup_ πtype - Refuse a subgroup header
Type Flagsvalue draft-23 Section 11.3.1 lists as invalid.