Expand description
Draft-17 data stream header encoding and decoding.
Subgroup header type byte: 0b00X1XXXX (bit 4 always set)
- 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)
Datagram type byte: 0b00X0XXXX (bit 4 always 0)
- 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)
Neither range is fully populated. Draft-17 Section 10.4.2 and
draft-17 Section 10.3.1 each close with a list of type values an endpoint
βMUST close the session with a PROTOCOL_VIOLATIONβ on receiving, and the two
figures spell the surviving values out:
0x10..0x15 / 0x18..0x1D / 0x30..0x35 / 0x38..0x3D for a subgroup header,
0x00..0x0F / 0x20..0x21 / 0x24..0x25 / 0x28..0x29 / 0x2C..0x2D for a
datagram. Both decoders refuse everything else, so a header this module
hands back always describes a framing the draft defines.
Fetch header: stream type 0x05 + request_id, followed by objects whose
fields are named by a Serialization Flags varint rather than all being
present β see FetchObjectHeader.
Re-exportsΒ§
use bytes::Buf;πuse bytes::BufMut;πuse super::types::ObjectStatus;πuse crate::error::CodecError;πuse crate::object_properties::ObjectProperty;πuse crate::object_properties::PropertyValue;πuse crate::varint::Moqt17 as Wire;πuse crate::varint::VarInt;π
StructsΒ§
- Datagram
Header - Fetch
Gaps - The Prior Group ID Gap and Prior Object ID Gap conditions of draft-17 Section 11.7 and draft-17 Section 11.8 that one fetch stream shows.
- Fetch
Header - Fetch
Object - One frame from a FETCH stream with the fields its Serialization Flags left off the wire filled in from the frames before it.
- Fetch
Object Header - One object on a draft-17 fetch stream, without its payload.
- Fetch
Object Reader - Resolves the elided fields of the frames on one FETCH stream.
- Fetch
Object Writer - Re-encodes resolved fetch frames 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-17 subgroup stream. Object IDs are
delta-encoded and the presence of a βpropertiesβ block (the
draft-17 equivalent of extension headers) is determined by the
PROPERTIES bit on the enclosing
SubgroupHeader. UseSubgroupObjectReaderto encode/decode. - Subgroup
Object Meta - The framing of one draft-17 subgroup object, without its payload.
- Subgroup
Object Reader
EnumsΒ§
- EndOf
Range - The two Serialization Flags values that mark a range of Objects rather than carrying one, from draft-17 Section 10.4.4 Table 6 and Section 10.4.4.2.
- Payload
Permission - Whether an object carrying a given status is allowed a non-empty payload.
ConstantsΒ§
- DATAGRAM_
DEFAULT_ πPRIORITY_ BIT - DATAGRAM_
END_ πOF_ GROUP_ BIT - DATAGRAM_
FORM_ πMASK - The bits a datagram type must fix: 7, 6 and 4 all clear. That is the form
0b00X0XXXXwritten as a mask, leaving bit 5 and the low nibble free. - DATAGRAM_
PROPERTIES_ πBIT - DATAGRAM_
STATUS_ πBIT - DATAGRAM_
ZERO_ πOBJECT_ ID_ BIT - FETCH_
DATAGRAM_ πBIT - The object was forwarded as a datagram and has no Subgroup ID; the two least significant bits are to be ignored.
- FETCH_
END_ πOF_ NON_ EXISTENT_ RANGE - Serialization Flags
0x8C, End of Non-Existent Range. - FETCH_
END_ πOF_ UNKNOWN_ RANGE - Serialization Flags
0x10C, End of Unknown Range. - FETCH_
FLAGS_ πBIT_ FORM_ MAX - The largest Serialization Flags value read as a set of bits. Draft-17 Section 10.4.4: βWhen less than 128, the bits represent flags described below.β
- FETCH_
GROUP_ πID_ BIT - Group ID field present; clear means the prior objectβs Group ID.
- FETCH_
OBJECT_ πID_ BIT - Object ID field present; clear means the prior objectβs ID plus one.
- FETCH_
PRIORITY_ πBIT - Priority field present; clear means the prior objectβs priority.
- FETCH_
PROPERTIES_ πBIT - Properties field present.
- FETCH_
STREAM_ πTYPE - FETCH_
SUBGROUP_ πMODE_ EXPLICIT - SUBGROUP mode
0x03: an explicit Subgroup ID field is present. - FETCH_
SUBGROUP_ πMODE_ MASK - SUBGROUP mode, the two least significant Serialization Flags bits (draft-17 Section 10.4.4.1, Table 7).
- FETCH_
SUBGROUP_ πMODE_ PRIOR - SUBGROUP mode
0x01: the Subgroup ID is the prior objectβs. Mode0x00, the remaining value, fixes the Subgroup ID at zero and needs no constant β nothing tests for it. - FETCH_
SUBGROUP_ πMODE_ PRIOR_ PLUS_ ONE - SUBGROUP mode
0x02: the Subgroup ID is the prior objectβs plus one. - PRIOR_
GROUP_ ID_ GAP - Prior Group ID Gap, Object Property Type 0x3C (Section 11.7).
- PRIOR_
OBJECT_ ID_ GAP - Prior Object ID Gap, Object Property Type 0x3E (Section 11.8).
- SETUP_
STREAM_ πTYPE - The unidirectional stream Type draft-17 Section 9.4 gives the control stream.
- SUBGROUP_
BASE_ πBIT - SUBGROUP_
DEFAULT_ πPRIORITY_ BIT - SUBGROUP_
END_ πOF_ GROUP_ BIT - SUBGROUP_
FORM_ πMASK - The bits a subgroup header type must fix: 7 and 6 clear, 4 set. That is the
form
0b00X1XXXXwritten as a mask, leaving bit 5 and the low nibble free. - SUBGROUP_
ID_ πMODE_ MASK - SUBGROUP_
ID_ πMODE_ RESERVED - SUBGROUP_ID_MODE
0b11, the value draft-17 reserves. - SUBGROUP_
PROPERTIES_ πBIT
FunctionsΒ§
- collect_
gaps π - datagram_
type_ πerror - Which failure a leading datagram Type that is not one a reader wants is.
- datagram_
type_ πis_ valid - Whether
datagram_typeis one of the datagram types draft-17 defines. - decoded_
status π - Turn a wire Object Status code into an
ObjectStatus, refusing one draft-17 does not assign. - fetch_
flags_ πare_ defined - Whether draft-17 defines this Serialization Flags value.
- fetch_
has_ πgroup_ id - fetch_
has_ πobject_ id - fetch_
has_ πpriority - fetch_
has_ πproperties - fetch_
has_ πsubgroup_ id - Whether an explicit Subgroup ID field follows the Group ID.
- skip π
- Advance
bufpastlenbytes without copying them. - stream_
type_ πerror - Which failure a leading unidirectional stream Type that is not the one a reader wants is.
- subgroup_
type_ πis_ reserved_ mode - Whether
rawsits inside the subgroup form but names the reserved SUBGROUP_ID_MODE β the first of the two lists quoted above. - subgroup_
type_ πis_ valid - Whether
header_typeis one of the subgroup header types draft-17 defines. - wide_
type_ πrefusal - Refuse a Type field spelled in more than one byte, before anything narrows it to a byte.