rtciv0.5.0

rtci-sdp

SDP parsing and serialization (RFC 8866) with the attributes WebRTC negotiation uses. 10 public modules, 178 items at 0.5.0.

README

SDP parsing and serialization as WebRTC uses it: session and media sections, and typed attributes for codecs (rtpmap, fmtp, rtcp-fb), ICE, DTLS fingerprints, header extension maps, grouping (BUNDLE, FID, LS), simulcast and RID, SSRC attributes and decoding dependencies.

Specifications

  • RFC 8866, SDP; RFC 3264, the offer/answer model
  • RFC 9429, JSEP, for the attributes it uses
  • RFC 5576, source-specific attributes; RFC 5583, decoding dependencies; RFC 5888, grouping
  • RFC 8285 (extmap), RFC 8859 (attribute multiplexing categories), RFC 8888 (ccfb)

Clause-by-clause status, with the test that proves each clause: rfc8866, rfc3264, rfc5576, rfc5583, rfc8859.

Use

SessionDescription::unmarshal parses a description (ParseOptions names what else to accept), marshal writes it back, and the builders make one section by section. The JSEP logic (what an offer or answer contains) is in the root crate (rtci).

Sans-I/O

A parser and writer: strings in, typed descriptions out, and back. No I/O, no clock.

Licence

Licensed under either of the MIT licence or the Apache License, Version 2.0, at your option.

This crate is part of the rtci workspace, which descends from webrtc-rs/rtc and is developed independently; FORK.md lists what it carries over upstream. Upstream's licence and copyright notices are retained.

rtci_sdp

SDP parsing and serialization.

  • modattributeTyped, validated attributes, and the RFC 8859 multiplexing categories.
  • moddescriptionSession and media descriptions — the v=/m= structure of an SDP document.
  • moddirectionTransmission direction (sendrecv, sendonly, recvonly, inactive).
  • modextmapa=extmap RTP header-extension declarations and the well-known extension URIs.
  • modutilParsing helpers plus the codec and connection-role types shared across descriptions.
  • useMediaDescriptionfrom description::media::MediaDescriptionMediaDescription represents a media type.
  • useParseOptionsfrom description::session::ParseOptionsWhat SessionDescription::unmarshal_with_options accepts beyond the RFC 8866 grammar.
  • useSdpDecimalfrom description::session::SdpDecimalA decimal number of any length, 1*DIGIT: the <sess-id> and <sess-version> of an o= line (RFC 8866 section 9). The grammar sets no upper bound, so a compliant description may carry values beyond 64 bits (RFC 9429 section 5.2.1 has a JSEP endpoint generate them within 64 bits, and section 5.8 has it accept compliant SDP that does not follow its generation rules).
  • useSessionDescriptionfrom description::session::SessionDescriptionSessionDescription is a a well-defined format for conveying sufficient information to discover and participate in a multimedia session.

rtci_sdp::attribute

