pub struct ExtMap {
pub value: u16,
pub direction: Direction,
pub uri: Option<Url>,
pub ext_attr: Option<String>,
}Expand description
ExtMap represents the activation of a single RTP header extension:
a=extmap:<value>["/"<direction>] <URI> [<extensionattributes>] (RFC 8285 section 5).
extmap-value = mapentry SP extensionname [SP extensionattributes]
mapentry = "extmap:" 1*5DIGIT ["/" direction]
extensionname = URI
extensionattributes = byte-string
direction = "sendonly" / "recvonly" / "sendrecv" / "inactive"Fields§
§value: u16The id this extension is negotiated under.
RFC 8285 section 4.3 calls 1 to 256 the valid range: 1 to 255 is the local identifier
that appears in RTP packets (1 to 14 fit the one-byte header form; 15 and above need
the two-byte form), and 256 names the four appbits of the two-byte header. 4096 to
4351 is not an identifier: an offerer with more extensions than identifiers, or with
alternatives, uses that range, and the answerer that wants the extension remaps it
to a free valid id (RFC 8285 section 6). See ExtMap::is_answerer_assigned.
direction: DirectionThe direction the extension applies in, if the attribute restricted it.
uri: Option<Url>The extension’s canonical URI.
ext_attr: Option<String>Extension-specific attributes trailing the URI: a byte-string, spaces included.
Implementations§
Source§impl ExtMap
impl ExtMap
Sourcepub fn is_answerer_assigned(&self) -> bool
pub fn is_answerer_assigned(&self) -> bool
Whether the id is in the 4096 to 4351 range: the offerer did not number the extension, and an answerer that accepts it remaps it to a free id in the valid range (RFC 8285 section 6). Such an id never appears in a packet.
Sourcepub fn fits_one_byte_header(&self) -> bool
pub fn fits_one_byte_header(&self) -> bool
Whether the id fits the one-byte header form (1 to 14). An id of 15 to 255 needs the two-byte form (RFC 8285 section 4.3).
Sourcepub fn is_element_id(&self) -> bool
pub fn is_element_id(&self) -> bool
Whether the id identifies an extension element in a packet: 1 to 255. 256 (the
appbits) and the 4096 to 4351 range do not.
Sourcepub fn unmarshal<R: BufRead>(reader: &mut R) -> Result<Self>
pub fn unmarshal<R: BufRead>(reader: &mut R) -> Result<Self>
unmarshal creates an Extmap from a line of the form extmap:<value>... (the
attribute, with or without its a=), for a caller that will use the id in packets.
It accepts what TypedAttribute::parse accepts, minus the ids that do not
identify an extension element: 256 (the appbits) and 4096 to 4351 (extensions the
offerer left for the answerer to number) are refused here, because every caller of
this function takes ExtMap::value as the identifier to put in, or look for in,
an RTP header. A caller that handles those ids (RFC 8285 section 6: skip the
extension, or remap it to a free id) parses with TypedAttribute::parse, or
reads a description’s extmaps(), and asks ExtMap::is_element_id.
Trait Implementations§
Source§impl TypedAttribute for ExtMap
impl TypedAttribute for ExtMap
Source§fn parse(value: &str) -> Result<Self>
fn parse(value: &str) -> Result<Self>
Parses the value of an a=extmap line: what follows extmap:.
The id must be one RFC 8285 gives a meaning: 1 to 256 (the valid range), or 4096 to 4351 (the range an answerer remaps). 0 is padding, and nothing else is defined.
Source§fn to_attribute(&self) -> Attribute
fn to_attribute(&self) -> Attribute
a= line this value makes.