LibQuicR
quicr::messages Namespace Reference

Classes

struct  ProtocolViolationException
 Exception indicating that received or constructed data violates the MoQ protocol. More...
 
struct  Location
 Absolute group/object location ordered lexicographically by group then object. More...
 
struct  FetchEndLocation
 Inclusive terminal location for a fetch range. More...
 
struct  KeyValuePair
 
struct  Token
 
struct  SubscriptionFilter
 
struct  TrackFilter
 Selects tracks by property, count, and timeout constraints. More...
 
class  KeyValuePairs
 Draft 18 flat key-value pairs: a bounded, sorted KVP sequence without a leading count. More...
 
class  TrackExtensions
 Mutable and immutable track-scoped extension maps. More...
 
class  Message
 Generic message buffer formatting class. More...
 
struct  StreamHeaderProperties
 
struct  DatagramHeaderProperties
 
struct  FetchHeader
 Header opening a fetch data stream. More...
 
struct  FetchSerializationProperties
 Fetch data-plane serialization flag. More...
 
struct  FetchObject
 One wire-level object or end-of-range marker on a fetch stream. More...
 
struct  ResolvedFetchObject
 Fetch object after stateful delta resolution. More...
 
class  FetchObjectSerializationState
 Fetch data-plane (de)serializer. More...
 
struct  ObjectDatagram
 Payload-bearing object datagram. More...
 
struct  ObjectDatagramStatus
 Object-status datagram without payload. More...
 
struct  StreamHeaderSubGroup
 Header opening a subgroup object stream. More...
 
struct  StreamSubGroupObject
 One object record carried after a StreamHeaderSubGroup. More...
 
class  ParameterList
 

Typedefs

using Filter = std::variant< std::monostate, SubscriptionFilter, TrackFilter >
 Any supported filter representation; monostate means no/unsupported filter. More...
 
using Parameter = KeyValuePair< ParameterType >
 A message parameter key/value pair. More...
 
using SetupParameter = KeyValuePair< SetupOptionType >
 A setup-option key/value pair. More...
 
using Parameters = quicr::messages::ParameterList< quicr::messages::ParameterType >
 Standard message-parameter list. More...
 

Enumerations

enum class  ControlMessageType : uint64_t {
  kRequestUpdate = 0x2 , kSubscribe = 0x3 , kSubscribeOk = 0x4 , kRequestError = 0x5 ,
  kPublishNamespace = 0x6 , kRequestOk = 0x7 , kNamespace = 0x8 , kPublishNamespaceDone = 0x9 ,
  kUnsubscribe = 0xa , kPublishDone = 0xb , kPublishNamespaceCancel = 0xc , kTrackStatus = 0xd ,
  kNamespaceDone = 0xe , kPublishBlocked = 0xf , kGoaway = 0x10 , kMaxRequestId = 0x15 ,
  kFetch = 0x16 , kFetchCancel = 0x17 , kFetchOk = 0x18 , kRequestsBlocked = 0x1a ,
  kPublish = 0x1d , kSubscribeNamespace = 0x50 , kSubscribeTracks = 0x51 , kSetup = 0x2F00
}
 MoQ control-message wire type codes. More...
 
enum class  SetupOptionType : uint64_t {
  kPath = 0x01 , kAuthorizationToken = 0x03 , kMaxAuthTokenCacheSize = 0x04 , kAuthority = 0x05 ,
  kMoqtImplementation = 0x07 , kEndpointId = 0xF1 , kInvalid = 0xFF
}
 SETUP option type codes. More...
 
enum class  GroupOrder : uint8_t { kAscending = 0x1 , kDescending = 0x2 }
 Requested group traversal order. More...
 
enum class  FilterType : uint64_t { kNone , kSubscriptionFilter , kTrackFilter }
 In-memory filter discriminator. More...
 
enum class  SubscriptionFilterType : std::uint64_t { kNextGroupStart = 0x1 , kLargestObject = 0x2 , kAbsoluteStart = 0x3 , kAbsoluteRange = 0x4 }
 Subscription-filter form. More...
 
enum class  PublishDoneStatusCode : uint64_t {
  kInternalError = 0x0 , kUnauthorized = 0x1 , kTrackEnded = 0x2 , kSubscriptionEnded = 0x3 ,
  kGoingAway = 0x4 , kTooFarBehind = 0x5 , kExpired = 0x6 , kMalformedTrack = 0x12 ,
  kUpdateFailed = 0x8 , kExcessiveLoad = 0x9
}
 Publish-done status codes. More...
 
enum class  FetchType : uint8_t { kStandalone = 0x1 , kRelativeJoiningFetch , kAbsoluteJoiningFetch }
 FETCH request form. More...
 
enum class  TerminationReason : uint64_t {
  kNoError = 0x0 , kInternalError = 0x1 , kUnauthorized = 0x2 , kProtocolViolation = 0x3 ,
  kInvalidRequestId = 0x4 , kDuplicateTrackAlias = 0x5 , kKeyValueFormattingError = 0x6 , kTooManyRequests = 0x7 ,
  kInvalidPath = 0x8 , kMalformedPath = 0x9 , kGoawayTimeout = 0x10 , kControlMessageTimeout = 0x11 ,
  kDataStreamTimeout = 0x12 , kAuthTokenCacheOverflow = 0x13 , kDuplicateAuthTokenAlias = 0x14 , kVersionNegotiationFailed = 0x15 ,
  kMalformedAuthToken = 0x16 , kUnknownAuthTokenAlias = 0x17 , kExpiredAuthToken = 0x18 , kInvalidAuthority = 0x19 ,
  kMalformedAuthority = 0x1A
}
 Session termination reason codes. More...
 
enum class  StreamResetError : uint64_t {
  kInternalError = 0x0 , kCancelled = 0x1 , kDeliveryTimeout = 0x2 , kSessionClosed = 0x3 ,
  kUnknownObjectStatus = 0x4 , kMalformedTrack = 0x12
}
 Data-stream reset error codes. More...
 