Typed, validated attributes, and the RFC 8859 multiplexing categories.

  • modmuxThe RFC 8859 multiplexing category of every SDP attribute, as data.
  • structCandidatefrom ice::Candidatea=candidate:... (RFC 8839 section 5.1).
  • structContentfrom rtp::Contenta=content:<tag>[,<tag>...] (RFC 4796 section 5): what a media stream shows.
  • structDependfrom grouping::Dependa=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.
  • structDependencyfrom grouping::DependencyOne dependent-fmt SP dependency-tag of a=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).
  • structFingerprintfrom security::Fingerprinta=fingerprint:<hash-func> <fingerprint> (RFC 8122 section 5).
  • structFmtpfrom rtp::Fmtpa=fmtp:<format> <format specific parameters> (RFC 8866 section 6.15).
  • structGroupfrom grouping::Groupa=group:<semantics> *(SP <identification-tag>) (RFC 5888 section 5).
  • structIceOptionsfrom ice::IceOptionsa=ice-options:<tag> *(SP <tag>) (RFC 8839 section 5.6), each tag 1*ice-char: trickle (RFC 8840), ice2 (RFC 8445), renomination, ...
  • structIcePacingfrom ice::IcePacinga=ice-pacing:<ms> (RFC 8839 section 5.5): 1*10DIGIT, the pacing of connectivity checks in milliseconds; 50 when the attribute is absent.
  • structIdentityfrom security::Identitya=identity:<assertion> *(SP <extension>) (RFC 8827 section 5).
  • structImageAttrfrom rtp::ImageAttra=imageattr:<pt> (send|recv) <attr-list> [(send|recv) <attr-list>] (RFC 6236 section 3.1).
  • structImageAttrSetfrom rtp::ImageAttrSetOne [x=...,y=...,...] set of an a=imageattr line.
  • structMaxMessageSizefrom sctp::MaxMessageSizea=max-message-size:<octets> (RFC 8841 section 6): 1*DIGIT without leading zeroes. 0 means the endpoint handles messages of any size; an absent attribute means 64 kilobytes.
  • structMsidfrom grouping::Msida=msid:<msid-id> [SP <msid-appdata>] (RFC 8830 section 2).
  • structMsidSemanticfrom grouping::MsidSemantica=msid-semantic:<semantic> *(SP <msid-id>).
  • structRemoteCandidatefrom ice::RemoteCandidateOne component-id SP connection-address SP port of an a=remote-candidates line.
  • structRemoteCandidatesfrom ice::RemoteCandidatesa=remote-candidates:<component> <address> <port> ... (RFC 8839 section 5.2): the remote candidates the controlling agent uses, one per component.
  • structRidfrom simulcast::Rida=rid:<rid-id> <direction> [pt=<fmt-list>;]<restriction>=<value>;... (RFC 8851 section 10).
  • structRtcpfrom rtcp::Rtcpa=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.
  • structRtcpAddressfrom rtcp::RtcpAddressThe address of an a=rtcp line.
  • structRtcpFbfrom rtcp::RtcpFba=rtcp-fb:<pt> <id> [<param> [<rest>]] (RFC 4585 section 4.2).
  • structRtcpXrfrom rtcp::RtcpXra=rtcp-xr:[<xr-format> *(SP <xr-format>)] (RFC 3611 section 5.1). An empty list turns extended reports off.
  • structRtpMapfrom rtp::RtpMapa=rtpmap:<payload type> <encoding name>/<clock rate>[/<encoding params>] (RFC 8866 section 6.6).
  • structSctpMapfrom sctp::SctpMapa=sctpmap:<port> <app> [<streams>] (draft-ietf-mmusic-sctp-sdp-05), what data sections carried before a=sctp-port: the SCTP port, the application protocol (webrtc-datachannel) and the number of streams.
  • structSctpPortfrom sctp::SctpPorta=sctp-port:<port> (RFC 8841 section 5): 1*5(DIGIT), 0 to 65535, "leading zeroes MUST NOT be used".
  • structSetupfrom security::Setupa=setup:<role> (RFC 4145 section 4): active, passive, actpass or holdconn.
  • structSimulcastfrom simulcast::Simulcasta=simulcast:<direction> <streams> [<direction> <streams>] (RFC 8853 section 5.1).
  • structSimulcastIdfrom simulcast::SimulcastIdOne sc-id of an a=simulcast line: a rid-id, with ~ in front when the stream is initially paused (RFC 8853 section 5.1, RFC 7728).
  • structSsrcfrom source::Ssrca=ssrc:<ssrc-id> <attribute>[:<value>] (RFC 5576 section 4.1): one source attribute of one synchronization source.
  • structSsrcGroupfrom source::SsrcGroupa=ssrc-group:<semantics> *(SP <ssrc-id>) (RFC 5576 section 4.2).
  • enumDependencyTypefrom grouping::DependencyTypeA 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").
  • enumImageAttrListfrom rtp::ImageAttrListThe attribute list of one direction of an a=imageattr line.
  • enumImageAttrRangefrom rtp::ImageAttrRangeA range of an a=imageattr set: xyrange for x= and y=, srange for sar=.
  • enumRidDirectionfrom simulcast::RidDirectionrid-dir: which way the restrictions of an a=rid line apply.
  • enumRidIdGrammarfrom simulcast::RidIdGrammarThe rid-id grammar a line is read with.
  • enumRtcpFbKindfrom rtcp::RtcpFbKindWhat an a=rtcp-fb line stands for: the feedback messages the specifications define, and RtcpFbKind::Other for the rest.
  • enumRtcpFbPayloadTypefrom rtcp::RtcpFbPayloadTypertcp-fb-pt: the formats an a=rtcp-fb line applies to.
  • enumRtcpXrFormatfrom rtcp::RtcpXrFormatOne xr-format of an a=rtcp-xr line.
  • enumRtcpXrRttModefrom rtcp::RtcpXrRttModercvr-rtt-mode.
  • enumRtcpXrStatFlagfrom rtcp::RtcpXrStatFlagstat-flag: a statistic of the stat-summary report block.
  • traitTypedAttributeAn attribute with a value whose grammar this crate knows.
  • fncheck_attributefrom validate::check_attributeChecks 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 …
  • useConferenceTypefrom informational::ConferenceType
  • useFrameRatefrom rtp::FrameRate
  • useIcePwdfrom ice::IcePwd
  • useIceUfragfrom ice::IceUfrag
  • useMaxPtimefrom rtp::MaxPtime
  • useMidfrom grouping::Mid
  • useOrientfrom informational::Orient
  • usePtimefrom rtp::Ptime
  • useQualityfrom informational::Quality
  • useTlsIdfrom security::TlsId
  • useToolfrom informational::Tool

