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-0095.xml 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  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>Stream Initiation</title>
  10. <abstract>This specification defines an XMPP protocol extension for initiating a data stream between any two XMPP entities. The protocol includes the ability to include metadata about the stream and provides a pluggable framework so that various profiles of stream initiation can be defined for particular use cases (such as file transfer).</abstract>
  11. &LEGALNOTICE;
  12. <number>0095</number>
  13. <status>Deprecated</status>
  14. <type>Standards Track</type>
  15. <sig>Standards</sig>
  16. <dependencies>
  17. <spec>XMPP Core</spec>
  18. <spec>XEP-0030</spec>
  19. </dependencies>
  20. <supersedes/>
  21. <supersededby><spec>XEP-0166</spec></supersededby>
  22. <shortname>si</shortname>
  23. <schemaloc>
  24. <url>http://www.xmpp.org/schemas/si.xsd</url>
  25. </schemaloc>
  26. <registry/>
  27. &temas;
  28. &linuxwolf;
  29. &reatmon;
  30. <revision>
  31. <version>1.2</version>
  32. <date>2017-11-29</date>
  33. <initials>XEP Editor (ssw)</initials>
  34. <remark>Deprecated by vote of the council.</remark>
  35. </revision>
  36. <revision>
  37. <version>1.1</version>
  38. <date>2004-04-13</date>
  39. <initials>psa</initials>
  40. <remark>More fully defined the XMPP Registrar considerations.</remark>
  41. </revision>
  42. <revision>
  43. <version>1.0</version>
  44. <date>2003-10-17</date>
  45. <initials>psa</initials>
  46. <remark>Per a vote of the Jabber Council, advanced status to Draft.</remark>
  47. </revision>
  48. <revision>
  49. <version>0.6</version>
  50. <date>2003-07-15</date>
  51. <initials>rwe</initials>
  52. <remark>Stream ids not needed on return results. Moved s5b, ibb, and url-data to the actual namespaces of the stream protocols.</remark>
  53. </revision>
  54. <revision>
  55. <version>0.5</version>
  56. <date>2003-07-06</date>
  57. <initials>lw</initials>
  58. <remark>Removed signalling; Strengthened the profile definition requirements; Allowed for optional feature negotiation under certain circumstances</remark>
  59. </revision>
  60. <revision>
  61. <version>0.4</version>
  62. <date>2003-06-30</date>
  63. <initials>lw</initials>
  64. <remark>Actually added XML schemas; Added clarifications/requirements for stream interaction.; Fixed various typos and inconsistencies</remark>
  65. </revision>
  66. <revision>
  67. <version>0.3</version>
  68. <date>2003-06-30</date>
  69. <initials>lw</initials>
  70. <remark>
  71. Added XML schemas; Added XMPP-style error conditions; Added signal/notification support; Moderate reorganization to accommodate changes
  72. </remark>
  73. </revision>
  74. <revision>
  75. <version>0.2</version>
  76. <date>2003-06-23</date>
  77. <initials>tjm</initials>
  78. <remark>
  79. Added linuxwolf as an author (should have been there from the start), form
  80. uses stream-method as the field var, clarified the stream interaction.
  81. </remark>
  82. </revision>
  83. <revision>
  84. <version>0.1</version>
  85. <date>2003-06-10</date>
  86. <initials>tjm</initials>
  87. <remark>Initial version.</remark>
  88. </revision>
  89. </header>
  90. <section1 topic='Introduction' anchor='intro'>
  91. <p>As the Jabber protocols are extended beyond basic messaging and presence, the need has arisen for a generic protocol that can be used to negotiate content streams between any two entities. Such streams might be in-band, but more likely will be out-of-band, binary streams used in applications such as file transfer, voice chat, and video conferencing. This document provides a method for negotiating such streams, including meta-information about the intended usage of the stream.</p>
  92. </section1>
  93. <section1 topic='Requirements' anchor='reqs'>
  94. <ul>
  95. <li>The defined protocol will allow for negotiation of a common stream.</li>
  96. <li>The defined protocol will allow for meta-information to be sent about the stream usage.</li>
  97. <li>The defined protocol will not be required for stream usage.</li>
  98. </ul>
  99. </section1>
  100. <section1 topic='Use Case' anchor='usecase'>
  101. <p>The process for stream negotiation is as follows:</p>
  102. <ol>
  103. <li>Sender discovers if Receiver implements the desired profile. [E1]</li>
  104. <li>Sender offers a stream initiation. [E2]</li>
  105. <li>Receiver accepts stream initiation.</li>
  106. <li>Sender and receiver prepare for using negotiated profile and stream, EUC</li>
  107. </ol>
  108. <p>Error Conditions:</p>
  109. <ol>
  110. <li>The Receiver does not support the desired profile, EUC</li>
  111. <li>Receiver rejects the stream initiation, EUC</li>
  112. </ol>
  113. <section2 topic='Discovery' anchor='usecase-disco'>
  114. <p>Before a Stream Initiation is attempted the Sender should be sure that the Receiver supports both Stream Initiation and the specific profile that they wish to use. This is typically accomplished using &xep0030;:</p>
  115. <example caption='Requesting Disco Information From Receiver'><![CDATA[
  116. <iq type='get'
  117. to='receiver@jabber.org/resource'
  118. from='sender@jabber.org/resource'
  119. id='info1'>
  120. <query xmlns='http://jabber.org/protocol/disco#info'/>
  121. </iq>
  122. ]]></example>
  123. <p>The Receiver advertises the "http://jabber.org/protocol/si" namespace as a feature to represent that they implement this document. The specific profiles are also announced this way; they can be found by looking for "http://jabber.org/protocol/si/profile/profile-name". Shown in the result is a potential file transfer profile:</p>
  124. <example caption='Receiver Disco Information Result'><![CDATA[
  125. <iq type='result'
  126. to='sender@jabber.org/resource'
  127. from='receiver@jabber.org/resource'
  128. id='info1'>
  129. <query xmlns='http://jabber.org/protocol/disco#info'>
  130. ...
  131. <feature var='http://jabber.org/protocol/si'/>
  132. <feature var='http://jabber.org/protocol/si/profile/file-transfer'/>
  133. ...
  134. </query>
  135. </iq>
  136. ]]></example>
  137. </section2>
  138. <section2 topic='Negotiating Profile and Stream' anchor='usecase-neg'>
  139. <p>Once support is determined, the Sender starts the negotiation with the Receiver by sending an &IQ; stanza of type "set", such as in the following example from &xep0096;:</p>
  140. <example caption='Offer Stream Initiation'><![CDATA[
  141. <iq type='set' id='offer1' to='receiver@jabber.org/resource'>
  142. <si xmlns='http://jabber.org/protocol/si'
  143. id='a0'
  144. mime-type='text/plain'
  145. profile='http://jabber.org/protocol/si/profile/file-transfer'>
  146. <file xmlns='http://jabber.org/protocol/si/profile/file-transfer'
  147. name='test.txt'
  148. size='1022'>
  149. <desc>This is info about the file.</desc>
  150. </file>
  151. <feature xmlns='http://jabber.org/protocol/feature-neg'>
  152. <x xmlns='jabber:x:data' type='form'>
  153. <field var='stream-method' type='list-single'>
  154. <option><value>http://jabber.org/protocol/bytestreams</value></option>
  155. <option><value>jabber:iq:oob</value></option>
  156. <option><value>http://jabber.org/protocol/ibb</value></option>
  157. </field>
  158. </x>
  159. </feature>
  160. </si>
  161. </iq>
  162. ]]></example>
  163. <p>At this point the Receiver can view the profile and other information to decide if they wish to accept the Stream Initiation. If acceptable the Receiver MUST select one of the presented stream types to use.</p>
  164. <example caption='Accept Stream Initiation'>
  165. <![CDATA[
  166. <iq type='result' to='sender@jabber.org/resource' id='offer1'>
  167. <si xmlns='http://jabber.org/protocol/si'>
  168. <feature xmlns='http://jabber.org/protocol/feature-neg'>
  169. <x xmlns='jabber:x:data' type='submit'>
  170. <field var='stream-method'>
  171. <value>http://jabber.org/protocol/bytestreams</value>
  172. </field>
  173. </x>
  174. </feature>
  175. </si>
  176. </iq>
  177. ]]></example>
  178. <p>If the profile describes data to be sent back in the result it MUST be present as described in the profile's specification.</p>
  179. <example caption='Accept Stream Initiation with Profile'><![CDATA[
  180. <iq type='result' to='sender@jabber.org/resource' id='offer1'>
  181. <si xmlns='http://jabber.org/protocol/si'>
  182. <file xmlns='http://jabber.org/protocol/si/profile/profile-name'>
  183. <value>returned value</value>
  184. </file>
  185. <feature xmlns='http://jabber.org/protocol/feature-neg'>
  186. <x xmlns='jabber:x:data' type='submit'>
  187. <field var='stream-method'>
  188. <value>http://jabber.org/protocol/bytestreams</value>
  189. </field>
  190. </x>
  191. </feature>
  192. </si>
  193. </iq>
  194. ]]></example>
  195. <p>If none of the stream types are acceptable, or if the profile is not understood, the Receiver MUST reply with a "bad request" error:</p>
  196. <example caption='No Valid Streams'><![CDATA[
  197. <iq type='error' to='sender@jabber.org/resource' id='offer1'>
  198. <error code='400' type='cancel'>
  199. <bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  200. <no-valid-streams xmlns='http://jabber.org/protocol/si'/>
  201. </error>
  202. </iq>
  203. ]]></example>
  204. <example caption='Profile not understood'><![CDATA[
  205. <iq type='error' to='sender@jabber.org/resource' id='offer1'>
  206. <error code='400' type='cancel'>
  207. <bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  208. <bad-profile xmlns='http://jabber.org/protocol/si'/>
  209. </error>
  210. </iq>
  211. ]]></example>
  212. <p>If the Receiver rejects the request, they reply with a "forbidden" error:</p>
  213. <example caption='Rejecting Stream Initiation'><![CDATA[
  214. <iq type='error' to='sender@jabber.org/resource' id='offer1'>
  215. <error code='403' type='cancel'>
  216. <forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  217. <text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>Offer Declined</text>
  218. </error>
  219. </iq>
  220. ]]></example>
  221. </section2>
  222. <section2 topic='Preparing the Transfer' anchor='usecase-transfer'>
  223. <p>At this point, the Sender and Receiver make any preparations necessary for the stream to be used. The exact process is specific to each protocol, and is beyond the scope of this document. This step now marks the end of SI's responsibilities.</p>
  224. </section2>
  225. </section1>
  226. <section1 topic='Formal Definition' anchor='def'>
  227. <section2 topic='&lt;si/&gt; Root Element' anchor='def-si'>
  228. <p>The &lt;si/&gt; element is the root element for this protocol. It is an identifiable container for all the information necessary for negotiation and signalling. It contains attributes for the identifier, intended MIME-type, and profile. The contents convey stream-negotation and profile information.</p>
  229. <p>The "id" attribute is an opaque identifier. This attribute MUST be present on type='set', and MUST be a valid string. This SHOULD NOT be sent back on type='result', since the &lt;iq/&gt; "id" attribute provides the only context needed. This value is generated by the Sender, and the same value MUST be used throughout a session when talking to the Receiver.</p>
  230. <p>The "mime-type" attribute identifies the MIME-type for the data across the stream. This attribute MUST be a valid MIME-type as registered with &IANA; (specifically, as listed at &lt;<link url='http://www.iana.org/assignments/media-types'>http://www.iana.org/assignments/media-types</link>&gt;). During negotiation, this attribute SHOULD be present, and is otherwise not required. If not included during negotiation, its value is assumed to be "application/octet-stream".</p>
  231. <p>The "profile" attribute defines the SI profile in use. This value MUST be present during negotiation, and is the namespace of the profile to use.</p>
  232. <p>When the Sender first negotiates a Stream Initiation, all of the attributes SHOULD be present, and the id" and "profile" MUST be present. The contents MUST contain one profile, in the namespace declared in the "profile" attribute, and the feature negotiation for the stream. The feature negotiation MUST contain at least one option and use the field var "stream-method".</p>
  233. <p>When the Receiver accepts a Stream Initiation, the &lt;si/&gt; element SHOULD NOT possess any attributes. The selected stream MUST be in the feature negotiation for the stream. There MUST only be one selected stream.</p>
  234. </section2>
  235. <section2 topic='Error Codes' anchor='def-error'>
  236. <p>To simplify the discussion on error conditions, this document uses the following mapping between namespace URIs and namespace prefixes<note>This mapping is provided for the purpose of simplifying this discussion, and is not intended to be used in the actual protocol.</note>.</p>
  237. <table caption='Namespace Mappings'>
  238. <tr>
  239. <th>Prefix</th>
  240. <th>URI</th>
  241. </tr>
  242. <tr>
  243. <td>xmpp</td>
  244. <td>urn:ietf:params:xml:ns:xmpp-stanzas</td>
  245. </tr>
  246. <tr>
  247. <td>si</td>
  248. <td>http://jabber.org/protocol/si</td>
  249. </tr>
  250. </table>
  251. <p>Below are the most common errors that can result.</p>
  252. <table caption='Error Conditions/Codes'>
  253. <tr>
  254. <th>Error Code</th>
  255. <th>Error Type</th>
  256. <th>General Condition</th>
  257. <th>Specific Condition</th>
  258. <th>Description</th>
  259. </tr>
  260. <tr>
  261. <td>400</td>
  262. <td>cancel</td>
  263. <td>&lt;xmpp:bad-request/&gt;</td>
  264. <td>&lt;si:no-valid-streams/&gt;</td>
  265. <td>None of the available streams are acceptable.</td>
  266. </tr>
  267. <tr>
  268. <td>400</td>
  269. <td>modify</td>
  270. <td>&lt;xmpp:bad-request/&gt;</td>
  271. <td>&lt;si:bad-profile/&gt;</td>
  272. <td>The profile is not understood or invalid. The profile MAY supply a profile-specific error condition.</td>
  273. </tr>
  274. <tr>
  275. <td>403</td>
  276. <td>cancel</td>
  277. <td>&lt;xmpp:forbidden/&gt;</td>
  278. <td>NONE</td>
  279. <td>The stream is rejected.</td>
  280. </tr>
  281. </table>
  282. <p>For further information about the relationship between XMPP error handling and "legacy" (HTTP-style) error codes, refer to &xep0086;.</p>
  283. </section2>
  284. </section1>
  285. <section1 topic='Implementation Notes' anchor='impl'>
  286. <section2 topic='Profiles' anchor='impl-profiles'>
  287. <p>Stream Initiation on its own is of limited use; the Receiver almost always requires some reason for SI. Knowing this allows the Receiver to make a more educated choice about whether or not to accept the stream. This information is provided in Stream Initiation via a <em>profile</em>. A profile is a collection of information that describes the reason for and structure of the stream data, including what the data represents and what stream protocols are expected to be supported.</p>
  288. <p>The initial request for Stream Initiation MUST have only one profile, and this profile is in its own namespace. The profile is indicated not only by the presence of a "root" element in that particular namespace, but also be the "profile" attribute in &lt;si/&gt; The SUGGESTED format for profile namespaces is:</p>
  289. <code>http://jabber.org/protocol/si/profile/profile-name</code>
  290. <p>The information that the profile presents SHOULD be defined in an official XEP. The XEP defining the profile SHOULD contain explanations of what the profile consists of and MUST define the profile in a complete manner using DTD, Schema or another appropiate definition language.</p>
  291. <p>A profile SHOULD define what stream protocols MUST be supported, and MUST define what stream protocols MAY be supported. If a profile specifies only a single stream protocol that MUST be supported (even if others MAY also be supported), the "fneg" for the stream protocol may be omitted from the initial &lt;si/&gt;; the receiving entity then assumes the stream protocol that MUST be supported is the one to use.</p>
  292. <p>This document does not define any profiles, nor does it place any restrictions on what type of information a profile should detail. Other specifications will define profiles to be used with Stream Initiation.</p>
  293. </section2>
  294. <section2 topic='Stream Interaction' anchor='impl-stream'>
  295. <p>While Stream Initiation is not directly required for stream usage, it does provide many benefits. In order to fully appreciate these benefits, streams must link the Stream Initiation to the stream. The "id" attribute transported on the &lt;si/&gt; element is intended to do this. Once a session is fully negotiated, the value of the &lt;si/&gt; "id" attribute is used during the actual stream negotiation as the protocol's stream identifier attribute.</p>
  296. <p>To be compatible to this document, a stream protocol MUST define a stream identifier (typically "sid"), which MUST have a unique string representation. The stream protocol MUST be able to use any string identifier chosen during Stream Initiation, as long as the sending party does not use the same identifier more than once.</p>
  297. </section2>
  298. </section1>
  299. <section1 topic='Security Considerations' anchor='security'>
  300. <p>
  301. Data security concerns are left to the profiles to define. Wire security
  302. concerns are left to the stream definitions.
  303. </p>
  304. </section1>
  305. <section1 topic='IANA Considerations' anchor='iana'>
  306. <p>
  307. This document uses the MIME types as recorded by the IANA, but no direct
  308. interaction with the IANA is necessary.
  309. </p>
  310. </section1>
  311. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  312. <section2 topic='Protocol Namespaces' anchor='registrar-ns'>
  313. <p>The &REGISTRAR; includes the 'http://jabber.org/protocol/si' namespace in its registry of protocol namespaces.</p>
  314. </section2>
  315. <section2 topic='Registries' anchor='registrar-reg'>
  316. <section3 topic='Profiles Registry' anchor='registrar-reg-profiles'>
  317. <p>The XMPP Registrar shall maintain a registry of stream initiation profiles, located at &SIPROFILES;. Any such profile defined in a XMPP Extension Protocol specification MUST be submitted to the XMPP Registrar; profiles defined in non-standard protocol extensions SHOULD be submitted to the XMPP Registrar.</p>
  318. <section4 topic='Process' anchor='registrar-reg-profiles-process'>
  319. &REGPROCESS;
  320. <code><![CDATA[
  321. <profile>
  322. <name>The profile name</name>
  323. <doc>The specification that defines the profile</doc>
  324. <desc>A natural-language description of the profile</desc>
  325. </profile>
  326. ]]></code>
  327. </section4>
  328. </section3>
  329. </section2>
  330. </section1>
  331. <section1 topic='XML Schema' anchor='schema'>
  332. <code><![CDATA[
  333. <?xml version='1.0' encoding='UTF-8'?>
  334. <xs:schema
  335. xmlns:xs='http://www.w3.org/2001/XMLSchema'
  336. targetNamespace='http://jabber.org/protocol/si'
  337. xmlns='http://jabber.org/protocol/si'
  338. elementFormDefault='qualified'>
  339. <xs:import
  340. namespace='http://jabber.org/protocol/feature-neg'
  341. schemaLocation='http://www.xmpp.org/schemas/feature-neg.xsd'/>
  342. <xs:annotation>
  343. <xs:documentation>
  344. The protocol documented by this schema is defined in
  345. XEP-0095: http://www.xmpp.org/extensions/xep-0095.html
  346. </xs:documentation>
  347. </xs:annotation>
  348. <xs:element name='si'>
  349. <xs:annotation>
  350. <xs:documentation>
  351. This is the root content element. All other elements in
  352. this namespace are for communicating error information.
  353. </xs:documentation>
  354. </xs:annotation>
  355. <xs:complexType>
  356. <xs:sequence xmlns:fneg='http://jabber.org/protocol/feature-neg'>
  357. <xs:any namespace='##other' minOccurs='0'/>
  358. <xs:element ref='fneg:feature'/>
  359. </xs:sequence>
  360. <xs:attribute name='id' type='xs:string' use='optional'/>
  361. <xs:attribute name='mime-type' type='xs:string' use='optional'/>
  362. <xs:attribute name='profile' type='xs:string' use='optional'/>
  363. </xs:complexType>
  364. </xs:element>
  365. <xs:element name='bad-profile' type='empty'/>
  366. <xs:element name='no-valid-streams' type='empty'/>
  367. <xs:simpleType name='empty'>
  368. <xs:restriction base='xs:string'>
  369. <xs:enumeration value=''/>
  370. </xs:restriction>
  371. </xs:simpleType>
  372. </xs:schema>
  373. ]]></code>
  374. </section1>
  375. </xep>