48 const std::optional<Extensions>& extensions,
49 const std::optional<Extensions>& immutable_extensions);
67 template<
class StreamBufferType>
69 std::optional<std::size_t>& extension_headers_length,
70 std::optional<Extensions>& extensions,
71 std::optional<Extensions>& immutable_extensions,
72 std::size_t& extension_bytes_remaining,
73 std::optional<std::uint64_t>& current_header,
74 std::uint64_t& prev_extension_type);
207 static constexpr
bool IsValid(
const std::uint64_t type) noexcept
259 const bool status) noexcept
272 constexpr std::uint8_t
GetType() const noexcept
274 std::uint8_t type = 0;
298 static constexpr
bool IsValid(
const std::uint8_t type) noexcept
325 [[maybe_unused]] [[nodiscard]]
static StreamMessageType GetStreamMessageType(
const std::uint64_t type)
333 throw ProtocolViolationException(
"Invalid stream header type");
351 template<
class StreamBufferType>
355 uint64_t current_pos{ 0 };
356 bool parse_completed{
false };
438 [[nodiscard]] std::uint64_t
GetType() const noexcept;
446 std::optional<std::uint64_t>
451 std::optional<std::uint64_t>
457 std::optional<Extensions>
461 uint64_t payload_len{ 0 };
474 template<
class StreamBufferType>
478 std::optional<std::size_t> extension_headers_length;
479 std::size_t extension_bytes_remaining{ 0 };
480 std::optional<uint64_t> current_tag{};
481 std::uint64_t prev_extension_type{ 0 };
482 uint64_t current_pos{ 0 };
483 bool parse_completed{
false };
501 : group_order_(group_order)
527 std::optional<std::uint64_t> prior_group_id_;
528 std::optional<std::uint64_t> prior_object_id_;
529 std::optional<std::uint64_t> prior_subgroup_id_;
530 std::optional<std::uint8_t> prior_priority_;
570 uint64_t payload_len{ 0 };
575 bool end_of_group{
false };
586 template<
class StreamBufferType>
593 std::uint8_t
GetType()
const {
return GetProperties().GetType(); }
604 !priority.has_value(),
609 std::optional<DatagramHeaderProperties> properties;
610 std::optional<std::size_t> extension_headers_length;
611 std::size_t extension_bytes_left{ 0 };
612 std::optional<uint64_t> current_tag{};
613 std::uint64_t prev_extension_type{ 0 };
614 uint64_t current_pos{ 0 };
615 bool parse_completed{
false };
634 std::optional<std::uint8_t>
647 template<
class StreamBufferType>
656 !publisher_priority.has_value(),
658 return properties.GetType();
662 std::optional<DatagramHeaderProperties> properties;
663 std::optional<std::size_t> extension_headers_length;
664 std::size_t extension_bytes_left{ 0 };
665 std::optional<uint64_t> current_tag{};
666 std::uint64_t prev_extension_type{ 0 };
667 uint64_t current_pos{ 0 };
668 bool parse_completed{
false };
687 std::optional<std::uint64_t>
700 template<
class StreamBufferType>
704 uint64_t current_pos{ 0 };
705 bool parse_completed{
false };
732 uint64_t payload_len{ 0 };
743 std::optional<StreamHeaderProperties> properties{};
753 template<
class StreamBufferType>
757 std::optional<std::size_t> extension_headers_length;
758 std::size_t extension_bytes_left{ 0 };
759 std::optional<uint64_t> current_tag{};
760 std::uint64_t prev_extension_type{ 0 };
761 uint64_t current_pos{ 0 };
762 bool parse_completed{
false };
Fetch data-plane (de)serializer.
Definition: message_serialisation.h:497
FetchObject Encode(const ObjectHeaders &headers, std::uint8_t priority, BytesSpan payload)
FetchObjectSerializationState(GroupOrder group_order) noexcept
Definition: message_serialisation.h:500
std::optional< ResolvedFetchObject > Decode(FetchObject &&object)
Definition: ctrl_message_types.h:38
bool ParseExtensions(StreamBufferType &buffer, std::optional< std::size_t > &extension_headers_length, std::optional< Extensions > &extensions, std::optional< Extensions > &immutable_extensions, std::size_t &extension_bytes_remaining, std::optional< std::uint64_t > ¤t_header, std::uint64_t &prev_extension_type)
SubgroupIdType
Definition: message_serialisation.h:112
@ kSetFromFirstObject
ID comes from the first object and is omitted here.
@ kReserved
Reserved and rejected.
@ kIsZero
ID is zero and omitted from the wire.
@ kExplicit
ID is explicitly serialized.
void SerializeExtensions(Bytes &buffer, const std::optional< Extensions > &extensions, const std::optional< Extensions > &immutable_extensions)
Bytes & operator<<(Bytes &buffer, const Bytes &bytes)
DatagramStatusType
Definition: message_serialisation.h:95
@ kNoExtensions
Status datagram without extensions.
@ kWithExtensions
Status datagram with extensions.
StreamMessageType
Definition: message_serialisation.h:314
@ kFetchHeader
Fetch data stream.
@ kSubgroupHeader
Subgroup object stream.
BytesSpan operator>>(BytesSpan buffer, Bytes &value)
DatagramHeaderType
Definition: message_serialisation.h:80
@ kEndOfGroupWithExtensionsNoObjectId
End-of-group payload with implicit zero ID and extensions.
@ kEndOfGroupNoExtensionsObjectId
End-of-group payload with explicit object ID.
@ kNotEndOfGroupWithExtensionsObjectId
Payload, explicit object ID and extensions.
@ kNotEndOfGroupNoExtensionsObjectId
Payload, explicit object ID, no extensions.
@ kEndOfGroupWithExtensionsObjectId
End-of-group payload with extensions.
@ kNotEndOfGroupWithExtensionsNoObjectId
Payload with implicit zero ID and extensions.
@ kNotEndOfGroupNoExtensionsNoObjectId
Payload with implicit zero object ID.
@ kEndOfGroupNoExtensionsNoObjectId
End-of-group payload with implicit zero ID.
GroupOrder
Requested group traversal order.
Definition: ctrl_message_types.h:532
FetchHeaderType
Definition: message_serialisation.h:104
@ kFetchHeader
FETCH stream header.
std::vector< Byte > Bytes
Owning contiguous byte buffer.
Definition: bytes.h:18
std::span< const Byte > BytesSpan
Non-owning, read-only view of contiguous bytes.
Definition: bytes.h:21
ObjectStatus
Status of object as reported by the publisher.
Definition: object.h:35
std::map< uint64_t, std::vector< std::vector< uint8_t > >> Extensions
Definition: object.h:18
One wire-level object or end-of-range marker on a fetch stream.
Definition: message_serialisation.h:443
friend bool operator>>(StreamBufferType &buffer, FetchObject &msg)
std::optional< std::uint64_t > group_id_delta
Absolute first group ID or later group delta, as selected by flags.
Definition: message_serialisation.h:447
std::optional< Extensions > immutable_extensions
Immutable extensions extracted from the immutable container.
Definition: message_serialisation.h:458
std::optional< std::uint8_t > publisher_priority
Explicit publisher priority when the priority-present bit is set.
Definition: message_serialisation.h:455
std::optional< std::uint64_t > object_id_delta
Absolute first/new-group object ID or same-group object delta.
Definition: message_serialisation.h:452
std::optional< FetchSerializationProperties > properties
Parsed serialization flags; required for encoding and resolution.
Definition: message_serialisation.h:445
std::optional< Extensions > extensions
Mutable object extensions.
Definition: message_serialisation.h:456
std::optional< std::uint64_t > subgroup_id
Explicit subgroup ID when the selected mode requires one.
Definition: message_serialisation.h:450
Bytes payload
Owned payload bytes.
Definition: message_serialisation.h:464
Fetch data-plane serialization flag.
Definition: message_serialisation.h:378
static constexpr std::uint8_t kPropertiesBit
Extensions-field bit.
Definition: message_serialisation.h:409
SubgroupIdMode
Encoding used to reconstruct a normal stream object's subgroup ID.
Definition: message_serialisation.h:388
@ kPrior
Reuse prior subgroup ID.
@ kZero
Subgroup ID is zero.
@ kExplicit
Read an explicit subgroup ID.
@ kNext
Prior subgroup ID plus one.
FetchSerializationProperties(std::uint64_t value)
static constexpr std::uint8_t kSubgroupMask
Subgroup mode mask.
Definition: message_serialisation.h:405
bool object_id_delta_present
Whether an object-ID delta/absolute field follows.
Definition: message_serialisation.h:399
std::uint64_t GetType() const noexcept
static constexpr std::uint8_t kDatagramBit
Datagram-forwarding bit.
Definition: message_serialisation.h:410
bool priority_present
Whether publisher priority follows.
Definition: message_serialisation.h:401
static constexpr std::uint64_t kEndOfUnknownRange
End-of-unknown-range marker value.
Definition: message_serialisation.h:412
bool properties_present
Whether an extension block follows.
Definition: message_serialisation.h:402
std::optional< EndOfRange > end_of_range
End-of-range marker, or absent for a normal object.
Definition: message_serialisation.h:395
FetchSerializationProperties(SubgroupIdMode subgroup_id_mode, bool object_id_delta_present, bool group_id_delta_present, bool priority_present, bool properties_present, bool datagram) noexcept
static constexpr std::uint8_t kGroupIdDeltaBit
Group-ID-field bit.
Definition: message_serialisation.h:407
bool group_id_delta_present
Whether a group-ID delta/absolute field follows.
Definition: message_serialisation.h:400
std::optional< SubgroupIdMode > subgroup_id_mode
Subgroup mode for stream objects; absent for datagrams and end markers.
Definition: message_serialisation.h:398
EndOfRange
Special FETCH range-termination condition.
Definition: message_serialisation.h:381
@ kNonExistent
End location is known not to exist.
@ kUnknown
Existence of the end location is unknown.
static constexpr std::uint64_t kEndOfNonExistentRange
End-of-nonexistent-range marker value.
Definition: message_serialisation.h:411
static constexpr std::uint8_t kPriorityBit
Publisher-priority-field bit.
Definition: message_serialisation.h:408
static constexpr std::uint8_t kObjectIdDeltaBit
Object-ID-field bit.
Definition: message_serialisation.h:406
bool datagram
Whether the resolved object used datagram forwarding.
Definition: message_serialisation.h:403
Object-status datagram without payload.
Definition: message_serialisation.h:628
std::uint64_t group_id
Group identifier.
Definition: message_serialisation.h:630
friend bool operator>>(StreamBufferType &buffer, ObjectDatagramStatus &msg)
std::uint64_t track_alias
Track alias.
Definition: message_serialisation.h:629
std::uint64_t GetType() const
Definition: message_serialisation.h:651
std::optional< Extensions > immutable_extensions
Immutable extensions.
Definition: message_serialisation.h:637
std::optional< std::uint8_t > publisher_priority
Explicit publisher priority, or absent to inherit the default.
Definition: message_serialisation.h:635
ObjectStatus status
Reported object status encoded as UintVar.
Definition: message_serialisation.h:638
std::uint64_t object_id
Object identifier; omitted when zero.
Definition: message_serialisation.h:633
std::optional< Extensions > extensions
Mutable extensions.
Definition: message_serialisation.h:636
Payload-bearing object datagram.
Definition: message_serialisation.h:559
std::uint64_t track_alias
Track alias encoded as UintVar.
Definition: message_serialisation.h:560
DatagramHeaderProperties GetProperties() const
Definition: message_serialisation.h:599
ObjectStatus object_status
Not serialized by ObjectDatagram; payload datagrams imply available data.
Definition: message_serialisation.h:573
std::uint8_t GetType() const
Definition: message_serialisation.h:593
std::optional< std::uint8_t > priority
Explicit publisher priority, or absent to inherit the track default.
Definition: message_serialisation.h:565
std::uint64_t group_id
Group identifier encoded as UintVar.
Definition: message_serialisation.h:561
std::optional< Extensions > immutable_extensions
Immutable extensions nested in the immutable container.
Definition: message_serialisation.h:567
friend bool operator>>(StreamBufferType &buffer, ObjectDatagram &msg)
Bytes payload
Bytes occupying the remainder of this datagram.
Definition: message_serialisation.h:574
std::uint64_t object_id
Object identifier; omitted on wire when zero.
Definition: message_serialisation.h:564
std::optional< Extensions > extensions
Mutable object extensions.
Definition: message_serialisation.h:566
Exception indicating that received or constructed data violates the MoQ protocol.
Definition: ctrl_message_types.h:71
Fetch object after stateful delta resolution.
Definition: message_serialisation.h:488
ObjectHeaders headers
Absolute headers reconstructed from this object and prior state.
Definition: message_serialisation.h:489
Bytes payload
Owned payload moved from the wire object.
Definition: message_serialisation.h:492
One object record carried after a StreamHeaderSubGroup.
Definition: message_serialisation.h:728
Bytes payload
Owned payload bytes.
Definition: message_serialisation.h:740
std::uint64_t object_delta
Object-ID delta from the stream's reference object.
Definition: message_serialisation.h:729
std::optional< Extensions > immutable_extensions
Immutable extensions.
Definition: message_serialisation.h:737
ObjectStatus object_status
Status serialized only when payload is empty.
Definition: message_serialisation.h:735
std::optional< Extensions > extensions
Mutable extensions.
Definition: message_serialisation.h:736
friend bool operator>>(StreamBufferType &buffer, StreamSubGroupObject &msg)