xeps/xep-0343.xml

374 líneas
18 KiB
XML

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
<!ENTITY % ents SYSTEM 'xep.ent'>
<!ENTITY SCTPMAP "&lt;sctpmap/&gt;">
<!ENTITY FINGERPRINT "&lt;fingerprint/&gt;">
<!ENTITY webrtc-protocol "<span class='ref'><link url='http://tools.ietf.org/html/draft-jesup-rtcweb-data-protocol-04'>WebRTC Data Channel Protocol</link></span> <note>WebRTC Data Channel Protocol &lt;<link url='http://tools.ietf.org/html/draft-jesup-rtcweb-data-protocol-04'>http://tools.ietf.org/html/draft-jesup-rtcweb-data-protocol-04</link>&gt;.</note>" >
<!ENTITY w3-webrtc-draft "<span class='ref'><link url='http://www.w3.org/TR/2013/WD-webrtc-20130910/'>WebRTC 1.0: Real-time Communication Between Browsers</link></span> <note>WebRTC 1.0: Real-time Communication Between Browsers &lt;<link url='http://www.w3.org/TR/2013/WD-webrtc-20130910/'>http://www.w3.org/TR/2013/WD-webrtc-20130910/</link>&gt;.</note>" >
<!ENTITY rfc3758 "<span class='ref'><link url='http://tools.ietf.org/html/rfc3758'>RFC 3758</link></span> <note>RFC 3758: Stream Control Transmission Protocol (SCTP) Partial Reliability Extension &lt;<link url='http://tools.ietf.org/html/rfc3758'>http://tools.ietf.org/html/rfc3758</link>&gt;.</note>" >
%ents;
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
<title>Signaling WebRTC datachannels in Jingle</title>
<abstract>This specification defines how to use the ICE-UDP Jingle transport method to send media data using WebRTC DataChannels, so technically uses DTLS/SCTP on top of the Interactive Connectivity Establishment (ICE) methodology, which provides robust NAT traversal for media traffic.</abstract>
&LEGALNOTICE;
<number>0343</number>
<status>Deferred</status>
<type>Standards Track</type>
<sig>Standards</sig>
<approver>Council</approver>
<dependencies>
<spec>XEP-0176</spec>
<spec>XEP-0320</spec>
</dependencies>
<supersedes/>
<supersededby/>
<shortname>jingle-webrtc-datachannels</shortname>
<author>
<firstname>Jens</firstname>
<surname>Bavendiek</surname>
<email>bavendiek@dbis.rwth-aachen.de</email>
</author>
<revision>
<version>0.3.1</version>
<date>2020-03-20</date>
<initials>ri0n</initials>
<remark>Fix attribute name (xmlns) in example</remark>
</revision>
<revision>
<version>0.3</version>
<date>2017-09-11</date>
<initials>XEP Editor (jwi)</initials>
<remark>Defer due to lack of activity.</remark>
</revision>
<revision>
<version>0.2</version>
<date>2014-07-15</date>
<initials>ph</initials>
<remark><p>Add optional explicit signaling of channels to the transport element.</p></remark>
</revision>
<revision>
<version>0.1</version>
<date>2014-01-23</date>
<initials>psa</initials>
<remark><p>Initial published version approved by the XMPP Council.</p></remark>
</revision>
<revision>
<version>0.0.1</version>
<date>2013-12-03</date>
<initials>jab</initials>
<remark><p>First draft.</p></remark>
</revision>
</header>
<section1 topic='Introduction' anchor='intro'>
<p>This document specifies a method for establishing a direct connection using SCTP channels over DTLS. As WebRTC supports the SCTP partial reliability extension (see &rfc3758;), the connection established can either be reliable or partial-reliable. However due to the wider use (e.g. &xep0234;) and easier maintenance, this transport method defines the mandatory use of reliable and in-order-delivery datachannels (thus a streaming transport). If the need for partial-reliability is there, a second specification for datagram type datachannels might be created. The establishment of this connection is managed by &xep0176;. The establishment of security provided by DTLS is described in &xep0320;.</p>
</section1>
<section1 topic='Use Cases' anchor='usecases'>
<p>There are several use cases. Given below are a few examples:</p>
<ol>
<li>Two parties engaged in a WebRTC-based video conference want to share a file via &xep0234;</li>
<li>A browser application that uses XMPP for communication wants to support file-transfer</li>
<li>A browser based application wants to send a file to a non-browser client</li>
</ol>
</section1>
<section1 topic='Jingle Conformance' anchor='conformance'>
<p>In accordance with Section 10 of <cite>XEP-0166</cite>, this document specifies the following information related to the Jingle DTLS/SCTP transport method:</p>
<ol>
<li><p>The transport negotiation process is defined in the <link url='#protocol'>Protocol Description</link> section of this document.</p></li>
<li><p>The semantics of the &SCTPMAP; element are defined in the <link url='#protocol-syntax'>Syntax</link> section of this document.</p></li>
</ol>
</section1>
<section1 topic='Protocol Description' anchor='protocol'>
<p>This protocol requires the Stream Control Transmission Protocol (SCTP) to run within the security context of the Datagram Transport Layer Security (DTLS) protocol. As determined by <cite>RTCWeb Data Channels</cite> running SCTP on top of DTLS is preferred, as in this order the control messages are encrypted as well and the DTLS channel can be shared with several applications</p>
<section2 topic='Session Initiation' anchor='protocol-initiate'>
<p>In order for the initiator in a Jingle exchange to start the negotiation, it sends a Jingle "session-initiate" stanza that includes at least one content type, as described in <cite>XEP-0166</cite>. If the initiator wishes to negotiate the SCTP transport method for an application format, it MUST include a &SCTPMAP; child element qualified by the 'urn:xmpp:jingle:transports:dtls-sctp:1' namespace &VNOTE;. The &TRANSPORT; element SHOULD in turn contain one &CANDIDATE; element for each of the initiator's higher-priority transport candidates as determined in accordance with the ICE methodology, but MAY instead be empty (with each candidate to be sent as the payload of a transport-info message).</p>
<example caption="Initiation"><![CDATA[
<iq from='romeo@montague.lit/orchard'
id='ixt174g9'
to='juliet@capulet.lit/balcony'
type='set'>
<jingle xmlns='urn:xmpp:jingle:1'
action='session-initiate'
initiator='romeo@montague.lit/orchard'
sid='a73sjjvkla37jfea'>
<content creator='initiator' name='file-552da749930852c69ae5d2141d3766b1'>
<description xmlns='urn:xmpp:jingle:apps:file-transfer:3'>
<offer>
<file>
<date>1969-07-21T02:56:15Z</date>
<desc>This is a test. If this were a real file...</desc>
<name>test.txt</name>
<range/>
<size>1022</size>
<hash xmlns='urn:xmpp:hashes:1' algo='sha-1'>552da749930852c69ae5d2141d3766b1</hash>
</file>
</offer>
</description>
<transport xmlns='urn:xmpp:jingle:transports:ice-udp:1'
pwd='asd88fgpdd777uzjYhagZg'
ufrag='8hhy'>
<sctpmap xmlns='urn:xmpp:jingle:transports:dtls-sctp:1' number='5000' protocol='webrtc-datachannel' streams='1024'/>
<fingerprint xmlns='urn:xmpp:jingle:apps:dtls:0' hash='sha-256' setup='actpass'>
02:1A:CC:54:27:AB:EB:9C:53:3F:3E:4B:65:2E:7D:46:3F:54:42:CD:54:F1:7A:03:A2:7D:F9:B0:7F:46:19:B2
</fingerprint>
<candidate component='1'
foundation='1'
generation='0'
id='el0747fg11'
ip='10.0.1.1'
network='1'
port='8998'
priority='2130706431'
protocol='udp'
type='host'/>
<candidate component='1'
foundation='2'
generation='0'
id='y3s2b30v3r'
ip='192.0.2.3'
network='1'
port='45664'
priority='1694498815'
protocol='udp'
rel-addr='10.0.1.1'
rel-port='8998'
type='srflx'/>
</transport>
</content>
</jingle>
</iq>
]]></example>
<p>As seen in the example, there is no notion about DataChannel internals. The only things negotiated here are the port on which the SCTP Stream runs and the name of the DataChannel. Further negotiation is happening through the &webrtc-protocol;, thus the DataChannel is identified through the content name.</p>
<p>For some uses like negotiated datachannels, it might be required to explicitly signal the channel properties. This is done by including a &lt;channel/&gt; element qualified by the 'urn:xmpp:jingle:transports:webrtc-datachannel:0' namespace &VNOTE; as child of the &TRANSPORT; for each channel that has to be signaled. An abbreviated example follows:</p>
<example caption="Initiation (with explicit channel signaling)"><![CDATA[
[...]
<transport xmlns='urn:xmpp:jingle:transports:ice-udp:1'
pwd='asd88fgpdd777uzjYhagZg'
ufrag='8hhy'>
<sctpmap xmlns='urn:xmpp:jingle:transports:dtls-sctp:1' number='5000' protocol='webrtc-datachannel' streams='1024'/>
<channel xmlns='urn:xmpp:jingle:transports:webrtc-datachannel:0' id="1" negotiated="true"/>
<channel xmlns='urn:xmpp:jingle:transports:webrtc-datachannel:0' id="3" negotiated="true"/>
<fingerprint mlns='urn:xmpp:jingle:apps:dtls:0' hash='sha-256' setup='actpass'>
[...]
]]></example>
</section2>
<section2 topic='Syntax' anchor='protocol-syntax'>
<p>The values and names for the &SCTPMAP; element are taken from the corresponding SDP. The attributes of the &lt;sctpmap/&gt; element are as follows.</p>
<table caption='Sctpmap Attributes'>
<tr>
<th>Name</th>
<th>Description</th>
<th>SDP Syntax</th>
<th>Example</th>
</tr>
<tr>
<td>port</td>
<td>A port number where the channel is to be contacted</td>
<td>Port value in a=sctpmap line</td>
<td>5000</td>
</tr>
<tr>
<td>protocol</td>
<td>Media format</td>
<td>Protocol value in a=sctpmap line</td>
<td>webrtc-datachannel</td>
</tr>
<tr>
<td>streams</td>
<td>Number of supported incoming streams</td>
<td>Stream value in a=sctpmap line</td>
<td>16</td>
</tr>
</table>
<p>The attributes of the &lt;channel/&gt; element map directly to the attributes of the <link url="http://www.w3.org/TR/2013/WD-webrtc-20130910/#dictionary-rtcdatachannelinit-members">RTCDataChannelInit</link> dictionary as defined in &w3-webrtc-draft;.</p>
</section2>
<section2 topic='Response' anchor='protocol-response'>
<p>As described in <cite>XEP-0166</cite>, to acknowledge receipt of the session initiation request, the responder immediately returns an IQ-result.</p>
<example caption="Responder acknowledges receipt of session-initiate request"><![CDATA[
<iq from='juliet@capulet.lit/balcony'
id='ixt174g9'
to='romeo@montague.lit/orchard'
type='result'/>
]]></example>
<p>Depending on the application type, a user agent controlled by a human user might need to wait for the user to affirm a desire to proceed with the session before continuing. When the user agent has received such affirmation (or if the user agent can automatically proceed for any reason, e.g. because no human intervention is expected or because a human user has configured the user agent to automatically accept sessions with a given entity), it returns a Jingle session-accept message. This message MUST contain a &TRANSPORT; element qualified by the 'urn:xmpp:jingle:transports:ice-udp:1' namespace, which SHOULD in turn contain one &SCTPMAP; element qualified by the 'urn:xmpp:jingle:transports:dtls-sctp:1' namespace for the channel used by the responder.</p>
<p>Note: See the <link url='#security'>Security Considerations</link> section of this document regarding the exposure of IP addresses by the responder's client.</p>
<example caption="Responder accepts the session request"><![CDATA[
<iq from='juliet@capulet.lit/balcony'
id='rw782g55'
to='romeo@montague.lit/orchard'
type='set'>
<jingle xmlns='urn:xmpp:jingle:1'
action='session-accept'
initiator='romeo@montague.lit/orchard'
responder='juliet@capulet.lit/balcony'
sid='a73sjjvkla37jfea'>
<content creator='initiator' name='file-552da749930852c69ae5d2141d3766b1'>
<description xmlns='urn:xmpp:jingle:apps:file-transfer:3'>
<offer>
<file>
<date>1969-07-21T02:56:15Z</date>
<desc>This is a test. If this were a real file...</desc>
<name>test.txt</name>
<range/>
<size>1022</size>
<hash xmlns='urn:xmpp:hashes:1' algo='sha-1'>552da749930852c69ae5d2141d3766b1</hash>
</file>
</offer>
</description>
<transport xmlns='urn:xmpp:jingle:transports:ice-udp:1'
pwd='YH75Fviy6338Vbrhrlp8Yh'
ufrag='9uB6'>
<fingerprint xmlns='urn:xmpp:jingle:apps:dtls:0' hash='sha-256' setup='actpass'>
02:1A:CC:54:27:AB:EB:9C:53:3F:3E:4B:65:2E:7D:46:3F:54:42:CD:54:F1:7A:03:A2:7D:F9:B0:7F:46:19:B2
</fingerprint>
<sctpmap xmlns='urn:xmpp:jingle:transports:dtls-sctp:1' number='5000' protocol='webrtc-datachannel' streams='1024'/>
<candidate component='1'
foundation='1'
generation='0'
id='or2ii2syr1'
ip='192.0.2.1'
network='0'
port='3478'
priority='2130706431'
protocol='udp'
type='host'/>
</transport>
</content>
</jingle>
</iq>
]]></example>
<p>The initiator acknowledges the Jingle session-accept.</p>
<example caption="Initiator acknowledges session-accept."><![CDATA[
<iq from='juliet@capulet.lit/balcony'
id='ixt174g9'
to='romeo@montague.lit/orchard'
type='result'/>
]]></example>
</section2>
<section2 topic='Adding a new channel' anchor='protocol-add'>
<p>Even after media has begun to flow, either party MAY continue to send additional channels to the other party (e.g., because the user wants to transmit a new file). Such events are shared by sending a content-add message.</p>
<example caption="Initiator sends a content-add"><![CDATA[
<iq from='romeo@montague.lit/orchard'
id='uh3g1f48'
to='juliet@capulet.lit/balcony'
type='set'>
<jingle xmlns='urn:xmpp:jingle:1'
action='content-add'
initiator='romeo@montague.lit/orchard'
sid='a73sjjvkla37jfea'>
<content creator='initiator' name='this-is-the-new-content'>
<description xmlns='urn:xmpp:jingle:apps:some-file' media='file'/>
<transport xmlns='urn:xmpp:jingle:transports:ice-udp:1'/>
</content>
</jingle>
</iq>
]]></example>
<p>The receiving party MUST acknowledge receipt.</p>
<example caption="Recipient acknowledges receipt"><![CDATA[
<iq from='juliet@capulet.lit/balcony'
id='uh3g1f48'
to='romeo@montague.lit/orchard'
type='result'/>
]]></example>
</section2>
</section1>
<section1 topic='Security Considerations' anchor='security'>
<p>By design is the sent media already encrypted by the DTLS layer</p>
</section1>
<section1 topic='Acknowledgements' anchor='acks'>
<p>Special thanks to István Koren at i5 and their <link url='http://dbis.rwth-aachen.de/cms/projects/the-xmpp-experience/'>XMPP Experience</link></p>
<p>Thanks to Philipp Hancke and Tobias Markmann for their help and support and all the XEP-Authors for their examples.</p>
</section1>
<section1 topic='IANA Considerations' anchor='iana'>
<p>This document requires no interaction with &IANA;.</p>
</section1>
<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
<section2 topic='Protocol Namespaces' anchor='registrar-ns'>
<p>This specification defines the following XML namespace:</p>
<ul>
<li>urn:xmpp:jingle:transports:dtls-sctp:1</li>
<li>urn:xmpp:jingle:transports:webrtc-datachannel:0</li>
</ul>
<p>The &REGISTRAR; includes the foregoing namespace in its registry at &NAMESPACES;, as governed by &xep0053;.</p>
</section2>
<section2 topic='Protocol Versioning' anchor='registrar-versioning'>
&NSVER;
</section2>
<section2 topic='SCTP Mapping' anchor='registrar-features'>
<p>The registry submission is as follows.</p>
<code><![CDATA[
<var>
<name>IETF Draft MMUSIC</name>
<desc>
Signals support for SCTP in the SDP as described in draft-ietf-mmusic-sctp-sdp-05
</desc>
<doc>XEP-SCTP</doc>
</var>
]]></code>
</section2>
</section1>
<section1 topic='XML Schema' anchor='schema'>
<code><![CDATA[
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
targetNamespace='urn:xmpp:jingle:transports:dtls-sctp:1'
xmlns='urn:xmpp:jingle:transports:dtls-sctp:1'
elementFormDefault='qualified'>
<xs:annotation>
<xs:documentation>
The protocol documented by this schema is defined in
XEP-0343: http://www.xmpp.org/extensions/xep-0343.html
</xs:documentation>
</xs:annotation>
<xs:element name='sctpmap'>
<xs:complexType>
<xs:simpleContent>
<xs:extension base='xs:string'>
<xs:attribute name='number' type='xs:unsignedByte' use='required'/>
<xs:attribute name='protocol' type='xs:string' use='required'/>
<xs:attribute name='streams' type='xs:positiveInteger' use='optional'/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:schema>
<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
targetNamespace='urn:xmpp:jingle:transports:webrtc-datachannel:0'
xmlns='urn:xmpp:jingle:transports:webrtc-datachannel:0'
elementFormDefault='qualified'>
<xs:annotation>
<xs:documentation>
The protocol documented by this schema is defined in
XEP-0343: http://www.xmpp.org/extensions/xep-0343.html
</xs:documentation>
</xs:annotation>
<xs:element name='channel'>
<xs:complexType>
<xs:simpleContent>
<xs:extension base='xs:string'>
<xs:attribute name='id' type='xs:unsignedShort' use='optional'/>
<xs:attribute name='maxPacketLifeTime' type='xs:unsignedShort' use='optional'/>
<xs:attribute name='maxRetransmits' type='xs:unsignedShort' use='optional'/>
<xs:attribute name='negotiated' type='xs:boolean' use='optional' default='false'/>
<xs:attribute name='ordered' type='xs:boolean' use='optional' default='true'/>
<xs:attribute name='protocol' type='xs:string' use='optional'/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:schema>
]]></code>
</section1>
</xep>