Skip to main content

SessionDescription

Struct SessionDescription 

Source
pub struct SessionDescription {
    pub origin: Origin,
    pub session_name: String,
    pub connection: Option<Connection>,
    pub timing: Vec<Timing>,
    pub attributes: Vec<Attribute>,
    pub media: Vec<MediaDescription>,
    pub other: Vec<(char, String)>,
}
Expand description

A whole session description.

Fields§

§origin: Origin

The o= line.

§session_name: String

The s= line.

§connection: Option<Connection>

The session-level c= line.

§timing: Vec<Timing>

The t= lines.

§attributes: Vec<Attribute>

Session-level attributes.

§media: Vec<MediaDescription>

The media streams, in order. The order is load-bearing: an answer’s streams correspond to the offer’s by position.

§other: Vec<(char, String)>

Lines this crate does not model, kept so they survive a round trip.

Implementations§

Source§

impl SessionDescription

Source

pub fn new(address: IpAddr, session_id: u64, session_version: u64) -> Self

A session description for an address.

Source

pub fn address_for(&self, media: &MediaDescription) -> Option<IpAddr>

The connection address for a stream: its own c= if it has one, else the session’s.

A domain-name address yields None here — the name is preserved in the description, but only a resolver can turn it into somewhere to send media.

Source

pub fn direction(&self) -> Direction

The session-level direction, defaulting to sendrecv.

Source

pub fn fingerprint(&self) -> Option<Fingerprint>

The session-level a=fingerprint, if the description carries one (RFC 8122 §5).

§5 allows the attribute at either level, and one given here applies to every stream that does not override it. A browser puts it here and on no m= line at all, so a stack that reads only the media level finds nothing and refuses a perfectly good offer.

Source

pub fn ice_ufrag(&self) -> Option<&str>

The session-level a=ice-ufrag (RFC 8839 §5.4), which is a default for every stream.

Source

pub fn ice_pwd(&self) -> Option<&str>

The session-level a=ice-pwd (RFC 8839 §5.4), which is a default for every stream.

Source

pub fn ice_credentials_for( &self, media: &MediaDescription, ) -> Option<Credentials>

The short-term credentials that apply to one stream (RFC 8839 §5.4).

Media level wins. §5.4 allows the attributes at either level and makes the session level a default, so a stream with its own ice-ufrag uses it and a stream without it inherits — and the two must not be mixed: taking the fragment from the media line and the password from the session line produces a credential neither end can authenticate with, and it looks exactly like a network fault. The pair is therefore resolved together, from whichever level supplied the fragment.

None when the description gives no usable pair at either level, which per §5.4 means the stream is not doing ICE. Values up to 256 characters are accepted, as §5.4 requires, even though sipx will not send one longer than 32.

Source

pub fn ice_options(&self) -> impl Iterator<Item = &str>

The session-level option tags (RFC 8839 §5.6).

Source

pub fn ice_options_for<'a>( &'a self, media: &'a MediaDescription, ) -> impl Iterator<Item = &'a str>

The option tags that apply to one stream: the session’s and the stream’s together.

A union and not an override, which is where this differs from the credentials above. §5.6 makes the attribute a statement that “a certain extension is supported by the agent”, and an agent does not stop supporting an extension because a particular m= line named a different one. Tags may repeat if both levels name the same one.

Source

pub fn is_ice_lite(&self) -> bool

Whether the description carries a=ice-lite (RFC 8839 §5.3). Session-level only.

A lite peer never gathers, never sends a check and never nominates, so sipx takes the controlling role unconditionally against one (RFC 8445 §6.1.1) and must not wait for checks that will never arrive. sipx itself is always a full agent and never sends this.

Source

pub fn ice_pacing(&self) -> Pacing

The a=ice-pacing the description asks for (RFC 8839 §5.5). Session-level only.

Pacing::DEFAULT when the attribute is absent or unreadable, because §5.5 gives the absent case a value — 50 ms — rather than leaving it undefined.

Source

pub fn to_string_sdp(&self) -> String

Serialize to the wire format.

Line order follows RFC 8866 §5, which is not a style preference: the grammar fixes the order, and receivers do reject descriptions that get it wrong.

Trait Implementations§

Source§

impl Clone for SessionDescription

Source§

fn clone(&self) -> SessionDescription

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 SessionDescription

Source§

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

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

impl PartialEq for SessionDescription

Source§

fn eq(&self, other: &SessionDescription) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for SessionDescription

Source§

impl StructuralPartialEq for SessionDescription

Auto Trait Implementations§

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> Same for T

Source§

type Output = T

Should always be Self
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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,