enum class  ExtensionType : uint64_t {
  kDeliveryTimeout = 0x02 , kMaxCacheDuration = 0x04 , kDefaultPublisherPriority = 0x0E , kDefaultPublisherGroupOrder = 0x22 ,
  kDynamicGroups = 0x30 , kPriorGroupIdGap = 0x3C , kPriorObjectIdGap = 0x3E , kImmutable = 0x0B
}
 Known track/object extension type codes. More...
 
enum class  DatagramHeaderType : uint8_t {
  kNotEndOfGroupNoExtensionsObjectId = 0x00 , kNotEndOfGroupWithExtensionsObjectId = 0x01 , kEndOfGroupNoExtensionsObjectId = 0x02 , kEndOfGroupWithExtensionsObjectId = 0x03 ,
  kNotEndOfGroupNoExtensionsNoObjectId = 0x04 , kNotEndOfGroupWithExtensionsNoObjectId = 0x05 , kEndOfGroupNoExtensionsNoObjectId = 0x06 , kEndOfGroupWithExtensionsNoObjectId = 0x07
}
 
enum class  DatagramStatusType : uint8_t { kNoExtensions = 0x20 , kWithExtensions = 0x21 }
 
enum class  FetchHeaderType : uint8_t { kFetchHeader = 0x05 }
 
enum class  SubgroupIdType : std::uint8_t { kIsZero = 0b00 , kSetFromFirstObject = 0b01 , kExplicit = 0b10 , kReserved = 0b11 }
 
enum class  StreamMessageType { kFetchHeader , kSubgroupHeader }
 
enum class  ParameterType : uint64_t {
  kDeliveryTimeout = 0x02 , kAuthorizationToken = 0x03 , kRendezvousTimeout = 0x04 , kSubgroupDeliveryTimeout = 0x06 ,
  kFillTimeout = 0x0A , kExpires = 0x08 , kLargestObject = 0x09 , kForward = 0x10 ,
  kSubscriberPriority = 0x20 , kSubscriptionFilter = 0x21 , kGroupOrder = 0x22 , kNewGroupRequest = 0x32 ,
  kTrackNamespacePrefix = 0x34 , kTrackFilter = 0x29 , kInvalid = 0xFF
}
 Message-parameter type codes used as delta-encoded map keys on the wire. More...
 
enum class  ParameterEncoding { kByte , kVarint , kLocation , kBytes }
 Physical value encoding selected by a parameter type. More...
 

Functions

Bytes & operator<< (Bytes &buffer, const Bytes &bytes)
 
Bytes & operator<< (Bytes &buffer, const BytesSpan &bytes)
 
BytesSpan operator>> (BytesSpan buffer, Bytes &value)
 
Bytes & operator<< (Bytes &buffer, std::uint64_t value)
 
BytesSpan operator>> (BytesSpan buffer, std::uint64_t &value)
 
Bytes & operator<< (Bytes &buffer, std::uint8_t value)
 
BytesSpan operator>> (BytesSpan buffer, uint8_t &value)
 
Bytes & operator<< (Bytes &buffer, std::uint16_t value)
 
BytesSpan operator>> (BytesSpan buffer, std::uint16_t &value)
 
Bytes & operator<< (Bytes &buffer, const UintVar &value)
 
Bytes & operator<< (Bytes &buffer, const Location &location)
 
BytesSpan operator>> (BytesSpan buffer, Location &location)
 
template<KeyType T>
Bytes & operator<< (Bytes &buffer, const T value)
 
template<KeyType T>
BytesSpan operator>> (BytesSpan buffer, T &value)
 
template<KeyType T>
void SerializeKvp (Bytes &buffer, const KeyValuePair< T > &kvp, const T prev_type)
 
template<KeyType T>
void ParseKvp (BytesSpan &buffer, KeyValuePair< T > &kvp, const T prev_type)
 
Bytes & operator<< (Bytes &buffer, const Token &token)
 
BytesSpan operator>> (BytesSpan buffer, Token &token)
 
Bytes & operator<< (Bytes &buffer, GroupOrder value)
 
BytesSpan operator>> (BytesSpan buffer, GroupOrder &value)
 
Bytes & operator<< (Bytes &bytes, const SubscriptionFilter &filter)
 
BytesSpan operator>> (BytesSpan bytes, SubscriptionFilter &filter)
 
Bytes & operator<< (Bytes &bytes, const TrackFilter &filter)
 
BytesSpan operator>> (BytesSpan bytes, TrackFilter &filter)
 
FilterType GetFilterType (const Filter &filter)
 
Bytes & operator<< (Bytes &bytes, const Filter &filter)
 
BytesSpan operator>> (BytesSpan, Filter &)
 
Filter DeserializeFilter (FilterType filter_type, BytesSpan bytes)
 
Bytes & operator<< (Bytes &buffer, PublishDoneStatusCode value)
 
BytesSpan operator>> (BytesSpan buffer, PublishDoneStatusCode &value)
 
Bytes & operator<< (Bytes &buffer, FetchType value)
 
BytesSpan operator>> (BytesSpan buffer, FetchType &value)
 
BytesSpan operator>> (BytesSpan buffer, KeyValuePairs &msg)
 
Bytes & operator<< (Bytes &buffer, const KeyValuePairs &msg)
 
BytesSpan operator>> (BytesSpan buffer, TrackExtensions &msg)
 
Bytes & operator<< (Bytes &buffer, const TrackExtensions &msg)
 
Bytes & operator<< (Bytes &buffer, const std::optional< Extensions > &extensions)
 
Bytes & operator<< (Bytes &buffer, const Extensions &extensions)
 
BytesSpan operator>> (BytesSpan buffer, Extensions &extensions)
 
void SerializeExtensions (Bytes &buffer, const std::optional< Extensions > &extensions, const std::optional< Extensions > &immutable_extensions)
 
