Skip to main content

ExtMap

Struct ExtMap 

Source
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: u16

The 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: Direction

The 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

Source

pub fn convert(&self) -> Attribute

converts this object to an Attribute

Source

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.

Source

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).

Source

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.

Source

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.

Source

pub fn marshal(&self) -> String

marshal creates a string from an ExtMap

Trait Implementations§

Source§

impl Clone for ExtMap

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ExtMap

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ExtMap

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for ExtMap

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl TypedAttribute for ExtMap

Source§

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§

const NAME: &'static str = "extmap"

The attribute name, as it follows a=.
Source§

fn to_attribute(&self) -> Attribute

The a= line this value makes.

Auto Trait Implementations§

§

impl Forget for ExtMap

§

impl Freeze for ExtMap
where *const u8 is !null: Freeze, PhantomData<u8>: Freeze,

§

impl Move for ExtMap

§

impl RefUnwindSafe for ExtMap

§

impl Send for ExtMap
where RawVecInner: Send,

§

impl Sync for ExtMap
where RawVecInner: Sync,

§

impl Unpin for ExtMap
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for ExtMap

§

impl UnwindSafe for ExtMap
where RawVecInner: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.