Skip to main content

Module data_stream

Module data_stream 

Source
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Β§

DatagramHeader
FetchGaps
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.
FetchHeader
The head of a fetch stream: the stream type 0x05 and a Request ID.
FetchObject
One entry from a FETCH stream with its delta-encoded fields resolved.
FetchObjectHeader
One entry on a draft-23 fetch stream, up to but not including its payload.
FetchObjectLayout πŸ”’
Which fields a Serialization Flags value puts on the wire.
FetchObjectReader
Resolves the delta-encoded fields of the entries on one FETCH stream.
FetchObjectWriter
Re-encodes resolved fetch entries onto one FETCH stream.
PriorGaps
The Prior Group ID Gap and Prior Object ID Gap one Object carries.
SubgroupHeader
SubgroupObject
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. Use SubgroupObjectReader to encode/decode.
SubgroupObjectMeta
The framing of one draft-23 subgroup object, without its payload.
SubgroupObjectReader

EnumsΒ§

FetchEndMarker
An indicator that ends a Group or the Track rather than a range.
FetchEndOfRange
What an End of Range indicator says about the Locations it covers.
GroupOrder
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 Flags value 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 Flags value that is not one a reader wants is.
datagram_type_is_valid πŸ”’
Whether raw is a datagram Type Flags value 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 buf past len bytes without copying them.
step_group πŸ”’
prior moved by delta + extra in order’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 raw is a subgroup Type Flags value draft-23 admits: below 128, bit 4 set, and not the reserved SUBGROUP_ID_MODE.
validate_datagram_type πŸ”’
Refuse a datagram Type Flags value draft-23 Section 11.2.1 lists as invalid.
validate_subgroup_type πŸ”’
Refuse a subgroup header Type Flags value draft-23 Section 11.3.1 lists as invalid.