template<class StreamBufferType >
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 > &current_header, std::uint64_t &prev_extension_type)
 
BytesSpan operator>> (BytesSpan buffer, FetchHeader &msg)
 
Bytes & operator<< (Bytes &buffer, const FetchHeader &msg)
 
bool operator>> (Bytes &buffer, FetchObject &msg)
 
Bytes & operator<< (Bytes &buffer, const FetchObject &msg)
 
Bytes & operator<< (Bytes &buffer, const ObjectDatagram &msg)
 
Bytes & operator<< (Bytes &buffer, const ObjectDatagramStatus &msg)
 
bool operator>> (Bytes &buffer, StreamHeaderSubGroup &msg)
 
Bytes & operator<< (Bytes &buffer, const StreamHeaderSubGroup &msg)
 
bool operator>> (Bytes &buffer, StreamSubGroupObject &msg)
 
Bytes & operator<< (Bytes &buffer, const StreamSubGroupObject &msg)
 
constexpr ParameterType ToParameterFilterType (FilterType type)
 
constexpr FilterType ToFilterType (ParameterType type)
 
ParameterType GetFilterParameterType (const Filter &filter)
 
Parameter SerializeFilter (FilterType filter_type, const Filter &filter)
 
ParameterEncoding GetParameterEncoding (ParameterType type)
 
template<typename Type = ParameterType>
BytesSpan operator>> (BytesSpan buffer, ParameterList< Type > &msg)
 
template<typename Type = ParameterType>
Bytes & operator<< (Bytes &buffer, const ParameterList< Type > &msg)
 
void ValidateParameters (const Parameters &params, std::initializer_list< ParameterType > allowed)
 
std::vector< Token > CollectAuthTokens (const Parameters &params)
 
bool ResolveForward (const Parameters &params, bool default_value)
 
std::optional< GroupOrder > ResolveGroupOrder (const Parameters &params)
 
std::optional< std::uint64_t > ResolveExpires (const Parameters &params)
 
bool ContainsAnyFilter (const Parameters &params)
 
Filter ResolveFilter (const Parameters &params)
 

Variables

template<typename T >
concept KeyType
 
template<class T >
concept HasByteStreamOperators
 
template<class T >
concept ByteParameter
 
template<typename T >
concept ParameterValueType
 
constexpr FilterType kFilterTypes []
 Filter kinds searched by ContainsAnyFilter() and ResolveFilter(), in precedence order. More...
 

Typedef Documentation

◆ Filter

using quicr::messages::Filter = typedef std::variant<std::monostate, SubscriptionFilter, TrackFilter>

Any supported filter representation; monostate means no/unsupported filter.

◆ Parameter

A message parameter key/value pair.

◆ Parameters

◆ SetupParameter

A setup-option key/value pair.

Enumeration Type Documentation

◆ ControlMessageType

enum quicr::messages::ControlMessageType : uint64_t
strong

MoQ control-message wire type codes.

Enumerator
kRequestUpdate 

REQUEST_UPDATE.

kSubscribe 

SUBSCRIBE.

kSubscribeOk 

SUBSCRIBE_OK.

kRequestError 

REQUEST_ERROR.

kPublishNamespace 

PUBLISH_NAMESPACE.

kRequestOk 

REQUEST_OK.

kNamespace 

NAMESPACE.

kPublishNamespaceDone 

PUBLISH_NAMESPACE_DONE.

kUnsubscribe 

UNSUBSCRIBE.

kPublishDone 

PUBLISH_DONE.

kPublishNamespaceCancel 

PUBLISH_NAMESPACE_CANCEL.

kTrackStatus 

TRACK_STATUS.

kNamespaceDone 

NAMESPACE_DONE.

kPublishBlocked 

PUBLISH_BLOCKED.

kGoaway 

GOAWAY.

kMaxRequestId 

MAX_REQUEST_ID.

kFetch 

FETCH.

kFetchCancel 

FETCH_CANCEL.

kFetchOk 

FETCH_OK.

kRequestsBlocked 

REQUESTS_BLOCKED.

kPublish 

PUBLISH.

kSubscribeNamespace 

SUBSCRIBE_NAMESPACE.

kSubscribeTracks 

SUBSCRIBE_TRACKS.

kSetup 

SETUP.

◆ DatagramHeaderType

enum quicr::messages::DatagramHeaderType : uint8_t
strong

Possible datagram object header types.

Enumerator
kNotEndOfGroupNoExtensionsObjectId 

Payload, explicit object ID, no extensions.

kNotEndOfGroupWithExtensionsObjectId 

Payload, explicit object ID and extensions.

kEndOfGroupNoExtensionsObjectId 

End-of-group payload with explicit object ID.

kEndOfGroupWithExtensionsObjectId 

End-of-group payload with extensions.

kNotEndOfGroupNoExtensionsNoObjectId 

Payload with implicit zero object ID.

kNotEndOfGroupWithExtensionsNoObjectId 

Payload with implicit zero ID and extensions.

kEndOfGroupNoExtensionsNoObjectId 

End-of-group payload with implicit zero ID.

kEndOfGroupWithExtensionsNoObjectId 

End-of-group payload with implicit zero ID and extensions.

◆ DatagramStatusType

enum quicr::messages::DatagramStatusType : uint8_t
strong

Possible datagram status types.

Enumerator
kNoExtensions 

Status datagram without extensions.

kWithExtensions 

Status datagram with extensions.

◆ ExtensionType

enum quicr::messages::ExtensionType : uint64_t
strong

Known track/object extension type codes.

Enumerator
kDeliveryTimeout 

Delivery timeout.

kMaxCacheDuration 

Maximum cache duration.

kDefaultPublisherPriority 

Default publisher priority.

kDefaultPublisherGroupOrder 

Default publisher group order.

kDynamicGroups 

Dynamic-groups flag.

kPriorGroupIdGap 

Gap from the prior group identifier.

kPriorObjectIdGap 

Gap from the prior object identifier.

