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: OriginThe o= line.
session_name: StringThe 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
impl SessionDescription
Sourcepub fn new(address: IpAddr, session_id: u64, session_version: u64) -> Self
pub fn new(address: IpAddr, session_id: u64, session_version: u64) -> Self
A session description for an address.
Sourcepub fn address_for(&self, media: &MediaDescription) -> Option<IpAddr>
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.
Sourcepub fn fingerprint(&self) -> Option<Fingerprint>
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.
Sourcepub fn ice_ufrag(&self) -> Option<&str>
pub fn ice_ufrag(&self) -> Option<&str>
The session-level a=ice-ufrag (RFC 8839 §5.4), which is a default for every stream.
Sourcepub fn ice_pwd(&self) -> Option<&str>
pub fn ice_pwd(&self) -> Option<&str>
The session-level a=ice-pwd (RFC 8839 §5.4), which is a default for every stream.
Sourcepub fn ice_credentials_for(
&self,
media: &MediaDescription,
) -> Option<Credentials>
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.
Sourcepub fn ice_options(&self) -> impl Iterator<Item = &str>
pub fn ice_options(&self) -> impl Iterator<Item = &str>
The session-level option tags (RFC 8839 §5.6).
Sourcepub fn ice_options_for<'a>(
&'a self,
media: &'a MediaDescription,
) -> impl Iterator<Item = &'a str>
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.
Sourcepub fn is_ice_lite(&self) -> bool
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.
Sourcepub fn ice_pacing(&self) -> Pacing
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.
Sourcepub fn to_string_sdp(&self) -> String
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
impl Clone for SessionDescription
Source§fn clone(&self) -> SessionDescription
fn clone(&self) -> SessionDescription
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SessionDescription
impl Debug for SessionDescription
Source§impl PartialEq for SessionDescription
impl PartialEq for SessionDescription
Source§fn eq(&self, other: &SessionDescription) -> bool
fn eq(&self, other: &SessionDescription) -> bool
self and other values to be equal, and is used by ==.