rtci_sdp::attribute::mux

The RFC 8859 multiplexing category of every SDP attribute, as data.

  • structAttributeInfoOne row of the table.
  • enumAttributeLevelWhere an attribute may appear.
  • enumMuxCategoryHow the values of an attribute in the m= sections of one BUNDLE group relate (RFC 8859 section 4).
  • fnattributeThe row of the attribute name, or None for an attribute without a registered multiplexing category (RFC 8859 section 4.9 treats those as TBD: not to be multiplexed until analysed; a WebRTC endpoint simply ignores an attribute it does not know).
  • fnbandwidthThe category of a b= modifier (RFC 8859 section 6): CT is NORMAL; AS, RS and RR are SUM; TIAS is SPECIAL.
  • fncategoryThe multiplexing category of the attribute name.
  • fncontentThe category of an a=content value (RFC 8859 section 12): all NORMAL.
  • fngroup_semanticsThe category of an a=group semantics (RFC 8859 section 8; RFC 9143 for BUNDLE): ANAT is CAUTION, the others NORMAL.
  • fnrtcp_fbThe category of an a=rtcp-fb line (RFC 8859 section 7): IDENTICAL-PER-PT for ack, nack, trr-int and ccm with the parameters the RFC lists, SPECIAL for ack app and nack app, IDENTICAL for nack ecn. None for a feedback type RFC 8859 does not classify (goog-remb, transport-cc, ...); those follow the attribute's own category, IDENTICAL-PER-PT.
  • fnsource_attributeThe category of a source attribute, the ones written inside a=ssrc (RFC 8859 section 5.15): cname and previous-ssrc are NORMAL, fmtp is IDENTICAL-PER-PT.
  • fnssrc_group_semanticsThe category of an a=ssrc-group semantics (RFC 8859 section 9): all NORMAL.

rtci_sdp::description

Session and media descriptions — the v=/m= structure of an SDP document.

  • modcommonField types shared by session and media descriptions (c=, b=, a=).
  • modmediaThe m= media description and its fields.
  • modsessionThe whole session description, plus the well-known attribute keys.

rtci_sdp::description::common

Field types shared by session and media descriptions (c=, b=, a=).

  • structAddressAddress describes a structured address token from within the "c=" field.
  • structAttributeAttribute describes the "a=" field which represents the primary means for extending SDP.
  • structBandwidthBandwidth describes an optional field which denotes the proposed bandwidth to be used by the session or media.
  • structConnectionInformationConnectionInformation defines the representation for the "c=" field containing connection data.
  • enumBandwidthKindThe bandwidth modifiers (bwtype) the WebRTC specifications use.
  • typeEncryptionKeyEncryptionKey describes the "k=" line. RFC 8866 section 5.12 made it obsolete: it "MUST NOT be included in an SDP description and MUST be discarded if received", so the parser checks its syntax and drops it, and nothing writes one.
  • typeInformationInformation describes the "i=" field which provides textual information about the session.

rtci_sdp::description::media

The m= media description and its fields.

  • structMediaDescriptionMediaDescription represents a media type.
  • structMediaNameMediaName describes the "m=" field storage structure.
  • structRangedPortRangedPort supports special format for the media field "m=" port value. If it may be necessary to specify multiple transport ports, the protocol allows to write it as: <port>/<number of ports> where number of ports is a an offsetting range.
  • constEXT_MAP_VALUE_TRANSPORT_CC_KEYConstants for extmap key
  • constEXT_MAP_VALUE_TRANSPORT_CC_URIThe transport-wide congestion control header-extension URI.

rtci_sdp::description::session