kImmutable 

Container for immutable nested extension KVPs.

◆ FetchHeaderType

enum quicr::messages::FetchHeaderType : uint8_t
strong

Possible fetch header types.

Enumerator
kFetchHeader 

FETCH stream header.

◆ FetchType

enum quicr::messages::FetchType : uint8_t
strong

FETCH request form.

Enumerator
kStandalone 

Independent fetch.

kRelativeJoiningFetch 

Joining fetch relative to a subscription.

kAbsoluteJoiningFetch 

Joining fetch with absolute bounds.

◆ FilterType

enum quicr::messages::FilterType : uint64_t
strong

In-memory filter discriminator.

Enumerator
kNone 

No filter.

kSubscriptionFilter 

Location/subscription filter.

kTrackFilter 

Track-selection constraints.

◆ GroupOrder

enum quicr::messages::GroupOrder : uint8_t
strong

Requested group traversal order.

Enumerator
kAscending 

Increasing group identifiers.

kDescending 

Decreasing group identifiers.

Examples
simple_subscribe/main.cpp.

◆ ParameterEncoding

Physical value encoding selected by a parameter type.

Enumerator
kByte 

Exactly one raw byte.

kVarint 

One unsigned variable-length integer.

kLocation 

Two unsigned variable-length integers.

kBytes 

Unsigned-varint length followed by bytes.

◆ ParameterType

enum quicr::messages::ParameterType : uint64_t
strong

Message-parameter type codes used as delta-encoded map keys on the wire.

Enumerator
kDeliveryTimeout 

Delivery timeout, encoded as an unsigned varint.

kAuthorizationToken 

Sensitive opaque token bytes; never log the value.

kRendezvousTimeout 

Rendezvous timeout, encoded as an unsigned varint.

kSubgroupDeliveryTimeout 

Subgroup delivery timeout, encoded as an unsigned varint.

kFillTimeout 

Fill timeout, encoded as an unsigned varint.

kExpires 

Expiry value; zero is resolved as absent.

kLargestObject 

Group/object location encoded as two unsigned varints.

kForward 

One-byte Boolean forwarding flag.

kSubscriberPriority 

One-byte subscriber priority.

kSubscriptionFilter 

Length-prefixed location-filter bytes.

kGroupOrder 

One-byte GroupOrder value.

kNewGroupRequest 

New-group request encoded as an unsigned varint.

kTrackNamespacePrefix 

Length-prefixed opaque namespace-prefix bytes.

kTrackFilter 

Length-prefixed track filter bytes.

kInvalid 

Internal sentinel; not a valid wire parameter.

◆ PublishDoneStatusCode

Publish-done status codes.

Enumerator
kInternalError 

Internal error.

kUnauthorized 

Authorization failed.

kTrackEnded 

Track ended.

kSubscriptionEnded 

Subscription ended.

kGoingAway 

Endpoint is going away.

kTooFarBehind 

Consumer fell too far behind.

kExpired 
kMalformedTrack 
kUpdateFailed 
kExcessiveLoad 

◆ SetupOptionType

enum quicr::messages::SetupOptionType : uint64_t
strong

SETUP option type codes.

Enumerator
kPath 

Request path bytes.

kAuthorizationToken 

Sensitive opaque authorization token; never log its bytes.

kMaxAuthTokenCacheSize 

Maximum authorization-token alias cache size.

kAuthority 

Authority bytes.

kMoqtImplementation 

Implementation identification bytes.

kEndpointId 

Internal endpoint identifier.

kInvalid 

Internal invalid sentinel.

◆ StreamMessageType

The possible message types arriving over stream transport.

Enumerator
kFetchHeader 

Fetch data stream.

kSubgroupHeader 

Subgroup object stream.

◆ StreamResetError

enum quicr::messages::StreamResetError : uint64_t
strong

Data-stream reset error codes.

Enumerator
kInternalError 

Internal failure.

kCancelled 

Delivery was cancelled.

kDeliveryTimeout 

Delivery timed out.

kSessionClosed 

Session closed.

kUnknownObjectStatus 

Unknown object status.

kMalformedTrack 

Track data is malformed.

◆ SubgroupIdType

enum quicr::messages::SubgroupIdType : std::uint8_t
strong

Possible ways of communicating subgroup ID in stream headers.

Enumerator
kIsZero 

ID is zero and omitted from the wire.

kSetFromFirstObject 

ID comes from the first object and is omitted here.

kExplicit 

ID is explicitly serialized.

kReserved 

Reserved and rejected.

◆ SubscriptionFilterType

enum quicr::messages::SubscriptionFilterType : std::uint64_t
strong

Subscription-filter form.

Enumerator
kNextGroupStart 

Start at the next group.

kLargestObject 

Start at the largest object.

kAbsoluteStart 

Start at an absolute location.

kAbsoluteRange 

Select an absolute range.

◆ TerminationReason

enum quicr::messages::TerminationReason : uint64_t
strong

Session termination reason codes.

Enumerator
kNoError 

Clean termination.

kInternalError 

Internal endpoint failure.

kUnauthorized 

Authorization failure.

kProtocolViolation 

Peer violated the protocol.

kInvalidRequestId 

Invalid request identifier.

kDuplicateTrackAlias 

Track alias was reused.

kKeyValueFormattingError 

Malformed key/value sequence.

kTooManyRequests 

Request limit exceeded.

kInvalidPath 

Path is invalid.

kMalformedPath 

Path encoding is malformed.

kGoawayTimeout 

GOAWAY timed out.

kControlMessageTimeout 

Control-message timeout.

kDataStreamTimeout 

Data-stream timeout.

kAuthTokenCacheOverflow 

Authorization-token cache is full.

kDuplicateAuthTokenAlias 

Authorization-token alias was reused.

kVersionNegotiationFailed 

No mutually supported version.

kMalformedAuthToken 

Authorization token is malformed.

kUnknownAuthTokenAlias 

Authorization-token alias is unknown.

