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-0247.xml 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY % ents SYSTEM 'xep.ent'>
  4. %ents;
  5. ]>
  6. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  7. <xep>
  8. <header>
  9. <title>Jingle XML Streams</title>
  10. <abstract>This specification defines a Jingle application type for establishing direct or mediated XML streams between two entities over any streaming transport. This technology thus enables two entities to establish a trusted connection for end-to-end encryption or for bypassing server limits on large volumes of XMPP traffic.</abstract>
  11. &LEGALNOTICE;
  12. <number>0247</number>
  13. <status>Deferred</status>
  14. <type>Standards Track</type>
  15. <sig>Standards</sig>
  16. <dependencies>
  17. <spec>XMPP Core</spec>
  18. <spec>XEP-0047</spec>
  19. <spec>XEP-0065</spec>
  20. <spec>XEP-0166</spec>
  21. <spec>XEP-0246</spec>
  22. </dependencies>
  23. <supersedes/>
  24. <supersededby/>
  25. <shortname>NOT_YET_ASSIGNED</shortname>
  26. &stpeter;
  27. &infiniti;
  28. &dmeyer;
  29. <revision>
  30. <version>0.2</version>
  31. <date>2009-02-20</date>
  32. <initials>dm/psa</initials>
  33. <remark><p>Adjusted text and examples to reflect Jingle-XTLS, Jingle-IBB, and Jingle-S5B; moved stream security to Jingle-XTLS; moved basic stream setup from XEP-0246 to this document; changed examples to use Jingle-IBB as the transport; clarified stream opening and closing as well as session termination.</p></remark>
  34. </revision>
  35. <revision>
  36. <version>0.1</version>
  37. <date>2008-06-18</date>
  38. <initials>psa</initials>
  39. <remark><p>Initial published version.</p></remark>
  40. </revision>
  41. <revision>
  42. <version>0.0.1</version>
  43. <date>2008-06-13</date>
  44. <initials>psa/jk/dm</initials>
  45. <remark>First draft.</remark>
  46. </revision>
  47. </header>
  48. <section1 topic='Introduction' anchor='intro'>
  49. <p>The standard client-server architecture for XMPP communication provides a stable infrastructure for real-time communication. However, there are certain situations in which it is desirable to bypass the standard client-server architecture, including:</p>
  50. <ul>
  51. <li>Two endpoints cannot access an XMPP server</li>
  52. <li>Two endpoints want to enforce end-to-end encryption</li>
  53. <li>Two endpoints want to send a high volume of XMPP traffic but the intermediate servers enforce rate limits</li>
  54. </ul>
  55. <p>The first situation is addressed by &xep0174;. However, if the endpoints already have client-to-server connections but wish to bypass those connections or leverage those streams for a higher-level application such as end-to-end encryption, it is desirable for the two endpoints to negotiate an end-to-end XML stream. This specification defines methods for doing so, where the application format is an XML stream and the transport method is any direct or mediated streaming transport, such as &xep0261; (mediated), &xep0260; (direct or mediated), or a future ice-tcp Jingle transport (direct or mediated) based on &rfc6544;.</p>
  56. </section1>
  57. <section1 topic='Protocol' anchor='protocol'>
  58. <p>This section provides a friendly introduction to Jingle XML streams.</p>
  59. <p>First, the party that wishes to initiate the stream determines the responder's capabilities (via &xep0030; or &xep0115;). Here we assume that the responder supports a service discovery feature of 'urn:xmpp:jingle:apps:xmlstream:0' &VNOTE; corresponding to the Jingle XML stream functionality defined herein, as well as the 'urn:xmpp:jingle:transports:ibb:0' feature.</p>
  60. <p>The initiator then sends a Jingle session-initiation request to the responder. The content-type of the request specifies three things:</p>
  61. <ol start='1'>
  62. <li><p>An application type of "urn:xmpp:jingle:apps:xmlstream:0".</p></li>
  63. <li><p>Options for the streaming transport method, such as In-Band Bytestreams ("IBB") as defined in <cite>XEP-0261</cite> or SOCKS5 Bytestreams ("S5B") as defined in <cite>XEP-0260</cite>.</p></li>
  64. </ol>
  65. <p class='box'>Note: It is STRONGLY RECOMMENDED to encrypt all end-to-end XML streams as described in <cite>Jingle-XTLS</cite> (currently located at &lt;<link url='http://xmpp.org/extensions/inbox/jingle-xtls.html'>http://xmpp.org/extensions/inbox/jingle-xtls.html</link>&gt;). Those security flows are NOT described here.</p>
  66. <p>In this example, the initiator is &lt;romeo@montague.lit&gt;, the responder is &lt;juliet@capulet.lit&gt;, and the initiation request specifies a transport method of "jingle-ibb" (i.e., <cite>XEP-0261</cite>).</p>
  67. <p>The flow is as follows.</p>
  68. <code><![CDATA[
  69. Romeo Juliet
  70. | |
  71. | session-initiate |
  72. |------------------------------>|
  73. | ack |
  74. |<------------------------------|
  75. | session-accept |
  76. |<------------------------------|
  77. | ack |
  78. |------------------------------>|
  79. | [ XML stream over IBB ] |
  80. |<=============================>|
  81. | terminate |
  82. |<------------------------------|
  83. | ack |
  84. |------------------------------>|
  85. | |
  86. ]]></code>
  87. <p>First the initiator sends a Jingle session-initiate.</p>
  88. <example caption="Initiator sends session-initiate"><![CDATA[
  89. <iq from='romeo@montague.lit/orchard'
  90. id='ty1bf726'
  91. to='juliet@capulet.lit/balcony'
  92. type='set'>
  93. <jingle xmlns='urn:xmpp:jingle:0'
  94. action='session-initiate'
  95. initiator='romeo@montague.lit/orchard'
  96. sid='851ba2'>
  97. <content creator='initiator' name='xmlstream'>
  98. <description xmlns='urn:xmpp:jingle:apps:xmlstream:0'/>
  99. <transport xmlns='urn:xmpp:jingle:transports:ibb:0'
  100. block-size='4096'
  101. sid='vj3hs98y'/>
  102. </content>
  103. </jingle>
  104. </iq>
  105. ]]></example>
  106. <p>The responder immediately acknowledges receipt of the Jingle session-initiate.</p>
  107. <example caption="Responder acknowledges session-initiate"><![CDATA[
  108. <iq from='juliet@capulet.lit/balcony'
  109. id='ty1bf726'
  110. to='romeo@montague.lit/orchard'
  111. type='result'/>
  112. ]]></example>
  113. <p>If the responding user accepts the session then her client sends a session-accept.</p>
  114. <example caption="Responder sends session-accept"><![CDATA[
  115. <iq from='juliet@capulet.lit/balcony'
  116. id='hwd987h'
  117. to='romeo@montague.lit/orchard'
  118. type='set'>
  119. <jingle xmlns='urn:xmpp:jingle:0'
  120. action='session-accept'
  121. initiator='romeo@montague.lit/orchard'
  122. sid='a73sjjvkla37jfea'>
  123. <content creator='initiator' name='stub'>
  124. <description xmlns='urn:xmpp:jingle:apps:stub:0'/>
  125. <transport xmlns='urn:xmpp:jingle:transports:ibb:0'
  126. block-size='4096'
  127. sid='vj3hs98y'/>
  128. </content>
  129. </jingle>
  130. </iq>
  131. ]]></example>
  132. <p>The initiator acknowledges receipt.</p>
  133. <example caption="Initiator acknowledges session-accept"><![CDATA[
  134. <iq from='romeo@montague.lit/orchard'
  135. id='hwd987h'
  136. to='juliet@capulet.lit/balcony'
  137. type='result'/>
  138. ]]></example>
  139. <p>The clients can then begin to exchange XMPP data over the in-band bytestream. Because the transport is an in-band bytestream, the XMPP data is prepared as described in &xep0047; (i.e., Base64-encoded).</p>
  140. <p>First the initiator sends an initial stream header to the responder.</p>
  141. <example caption="Initial stream header (unencoded)"><![CDATA[
  142. <stream:stream
  143. xmlns='jabber:client'
  144. xmlns:stream='http://etherx.jabber.org/streams'
  145. from='romeo@montague.lit/orchard'
  146. to='juliet@capulet.lit/balcony'
  147. version='1.0'>
  148. ]]></example>
  149. <p>Note: In accordance with &xmppim;, the initial stream header SHOULD include the 'to' and 'from' attributes, which SHOULD specify the full JIDs of the clients. If the initiator supports stream features and the other stream-related aspects of XMPP 1.0 as specified in <cite>RFC 3920</cite>, then it SHOULD include the version='1.0' flag as shown in the previous example.</p>
  150. <example caption="Initial stream header (encoded in IBB) and IQ-result"><![CDATA[
  151. <iq from='romeo@montague.net/orchard'
  152. id='ur73n153'
  153. to='juliet@capulet.com/balcony'
  154. type='set'>
  155. <data xmlns='http://jabber.org/protocol/ibb' seq='0' sid='vj3hs98y'>
  156. PHN0cmVhbTpzdHJlYW0geG1sbnM9J2phYmJlcjpjbGllbnQnIHhtbG5zOnN0cmVh
  157. bT0naHR0cDovL2V0aGVyeC5qYWJiZXIub3JnL3N0cmVhbXMnIGZyb209J3JvbWVv
  158. QG1vbnRhZ3VlLmxpdC9vcmNoYXJkJyB0bz0nanVsaWV0QGNhcHVsZXQubGl0L2Jh
  159. bGNvbnknIHZlcnNpb249JzEuMCc+
  160. </data>
  161. </iq>
  162. <iq from='juliet@capulet.com/balcony'
  163. id='ur73n153'
  164. to='romeo@montague.net/orchard'
  165. type='result'/>
  166. ]]></example>
  167. <p>The responder then sends a response stream header back to the initiator (because this stream header is sent in the other direction, the IBB 'seq' attribute has a value of zero, not 1).</p>
  168. <example caption="Response stream header"><![CDATA[
  169. <stream:stream
  170. xmlns='jabber:client'
  171. xmlns:stream='http://etherx.jabber.org/streams'
  172. from='juliet@capulet.lit/balcony'
  173. id='hs91gh1836d8s717'
  174. to='romeo@montague.lit/orchard'
  175. version='1.0'>
  176. ]]></example>
  177. <example caption="Response stream header (encoded in IBB) and IQ-result"><![CDATA[
  178. <iq from='juliet@capulet.com/balcony'
  179. id='pd61g397'
  180. to='romeo@montague.net/orchard'
  181. type='set'>
  182. <data xmlns='http://jabber.org/protocol/ibb' seq='1' sid='vj3hs98y'>
  183. PHN0cmVhbTpzdHJlYW0geG1sbnM9J2phYmJlcjpjbGllbnQnIHhtbG5zOnN0cmVh
  184. bT0naHR0cDovL2V0aGVyeC5qYWJiZXIub3JnL3N0cmVhbXMnIGZyb209J2p1bGll
  185. dEBjYXB1bGV0LmxpdC9iYWxjb255JyBpZD0naHM5MWdoMTgzNmQ4czcxNycgdG89
  186. J3JvbWVvQG1vbnRhZ3VlLmxpdC9vcmNoYXJkJyB2ZXJzaW9uPScxLjAnPg==
  187. </data>
  188. </iq>
  189. <iq from='romeo@montague.net/orchard'
  190. id='pd61g397'
  191. to='juliet@capulet.com/balcony'
  192. type='result'/>
  193. ]]></example>
  194. <p>Once the streams are established, either entity then can send XMPP message, presence, and IQ stanzas, with or without 'to' and 'from' addresses.</p>
  195. <example caption="A message (unencoded)"><![CDATA[
  196. <message from='romeo@montague.lit/orchard' to='juliet@capulet.lit/balcony'>
  197. <body>M&apos;lady, I would be pleased to make your acquaintance.</body>
  198. </message>
  199. ]]></example>
  200. <example caption="A message (encoded in IBB) and IQ-result"><![CDATA[
  201. <iq from='romeo@montague.net/orchard'
  202. id='iq7dh294'
  203. to='juliet@capulet.com/balcony'
  204. type='set'>
  205. <data xmlns='http://jabber.org/protocol/ibb' seq='1' sid='vj3hs98y'>
  206. PG1lc3NhZ2UgZnJvbT0ncm9tZW9AbW9udGFndWUubGl0L29yY2hhcmQnIHRvPSdq
  207. dWxpZXRAY2FwdWxldC5saXQvYmFsY29ueSc+PGJvZHk+TSZhcG9zO2xhZHksIEkg
  208. d291bGQgYmUgcGxlYXNlZCB0byBtYWtlIHlvdXIgYWNxdWFpbnRhbmNlLjwvYm9k
  209. eT48L21lc3NhZ2U+
  210. </data>
  211. </iq>
  212. <iq from='juliet@capulet.com/balcony'
  213. id='iq7dh294'
  214. to='romeo@montague.net/orchard'
  215. type='result'/>
  216. ]]></example>
  217. <p>The responder could then send a reply.</p>
  218. <example caption="A reply (unencoded)"><![CDATA[
  219. <message from='juliet@capulet.lit/balcony' to='romeo@montague.lit/orchard'>
  220. <body>Art thou not Romeo, and a Montague?</body>
  221. </message>
  222. ]]></example>
  223. <example caption="A reply (encoded in IBB) and IQ-result"><![CDATA[
  224. <iq from='juliet@capulet.com/balcony'
  225. id='hr91hd63'
  226. to='romeo@montague.net/orchard'
  227. type='set'>
  228. <data xmlns='http://jabber.org/protocol/ibb' seq='1' sid='vj3hs98y'>
  229. PG1lc3NhZ2UgZnJvbT0nanVsaWV0QGNhcHVsZXQubGl0L2JhbGNvbnknIHRvPSdy
  230. b21lb0Btb250YWd1ZS5saXQvb3JjaGFyZCc+PGJvZHk+QXJ0IHRob3Ugbm90IFJv
  231. bWVvLCBhbmQgYSBNb250YWd1ZT88L2JvZHk+PC9tZXNzYWdlPg==
  232. </data>
  233. </iq>
  234. <iq from='romeo@montague.net/orchard'
  235. id='kr91n475'
  236. to='juliet@capulet.com/balcony'
  237. type='result'/>
  238. ]]></example>
  239. <p>To end the XML stream, either party sends a closing &lt;/stream:stream&gt; element.</p>
  240. <example caption="Stream close (unencoded)"><![CDATA[
  241. </stream:stream>
  242. ]]></example>
  243. <example caption="Stream close (encoded in IBB) and IQ-result"><![CDATA[
  244. <iq from='juliet@capulet.com/balcony'
  245. id='kr91n475'
  246. to='romeo@montague.net/orchard'
  247. type='set'>
  248. <data xmlns='http://jabber.org/protocol/ibb' seq='2' sid='vj3hs98y'>
  249. PC9zdHJlYW06c3RyZWFtPg==
  250. </data>
  251. </iq>
  252. <iq from='romeo@montague.net/orchard'
  253. id='kr91n475'
  254. to='juliet@capulet.com/balcony'
  255. type='result'/>
  256. ]]></example>
  257. <p>However, even after the application-level XML stream is terminated, the negotiated Jingle transport (here in-band bytestream) continues and could be re-used. To completely terminate the Jingle session, the terminating party would then also send a Jingle session-terminate message.</p>
  258. <example caption="Responder terminates the stream and session"><![CDATA[
  259. <iq from='juliet@capulet.lit/balcony'
  260. id='psy617r4'
  261. to='romeo@montague.lit/orchard'
  262. type='set'>
  263. <jingle xmlns='urn:xmpp:jingle:0'
  264. action='session-terminate'
  265. initiator='romeo@montague.lit/orchard'
  266. sid='851ba2'/>
  267. </iq>
  268. ]]></example>
  269. <p>The other party then acknowledges the Jingle session-terminate.</p>
  270. <example caption="Initiator acks session-terminate"><![CDATA[
  271. <iq from='romeo@montague.lit/orchard'
  272. id='psy617r4'
  273. to='juliet@capulet.lit/balcony'
  274. type='result'/>
  275. ]]></example>
  276. </section1>
  277. <section1 topic='Implementation Notes' anchor='impl'>
  278. <section2 topic='Mandatory to Implement Technologies' anchor='impl-mti'>
  279. <p>An implementations MUST support the Jingle IBB Transport Method (<cite>XEP-0261</cite>) as a dependable method of last resort. An implementation SHOULD support other streaming transport methods as well, such as the Jingle S5B Transport Method (<cite>XEP-0260</cite>).</p>
  280. </section2>
  281. <section2 topic='Preference Order of Transport Methods' anchor='impl-pref'>
  282. <p>An application MAY present transport methods in any order, except that the Jingle IBB Transport Method MUST be the lowest preference.</p>
  283. </section2>
  284. </section1>
  285. <section1 topic='IANA Considerations' anchor='iana'>
  286. <p>No interaction with &IANA; is required as a result of this document.</p>
  287. </section1>
  288. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  289. <section2 topic='Protocol Namespaces' anchor='registrar-ns'>
  290. <p>This specification defines the following XML namespace:</p>
  291. <ul>
  292. <li>urn:xmpp:jingle:apps:xmlstream:0</li>
  293. </ul>
  294. <p>Upon advancement of this specification from a status of Experimental to a status of Draft, the &REGISTRAR; shall add the foregoing namespaces to the registry located at &NAMESPACES;, as described in Section 4 of &xep0053;.</p>
  295. </section2>
  296. <section2 topic='Protocol Versioning' anchor='registrar-versioning'>
  297. &NSVER;
  298. </section2>
  299. <section2 topic='Jingle Application Formats' anchor='registrar-content'>
  300. <p>The XMPP Registrar shall include "xmlstream" in its registry of Jingle application formats. The registry submission is as follows:</p>
  301. <code><![CDATA[
  302. <application>
  303. <name>xmlstream</name>
  304. <desc>Jingle sessions for an end-to-end XML stream</desc>
  305. <transport>streaming</transport>
  306. <doc>XEP-0247</doc>
  307. </application>
  308. ]]></code>
  309. </section2>
  310. </section1>
  311. <section1 topic='XML Schema' anchor='schema'>
  312. <code><![CDATA[
  313. <?xml version='1.0' encoding='UTF-8'?>
  314. <xs:schema
  315. xmlns:xs='http://www.w3.org/2001/XMLSchema'
  316. targetNamespace='urn:xmpp:jingle:apps:xmlstream:0'
  317. xmlns='urn:xmpp:jingle:apps:xmlstream:0'
  318. elementFormDefault='qualified'>
  319. <xs:element name='description' type='empty'/>
  320. <xs:simpleType name='empty'>
  321. <xs:restriction base='xs:string'>
  322. <xs:enumeration value=''/>
  323. </xs:restriction>
  324. </xs:simpleType>
  325. </xs:schema>
  326. ]]></code>
  327. </section1>
  328. </xep>