The whole session description, plus the well-known attribute keys.

  • structOriginOrigin defines the structure for the "o=" field which provides the originator of the session plus a session identifier and version number.
  • structParseOptionsWhat SessionDescription::unmarshal_with_options accepts beyond the RFC 8866 grammar.
  • structRepeatTimeRepeatTime describes the "r=" fields of the session description which represents the intervals and durations for repeated scheduled sessions.
  • structSdpDecimalA decimal number of any length, 1*DIGIT: the <sess-id> and <sess-version> of an o= line (RFC 8866 section 9). The grammar sets no upper bound, so a compliant description may carry values beyond 64 bits (RFC 9429 section 5.2.1 has a JSEP endpoint generate them within 64 bits, and section 5.8 has it accept compliant SDP that does not follow its generation rules).
  • structSdpParseErrorA description that does not parse, and where: what SessionDescription::parse_located returns.
  • structSessionDescriptionSessionDescription is a a well-defined format for conveying sufficient information to discover and participate in a multimedia session.
  • structTimeDescriptionTimeDescription describes the "t=", "r=" and "z=" fields of the session description, which specify the start and stop times of a session, its repeat intervals and durations, and the time zone adjustments of those repetitions.
  • structTimeZoneTimeZone is one <adjustment time> <offset> pair of a "z=" line, which describes repeated sessions scheduling.
  • structTimingTiming defines the "t=" field's structured representation for the start and stop times.
  • enumCharsetThe character set of a description's charset-dependent fields (s=, i=), from its a=charset (RFC 8866 section 6.10).
  • typeEmailAddressEmailAddress describes a structured representations for the "e=" line which specifies email contact information for the person responsible for the conference.
  • typePhoneNumberPhoneNumber describes a structured representations for the "p=" line specify phone contact information for the person responsible for the conference.
  • typeSessionNameSessionName describes a structured representations for the "s=" field and is the textual session name.
  • typeVersionVersion describes the value provided by the "v=" field which gives the version of the Session Description Protocol.
  • constATTR_KEY_BUNDLE_ONLYa=bundle-only: the section is used only inside its BUNDLE group (RFC 9143).
  • constATTR_KEY_CANDIDATEConstants for SDP attributes used in JSEP
  • constATTR_KEY_CHARSETThe a=charset attribute (RFC 8866 section 6.10).
  • constATTR_KEY_CONNECTION_SETUPa=setup: the DTLS role — active, passive or actpass.
  • constATTR_KEY_CONTENTa=content: what a media stream shows (RFC 4796).
  • constATTR_KEY_CRYPTEXa=cryptex: RTP header extensions and CSRCs are encrypted (RFC 9335).
  • constATTR_KEY_END_OF_CANDIDATESa=end-of-candidates: ICE gathering for this section is complete.
  • constATTR_KEY_EXT_MAPa=extmap: maps an RTP header-extension URI to an id.
  • constATTR_KEY_EXTMAP_ALLOW_MIXEDa=extmap-allow-mixed: one- and two-byte header extensions may be mixed.
  • constATTR_KEY_FINGERPRINTa=fingerprint: a certificate fingerprint (RFC 8122).
  • constATTR_KEY_FMTPa=fmtp: format-specific parameters.
  • constATTR_KEY_FRAMERATEa=framerate: the maximum video frame rate.
  • constATTR_KEY_GROUPa=group: groups m-lines, as BUNDLE does.
  • constATTR_KEY_ICE_OPTIONSa=ice-options: the ICE options the agent supports.
  • constATTR_KEY_ICE_PACINGa=ice-pacing: the ICE pacing interval, in milliseconds.
  • constATTR_KEY_ICE_PWDa=ice-pwd: the ICE password.
  • constATTR_KEY_ICE_UFRAGa=ice-ufrag: the ICE user name fragment.
  • constATTR_KEY_ICELITEa=ice-lite: the endpoint is an ICE-lite implementation.
  • constATTR_KEY_IDENTITYa=identity: an identity assertion for the session.
  • constATTR_KEY_IMAGEATTRa=imageattr: image sizes a payload type sends or receives (RFC 6236).
  • constATTR_KEY_INACTIVEa=inactive: neither send nor receive.
  • constATTR_KEY_MAX_MESSAGE_SIZEa=max-message-size: the largest SCTP message this endpoint accepts.
  • constATTR_KEY_MAXPTIMEa=maxptime: the longest packet duration, in milliseconds.
  • constATTR_KEY_MIDa=mid: the media identification tag that names this m-line.
  • constATTR_KEY_MSIDa=msid: associates a track with a media stream.
  • constATTR_KEY_MSID_SEMANTICa=msid-semantic: declares the semantics used by a=msid.
  • constATTR_KEY_PTIMEa=ptime: the preferred packet duration, in milliseconds.
  • constATTR_KEY_RECV_ONLYa=recvonly: receive only.
  • constATTR_KEY_REMOTE_CANDIDATESa=remote-candidates: the remote candidates the controlling agent selected.
  • constATTR_KEY_RIDa=rid: an RTP stream identifier and its restrictions (RFC 8851).
  • constATTR_KEY_RTCPa=rtcp: the RTCP port and address (RFC 3605).
  • constATTR_KEY_RTCP_FBa=rtcp-fb: an RTCP feedback capability (RFC 4585).
  • constATTR_KEY_RTCP_XRa=rtcp-xr: RTCP extended reports (RFC 3611).
  • constATTR_KEY_RTCPMUXa=rtcp-mux: RTP and RTCP share one port.
  • constATTR_KEY_RTCPMUX_ONLYa=rtcp-mux-only: RTP and RTCP share one port and nothing else is supported (RFC 8858).
  • constATTR_KEY_RTCPRSIZEa=rtcp-rsize: reduced-size RTCP is supported.
  • constATTR_KEY_RTPMAPa=rtpmap: the codec of a payload type.
  • constATTR_KEY_SCTP_PORTa=sctp-port: the SCTP port (RFC 8841).
  • constATTR_KEY_SCTPMAPa=sctpmap: the SCTP association of an old-style data section (draft-ietf-mmusic-sctp-sdp-05; replaced by a=sctp-port).
  • constATTR_KEY_SEND_ONLYa=sendonly: send only.
  • constATTR_KEY_SEND_RECVa=sendrecv: send and receive.
  • constATTR_KEY_SIMULCASTa=simulcast: the simulcast streams of a media section (RFC 8853).
  • constATTR_KEY_SSRCa=ssrc: declares an SSRC and its attributes.
  • constATTR_KEY_SSRC_GROUPa=ssrc-group: relates SSRCs, such as an RTX stream to its primary.
  • constATTR_KEY_TLS_IDa=tls-id: the DTLS association identifier (RFC 8842).
  • constMAX_ATTRIBUTES_PER_SECTIONThe most a= lines SessionDescription::unmarshal accepts at the session level, and in each m= section.
  • constMAX_FORMATS_PER_MEDIAThe most formats SessionDescription::unmarshal accepts on one m= line. RTP payload types are 7 bits, so 128 distinct values exist.
  • constMAX_MEDIA_DESCRIPTIONSThe most m= sections SessionDescription::unmarshal accepts in one session description.
  • constMAX_SDP_LINESThe most lines SessionDescription::unmarshal accepts in one session description.
  • constMAX_SDP_SIZEThe largest session description, in bytes, SessionDescription::unmarshal accepts. Real offers and answers are a few to a few hundred kilobytes.
  • constNTP_UNIX_EPOCH_OFFSET_SECSThe seconds from the NTP epoch (1900-01-01 UTC) to the Unix epoch: RFC 8866 section 5.2 recommends "a timestamp, in seconds since January 1, 1900 UTC" for <sess-id> and, "as with <sess-id>", for <sess-version>.
  • constSEMANTIC_TOKEN_BUNDLEBUNDLE: the m= sections share one transport (RFC 9143).
  • constSEMANTIC_TOKEN_FLOW_IDENTIFICATIONFID: flow identification — the SSRCs carry the same content, as RTX does.
  • constSEMANTIC_TOKEN_FORWARD_ERROR_CORRECTIONFEC: one SSRC carries error-correction data for another.
  • constSEMANTIC_TOKEN_FORWARD_ERROR_CORRECTION_FRAMEWORKFEC-FR: the FEC framework grouping semantic.
  • constSEMANTIC_TOKEN_LIP_SYNCHRONIZATIONConstants for semantic tokens used in JSEP
  • constSEMANTIC_TOKEN_WEBRTC_MEDIA_STREAMSWMS: WebRTC media streams, used with a=msid-semantic.

rtci_sdp::direction

Transmission direction (sendrecv, sendonly, recvonly, inactive).

  • enumDirectionDirection is a marker for transmission direction of an endpoint

rtci_sdp::extmap

a=extmap RTP header-extension declarations and the well-known extension URIs.

rtci_sdp::util

Parsing helpers plus the codec and connection-role types shared across descriptions.

  • structCodecOne codec offered by a media section, assembled from its a=rtpmap, a=fmtp and a=rtcp-fb attributes.
  • enumConnectionRoleConnectionRole indicates which of the end points should initiate the connection establishment
  • constATTRIBUTE_KEYThe a= line prefix.

Generated from the sources of rtci-sdp 0.5.0 at its release tag. Items made by macros and methods are on docs.rs.