This document uses the conventions detailed in ([RFC9000], Section 1.3) when describing the binary encoding.
To reduce unnecessary use of bandwidth, variable length integers SHOULD be encoded using the least number of bytes possible to represent the required value.
1.4.1. Location Structure
Location identifies a particular Object in a Group within a Track.
Location {
Group (i),
Object (i)
}
In this document, a Location can be expressed in the form of {GroupID, ObjectID}, where GroupID and ObjectID indicate the Group ID and Object ID of the Location, respectively. The constituent parts of any Location A can be referred to using A.Group or A.Object.
Location A < Location B if:
A.Group < B.Group || (A.Group == B.Group && A.Object < B.Object)
1.4.2. Key-Value-Pair Structure
Key-Value-Pair is a flexible structure designed to carry key/value pairs in which the key is a variable length integer and the value is either a variable length integer or a byte field of arbitrary length.
Key-Value-Pairs encode a Type value as a delta from the previous Type value,
or from 0 if there is no previous Type value. This is efficient on the wire
and makes it easy to ensure there is only one instance of a type when needed.
The previous Type value plus the Delta Type MUST NOT be greater than 2^64 - 1.
If a Delta Type is received that would be too large, the Session MUST be closed
with a PROTOCOL_VIOLATION.
Key-Value-Pair is used in both the data plane and control plane, but is optimized for use in the data plane.
Key-Value-Pair {
Delta Type (i),
[Length (i),]
Value (..)
}
-
Delta Type: an unsigned integer, encoded as a varint, identifying the Type as a delta encoded value from the previous Type, if any. The Type identifies the type of value and also the subsequent serialization.
-
Length: Only present when Type is odd. Specifies the length of the Value field in bytes. The maximum length of a value is 2^16-1 bytes. If an endpoint receives a length larger than the maximum, it MUST close the session with a
PROTOCOL_VIOLATION. -
Value: A single varint encoded value when Type is even, otherwise a sequence of Length bytes.
If a receiver understands a Type, and the following Value or Length/Value does
not match the serialization defined by that Type, the receiver MUST close
the session with error code KEY_VALUE_FORMATTING_ERROR.
1.4.3. Reason Phrase Structure
Reason Phrase provides a way for the sender to encode additional diagnostic information about the error condition, where appropriate.
Reason Phrase {
Reason Phrase Length (i),
Reason Phrase Value (..)
}
-
Reason Phrase Length: A variable-length integer specifying the length of the reason phrase in bytes. The reason phrase length has a maximum value of 1024 bytes. If an endpoint receives a length exceeding the maximum, it MUST close the session with a
PROTOCOL_VIOLATION -
Reason Phrase Value: Additional diagnostic information about the error condition. The reason phrase value is encoded as UTF-8 string and does not carry information, such as language tags, that would aid comprehension by any entity other than the one that created the text.