pub struct SessionDescription {
Show 14 fields pub version: Version, pub origin: Origin, pub session_name: SessionName, pub session_information: Option<Information>, pub uri: Option<Url>, pub email_address: Option<EmailAddress>, pub phone_number: Option<PhoneNumber>, pub connection_information: Option<ConnectionInformation>, pub bandwidth: Vec<Bandwidth>, pub time_descriptions: Vec<TimeDescription>, pub time_zones: Vec<TimeZone>, pub encryption_key: Option<EncryptionKey>, pub attributes: Vec<Attribute>, pub media_descriptions: Vec<MediaDescription>,
}
Expand description

SessionDescription is a a well-defined format for conveying sufficient information to discover and participate in a multimedia session.

Fields§

§version: Version§origin: Origin

o=<username> <sess-id> <sess-version> <nettype> <addrtype> <unicast-address>

https://tools.ietf.org/html/rfc4566#section-5.2

§session_name: SessionName§session_information: Option<Information>§uri: Option<Url>§email_address: Option<EmailAddress>§phone_number: Option<PhoneNumber>§connection_information: Option<ConnectionInformation>

c=<nettype> <addrtype> <connection-address>

https://tools.ietf.org/html/rfc4566#section-5.7

§bandwidth: Vec<Bandwidth>§time_descriptions: Vec<TimeDescription>§time_zones: Vec<TimeZone>

z=<adjustment time> <offset> <adjustment time> <offset> ...

https://tools.ietf.org/html/rfc4566#section-5.11

§encryption_key: Option<EncryptionKey>

k=<method>

k=<method>:<encryption key>

https://tools.ietf.org/html/rfc4566#section-5.12

§attributes: Vec<Attribute>

a=<attribute>

a=<attribute>:<value>

https://tools.ietf.org/html/rfc4566#section-5.13

§media_descriptions: Vec<MediaDescription>

Implementations§

source§

impl SessionDescription

Reset cleans the SessionDescription, and sets all fields back to their default values

source

pub fn new_jsep_session_description(identity: bool) -> Self

API to match draft-ietf-rtcweb-jsep Move to webrtc or its own package? NewJSEPSessionDescription creates a new SessionDescription with some settings that are required by the JSEP spec.

source

pub fn with_property_attribute(self, key: String) -> Self

WithPropertyAttribute adds a property attribute ‘a=key’ to the session description

source

pub fn with_value_attribute(self, key: String, value: String) -> Self

WithValueAttribute adds a value attribute ‘a=key:value’ to the session description

source

pub fn with_fingerprint(self, algorithm: String, value: String) -> Self

WithFingerprint adds a fingerprint to the session description

source

pub fn with_media(self, md: MediaDescription) -> Self

WithMedia adds a media description to the session description

source

pub fn get_codec_for_payload_type( &self, payload_type: u8 ) -> Result<Codec, Error>

get_codec_for_payload_type scans the SessionDescription for the given payload type and returns the codec

source

pub fn get_payload_type_for_codec(&self, wanted: &Codec) -> Result<u8, Error>

get_payload_type_for_codec scans the SessionDescription for a codec that matches the provided codec as closely as possible and returns its payload type

source

pub fn attribute(&self, key: &str) -> Option<&String>

Attribute returns the value of an attribute and if it exists

source

pub fn marshal(&self) -> String

Marshal takes a SDP struct to text

https://tools.ietf.org/html/rfc4566#section-5

Session description v= (protocol version) o= (originator and session identifier) s= (session name) i=* (session information) u=* (URI of description) e=* (email address) p=* (phone number) c=* (connection information – not required if included in all media) b=* (zero or more bandwidth information lines) One or more time descriptions (“t=” and “r=” lines; see below) z=* (time zone adjustments) k=* (encryption key) a=* (zero or more session attribute lines) Zero or more media descriptions

Time description t= (time the session is active) r=* (zero or more repeat times)

Media description, if present m= (media name and transport address) i=* (media title) c=* (connection information – optional if included at session level) b=* (zero or more bandwidth information lines) k=* (encryption key) a=* (zero or more media attribute lines)

source

pub fn unmarshal<R: BufRead + Seek>(reader: &mut R) -> Result<Self, Error>

Unmarshal is the primary function that deserializes the session description message and stores it inside of a structured SessionDescription object.