kExpiredAuthToken 

Authorization token expired.

kInvalidAuthority 

Authority is invalid.

kMalformedAuthority 

Authority encoding is malformed.

Function Documentation

◆ CollectAuthTokens()

std::vector<Token> quicr::messages::CollectAuthTokens ( const Parameters &  params)
inline

Decodes authorization-token values.

Parameters
paramsSource parameters.
Returns
Decoded tokens.
Exceptions
ProtocolViolationExceptionfor an invalid token alias discriminator.
Warning
Token bytes are sensitive opaque data and must not be logged.

◆ ContainsAnyFilter()

bool quicr::messages::ContainsAnyFilter ( const Parameters &  params)
inline
Parameters
paramsParameters to inspect.
Returns
Whether any known filter parameter key is present.

◆ DeserializeFilter()

Filter quicr::messages::DeserializeFilter ( FilterType  filter_type,
BytesSpan  bytes 
)
inline

Decodes a concrete filter body.

Parameters
filter_typeExpected filter type.
bytesSpan bounded to the filter body.
Returns
SubscriptionFilter or TrackFilter for supported types; monostate for none or an unknown type.

◆ GetFilterParameterType()

ParameterType quicr::messages::GetFilterParameterType ( const Filter &  filter)
inline
Parameters
filterFilter to inspect.
Returns
Parameter key corresponding to the active alternative in filter.

◆ GetFilterType()

FilterType quicr::messages::GetFilterType ( const Filter &  filter)
inline
Parameters
filterFilter to inspect.
Returns
Discriminator corresponding to the active filter alternative.

◆ GetParameterEncoding()

ParameterEncoding quicr::messages::GetParameterEncoding ( ParameterType  type)
inline

Look up the wire encoding for a Message Parameter type.

Parameters
typeThe parameter type.
Returns
The encoding it uses.
Exceptions
ProtocolViolationExceptionif the type is unknown.

◆ operator<<() [1/26]

Bytes& quicr::messages::operator<< ( Bytes &  buffer,
const Bytes &  bytes 
)

Appends a varint length and copied bytes.

Parameters
bufferDestination bytes.
bytesBytes to copy.
Returns
buffer.

◆ operator<<() [2/26]

Bytes& quicr::messages::operator<< ( Bytes &  buffer,
const BytesSpan &  bytes 
)

Appends a varint length and copied span bytes.

Parameters
bufferDestination bytes.
bytesBytes to copy.
Returns
buffer.

◆ operator<<() [3/26]

Bytes& quicr::messages::operator<< ( Bytes &  buffer,
const Extensions &  extensions 
)

Appends a length-prefixed, sorted, delta-keyed extension block.

Parameters
bufferDestination bytes.
extensionsExtensions to serialize.
Returns
buffer.

◆ operator<<() [4/26]

Bytes& quicr::messages::operator<< ( Bytes &  buffer,
const FetchHeader &  msg 
)

Serializes type and request ID as UintVars.

Parameters
bufferDestination bytes.
msgHeader to serialize.
Returns
buffer.

◆ operator<<() [5/26]

Bytes& quicr::messages::operator<< ( Bytes &  buffer,
const FetchObject &  msg 
)

Serializes one fetch object.

Parameters
bufferDestination bytes.
msgObject to serialize.
Returns
buffer.
Exceptions
std::invalid_argumentif an end marker has payload.
ProtocolViolationExceptionfor nested immutable extensions.
Warning
Required optionals are enforced with assertions in debug builds.

◆ operator<<() [6/26]

Bytes& quicr::messages::operator<< ( Bytes &  buffer,
const KeyValuePairs &  msg 
)

Appends sorted, delta-keyed KVPs without a count or outer length.

Parameters
bufferDestination bytes.
msgKVPs to serialize.
Returns
buffer.

◆ operator<<() [7/26]

Bytes& quicr::messages::operator<< ( Bytes &  buffer,
const Location &  location 
)

Appends a location as two UintVars.

Parameters
bufferDestination bytes.
locationLocation to encode.
Returns
buffer.

◆ operator<<() [8/26]

Bytes& quicr::messages::operator<< ( Bytes &  buffer,
const ObjectDatagram &  msg 
)

Serializes header fields followed by raw payload bytes.

Parameters
bufferDestination bytes.
msgDatagram to serialize.
Returns
buffer.

◆ operator<<() [9/26]

Bytes& quicr::messages::operator<< ( Bytes &  buffer,
const ObjectDatagramStatus &  msg 
)

Serializes a status datagram.

Parameters
bufferDestination bytes.
msgDatagram to serialize.
Returns
buffer.

◆ operator<<() [10/26]

template<typename Type = ParameterType>
Bytes& quicr::messages::operator<< ( Bytes &  buffer,
const ParameterList< Type > &  msg 
)

Appends a counted, sorted, delta-keyed parameter list.

Template Parameters
TypeParameter-key type.
Parameters
bufferDestination byte vector.
msgList to serialize.
Returns
buffer.
Exceptions
ProtocolViolationExceptionfor unknown parameter types.
Warning
A present byte-encoded parameter must contain at least one byte.

◆ operator<<() [11/26]

Bytes& quicr::messages::operator<< ( Bytes &  buffer,
const std::optional< Extensions > &  extensions 
)

Appends a length-prefixed extension block, or a zero length when absent.

Parameters
bufferDestination bytes.
extensionsOptional extensions to serialize.
Returns
buffer.

◆ operator<<() [12/26]

Bytes& quicr::messages::operator<< ( Bytes &  buffer,
const StreamHeaderSubGroup &  msg 
)

Serializes a subgroup header.

Parameters
bufferDestination bytes.
msgHeader to serialize.
Returns
buffer.
Exceptions
std::invalid_argumentfor subgroup-ID fields inconsistent with the selected mode.

◆ operator<<() [13/26]

Bytes& quicr::messages::operator<< ( Bytes &  buffer,
const StreamSubGroupObject &  msg 
)

