Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

  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 SOCKS5 Bytestreams Transport Method</title>
  10. <abstract>This specification defines a Jingle transport method that results in sending data via the SOCKS5 Bytestreams (S5B) protocol defined in XEP-0065. Essentially this transport method reuses XEP-0065 semantics for sending the data and defines native Jingle methods for starting and ending an S5B session.</abstract>
  12. <number>0260</number>
  13. <status>Draft</status>
  14. <type>Standards Track</type>
  15. <sig>Standards</sig>
  16. <dependencies>
  17. <spec>XMPP Core</spec>
  18. <spec>XEP-0030</spec>
  19. <spec>XEP-0065</spec>
  20. </dependencies>
  21. <supersedes/>
  22. <supersededby/>
  23. <shortname>jingle-s5b</shortname>
  24. <schemaloc>
  25. <url>http://xmpp.org/schemas/jingle-transports-s5b.xsd</url>
  26. </schemaloc>
  27. <discuss>jingle</discuss>
  28. &stpeter;
  29. &dmeyer;
  30. &infiniti;
  31. &mlundblad;
  32. &tobias;
  33. <author>
  34. <firstname>Klaus</firstname>
  35. <surname>Hartke</surname>
  36. <email>klaus.hartke@googlemail.com</email>
  37. <jid>nx@jabber.org</jid>
  38. </author>
  39. <revision>
  40. <version>1.0.1</version>
  41. <date>2016-05-17</date>
  42. <initials>ssw</initials>
  43. <remark><p>Fix broken ICE-TCP reference.</p></remark>
  44. </revision>
  45. <revision>
  46. <version>1.0</version>
  47. <date>2011-09-23</date>
  48. <initials>psa</initials>
  49. <remark><p>Per a vote of the XMPP Council, advanced specification from Experimental to Draft; also added a further note about calculation of the 'dstaddr' attribute.</p></remark>
  50. </revision>
  51. <revision>
  52. <version>0.9</version>
  53. <date>2011-09-13</date>
  54. <initials>psa/tm</initials>
  55. <remark><p>Further clarified use of the dstaddr attribute, especially when the responder shares a proxy candidate with the initiator.</p></remark>
  56. </revision>
  57. <revision>
  58. <version>0.8</version>
  59. <date>2011-09-08</date>
  60. <initials>psa/tm</initials>
  61. <remark><p>More clearly described how to activate the bytestream.</p></remark>
  62. </revision>
  63. <revision>
  64. <version>0.7</version>
  65. <date>2011-08-31</date>
  66. <initials>psa</initials>
  67. <remark><p>Per feedback from the XMPP Council, changed some implementation guidelines from normative to informative and modified the security considerations to remove user interface recommendations and the recommendation to use XTLS (since it is not longer being actively developed).</p></remark>
  68. </revision>
  69. <revision>
  70. <version>0.6</version>
  71. <date>2011-08-26</date>
  72. <initials>psa/tm</initials>
  73. <remark><p>Added a 'dstaddr' attribute for feature-parity with XEP-0065.</p></remark>
  74. </revision>
  75. <revision>
  76. <version>0.5</version>
  77. <date>2010-04-13</date>
  78. <initials>psa</initials>
  79. <remark><p>Removed 'zeroconf' attribute for consistency with XEP-0065; clarified use of proxy-error condition; corrected schema.</p></remark>
  80. </revision>
  81. <revision>
  82. <version>0.4</version>
  83. <date>2010-02-17</date>
  84. <initials>ml/psa</initials>
  85. <remark><p>Added proxy-error action; added a block-size attribute in the transport-accept action when negotiating fallback to another transport, analogous to changes in XEP-0261; editorial review.</p></remark>
  86. </revision>
  87. <revision>
  88. <version>0.3</version>
  89. <date>2009-07-14</date>
  90. <initials>dm/kh/psa/jk</initials>
  91. <remark><p>Major update to make Jingle S5B inherit more features from ICE and ICE-TCP. Added priorities and candidate identifiers. Renamed streamhost element to candidate element. Updated candidate selection to use priorities, and it is now required for both clients to send a candidate-used or candidate-error notification. Defined type attribute to differentiate between various kinds of candidates. More clearly described how S5B negotiation is completed, including an activated notification from responder to initiator when the candidate used is a proxy. Noted reuse of fast-mode methodology from S5B optimization specification. Because of incompatibilities with the previous version, changed the namespace to urn:xmpp:jingle:transports:s5b:1.</p></remark>
  92. </revision>
  93. <revision>
  94. <version>0.2</version>
  95. <date>2009-03-09</date>
  96. <initials>psa</initials>
  97. <remark><p>Minor changes to track modifications to XEP-0166; updated security considerations for consistency with other transport methods; added section on service discovery.</p></remark>
  98. </revision>
  99. <revision>
  100. <version>0.1</version>
  101. <date>2009-02-19</date>
  102. <initials>psa</initials>
  103. <remark><p>Initial published version.</p></remark>
  104. </revision>
  105. <revision>
  106. <version>0.0.3</version>
  107. <date>2009-02-18</date>
  108. <initials>psa</initials>
  109. <remark><p>Clarified order of events to be consistent with raw-udp and ice-udp.</p></remark>
  110. </revision>
  111. <revision>
  112. <version>0.0.2</version>
  113. <date>2009-02-11</date>
  114. <initials>dm/jk</initials>
  115. <remark><p>Specified that the responder can send &lt;streamhost/&gt; candidates, consistent with the earlier S5B optimization extension; this change required the introduction of streamhost-used and streamhost-error. Also added text to encourage the use of NAT-assisting protocols.</p></remark>
  116. </revision>
  117. <revision>
  118. <version>0.0.1</version>
  119. <date>2009-02-10</date>
  120. <initials>psa</initials>
  121. <remark><p>Rough draft.</p></remark>
  122. </revision>
  123. </header>
  124. <section1 topic='Introduction' anchor='intro'>
  125. <p>&xep0166; defines a framework for negotiating and managing data sessions over XMPP. In order to provide a flexible framework, the base Jingle specification defines neither data transport methods nor application formats, leaving that up to separate specifications. The current document defines a transport method for establishing and managing data exchanges between XMPP entities using the existing SOCKS5 Bytestreams (S5B) protocol specified in &xep0065;. This "jingle-s5b" method results in a streaming transport method suitable for use in Jingle application types where packet loss cannot be tolerated (e.g., file transfer). Jingle-S5B reuses the protocol flow from <cite>XEP-0065</cite> for the communication with a SOCKS5 streamhost; the communication between two clients to negotiate the possible candidates differs from <cite>XEP-0065</cite> and shares similarities with &xep0176;</p>
  126. </section1>
  127. <section1 topic='Protocol' anchor='protocol'>
  128. <p>The basic flow is as follows.</p>
  129. <code><![CDATA[
  130. Initiator Responder
  131. | |
  132. | session-initiate |
  133. | (with S5B candidates) |
  134. |--------------------------------->|
  135. | ack |
  136. |<---------------------------------|
  137. | session-accept |
  138. | (with S5B candidates) |
  139. |<---------------------------------|
  140. | ack |
  141. |--------------------------------->|
  142. | candidate-used transport-info |
  143. |<---------------------------------|
  144. | ack |
  145. |--------------------------------->|
  146. | candidate-used transport-info |
  147. |--------------------------------->|
  148. | ack |
  149. |<---------------------------------|
  150. | S5B "SESSION" |
  151. |<================================>|
  152. | session-terminate |
  153. |<---------------------------------|
  154. | ack |
  155. |--------------------------------->|
  156. | |
  157. ]]></code>
  158. <p>This flow is illustrated in the following examples (to simplify the presentation these use an "example" application instead of a real application type).</p>
  159. <section2 topic='Selecting Candidates' anchor='select'>
  160. <p>It is RECOMMENDED that a client will offer as many &lt;candidate/&gt; elements as possible with itself as the host (i.e., non-proxy candidates). Such candidates might be found using the following methods:</p>
  161. <ul>
  162. <li>Opening the TCP port on all available interfaces the user wants to use (e.g., maybe not an expensive UMTS link), including the IPv4 and IPv6 addresses of that interface (if available).</li>
  163. <li>Using the client's external IP address as discovered through an assisting NAT protocol or other means.</li>
  164. </ul>
  165. <p>If the client knows it is behind a NAT and the router announces UPnP IGD or NAT-PMP support, the client SHOULD map the open port to the external interface of the router and include the public IP address and port information in the &lt;candidate/&gt; offers. To increase the chance of success without using a proxy, this specification encourages the responder to also send offers, effectively equivalent to the "fast-mode" for SOCKS5 Bytestreams as previously described at &lt;<link url='http://delta.affinix.com/specs/stream.html'>http://delta.affinix.com/specs/stream.html</link>&gt;.</p>
  166. </section2>
  167. <section2 topic='Exchanging Candidates' anchor='exchange'>
  168. <p>Once the initiator has a set of candidates, it sends a Jingle session-initiate request that contains one or more transport candidates which are a mixture of <cite>XEP-0065</cite> streamhosts and ICE candidates used in <cite>XEP-0176</cite>.</p>
  169. <p>Just as with the &QUERY; element from <cite>XEP-0065</cite>, here the &lt;transport/&gt; element contains the candidates. The following rules apply to the defined attributes of the &lt;transport/&gt; element when sent by the initiator in a Jingle session-initate message:</p>
  170. <ol>
  171. <li>The 'sid' attribute MUST be included. This attribute specifies the Stream ID for this bytestream.</li>
  172. <li>The 'dstaddr' attribute SHOULD be included if the initiator includes at least one candidate of the "proxy" type. This attribute enables the initiator to communicate the value it has calculated for the SOCKS5 DST.ADDR field (see Section 5.3.2 and Section 7 of <cite>XEP-0065</cite>) so that the responder can provide an accurate value to the proxy during SOCKS5 negotiation. Here the value is calculated as SHA1(SID + Initiator JID + Responder JID) since the initiator will be the entity that activates the bytestream at the proxy. <note>In <cite>XEP-0065</cite>, the DST.ADDR is always calculated as SHA1(SID + Requester JID + Target JID); in <cite>XEP-0260</cite> the Jingle "initiator" is the SOCKS5 Bytestreams "requester" and the Jingle "responder" is the SOCKS5 Bytestreams "target", so for proxy candidates sent from the initiator/requester to the responder/target the DST.ADDR is calculated as SHA1(SID + Initiator JID + Responder JID). Note well that the calcuation for proxy candidates sent from the responder/target to the initiator/requester is SHA1(SID + Responder JID + Initiator JID); this scenario is not covered by <cite>XEP-0065</cite> since in that specification only the SOCKS5 Bytestreams "requester" provides candidates.</note></li>
  173. <li>The 'mode' attribute MAY be included. This attribute specifies whether the underlying transport for the bytestream will be TCP (a value of "tcp", which is the default) or UDP (a value of "udp", see Section 8 of <cite>XEP-0065</cite>).</li>
  174. </ol>
  175. <p>In the following example, Romeo's client has two interfaces, one on port 5086 and the other on port 5087. The provided candidates are the IPv4 address of one interface, the IPv4 address of the second interface, and a proxy address at streamer.shakespeare.lit. Because Romeo's client has included a proxy candidate, it includes its computed value for the DST.ADDR field in the 'dstaddr' attribute (here computed as the SHA-1 hash of "vj3hs98yromeo@montague.lit/orchardjuliet@capulet.lit/balcony").</p>
  176. <example caption="Initiator sends session-initiate"><![CDATA[
  177. <iq from='romeo@montague.lit/orchard'
  178. id='xn28s7gk'
  179. to='juliet@capulet.lit/balcony'
  180. type='set'>
  181. <jingle xmlns='urn:xmpp:jingle:1'
  182. action='session-initiate'
  183. initiator='romeo@montague.lit/orchard'
  184. sid='a73sjjvkla37jfea'>
  185. <content creator='initiator' name='ex'>
  186. <description xmlns='urn:xmpp:example'/>
  187. <transport xmlns='urn:xmpp:jingle:transports:s5b:1'
  188. dstaddr='972b7bf47291ca609517f67f86b5081086052dad'
  189. mode='tcp'
  190. sid='vj3hs98y'>
  191. <candidate cid='hft54dqy'
  192. host=''
  193. jid='romeo@montague.lit/orchard'
  194. port='5086'
  195. priority='8257636'
  196. type='direct'/>
  197. <candidate cid='hutr46fe'
  198. host=''
  199. jid='romeo@montague.lit/orchard'
  200. port='5087'
  201. priority='8258636'
  202. type='direct'/>
  203. <candidate cid='xmdh4b7i'
  204. host='123.456.7.8'
  205. jid='streamer.shakespeare.lit'
  206. port='7625'
  207. priority='7878787'
  208. type='proxy'/>
  209. </transport>
  210. </content>
  211. </jingle>
  212. </iq>
  213. ]]></example>
  214. <p>The responder immediately acknowledges receipt.</p>
  215. <example caption="Responder acknowledges session-initiate"><![CDATA[
  216. <iq from='juliet@capulet.lit/balcony'
  217. id='xn28s7gk'
  218. to='romeo@montague.lit/orchard'
  219. type='result'/>
  220. ]]></example>
  221. <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.</p>
  222. <p>This message MUST contain a &TRANSPORT; element qualified by the 'urn:xmpp:jingle:transports:s5b:1' namespace, which SHOULD in turn contain one &lt;candidate/&gt; element for each SOCKS5 Bytestreams candidate generated by or known to the responder, but MAY instead be empty if the responder does not wish to offer any candidates or wishes to send each candidate as the payload of a transport-info message. If the responder sends candidates in the session-accept, the chances of a successful connection are increased. For example, the initiator might be behind a NAT or might have no access to an S5B proxy, whereas the responder might have a public IP address, might know about a proxy, or might have NAT penetration support like NAT-PMP in a router. However, the responder MUST NOT offer as a candidate any host/port combination that has already been offered by the initiator; this helps to prevent failure of negotiation with S5B proxies.</p>
  223. <p>The following rules apply to the defined attributes of the &lt;transport/&gt; element when sent by the responder in a Jingle session-accept message:</p>
  224. <ol>
  225. <li>The 'sid' attribute MUST be included and MUST be the same Stream ID communicated by the initiator in the Jingle session-initiate message.</li>
  226. <li>The 'dstaddr' attribute SHOULD be included if the responder includes at least one candidate of the "proxy" type. This attribute enables the responder to communicate the value it has calculated for the SOCKS5 DST.ADDR field (see Section 5.3.2 and Section 7 of <cite>XEP-0065</cite>) so that the initiator can provide an accurate value to the proxy during SOCKS5 negotiation. Here the value is calculated as SHA1(SID + Responder JID + Initiator JID) since the responder will be the entity that activates the bytestream at the proxy. <note>As noted, the calculation for proxy candidates sent from the responder/target to the initiator/requester is SHA1(SID + Responder JID + Initiator JID); this scenario is not covered by <cite>XEP-0065</cite> since in that specification only the SOCKS5 Bytestreams "requester" provides candidates.</note></li>
  227. <li>The 'mode' attribute MUST NOT be included since the underlying transport for the bytestream is determined by the initiator.</li>
  228. </ol>
  229. <p>In the following example, Juliet's client opens one port. The provided candidates are the (private) IPv4 address of the interface, a (public) IPv6 address, the public IPv4 address created by mapping the private IP address/port using NAT-PMP, and a proxy address. Because Juliet's client has included a proxy candidate, it includes its computed value for the DST.ADDR field in the 'dstaddr' attribute (here computed as the SHA-1 hash of "vj3hs98yjuliet@capulet.lit/balconyromeo@montague.lit/orchard").</p>
  230. <example caption="Responder sends session-accept with candidates"><![CDATA[
  231. <iq from='juliet@capulet.lit/balcony'
  232. id='hwd987h'
  233. to='romeo@montague.lit/orchard'
  234. type='set'>
  235. <jingle xmlns='urn:xmpp:jingle:1'
  236. action='session-accept'
  237. responder='juliet@capulet.lit/balcony'
  238. sid='a73sjjvkla37jfea'>
  239. <content creator='initiator' name='ex'>
  240. <description xmlns='urn:xmpp:example'/>
  241. <transport xmlns='urn:xmpp:jingle:transports:s5b:1'
  242. dstaddr='1a12fb7bc625e55f3ed5b29a53dbe0e4aa7d80ba'
  243. mode='tcp'
  244. sid='vj3hs98y'>
  245. <candidate cid='ht567dq'
  246. host=''
  247. jid='juliet@capulet.lit/balcony'
  248. port='6539'
  249. priority='8257636'
  250. type='direct'/>
  251. <candidate cid='grt654q2'
  252. host='2001:638:708:30c9:219:d1ff:fea4:a17d'
  253. jid='juliet@capulet.lit/balcony'
  254. port='6539'
  255. priority='8257606'
  256. type='direct'/>
  257. <candidate cid='hr65dqyd'
  258. host=''
  259. jid='juliet@capulet.lit/balcony'
  260. port='16453'
  261. priority='7929856'
  262. type='assisted'/>
  263. <candidate cid='pzv14s74'
  264. host='234.567.8.9'
  265. jid='proxy.marlowe.lit'
  266. port='7676'
  267. priority='7788877'
  268. type='proxy'/>
  269. </transport>
  270. </content>
  271. </jingle>
  272. </iq>
  273. ]]></example>
  274. <p>The initiator acknowledges receipt and tries to connect to the offered candidates.</p>
  275. <example caption="Initiator acknowledges session-accept"><![CDATA[
  276. <iq from='romeo@montague.lit/orchard'
  277. id='hwd987h'
  278. to='juliet@capulet.lit/balcony'
  279. type='result'/>
  280. ]]></example>
  281. <p>A client SHOULD check the offered candidates in order of their priority, starting with the highest value. How the priority is calculated depends on the actual available interfaces. An implementation SHOULD use the following formula:</p>
  282. <code>
  283. priority = (2^16)*(type preference) + (local preference)
  284. </code>
  285. <p>The type preference is an integer value between 0 and 127. The following types and their suggested preference values are defined.</p>
  286. <table caption='Defined Types'>
  287. <tr>
  288. <th>Type</th>
  289. <th>Description</th>
  290. <th>Preference Value</th>
  291. </tr>
  292. <tr>
  293. <td>direct</td>
  294. <td>Direct connection using the given interface</td>
  295. <td>126</td>
  296. </tr>
  297. <tr>
  298. <td>assisted</td>
  299. <td>Direct connection using NAT assisting technologies like NAT-PMP or UPnP-IGD</td>
  300. <td>120</td>
  301. </tr>
  302. <tr>
  303. <td>tunnel</td>
  304. <td>Tunnel protocols such as Teredo</td>
  305. <td>110</td>
  306. </tr>
  307. <tr>
  308. <td>proxy</td>
  309. <td>SOCKS5 Relay</td>
  310. <td>10</td>
  311. </tr>
  312. </table>
  313. <p>The local preference is used to rate different candidates of the same type, e.g. a DSL link might be preferred over a VPN connection. The value of the local preference SHOULD be between 0 and 65535. The proposed values are only guidelines. If a client wants to increase or decrease the value of a specific candidate it is free to do so. For instance, a client might have an expensive UMTS link as a last resort and might rate this link lower than all SOCKS5 relays.</p>
  314. </section2>
  315. <section2 topic='Connecting to Candidates' anchor='connect'>
  316. <p>After receiving its peer's candidates, a client start to connect to them in order of the priority. A detailed description of the protocol can be found in <cite>XEP-0065</cite>.</p>
  317. <p>Once one client has successfully created a connection, it sends the &lt;candidate-used/&gt; element to the peer inside a Jingle transport-info message. If a client receives a candidate-used notification it SHOULD continue trying to connect to candidates sent by its peer if it has not tried all candidates with a higher priority than the one successfully used by the peer.</p>
  318. <example caption="Initiator sends candidate-used in Jingle transport-info"><![CDATA[
  319. <iq from='romeo@montague.lit/orchard'
  320. id='hjdi8'
  321. to='juliet@capulet.lit/balcony'
  322. type='set'>
  323. <jingle xmlns='urn:xmpp:jingle:1'
  324. action='transport-info'
  325. initiator='romeo@montague.lit/orchard'
  326. sid='a73sjjvkla37jfea'>
  327. <content creator='initiator' name='ex'>
  328. <transport xmlns='urn:xmpp:jingle:transports:s5b:1'
  329. sid='vj3hs98y'>
  330. <candidate-used cid='hr65dqyd'/>
  331. </transport>
  332. </content>
  333. </jingle>
  334. </iq>
  335. ]]></example>
  336. <p>The peer immediately acknowledges receipt.</p>
  337. <example caption="Responder acknowledges candidate-used message"><![CDATA[
  338. <iq from='juliet@capulet.lit/balcony'
  339. id='hjdi8'
  340. to='romeo@montague.lit/orchard'
  341. type='result'/>
  342. ]]></example>
  343. <p>If a client is unable to connect to <em>any</em> candidate sent by its peer, or if it stopped trying to connect because its peer sent a candidate-used notification with a priority higher than its remaining candidate(s), it sends a candidate-error Jingle transport-info message (this is equivalent to the IQ-error with code='500' from the "fast-mode" extension).</p>
  344. <example caption="Responder sends candidate-error in Jingle transport-info"><![CDATA[
  345. <iq from='juliet@capulet.lit/balcony'
  346. id='gft65ewd'
  347. to='romeo@montague.lit/orchard'
  348. type='set'>
  349. <jingle xmlns='urn:xmpp:jingle:1'
  350. action='transport-info'
  351. initiator='romeo@montague.lit/orchard'
  352. sid='a73sjjvkla37jfea'>
  353. <content creator='initiator' name='ex'>
  354. <transport xmlns='urn:xmpp:jingle:transports:s5b:1'
  355. sid='vj3hs98y'>
  356. <candidate-error/>
  357. </transport>
  358. </content>
  359. </jingle>
  360. </iq>
  361. ]]></example>
  362. <p>The peer immediately acknowledges receipt.</p>
  363. <example caption="Responder acknowledges candidate-error message"><![CDATA[
  364. <iq from='romeo@montague.lit/orchard'
  365. id='gft65ewd'
  366. to='juliet@capulet.lit/balcony'
  367. type='result'/>
  368. ]]></example>
  369. </section2>
  370. <section2 topic='Completing the Negotiation' anchor='complete'>
  371. <p>The transport negotiation is completed in one of the following ways:</p>
  372. <ol start='1'>
  373. <li>If both parties send a candidate-error notification then the SOCKS5 negotiation has failed and the parties need to fall back to some other transport method, typically (but not necessarily) IBB; see the <link url='#fallback'>Fallback Methods</link> section of this document for details.</li>
  374. <li>If one of the parties sends a candidate-error notification and the other party sends a candidate-used notification, then the candidate-used shall be considered the nominated candidate.</li>
  375. <li>If both parties send a candidate-used notification but the candidates have a different priority, then the candidate with the higher priority shall be considered the nominated candidate.</li>
  376. <li>If both parties send a candidate-used notification with candidates having the same priority, then the candidate chosen by the initiator shall be considered the nominated candidate (this is consistent with the rules in <cite>XEP-0166</cite>).</li>
  377. </ol>
  378. <p>The parties shall use the nominated candidate for the data transfer. However, if the nominated candidate is of the "proxy" type, then the peer has no way to know when it can send data. Therefore the party that offered the nominated candidate MUST do two things...</p>
  379. <p>First, it activates the bytestream, as described in <cite>XEP-0065</cite>:</p>
  380. <example caption="Responder activates the bytestream at proxy"><![CDATA[
  381. <iq from='juliet@capulet.lit/balcony'
  382. id='vy1fa63k'
  383. to='streamer.shakespeare.lit'
  384. type='set'>
  385. <query xmlns='http://jabber.org/protocol/bytestreams'
  386. sid='a73sjjvkla37jfea'>
  387. <activate>romeo@montague.lit/orchard</activate>
  388. </query>
  389. </iq>
  390. ]]></example>
  391. <example caption="Proxy informs responder of activation"><![CDATA[
  392. <iq from='streamer.shakespeare.lit'
  393. id='vy1fa63k'
  394. to='juliet@capulet.lit/balcony'
  395. type='result'/>
  396. ]]></example>
  397. <p>Second, it sends an activated notification to the peer; it does so by sending a transport-info message containing an &lt;activated/&gt; element:</p>
  398. <example caption="Responder informs initiator that bytestream has been activated"><![CDATA[
  399. <iq from='juliet@capulet.lit/balcony'
  400. id='bv73bs91'
  401. to='romeo@montague.lit/orchard'
  402. type='set'>
  403. <jingle xmlns='urn:xmpp:jingle:1'
  404. action='transport-info'
  405. initiator='romeo@montague.lit/orchard'
  406. sid='a73sjjvkla37jfea'>
  407. <content creator='initiator' name='ex'>
  408. <transport xmlns='urn:xmpp:jingle:transports:s5b:1'
  409. sid='vj3hs98y'>
  410. <activated cid='xmdh4b7i'/>
  411. </transport>
  412. </content>
  413. </jingle>
  414. </iq>
  415. ]]></example>
  416. <p>If the nominated candidate is of the proxy type and either party cannot connect to the proxy (for example because of a restrictive firewall), the failing party shall send a transport-info message containing an &lt;proxy-error/&gt; element.</p>
  417. <example caption="Responder informs initiator of inability to connect to the proxy"><![CDATA[
  418. <iq from='juliet@capulet.lit/balcony'
  419. id='bv73bs91'
  420. to='romeo@montague.lit/orchard'
  421. type='set'>
  422. <jingle xmlns='urn:xmpp:jingle:1'
  423. action='transport-info'
  424. initiator='romeo@montague.lit/orchard'
  425. sid='a73sjjvkla37jfea'>
  426. <content creator='initiator' name='ex'>
  427. <transport xmlns='urn:xmpp:jingle:transports:s5b:1'
  428. sid='vj3hs98y'>
  429. <proxy-error/>
  430. </transport>
  431. </content>
  432. </jingle>
  433. </iq>
  434. ]]></example>
  435. <p>The parties shall then consider the bytestream unsuccessful and SHOULD attempt to fall back to another transport as described in <link url='#fallback'>Fallback Methods</link>.</p>
  436. </section2>
  437. <section2 topic='Exchanging Data' anchor='data'>
  438. <p>Once the parties have chosen (and if necessary activated) a streamhost, they can exchange data as defined in <cite>XEP-0065</cite>.</p>
  439. </section2>
  440. <section2 topic='Closing the Bytestream' anchor='close'>
  441. <p>Once the parties have finished using the bytestream (e.g., because a complete file has been sent), either party can send a Jingle session-terminate action.</p>
  442. <example caption="Initiator terminates the session"><![CDATA[
  443. <iq from='romeo@montague.lit/orchard'
  444. id='hz81vf48'
  445. to='juliet@capulet.lit/balcony'
  446. type='set'>
  447. <jingle xmlns='urn:xmpp:jingle:1'
  448. action='session-terminate'
  449. initiator='romeo@montague.lit/orchard'
  450. sid='a73sjjvkla37jfea'>
  451. <reason><success/></reason>
  452. </jingle>
  453. </iq>
  454. ]]></example>
  455. <p>The other party then acknowledges the session-terminate and the Jingle session is finished.</p>
  456. <example caption="Responder acknowledges session-terminate"><![CDATA[
  457. <iq from='juliet@capulet.lit/balcony'
  458. id='hz81vf48'
  459. to='romeo@montague.lit/orchard'
  460. type='result'/>
  461. ]]></example>
  462. </section2>
  463. </section1>
  464. <section1 topic='Fallback Methods' anchor='fallback'>
  465. <p>If the SOCKS5 Bytestreams negotiation fails, the parties might want to "fall back" to another transport. Currently the transport of last resort for a streaming exchange is &xep0047; as described for Jingle in &xep0261;, however if other transport methods are defined in the future (e.g. &rfc6544;) then clients could fall back to those methods instead of IBB. The protocol flow for fallback from S5B to IBB is as follows.</p>
  466. <code><![CDATA[
  467. Romeo Juliet
  468. | |
  469. | session-initiate |
  470. | (with S5B info) |
  471. |--------------------------------->|
  472. | ack |
  473. |<---------------------------------|
  474. | session-accept |
  475. | (with S5B info) |
  476. |<---------------------------------|
  477. | [ SOCKS5 failure! ] |
  478. |x--------------------------------x|
  479. | transport-replace (IBB) |
  480. |--------------------------------->|
  481. | ack |
  482. |<---------------------------------|
  483. | transport-accept (IBB) |
  484. |<---------------------------------|
  485. | ack |
  486. |--------------------------------->|
  487. | IBB "SESSION" |
  488. |=================================>|
  489. | terminate |
  490. |<---------------------------------|
  491. | ack |
  492. |--------------------------------->|
  493. | |
  494. ]]></code>
  495. <p>First the initiator sends a Jingle session-initiate, in this case with a transport of SOCKS5 Bytestreams. The protocol flow is exactly the same as described above. If both parties are unable to connect to a candidate provided by the peer, they send candidate-error messages to indicate that SOCKS5 has failed. The initiator MUST either terminate the Jingle session with a Jingle reason of &lt;connectivity-error/&gt; or replace the transport with something else using the transport-replace action. Typically the fallback option is IBB (see, for example, &xep0234;). Therefore the initiator sends a transport-replace action including a transport of IBB.</p>
  496. <example caption="Initiator replaces transport with IBB"><![CDATA[
  497. <iq from='romeo@montague.lit/orchard'
  498. id='hs92n57'
  499. to='juliet@capulet.lit/balcony'
  500. type='set'>
  501. <jingle xmlns='urn:xmpp:jingle:1'
  502. action='transport-replace'
  503. initiator='romeo@montague.lit/orchard'
  504. sid='a73sjjvkla37jfea'>
  505. <content creator='initiator' name='ex'>
  506. <transport xmlns='urn:xmpp:jingle:transports:ibb:1'
  507. block-size='4096'
  508. sid='ch3d9s71'/>
  509. </content>
  510. </jingle>
  511. </iq>
  512. ]]></example>
  513. <p>The responder then acknowledges the transport-replace action.</p>
  514. <example caption="Responder acknowledges transport-replace"><![CDATA[
  515. <iq from='juliet@capulet.lit/balcony'
  516. id='hs92n57'
  517. to='romeo@montague.lit/orchard'
  518. type='result'/>
  519. ]]></example>
  520. <p>If the transport replacement is acceptable, the responder then sends a transport-accept action to the initiator (if not, the responder sends a transport-reject action). If the responder wishes to use a smaller block size than the one specified in the transport-replace offer, this can be done by specifying a block-size attribute in the transport-accept action.</p>
  521. <example caption="Responder sends transport-accept"><![CDATA[
  522. <iq from='juliet@capulet.lit/balcony'
  523. id='is71ns63'
  524. to='romeo@montague.lit/orchard'
  525. type='set'>
  526. <jingle xmlns='urn:xmpp:jingle:1'
  527. action='transport-accept'
  528. initiator='romeo@montague.lit/orchard'
  529. sid='a73sjjvkla37jfea'>
  530. <content creator='initiator' name='ex'>
  531. <transport xmlns='urn:xmpp:jingle:transports:ibb:1'
  532. block-size='2048'
  533. sid='ch3d9s71'/>
  534. </content>
  535. </jingle>
  536. </iq>
  537. ]]></example>
  538. <p>The initiator acknowledges the Jingle transport-accept action.</p>
  539. <example caption="Initiator acknowledges transport-accept"><![CDATA[
  540. <iq from='juliet@capulet.lit/balcony'
  541. id='is71ns63'
  542. to='romeo@montague.lit/orchard'
  543. type='result'/>
  544. ]]></example>
  545. <p>Now the parties can send data using In-Band Bytestreams as defined in <cite>XEP-0261</cite> and <cite>XEP-0047</cite>.</p>
  546. </section1>
  547. <section1 topic='Processing Rules and Usage Guidelines' anchor='rules'>
  548. <p>The same processing rules and usage guidelines defined in <cite>XEP-0065</cite> apply to the Jingle S5B Transport Method. This document adds the following implementation suggestions in the context of Jingle:</p>
  549. <ol>
  550. <li>Try the offered candidates in the order of their priority, from highest to lowest.</li>
  551. <li>Stagger the connection attempts (e.g., initiate communications with the highest-priority candidate, then wait 200ms before initiating communications with the second-highest-priority candidate).</li>
  552. <li>To increase the potential for using a direct connection, consider waiting a bit longer than 200ms to initiate communications with proxy candidates.</li>
  553. </ol>
  554. </section1>
  555. <section1 topic='Determining Support' anchor='support'>
  556. <p>To advertise its support for the Jingle SOCKS5 Bytestreams Transport Method, when replying to &xep0030; information requests an entity MUST return URNs for any version of this protocol that the entity supports -- e.g., "urn:xmpp:jingle:transports:s5b:1" for this version &VNOTE;.</p>
  557. <example caption="Service discovery information request"><![CDATA[
  558. <iq from='romeo@montague.lit/orchard'
  559. id='uw72g176'
  560. to='juliet@capulet.lit/balcony'
  561. type='get'>
  562. <query xmlns='http://jabber.org/protocol/disco#info'/>
  563. </iq>
  564. ]]></example>
  565. <example caption="Service discovery information response"><![CDATA[
  566. <iq from='juliet@capulet.lit/balcony'
  567. id='uw72g176'
  568. to='romeo@montague.lit/orchard'
  569. type='result'>
  570. <query xmlns='http://jabber.org/protocol/disco#info'>
  571. <feature var='urn:xmpp:jingle:1'/>
  572. <feature var='urn:xmpp:jingle:transports:s5b:1'/>
  573. </query>
  574. </iq>
  575. ]]></example>
  576. <p>In order for an application to determine whether an entity supports this protocol, where possible it SHOULD use the dynamic, presence-based profile of service discovery defined in &xep0115;. However, if an application has not received entity capabilities information from an entity, it SHOULD use explicit service discovery instead.</p>
  577. </section1>
  578. <section1 topic='Security Considerations' anchor='security'>
  579. <section2 topic='Sharing IP Addresses' anchor='security-sharing'>
  580. <p>The exchange of candidates might result in exposure of the sender's IP addresses, which comprise a form of personally identifying information. A Jingle client MUST enable a user to control which entities will be allowed to receive such information. If a human user explicitly accepts a session request, then the client can consider that action to imply approval of IP address sharing.</p>
  581. </section2>
  582. <section2 topic='Encryption of Media' anchor='security-media'>
  583. <p>This specification, like <cite>XEP-0065</cite> before it, does not directly support end-to-end encryption of the media sent over the transport.</p>
  584. </section2>
  585. </section1>
  586. <section1 topic='IANA Considerations' anchor='iana'>
  587. <p>This document requires no interaction with &IANA;.</p>
  588. </section1>
  589. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  590. <section2 topic='Protocol Namespaces' anchor='registrar-ns'>
  591. <p>The &REGISTRAR; includes 'urn:xmpp:jingle:transports:s5b:1' in its registry of protocol namespaces at &NAMESPACES;, as described in Section 4 of &xep0053;.</p>
  592. </section2>
  593. <section2 topic='Protocol Versioning' anchor='registrar-versioning'>
  594. &NSVER;
  595. </section2>
  596. <section2 topic='Jingle Transport Methods' anchor='registrar-transports'>
  597. <p>The &REGISTRAR; includes "jingle-s5b" in its registry of Jingle transport methods at &JINGLETRANSPORTS;. The registry submission is as follows:</p>
  598. <code><![CDATA[
  599. <transport>
  600. <name>s5b</name>
  601. <desc>
  602. A method for negotiating data exchange over SOCKS5 Bytestreams.
  603. </desc>
  604. <type>streaming</type>
  605. <doc>XEP-0260</doc>
  606. </transport>
  607. ]]></code>
  608. </section2>
  609. </section1>
  610. <section1 topic='Schema' anchor='schema'>
  611. <code><![CDATA[
  612. <?xml version='1.0' encoding='UTF-8'?>
  613. <xs:schema
  614. xmlns:xs='http://www.w3.org/2001/XMLSchema'
  615. targetNamespace='urn:xmpp:jingle:transports:s5b:1'
  616. xmlns='urn:xmpp:jingle:transports:s5b:1'
  617. elementFormDefault='qualified'>
  618. <xs:annotation>
  619. <xs:documentation>
  620. The protocol documented by this schema is defined in
  621. XEP-0260: http://www.xmpp.org/extensions/xep-0260.html
  622. </xs:documentation>
  623. </xs:annotation>
  624. <xs:element name='transport'>
  625. <xs:complexType>
  626. <xs:choice>
  627. <xs:element ref='activated'
  628. minOccurs='0' maxOccurs='1'/>
  629. <xs:element ref='candidate'
  630. minOccurs='0' maxOccurs='unbounded'/>
  631. <xs:element name='candidate-error'
  632. minOccurs='0' maxOccurs='1' type='empty'/>
  633. <xs:element ref='candidate-used'
  634. minOccurs='0' maxOccurs='1'/>
  635. <xs:element name='proxy-error'
  636. minOccurs='0' maxOccurs='1' type='empty'/>
  637. </xs:choice>
  638. <xs:attribute name='dstaddr' use='optional' type='xs:string'/>
  639. <xs:attribute name='mode' use='optional' default='tcp'>
  640. <xs:simpleType>
  641. <xs:restriction base='xs:NCName'>
  642. <xs:enumeration value='tcp'/>
  643. <xs:enumeration value='udp'/>
  644. </xs:restriction>
  645. </xs:simpleType>
  646. </xs:attribute>
  647. <xs:attribute name='sid' type='xs:string' use='optional'/>
  648. </xs:complexType>
  649. </xs:element>
  650. <xs:element name='candidate'>
  651. <xs:complexType>
  652. <xs:simpleContent>
  653. <xs:extension base='empty'>
  654. <xs:attribute name='cid'
  655. type='xs:string' use='required'/>
  656. <xs:attribute name='host'
  657. type='xs:string' use='required'/>
  658. <xs:attribute name='jid'
  659. type='xs:string' use='required'/>
  660. <xs:attribute name='port'
  661. type='xs:positiveInteger' use='optional'/>
  662. <xs:attribute name='priority'
  663. type='xs:positiveInteger' use='required'/>
  664. <xs:attribute name='type'
  665. use='optional' default='direct'>
  666. <xs:simpleType>
  667. <xs:restriction base='xs:NCName'>
  668. <xs:enumeration value='assisted'/>
  669. <xs:enumeration value='direct'/>
  670. <xs:enumeration value='proxy'/>
  671. <xs:enumeration value='tunnel'/>
  672. </xs:restriction>
  673. </xs:simpleType>
  674. </xs:attribute>
  675. </xs:extension>
  676. </xs:simpleContent>
  677. </xs:complexType>
  678. </xs:element>
  679. <xs:element name='candidate-used'>
  680. <xs:complexType>
  681. <xs:simpleContent>
  682. <xs:extension base='empty'>
  683. <xs:attribute name='cid' type='xs:string' use='required'/>
  684. </xs:extension>
  685. </xs:simpleContent>
  686. </xs:complexType>
  687. </xs:element>
  688. <xs:element name='activated'>
  689. <xs:complexType>
  690. <xs:simpleContent>
  691. <xs:extension base='empty'>
  692. <xs:attribute name='cid' type='xs:string' use='required'/>
  693. </xs:extension>
  694. </xs:simpleContent>
  695. </xs:complexType>
  696. </xs:element>
  697. <xs:simpleType name='empty'>
  698. <xs:restriction base='xs:string'>
  699. <xs:enumeration value=''/>
  700. </xs:restriction>
  701. </xs:simpleType>
  702. </xs:schema>
  703. ]]></code>
  704. </section1>
  705. <section1 topic='Acknowledgements' anchor='acks'>
  706. <p>Thanks to Steffen Larsen, Florian Schmaus, Kevin Smith, and Remko Tronçon for their feedback.</p>
  707. </section1>
  708. </xep>