No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xep-0343.xml 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY % ents SYSTEM 'xep.ent'>
  4. <!ENTITY SCTPMAP "&lt;sctpmap/&gt;">
  5. <!ENTITY FINGERPRINT "&lt;fingerprint/&gt;">
  6. <!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>" >
  7. <!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>" >
  8. <!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>" >
  9. %ents;
  10. ]>
  11. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  12. <xep>
  13. <header>
  14. <title>Signaling WebRTC datachannels in Jingle</title>
  15. <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>
  16. &LEGALNOTICE;
  17. <number>0343</number>
  18. <status>Deferred</status>
  19. <type>Standards Track</type>
  20. <sig>Standards</sig>
  21. <approver>Council</approver>
  22. <dependencies>
  23. <spec>XEP-0176</spec>
  24. <spec>XEP-0320</spec>
  25. </dependencies>
  26. <supersedes/>
  27. <supersededby/>
  28. <shortname>jingle-webrtc-datachannels</shortname>
  29. <author>
  30. <firstname>Jens</firstname>
  31. <surname>Bavendiek</surname>
  32. <email>bavendiek@dbis.rwth-aachen.de</email>
  33. </author>
  34. <revision>
  35. <version>0.3</version>
  36. <date>2017-09-11</date>
  37. <initials>XEP Editor (jwi)</initials>
  38. <remark>Defer due to lack of activity.</remark>
  39. </revision>
  40. <revision>
  41. <version>0.2</version>
  42. <date>2014-07-15</date>
  43. <initials>ph</initials>
  44. <remark><p>Add optional explicit signaling of channels to the transport element.</p></remark>
  45. </revision>
  46. <revision>
  47. <version>0.1</version>
  48. <date>2014-01-23</date>
  49. <initials>psa</initials>
  50. <remark><p>Initial published version approved by the XMPP Council.</p></remark>
  51. </revision>
  52. <revision>
  53. <version>0.0.1</version>
  54. <date>2013-12-03</date>
  55. <initials>jab</initials>
  56. <remark><p>First draft.</p></remark>
  57. </revision>
  58. </header>
  59. <section1 topic='Introduction' anchor='intro'>
  60. <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>
  61. </section1>
  62. <section1 topic='Use Cases' anchor='usecases'>
  63. <p>There are several use cases. Given below are a few examples:</p>
  64. <ol>
  65. <li>Two parties engaged in a WebRTC-based video conference want to share a file via &xep0234;</li>
  66. <li>A browser application that uses XMPP for communication wants to support file-transfer</li>
  67. <li>A browser based application wants to send a file to a non-browser client</li>
  68. </ol>
  69. </section1>
  70. <section1 topic='Jingle Conformance' anchor='conformance'>
  71. <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>
  72. <ol>
  73. <li><p>The transport negotiation process is defined in the <link url='#protocol'>Protocol Description</link> section of this document.</p></li>
  74. <li><p>The semantics of the &SCTPMAP; element are defined in the <link url='#protocol-syntax'>Syntax</link> section of this document.</p></li>
  75. </ol>
  76. </section1>
  77. <section1 topic='Protocol Description' anchor='protocol'>
  78. <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>
  79. <section2 topic='Session Initiation' anchor='protocol-initiate'>
  80. <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>
  81. <example caption="Initiation"><![CDATA[
  82. <iq from='romeo@montague.lit/orchard'
  83. id='ixt174g9'
  84. to='juliet@capulet.lit/balcony'
  85. type='set'>
  86. <jingle xmlns='urn:xmpp:jingle:1'
  87. action='session-initiate'
  88. initiator='romeo@montague.lit/orchard'
  89. sid='a73sjjvkla37jfea'>
  90. <content creator='initiator' name='file-552da749930852c69ae5d2141d3766b1'>
  91. <description xmlns='urn:xmpp:jingle:apps:file-transfer:3'>
  92. <offer>
  93. <file>
  94. <date>1969-07-21T02:56:15Z</date>
  95. <desc>This is a test. If this were a real file...</desc>
  96. <name>test.txt</name>
  97. <range/>
  98. <size>1022</size>
  99. <hash xmlns='urn:xmpp:hashes:1' algo='sha-1'>552da749930852c69ae5d2141d3766b1</hash>
  100. </file>
  101. </offer>
  102. </description>
  103. <transport xmlns='urn:xmpp:jingle:transports:ice-udp:1'
  104. pwd='asd88fgpdd777uzjYhagZg'
  105. ufrag='8hhy'>
  106. <sctpmap xmlns='urn:xmpp:jingle:transports:dtls-sctp:1' number='5000' protocol='webrtc-datachannel' streams='1024'/>
  107. <fingerprint mlns='urn:xmpp:jingle:apps:dtls:0' hash='sha-256' setup='actpass'>
  108. 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
  109. </fingerprint>
  110. <candidate component='1'
  111. foundation='1'
  112. generation='0'
  113. id='el0747fg11'
  114. ip='10.0.1.1'
  115. network='1'
  116. port='8998'
  117. priority='2130706431'
  118. protocol='udp'
  119. type='host'/>
  120. <candidate component='1'
  121. foundation='2'
  122. generation='0'
  123. id='y3s2b30v3r'
  124. ip='192.0.2.3'
  125. network='1'
  126. port='45664'
  127. priority='1694498815'
  128. protocol='udp'
  129. rel-addr='10.0.1.1'
  130. rel-port='8998'
  131. type='srflx'/>
  132. </transport>
  133. </content>
  134. </jingle>
  135. </iq>
  136. ]]></example>
  137. <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>
  138. <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>
  139. <example caption="Initiation (with explicit channel signaling)"><![CDATA[
  140. [...]
  141. <transport xmlns='urn:xmpp:jingle:transports:ice-udp:1'
  142. pwd='asd88fgpdd777uzjYhagZg'
  143. ufrag='8hhy'>
  144. <sctpmap xmlns='urn:xmpp:jingle:transports:dtls-sctp:1' number='5000' protocol='webrtc-datachannel' streams='1024'/>
  145. <channel xmlns='urn:xmpp:jingle:transports:webrtc-datachannel:0' id="1" negotiated="true"/>
  146. <channel xmlns='urn:xmpp:jingle:transports:webrtc-datachannel:0' id="3" negotiated="true"/>
  147. <fingerprint mlns='urn:xmpp:jingle:apps:dtls:0' hash='sha-256' setup='actpass'>
  148. [...]
  149. ]]></example>
  150. </section2>
  151. <section2 topic='Syntax' anchor='protocol-syntax'>
  152. <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>
  153. <table caption='Sctpmap Attributes'>
  154. <tr>
  155. <th>Name</th>
  156. <th>Description</th>
  157. <th>SDP Syntax</th>
  158. <th>Example</th>
  159. </tr>
  160. <tr>
  161. <td>port</td>
  162. <td>A port number where the channel is to be contacted</td>
  163. <td>Port value in a=sctpmap line</td>
  164. <td>5000</td>
  165. </tr>
  166. <tr>
  167. <td>protocol</td>
  168. <td>Media format</td>
  169. <td>Protocol value in a=sctpmap line</td>
  170. <td>webrtc-datachannel</td>
  171. </tr>
  172. <tr>
  173. <td>streams</td>
  174. <td>Number of supported incoming streams</td>
  175. <td>Stream value in a=sctpmap line</td>
  176. <td>16</td>
  177. </tr>
  178. </table>
  179. <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>
  180. </section2>
  181. <section2 topic='Response' anchor='protocol-response'>
  182. <p>As described in <cite>XEP-0166</cite>, to acknowledge receipt of the session initiation request, the responder immediately returns an IQ-result.</p>
  183. <example caption="Responder acknowledges receipt of session-initiate request"><![CDATA[
  184. <iq from='juliet@capulet.lit/balcony'
  185. id='ixt174g9'
  186. to='romeo@montague.lit/orchard'
  187. type='result'/>
  188. ]]></example>
  189. <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>
  190. <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>
  191. <example caption="Responder accepts the session request"><![CDATA[
  192. <iq from='juliet@capulet.lit/balcony'
  193. id='rw782g55'
  194. to='romeo@montague.lit/orchard'
  195. type='set'>
  196. <jingle xmlns='urn:xmpp:jingle:1'
  197. action='session-accept'
  198. initiator='romeo@montague.lit/orchard'
  199. responder='juliet@capulet.lit/balcony'
  200. sid='a73sjjvkla37jfea'>
  201. <content creator='initiator' name='file-552da749930852c69ae5d2141d3766b1'>
  202. <description xmlns='urn:xmpp:jingle:apps:file-transfer:3'>
  203. <offer>
  204. <file>
  205. <date>1969-07-21T02:56:15Z</date>
  206. <desc>This is a test. If this were a real file...</desc>
  207. <name>test.txt</name>
  208. <range/>
  209. <size>1022</size>
  210. <hash xmlns='urn:xmpp:hashes:1' algo='sha-1'>552da749930852c69ae5d2141d3766b1</hash>
  211. </file>
  212. </offer>
  213. </description>
  214. <transport xmlns='urn:xmpp:jingle:transports:ice-udp:1'
  215. pwd='YH75Fviy6338Vbrhrlp8Yh'
  216. ufrag='9uB6'>
  217. <fingerprint xmlns='urn:xmpp:jingle:apps:dtls:0' hash='sha-256' setup='actpass'>
  218. 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
  219. </fingerprint>
  220. <sctpmap xmlns='urn:xmpp:jingle:transports:dtls-sctp:1' number='5000' protocol='webrtc-datachannel' streams='1024'/>
  221. <candidate component='1'
  222. foundation='1'
  223. generation='0'
  224. id='or2ii2syr1'
  225. ip='192.0.2.1'
  226. network='0'
  227. port='3478'
  228. priority='2130706431'
  229. protocol='udp'
  230. type='host'/>
  231. </transport>
  232. </content>
  233. </jingle>
  234. </iq>
  235. ]]></example>
  236. <p>The initiator acknowledges the Jingle session-accept.</p>
  237. <example caption="Initiator acknowledges session-accept."><![CDATA[
  238. <iq from='juliet@capulet.lit/balcony'
  239. id='ixt174g9'
  240. to='romeo@montague.lit/orchard'
  241. type='result'/>
  242. ]]></example>
  243. </section2>
  244. <section2 topic='Adding a new channel' anchor='protocol-add'>
  245. <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>
  246. <example caption="Initiator sends a content-add"><![CDATA[
  247. <iq from='romeo@montague.lit/orchard'
  248. id='uh3g1f48'
  249. to='juliet@capulet.lit/balcony'
  250. type='set'>
  251. <jingle xmlns='urn:xmpp:jingle:1'
  252. action='content-add'
  253. initiator='romeo@montague.lit/orchard'
  254. sid='a73sjjvkla37jfea'>
  255. <content creator='initiator' name='this-is-the-new-content'>
  256. <description xmlns='urn:xmpp:jingle:apps:some-file' media='file'/>
  257. <transport xmlns='urn:xmpp:jingle:transports:ice-udp:1'/>
  258. </content>
  259. </jingle>
  260. </iq>
  261. ]]></example>
  262. <p>The receiving party MUST acknowledge receipt.</p>
  263. <example caption="Recipient acknowledges receipt"><![CDATA[
  264. <iq from='juliet@capulet.lit/balcony'
  265. id='uh3g1f48'
  266. to='romeo@montague.lit/orchard'
  267. type='result'/>
  268. ]]></example>
  269. </section2>
  270. </section1>
  271. <section1 topic='Security Considerations' anchor='security'>
  272. <p>By design is the sent media already encrypted by the DTLS layer</p>
  273. </section1>
  274. <section1 topic='Acknowledgements' anchor='acks'>
  275. <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>
  276. <p>Thanks to Philipp Hancke and Tobias Markmann for their help and support and all the XEP-Authors for their examples.</p>
  277. </section1>
  278. <section1 topic='IANA Considerations' anchor='iana'>
  279. <p>This document requires no interaction with &IANA;.</p>
  280. </section1>
  281. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  282. <section2 topic='Protocol Namespaces' anchor='registrar-ns'>
  283. <p>This specification defines the following XML namespace:</p>
  284. <ul>
  285. <li>urn:xmpp:jingle:transports:dtls-sctp:1</li>
  286. <li>urn:xmpp:jingle:transports:webrtc-datachannel:0</li>
  287. </ul>
  288. <p>The &REGISTRAR; includes the foregoing namespace in its registry at &NAMESPACES;, as governed by &xep0053;.</p>
  289. </section2>
  290. <section2 topic='Protocol Versioning' anchor='registrar-versioning'>
  291. &NSVER;
  292. </section2>
  293. <section2 topic='SCTP Mapping' anchor='registrar-features'>
  294. <p>The registry submission is as follows.</p>
  295. <code><![CDATA[
  296. <var>
  297. <name>IETF Draft MMUSIC</name>
  298. <desc>
  299. Signals support for SCTP in the SDP as described in draft-ietf-mmusic-sctp-sdp-05
  300. </desc>
  301. <doc>XEP-SCTP</doc>
  302. </var>
  303. ]]></code>
  304. </section2>
  305. </section1>
  306. <section1 topic='XML Schema' anchor='schema'>
  307. <code><![CDATA[
  308. <?xml version='1.0' encoding='UTF-8'?>
  309. <xs:schema
  310. xmlns:xs='http://www.w3.org/2001/XMLSchema'
  311. targetNamespace='urn:xmpp:jingle:transports:dtls-sctp:1'
  312. xmlns='urn:xmpp:jingle:transports:dtls-sctp:1'
  313. elementFormDefault='qualified'>
  314. <xs:annotation>
  315. <xs:documentation>
  316. The protocol documented by this schema is defined in
  317. XEP-0343: http://www.xmpp.org/extensions/xep-0343.html
  318. </xs:documentation>
  319. </xs:annotation>
  320. <xs:element name='sctpmap'>
  321. <xs:complexType>
  322. <xs:simpleContent>
  323. <xs:extension base='xs:string'>
  324. <xs:attribute name='number' type='xs:unsignedByte' use='required'/>
  325. <xs:attribute name='protocol' type='xs:string' use='required'/>
  326. <xs:attribute name='streams' type='xs:positiveInteger' use='optional'/>
  327. </xs:extension>
  328. </xs:simpleContent>
  329. </xs:complexType>
  330. </xs:element>
  331. </xs:schema>
  332. <xs:schema
  333. xmlns:xs='http://www.w3.org/2001/XMLSchema'
  334. targetNamespace='urn:xmpp:jingle:transports:webrtc-datachannel:0'
  335. xmlns='urn:xmpp:jingle:transports:webrtc-datachannel:0'
  336. elementFormDefault='qualified'>
  337. <xs:annotation>
  338. <xs:documentation>
  339. The protocol documented by this schema is defined in
  340. XEP-0343: http://www.xmpp.org/extensions/xep-0343.html
  341. </xs:documentation>
  342. </xs:annotation>
  343. <xs:element name='channel'>
  344. <xs:complexType>
  345. <xs:simpleContent>
  346. <xs:extension base='xs:string'>
  347. <xs:attribute name='id' type='xs:unsignedShort' use='optional'/>
  348. <xs:attribute name='maxPacketLifeTime' type='xs:unsignedShort' use='optional'/>
  349. <xs:attribute name='maxRetransmits' type='xs:unsignedShort' use='optional'/>
  350. <xs:attribute name='negotiated' type='xs:boolean' use='optional' default='false'/>
  351. <xs:attribute name='ordered' type='xs:boolean' use='optional' default='true'/>
  352. <xs:attribute name='protocol' type='xs:string' use='optional'/>
  353. </xs:extension>
  354. </xs:simpleContent>
  355. </xs:complexType>
  356. </xs:element>
  357. </xs:schema>
  358. ]]></code>
  359. </section1>
  360. </xep>