Serializes one subgroup object.

Parameters
bufferDestination bytes.
msgObject to serialize.
Returns
buffer.
Warning
Parent properties and extension compatibility are enforced with assertions.

◆ operator<<() [14/26]

template<KeyType T>
Bytes& quicr::messages::operator<< ( Bytes &  buffer,
const T  value 
)

Serializes a uint64-compatible key as UintVar.

Template Parameters
TKey type.
Parameters
bufferDestination bytes.
valueValue to encode.
Returns
buffer.

◆ operator<<() [15/26]

Bytes& quicr::messages::operator<< ( Bytes &  buffer,
const Token &  token 
)
inline

Serializes a token body without an enclosing length.

Parameters
bufferDestination bytes.
tokenToken to serialize.
Returns
buffer.
Exceptions
std::bad_optional_accesswhen fields required by alias_type are absent.

◆ operator<<() [16/26]

Bytes& quicr::messages::operator<< ( Bytes &  buffer,
const TrackExtensions &  msg 
)

Appends mutable KVPs plus an immutable container KVP.

Parameters
bufferDestination bytes.
msgExtensions to serialize.
Returns
buffer.

◆ operator<<() [17/26]

Bytes& quicr::messages::operator<< ( Bytes &  buffer,
const UintVar &  value 
)

Appends the stored UintVar encoding verbatim.

Parameters
bufferDestination bytes.
valueEncoding to append.
Returns
buffer.

◆ operator<<() [18/26]

Bytes& quicr::messages::operator<< ( Bytes &  buffer,
FetchType  value 
)

Serializes a FetchType as UintVar.

Parameters
bufferDestination bytes.
valueFetch type to serialize.
Returns
buffer.

◆ operator<<() [19/26]

Bytes& quicr::messages::operator<< ( Bytes &  buffer,
GroupOrder  value 
)

Serializes a validated GroupOrder as UintVar.

Exceptions
ProtocolViolationExceptionfor another value.

◆ operator<<() [20/26]

Bytes& quicr::messages::operator<< ( Bytes &  buffer,
PublishDoneStatusCode  value 
)

Serializes a PublishDoneStatusCode as UintVar.

Parameters
bufferDestination bytes.
valueStatus code to serialize.
Returns
buffer.

◆ operator<<() [21/26]

Bytes& quicr::messages::operator<< ( Bytes &  buffer,
std::uint16_t  value 
)

Appends a two-byte big-endian integer.

Parameters
bufferDestination bytes.
valueValue to append.
Returns
buffer.

◆ operator<<() [22/26]

Bytes& quicr::messages::operator<< ( Bytes &  buffer,
std::uint64_t  value 
)

Appends a value as UintVar.

Parameters
bufferDestination bytes.
valueValue to encode.
Returns
buffer.

◆ operator<<() [23/26]

Bytes& quicr::messages::operator<< ( Bytes &  buffer,
std::uint8_t  value 
)

Appends one raw byte.

Parameters
bufferDestination bytes.
valueByte to append.
Returns
buffer.

◆ operator<<() [24/26]

Bytes& quicr::messages::operator<< ( Bytes &  bytes,
const Filter &  filter 
)
inline

Serializes the active filter body without a discriminator.

Parameters
bytesDestination bytes.
filterFilter to serialize.
Returns
bytes.

◆ operator<<() [25/26]

Bytes& quicr::messages::operator<< ( Bytes &  bytes,
const SubscriptionFilter &  filter 
)
inline

◆ operator<<() [26/26]

Bytes& quicr::messages::operator<< ( Bytes &  bytes,
const TrackFilter &  filter 
)
inline

Serializes three UintVars.

Parameters
bytesDestination bytes.
filterFilter to serialize.
Returns
bytes.

◆ operator>>() [1/21]

bool quicr::messages::operator>> ( Bytes &  buffer,
FetchObject &  msg 
)

Declared byte-vector fetch-object decoder.

Parameters
bufferInput bytes.
msgDestination object.
Returns
Whether decoding completed.
Note
No definition is present in this repository; use the StreamBuffer overload.

◆ operator>>() [2/21]

bool quicr::messages::operator>> ( Bytes &  buffer,
StreamHeaderSubGroup &  msg 
)

Declared byte-vector subgroup-header decoder.

Parameters
bufferInput bytes.
msgDestination header.
Returns
Whether decoding completed.
Note
No definition is present in this repository; use the StreamBuffer overload.

◆ operator>>() [3/21]

bool quicr::messages::operator>> ( Bytes &  buffer,
StreamSubGroupObject &  msg 
)

Declared byte-vector subgroup-object decoder.

Parameters
bufferInput bytes.
msgDestination object.
Returns
Whether decoding completed.
Note
No definition is present in this repository; use the StreamBuffer overload.

◆ operator>>() [4/21]

BytesSpan quicr::messages::operator>> ( BytesSpan  buffer,
Bytes &  value 
)

Parses length-prefixed bytes.

Parameters
bufferInput span.
valueDestination for the parsed bytes.
Returns
Unconsumed suffix.

◆ operator>>() [5/21]

BytesSpan quicr::messages::operator>> ( BytesSpan  buffer,
Extensions &  extensions 
)

Parses one length-prefixed extension block.

Parameters
bufferInput span.
extensionsDestination extensions.
Returns
Unconsumed suffix.

◆ operator>>() [6/21]

BytesSpan quicr::messages::operator>> ( BytesSpan  buffer,
FetchHeader &  msg 
)

Declared contiguous-span fetch-header decoder.

Parameters
bufferInput span.
msgDestination header.
Returns
Unconsumed suffix.
Note
No definition is present in this repository; use the StreamBuffer overload.

◆ operator>>() [7/21]

BytesSpan quicr::messages::operator>> ( BytesSpan  buffer,
FetchType &  value 
)

Parses one raw byte as FetchType without range validation.

