Expand description
Typed, validated attributes, and the RFC 8859 multiplexing categories. Typed, validated access to the attributes the WebRTC specifications use.
[SessionDescription::unmarshal] keeps every a=
line as a name and a value: RFC 8866 section 5.13 has an attribute that is not understood
ignored, and the parser cannot know which ones its caller understands. This module is
where a value gets its grammar. Each type parses the value of one attribute against the
ABNF of the RFC that defines it and prints it back in the form that RFC gives.
There are three ways in:
- The accessors on [
SessionDescription] and [MediaDescription]:mid(),rtpmaps(),candidates(),fingerprints(),simulcast()and so on. Each returnsErrwhen the attribute is present and malformed, so a caller can tell “absent” from “broken”. - The generic
typed::<T>()/typed_all::<T>()for anyTypedAttribute. - [
SessionDescription::validate], which checks every known attribute of a description at once, together with the level each may appear at.
| Attribute | Type | Defined in |
|---|---|---|
group | Group | RFC 5888, RFC 9143 |
mid | Mid | RFC 5888 |
msid, msid-semantic | Msid, MsidSemantic | RFC 8830 |
ssrc, ssrc-group | Ssrc, SsrcGroup | RFC 5576 |
rid | Rid | RFC 8851 |
simulcast | Simulcast | RFC 8853 |
extmap | ExtMap | RFC 8285 |
rtcp, rtcp-fb, rtcp-xr | Rtcp, RtcpFb, RtcpXr | RFC 3605, RFC 4585 / 5104, RFC 3611 |
rtpmap, fmtp | RtpMap, Fmtp | RFC 8866 |
ptime, maxptime, framerate | Ptime, MaxPtime, FrameRate | RFC 8866 |
imageattr | ImageAttr | RFC 6236 |
content | Content | RFC 4796 |
candidate, remote-candidates | Candidate, RemoteCandidates | RFC 8839 |
ice-ufrag, ice-pwd, ice-options, ice-pacing | IceUfrag, IcePwd, IceOptions, IcePacing | RFC 8839 |
fingerprint | Fingerprint | RFC 8122 |
setup | Setup | RFC 4145, RFC 8842 |
tls-id | TlsId | RFC 8842 |
identity | Identity | RFC 8827 |
sctp-port, max-message-size, sctpmap | SctpPort, MaxMessageSize, SctpMap | RFC 8841 |
Attributes without a value (rtcp-mux, rtcp-mux-only, rtcp-rsize, ice-lite,
end-of-candidates, bundle-only, extmap-allow-mixed, cryptex and the four
directions) are read with flag() or their named accessor, which refuses one that
carries a value.
mux holds the RFC 8859 multiplexing category of every attribute.
Modules§
- mux
- The RFC 8859 multiplexing category of every SDP attribute, as data.
Structs§
- Candidate
a=candidate:...(RFC 8839 section 5.1).- Content
a=content:<tag>[,<tag>...](RFC 4796 section 5): what a media stream shows.- Depend
a=depend:<dependent-fmt> <dependency-tag> *(";" SP <dependent-fmt> <dependency-tag>)(RFC 5583 section 5.2.2, the ABNF of the section’s code block). “There MUST be exactly one dependency-tag indicated per dependent-fmt”: a value naming a format twice is refused.- Dependency
- One
dependent-fmt SP dependency-tagofa=depend(RFC 5583 section 5.2.2): the format of this media description, its dependency type, and at most one identification tag with the formats of that media description it depends on (any of them suffices). - Fingerprint
a=fingerprint:<hash-func> <fingerprint>(RFC 8122 section 5).- Fmtp
a=fmtp:<format> <format specific parameters>(RFC 8866 section 6.15).- Frame
Rate a=framerate:<frame rate>(RFC 8866 section 6.13): the maximum video frame rate, in frames per second.- Group
a=group:<semantics> *(SP <identification-tag>)(RFC 5888 section 5).- IceOptions
a=ice-options:<tag> *(SP <tag>)(RFC 8839 section 5.6), each tag1*ice-char:trickle(RFC 8840),ice2(RFC 8445),renomination, …- IcePacing
a=ice-pacing:<ms>(RFC 8839 section 5.5):1*10DIGIT, the pacing of connectivity checks in milliseconds; 50 when the attribute is absent.- IcePwd
a=ice-pwd:<password>(RFC 8839 section 5.4):22*256ice-char.- IceUfrag
a=ice-ufrag:<ufrag>(RFC 8839 section 5.4):4*256ice-char.- Identity
a=identity:<assertion> *(SP <extension>)(RFC 8827 section 5).- Image
Attr a=imageattr:<pt> (send|recv) <attr-list> [(send|recv) <attr-list>](RFC 6236 section 3.1).- Image
Attr Set - One
[x=...,y=...,...]set of ana=imageattrline. - MaxMessage
Size a=max-message-size:<octets>(RFC 8841 section 6):1*DIGITwithout leading zeroes. 0 means the endpoint handles messages of any size; an absent attribute means 64 kilobytes.- MaxPtime
a=maxptime:<maximum packet time>(RFC 8866 section 6.5): the most media a packet may carry, in milliseconds.- Mid
a=mid:<identification-tag>(RFC 5888 section 4): a token.- Msid
a=msid:<msid-id> [SP <msid-appdata>](RFC 8830 section 2).- Msid
Semantic a=msid-semantic:<semantic> *(SP <msid-id>).- Ptime
a=ptime:<packet time>(RFC 8866 section 6.4): the length of media in a packet the receiver prefers, in milliseconds.- Remote
Candidate - One
component-id SP connection-address SP portof ana=remote-candidatesline. - Remote
Candidates a=remote-candidates:<component> <address> <port> ...(RFC 8839 section 5.2): the remote candidates the controlling agent uses, one per component.- Rid
a=rid:<rid-id> <direction> [pt=<fmt-list>;]<restriction>=<value>;...(RFC 8851 section 10).- Rtcp
a=rtcp:<port> [<nettype> <addrtype> <connection-address>](RFC 3605 section 2.1): the port, and optionally the address, RTCP is sent to when it is not the one after the RTP port.- Rtcp
Address - The address of an
a=rtcpline. - RtcpFb
a=rtcp-fb:<pt> <id> [<param> [<rest>]](RFC 4585 section 4.2).- RtcpXr
a=rtcp-xr:[<xr-format> *(SP <xr-format>)](RFC 3611 section 5.1). An empty list turns extended reports off.- RtpMap
a=rtpmap:<payload type> <encoding name>/<clock rate>[/<encoding params>](RFC 8866 section 6.6).- SctpMap
a=sctpmap:<port> <app> [<streams>](draft-ietf-mmusic-sctp-sdp-05), what data sections carried beforea=sctp-port: the SCTP port, the application protocol (webrtc-datachannel) and the number of streams.- Sctp
Port a=sctp-port:<port>(RFC 8841 section 5):1*5(DIGIT), 0 to 65535, “leading zeroes MUST NOT be used”.- Setup
a=setup:<role>(RFC 4145 section 4):active,passive,actpassorholdconn.- Simulcast
a=simulcast:<direction> <streams> [<direction> <streams>](RFC 8853 section 5.1).- Simulcast
Id - One
sc-idof ana=simulcastline: a rid-id, with~in front when the stream is initially paused (RFC 8853 section 5.1, RFC 7728). - Ssrc
a=ssrc:<ssrc-id> <attribute>[:<value>](RFC 5576 section 4.1): one source attribute of one synchronization source.- Ssrc
Group a=ssrc-group:<semantics> *(SP <ssrc-id>)(RFC 5576 section 4.2).- TlsId
a=tls-id:<id>(RFC 8842 section 4):20*255(tls-id-char),tls-id-char = ALPHA / DIGIT / "+" / "/" / "-" / "_".
Enums§
- Dependency
Type - A dependency type of
a=depend(RFC 5583 section 5.2.2):lay(layered),mdc(multiple description), or another token (“dependency types MUST be defined in a Standards-Track document”). - Image
Attr List - The attribute list of one direction of an
a=imageattrline. - Image
Attr Range - A range of an
a=imageattrset:xyrangeforx=andy=,srangeforsar=. - RidDirection
rid-dir: which way the restrictions of ana=ridline apply.- Rtcp
FbKind - What an
a=rtcp-fbline stands for: the feedback messages the specifications define, andRtcpFbKind::Otherfor the rest. - Rtcp
FbPayload Type rtcp-fb-pt: the formats ana=rtcp-fbline applies to.- Rtcp
XrFormat - One
xr-formatof ana=rtcp-xrline. - Rtcp
XrRtt Mode rcvr-rtt-mode.- Rtcp
XrStat Flag stat-flag: a statistic of thestat-summaryreport block.
Traits§
- Typed
Attribute - An attribute with a value whose grammar this crate knows.
Functions§
- check_
attribute - Checks one attribute’s value against the grammar of its name (RFC 9429 section 5.8: a
line that is not well formed rejects the description “even if the value is to be
discarded”): a known attribute’s value must parse as its type, a property attribute
(
rtcp-mux,sendrecv, …) must have none, and an unknown one needs only a token name and a value without NUL, CR or LF (RFC 8866 section 5.13). The checks across lines and levels ofSessionDescription::validateare not made.