The States Transition Table describes the computation flow between functions (namely s1, s2, s3, …) for a parsing procedure that complies with the specifications laid out by the rfc4566#section-5 as well as by JavaScript Session Establishment Protocol draft. Links: https://tools.ietf.org/html/rfc4566#section-5 https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-24

https://tools.ietf.org/html/rfc4566#section-5

Session description v= (protocol version) o= (originator and session identifier) s= (session name) i=* (session information) u=* (URI of description) e=* (email address) p=* (phone number) c=* (connection information – not required if included in all media) b=* (zero or more bandwidth information lines) One or more time descriptions (“t=” and “r=” lines; see below) z=* (time zone adjustments) k=* (encryption key) a=* (zero or more session attribute lines) Zero or more media descriptions

Time description t= (time the session is active) r=* (zero or more repeat times)

Media description, if present m= (media name and transport address) i=* (media title) c=* (connection information – optional if included at session level) b=* (zero or more bandwidth information lines) k=* (encryption key) a=* (zero or more media attribute lines)

In order to generate the following state table and draw subsequent deterministic finite-state automota (“DFA”) the following regex was used to derive the DFA: vosi?u?e?p?c?b*(tr*)+z?k?a*(mi?c?bk?a)* possible place and state to exit: ** * * * ** * * * * 99 1 1 1 11 1 1 1 1 3 1 1 26 5 5 4 4

Please pay close attention to the k, and a parsing states. In the table below in order to distinguish between the states belonging to the media description as opposed to the session description, the states are marked with an asterisk (“a*”, “k*”).

+--------+----+-------+----+-----+----+-----+---+----+----+---+---+-----+---+---+----+---+----+
| STATES | a* | a*,k* | a  | a,k | b  | b,c | e | i  | m  | o | p | r,t | s | t | u  | v | z  |
+--------+----+-------+----+-----+----+-----+---+----+----+---+---+-----+---+---+----+---+----+
|   s1   |    |       |    |     |    |     |   |    |    |   |   |     |   |   |    | 2 |    |
|   s2   |    |       |    |     |    |     |   |    |    | 3 |   |     |   |   |    |   |    |
|   s3   |    |       |    |     |    |     |   |    |    |   |   |     | 4 |   |    |   |    |
|   s4   |    |       |    |     |    |   5 | 6 |  7 |    |   | 8 |     |   | 9 | 10 |   |    |
|   s5   |    |       |    |     |  5 |     |   |    |    |   |   |     |   | 9 |    |   |    |
|   s6   |    |       |    |     |    |   5 |   |    |    |   | 8 |     |   | 9 |    |   |    |
|   s7   |    |       |    |     |    |   5 | 6 |    |    |   | 8 |     |   | 9 | 10 |   |    |
|   s8   |    |       |    |     |    |   5 |   |    |    |   |   |     |   | 9 |    |   |    |
|   s9   |    |       |    |  11 |    |     |   |    | 12 |   |   |   9 |   |   |    |   | 13 |
|   s10  |    |       |    |     |    |   5 | 6 |    |    |   | 8 |     |   | 9 |    |   |    |
|   s11  |    |       | 11 |     |    |     |   |    | 12 |   |   |     |   |   |    |   |    |
|   s12  |    |    14 |    |     |    |  15 |   | 16 | 12 |   |   |     |   |   |    |   |    |
|   s13  |    |       |    |  11 |    |     |   |    | 12 |   |   |     |   |   |    |   |    |
|   s14  | 14 |       |    |     |    |     |   |    | 12 |   |   |     |   |   |    |   |    |
|   s15  |    |    14 |    |     | 15 |     |   |    | 12 |   |   |     |   |   |    |   |    |
|   s16  |    |    14 |    |     |    |  15 |   |    | 12 |   |   |     |   |   |    |   |    |
+--------+----+-------+----+-----+----+-----+---+----+----+---+---+-----+---+---+----+---+----+

Trait Implementations§

source§

impl Clone for SessionDescription

source§

fn clone(&self) -> SessionDescription

Returns a copy of the value. Read more
1.0.0 · 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 Default for SessionDescription

source§

fn default() -> SessionDescription

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

impl From<SessionDescription> for String

source§

fn from(sdp: SessionDescription) -> String

Converts to this type from the input type.
source§

impl TryFrom<String> for SessionDescription

§

type Error = Error

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

fn try_from(sdp_string: String) -> Result<Self, Error>

Performs the conversion.

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> 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,

§

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>,

§

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>,

§

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