Parameters
bufferInput span.
valueDestination fetch type.
Returns
Unconsumed suffix.

◆ operator>>() [8/21]

BytesSpan quicr::messages::operator>> ( BytesSpan  buffer,
GroupOrder &  value 
)

Parses and validates a GroupOrder.

Returns
Unconsumed suffix.
Exceptions
ProtocolViolationExceptionfor another value.

◆ operator>>() [9/21]

BytesSpan quicr::messages::operator>> ( BytesSpan  buffer,
KeyValuePairs &  msg 
)

Parses KVPs through the end of the input span.

Parameters
bufferInput span.
msgDestination replaced with parsed KVPs.
Returns
An empty suffix.

◆ operator>>() [10/21]

BytesSpan quicr::messages::operator>> ( BytesSpan  buffer,
Location &  location 
)

Parses two UintVars as a location.

Parameters
bufferInput span.
locationDestination for the parsed location.
Returns
Unconsumed suffix.

◆ operator>>() [11/21]

template<typename Type = ParameterType>
BytesSpan quicr::messages::operator>> ( BytesSpan  buffer,
ParameterList< Type > &  msg 
)

Parses a counted, delta-keyed parameter list and advances the span. Existing entries are not cleared; decoded bytes append to matching keys.

Template Parameters
TypeParameter-key type.
Parameters
bufferInput span passed by value.
msgDestination list.
Returns
Unconsumed suffix of buffer.
Exceptions
ProtocolViolationExceptionfor unknown parameter types.
UintVarInvalidArgExceptionor std::invalid_argument for truncated input.

◆ operator>>() [12/21]

BytesSpan quicr::messages::operator>> ( BytesSpan  buffer,
PublishDoneStatusCode &  value 
)

Parses a PublishDoneStatusCode without range validation.

Parameters
bufferInput span.
valueDestination status code.
Returns
Unconsumed suffix.

◆ operator>>() [13/21]

BytesSpan quicr::messages::operator>> ( BytesSpan  buffer,
std::uint16_t &  value 
)

Parses a two-byte big-endian integer.

Parameters
bufferInput span.
valueDestination for the parsed value.
Returns
Unconsumed suffix.
Exceptions
std::invalid_argumenton truncation.

◆ operator>>() [14/21]

BytesSpan quicr::messages::operator>> ( BytesSpan  buffer,
std::uint64_t &  value 
)

Parses one UintVar.

Parameters
bufferInput span.
valueDestination for the decoded value.
Returns
Unconsumed suffix.

◆ operator>>() [15/21]

template<KeyType T>
BytesSpan quicr::messages::operator>> ( BytesSpan  buffer,
T &  value 
)

Parses a UintVar key and advances the span.

Template Parameters
TKey type.
Parameters
bufferInput span.
valueDecoded value.
Returns
Unconsumed suffix.

◆ operator>>() [16/21]

BytesSpan quicr::messages::operator>> ( BytesSpan  buffer,
Token &  token 
)
inline

Parses a token body.

Register and use-value consume every byte remaining in buffer as the token value, so callers must pass a span bounded to one token parameter.

Parameters
bufferInput span bounded to one token parameter.
tokenDestination token.
Returns
Empty suffix for value-carrying forms, otherwise the unconsumed suffix.
Exceptions
ProtocolViolationExceptionfor an unknown alias operation.
Warning
Parsed token bytes are sensitive opaque data and must not be logged.

◆ operator>>() [17/21]

BytesSpan quicr::messages::operator>> ( BytesSpan  buffer,
TrackExtensions &  msg 
)

Parses KVPs through the end of the input span.

Parameters
bufferInput span.
msgDestination whose extension maps are replaced.
Returns
An empty suffix.

◆ operator>>() [18/21]

BytesSpan quicr::messages::operator>> ( BytesSpan  buffer,
uint8_t &  value 
)

Parses one raw byte.

Parameters
bufferInput span.
valueDestination for the parsed byte.
Returns
Unconsumed suffix.
Exceptions
std::invalid_argumenton truncation.

◆ operator>>() [19/21]

BytesSpan quicr::messages::operator>> ( BytesSpan  bytes,
SubscriptionFilter &  filter 
)
inline

Resets and parses a location filter.

Parameters
bytesInput span.
filterDestination filter.
Returns
Unconsumed suffix.

◆ operator>>() [20/21]

BytesSpan quicr::messages::operator>> ( BytesSpan  bytes,
TrackFilter &  filter 
)
inline

Parses three UintVars.

Parameters
bytesInput span.
filterDestination filter.
Returns
Unconsumed suffix.

◆ operator>>() [21/21]

BytesSpan quicr::messages::operator>> ( BytesSpan  ,
Filter &   
)
inline

Rejects decoding without a concrete filter type.

Exceptions
std::runtime_errorunconditionally.

◆ ParseExtensions()

template<class StreamBufferType >
bool quicr::messages::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 > &  current_header,
std::uint64_t &  prev_extension_type 
)

Parse extensions from MoQ encoded format.

Template Parameters
StreamBufferTypeIncremental buffer providing UintVar and byte reads.
Parameters
bufferBuffer to parse from.
extension_headers_lengthExtract length of all extension headers.
extensionsParsed mutable extensions, if any.
immutable_extensionsParsed immutable extensions, if any.
extension_bytes_remainingTotal bytes of extension headers left to parse.
current_headerCurrent header key being parsed (absolute type, after delta decoding).
prev_extension_typePrevious extension type for delta decoding.
Returns
True when the complete block has been consumed; false when more bytes are required.
Exceptions
ProtocolViolationExceptionon delta overflow or nested immutable extensions.
Note
All state arguments are in/out values and must be preserved unchanged between calls except through this function. Successfully consumed bytes are removed from buffer even when false is returned.

◆ ParseKvp()

template<KeyType T>
void quicr::messages::ParseKvp ( BytesSpan &  buffer,
KeyValuePair< T > &  kvp,
const T  prev_type 
)

Deserialize KVP.

