Struct sdp::description::session::SessionDescription
source · 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>
session_name: SessionName
s=<session name>
session_information: Option<Information>
i=<session description>
uri: Option<Url>
§email_address: Option<EmailAddress>
e=<email-address>
phone_number: Option<PhoneNumber>
p=<phone-number>
connection_information: Option<ConnectionInformation>
c=<nettype> <addrtype> <connection-address>
bandwidth: Vec<Bandwidth>
b=<bwtype>:<bandwidth>
time_descriptions: Vec<TimeDescription>
§time_zones: Vec<TimeZone>
z=<adjustment time> <offset> <adjustment time> <offset> ...
encryption_key: Option<EncryptionKey>
§attributes: Vec<Attribute>
§media_descriptions: Vec<MediaDescription>
Implementations§
source§impl SessionDescription
impl SessionDescription
Reset cleans the SessionDescription, and sets all fields back to their default values
sourcepub fn new_jsep_session_description(identity: bool) -> Self
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.
sourcepub fn with_property_attribute(self, key: String) -> Self
pub fn with_property_attribute(self, key: String) -> Self
WithPropertyAttribute adds a property attribute ‘a=key’ to the session description
sourcepub fn with_value_attribute(self, key: String, value: String) -> Self
pub fn with_value_attribute(self, key: String, value: String) -> Self
WithValueAttribute adds a value attribute ‘a=key:value’ to the session description
sourcepub fn with_fingerprint(self, algorithm: String, value: String) -> Self
pub fn with_fingerprint(self, algorithm: String, value: String) -> Self
WithFingerprint adds a fingerprint to the session description
sourcepub fn with_media(self, md: MediaDescription) -> Self
pub fn with_media(self, md: MediaDescription) -> Self
WithMedia adds a media description to the session description
sourcepub fn get_codec_for_payload_type(
&self,
payload_type: u8
) -> Result<Codec, Error>
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
sourcepub fn get_payload_type_for_codec(&self, wanted: &Codec) -> Result<u8, Error>
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
sourcepub fn attribute(&self, key: &str) -> Option<&String>
pub fn attribute(&self, key: &str) -> Option<&String>
Attribute returns the value of an attribute and if it exists
sourcepub fn marshal(&self) -> String
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)
sourcepub fn unmarshal<R: BufRead + Seek>(reader: &mut R) -> Result<Self, Error>
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
impl Clone for SessionDescription
source§fn clone(&self) -> SessionDescription
fn clone(&self) -> SessionDescription
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more