Parameters
bufferBuffer to read from.
kvpThe KeyValuePair to read into.
prev_typeThe previous type value to unwrap the delta.
Note
buffer is mutated to its unconsumed suffix.
Exceptions
ProtocolViolationExceptionif delta causes overflow past 2^64-1.

◆ ResolveExpires()

std::optional<std::uint64_t> quicr::messages::ResolveExpires ( const Parameters &  params)
inline
Parameters
paramsParameters to inspect.
Returns
EXPIRES when present and nonzero; otherwise std::nullopt.

◆ ResolveFilter()

Filter quicr::messages::ResolveFilter ( const Parameters &  params)
inline

Resolves the first present filter according to kFilterTypes order.

Parameters
paramsParameters to inspect.
Returns
Decoded filter, or monostate when none is present or its decoder is unsupported.

◆ ResolveForward()

bool quicr::messages::ResolveForward ( const Parameters &  params,
bool  default_value 
)
inline

Resolves the optional FORWARD byte.

Parameters
paramsParameters to inspect.
default_valueValue to return when FORWARD is absent.
Returns
default_value when absent; otherwise the encoded Boolean.
Exceptions
ProtocolViolationExceptionunless the encoded value is zero or one.

◆ ResolveGroupOrder()

std::optional<GroupOrder> quicr::messages::ResolveGroupOrder ( const Parameters &  params)
inline

Resolves and validates GROUP_ORDER.

Parameters
paramsParameters to inspect.
Returns
Valid order, or std::nullopt when absent.
Exceptions
ProtocolViolationExceptionfor any other byte value.

◆ SerializeExtensions()

void quicr::messages::SerializeExtensions ( Bytes &  buffer,
const std::optional< Extensions > &  extensions,
const std::optional< Extensions > &  immutable_extensions 
)

Serialize extensions to MoQ encoding.

Parameters
bufferBuffer to serialize to.
extensionsOptionally, mutable extensions.
immutable_extensionsOptionally, immutable extensions.
Exceptions
ProtocolViolationExceptionif immutable extensions contain kImmutable.

◆ SerializeFilter()

Parameter quicr::messages::SerializeFilter ( FilterType  filter_type,
const Filter &  filter 
)
inline

Serializes a filter into a parameter value.

Parameters
filter_typeWire discriminator used for the parameter key.
filterActive filter value. No validation ensures it matches filter_type.
Returns
Parameter containing the serialized filter, or an empty value for monostate.

◆ SerializeKvp()

template<KeyType T>
void quicr::messages::SerializeKvp ( Bytes &  buffer,
const KeyValuePair< T > &  kvp,
const T  prev_type 
)

Serialize KVP.

Parameters
bufferBuffer to write into.
kvpThe KeyValuePair to write.
prev_typeThe previous type value so we can do the delta.
Exceptions
std::invalid_argumentif an even-key value exceeds eight bytes.
Warning
kvp.type must not be less than prev_type; this function does not validate underflow.

◆ ToFilterType()

constexpr FilterType quicr::messages::ToFilterType ( ParameterType  type)
constexpr

Converts a filter parameter key to its filter discriminator.

Parameters
typeParameter key to convert.
Returns
Corresponding filter type.
Exceptions
std::invalid_argumentif type is not a filter parameter.

◆ ToParameterFilterType()

constexpr ParameterType quicr::messages::ToParameterFilterType ( FilterType  type)
constexpr
Parameters
typeFilter type to convert.
Returns
Parameter type corresponding to type, or kInvalid for kNone.

◆ ValidateParameters()

void quicr::messages::ValidateParameters ( const Parameters &  params,
std::initializer_list< ParameterType >  allowed 
)
inline

Ensures every stored key is allowed.

Parameters
paramsParameters to inspect.
allowedAllowed parameter types.
Exceptions
ProtocolViolationExceptionfor a disallowed key or duplicate non-token key.
Note
ParameterList uses a map, so separately encoded duplicate entries have already coalesced by the time this function runs; duplicate detection is therefore limited.

Variable Documentation

◆ ByteParameter

template<class T >
concept quicr::messages::ByteParameter
Initial value:
= std::is_convertible_v<T, std::uint8_t> ||
(std::is_enum_v<T> && std::same_as<std::underlying_type_t<T>, std::uint8_t>)

Types representable by one raw parameter byte.

Template Parameters
TCandidate integral or byte-backed enum type.

◆ HasByteStreamOperators

template<class T >
concept quicr::messages::HasByteStreamOperators
Initial value:
= requires(T& value, Bytes& bytes) {
{ bytes << value } -> std::same_as<Bytes&>;
{ BytesSpan{} >> value } -> std::same_as<BytesSpan>;
}
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

Types with matching insertion into Bytes and extraction from BytesSpan.

Template Parameters
TCandidate type.

◆ KeyType

template<typename T >
concept quicr::messages::KeyType
Initial value:
=
std::same_as<T, std::uint64_t> || (std::is_enum_v<T> && std::same_as<std::underlying_type_t<T>, std::uint64_t>)

Types usable as delta-encoded KVP keys.

Template Parameters
TEither uint64_t or an enum with uint64_t underlying type.

◆ kFilterTypes

constexpr FilterType quicr::messages::kFilterTypes[]
inlineconstexpr
Initial value:
= {
FilterType::kSubscriptionFilter,
FilterType::kTrackFilter,
}

Filter kinds searched by ContainsAnyFilter() and ResolveFilter(), in precedence order.

◆ ParameterValueType

template<typename T >
concept quicr::messages::ParameterValueType
Initial value:
=
HasByteStreamOperators<std::decay_t<T>> || ByteParameter<std::decay_t<T>> ||
std::is_same_v<std::decay_t<T>, Location> || std::is_same_v<std::decay_t<T>, Bytes> || requires(T v) {
{ UintVar(v) };
}

Types accepted by typed parameter insertion and retrieval.

Template Parameters
TCandidate value type.