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

  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>Feature Negotiation</title>
  10. <abstract>This specification defines an XMPP protocol extension that enables two entities to mutually negotiate feature options, such as parameters related to a file transfer or a communications session.</abstract>
  12. <number>0020</number>
  13. <status>Deprecated</status>
  14. <type>Standards Track</type>
  15. <sig>Standards</sig>
  16. <dependencies>
  17. <spec>XMPP Core</spec>
  18. <spec>XEP-0004</spec>
  19. </dependencies>
  20. <supersedes/>
  21. <supersededby/>
  22. <shortname>feature-neg</shortname>
  23. <schemaloc>
  24. <url></url>
  25. </schemaloc>
  26. &pgmillard;
  27. &stpeter;
  28. &ianpaterson;
  29. <revision>
  30. <version>1.6</version>
  31. <date>2018-03-07</date>
  32. <initials>jwi (Editor)</initials>
  33. <remark>Deprecated as per Council vote on 2018-03-07.</remark>
  34. </revision>
  35. <revision>
  36. <version>1.5</version>
  37. <date>2006-11-21</date>
  38. <initials>ip</initials>
  39. <remark>Added FORM_TYPEs to examples; added service-unavailable error and Security Considerations; various other updates and corrections avoiding material changes.</remark>
  40. </revision>
  41. <revision>
  42. <version>1.4</version>
  43. <date>2004-05-21</date>
  44. <initials>psa</initials>
  45. <remark>Moved remaining feature negotiation text from XEP-0030 to this document.</remark>
  46. </revision>
  47. <revision>
  48. <version>1.3</version>
  49. <date>2004-04-23</date>
  50. <initials>psa</initials>
  51. <remark>Per Council discussion, changed root element from &lt;query/&gt; to &lt;feature/&gt; for the sake of consistency with using protocols; moved some text from XEP-0030 to this document.</remark>
  52. </revision>
  53. <revision>
  54. <version>1.2</version>
  55. <date>2004-03-08</date>
  56. <initials>psa</initials>
  57. <remark>Added XMPP error handling; clarified the text; corrected the examples; fixed an error in the schema; added numerous references.</remark>
  58. </revision>
  59. <revision>
  60. <version>1.1</version>
  61. <date>2003-02-16</date>
  62. <initials>psa</initials>
  63. <remark>Made corrections to the text; added security and IANA considerations; added schema.</remark>
  64. </revision>
  65. <revision>
  66. <version>1.0</version>
  67. <date>2002-12-06</date>
  68. <initials>psa</initials>
  69. <remark>Per a vote of the Jabber Council, revision 0.4 was advanced to Draft on 2002-12-06.</remark>
  70. </revision>
  71. <revision>
  72. <version>0.4</version>
  73. <date>2002-11-17</date>
  74. <initials>pgm</initials>
  75. <remark>Changed protocol to use jabber:x:data.</remark>
  76. </revision>
  77. <revision>
  78. <version>0.3</version>
  79. <date>2002-10-01</date>
  80. <initials>pgm</initials>
  81. <remark>Added some extra text to help clarify protocol &amp; purpose.</remark>
  82. </revision>
  83. <revision>
  84. <version>0.2</version>
  85. <date>2002-05-22</date>
  86. <initials>pgm</initials>
  87. <remark>Changed examples.</remark>
  88. </revision>
  89. <revision>
  90. <version>0.1</version>
  91. <date>2002-02-26</date>
  92. <initials>pgm</initials>
  93. <remark>Initial version.</remark>
  94. </revision>
  95. </header>
  96. <section1 topic="Introduction" anchor='intro'>
  97. <p>A discovery protocol such as &xep0030; enables Jabber entities to query other entities regarding the features they support, but does not provide a means for the two entities to negotiate specific options related to the advertised features.</p>
  98. <p>The protocol defined herein enables Jabber entities to negotiate options for specific features. These features could be negotiated between any two endpoints on the Jabber network, such as two clients, a client and a component, two components, a client and a server, or two servers. The protocol is generic enough that it can be used whenever options need to be negotiated between two Jabber entities. For examples, &xep0095;, &xep0096; or &xep0155;.</p>
  99. </section1>
  100. <section1 topic="Protocol Details" anchor='protocol'>
  101. <p>Features are negotiated through the exchange of &IQ; or &MESSAGE; stanzas containing &lt;feature/&gt; child elements qualified by the '' namespace. However, this &lt;feature/&gt; element is simply a wrapper for structured data encapsulated in the &xep0004; protocol. <note>Earlier versions of this document defined a structured data format to handle the feature negotiation workflow; versions later than 0.4 use <cite>Data Forms</cite>, i.e., the 'jabber:x:data' namespace.</note></p>
  102. <p>In order to begin a negotation, the initiator sends an &IQ; stanza of type "get" (or a &MESSAGE; stanza type "normal" - see <cite>Stanza Session Negotiation</cite> for examples) to the recipient with a single &lt;feature/&gt; element containing a data form of type "form" which defines the available options for one or more features. Each feature is represented as an x-data "field".</p>
  103. <p>The recipient SHOULD examine each feature and the values of the options provided. In order to indicate preferred values, the recipient then SHOULD specify one value for each feature and return a data form of type "submit" to the initiator in an &IQ; stanza of type "result" (or a &MESSAGE; stanza type "normal").</p>
  104. <p>The following examples show some likely scenarios for feature negotiation between entities. Further examples can be found in "using protocols", such as <cite>File Transfer</cite>.</p>
  105. <section2 topic="Basic Flow" anchor='protocol-basic'>
  106. <p>A typical negotiation flow is shown in the following example of two entities negotiating the time and place for a meeting.</p>
  107. <example caption="Initiating entity sends offer"><![CDATA[
  108. <iq type='set'
  109. from=''
  110. to=''
  111. id='neg1'>
  112. <feature xmlns=''>
  113. <x xmlns='jabber:x:data' type='form'>
  114. <field var='FORM_TYPE' type='hidden'>
  115. <value>romantic_meetings</value>
  116. </field>
  117. <field type='list-single' var='places-to-meet'>
  118. <option><value>Secret Grotto</value></option>
  119. <option><value>Verona Park</value></option>
  120. </field>
  121. <field type='list-single' var='times-to-meet'>
  122. <option><value>22:00</value></option>
  123. <option><value>22:30</value></option>
  124. <option><value>23:00</value></option>
  125. </field>
  126. </x>
  127. </feature>
  128. </iq>
  129. ]]></example>
  130. <example caption="Responding entity sends preferred option values"><![CDATA[
  131. <iq type='result'
  132. id='neg1'
  133. from=''
  134. to=''>
  135. <feature xmlns=''>
  136. <x xmlns='jabber:x:data' type='submit'>
  137. <field var='FORM_TYPE'>
  138. <value>romantic_meetings</value>
  139. </field>
  140. <field var='places-to-meet'>
  141. <value>Secret Grotto</value>
  142. </field>
  143. <field var='times-to-meet'>
  144. <value>22:30</value>
  145. </field>
  146. </x>
  147. </feature>
  148. </iq>
  149. ]]></example>
  150. <p>Note: If the responding entity does not want to reveal presence to the initiating entity for whatever reason then the responding entity's client SHOULD return a &unavailable; error (or return no response or error whatsoever if the offer was wrapped in a &MESSAGE; stanza) - see <link url='#security'>Security Considerations</link>.</p>
  151. <p>If the responding entity does not support <strong>Feature Negotiation</strong> or does not support the specified FORM_TYPE, it SHOULD also return a &unavailable; error:</p>
  152. <example caption="Responding entity does not support feature negotiation"><![CDATA[
  153. <iq type='error'
  154. id='neg1'
  155. from=''
  156. to=''>
  157. <feature xmlns=''>
  158. <x xmlns='jabber:x:data' type='form'>
  159. <field var='FORM_TYPE' type='hidden'>
  160. <value>romantic_meetings</value>
  161. </field>
  162. ...
  163. </x>
  164. </feature>
  165. <error type='cancel'>
  166. <service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  167. </error>
  168. </iq>
  169. ]]></example>
  170. <p>If the responding entity does not support one or more of the features, it SHOULD return a &feature; error, and SHOULD specify the feature(s) not implemented in the XMPP &lt;text/&gt; element.</p>
  171. <example caption="Responding entity does not support a feature"><![CDATA[
  172. <iq type='error'
  173. id='neg1'
  174. from=''
  175. to=''>
  176. <feature xmlns=''>
  177. <x xmlns='jabber:x:data' type='form'>
  178. <field var='FORM_TYPE' type='hidden'>
  179. <value>romantic_meetings</value>
  180. </field>
  181. ...
  182. </x>
  183. </feature>
  184. <error type='cancel'>
  185. <feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  186. <text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>times-to-meet</text>
  187. </error>
  188. </iq>
  189. ]]></example>
  190. <p>If the responding entity supports none of the options offered for one or more of the features, it SHOULD return a &notacceptable; error, and SHOULD specify the relevant feature(s) in the XMPP &lt;text/&gt; element.</p>
  191. <example caption="Responding entity supports no options"><![CDATA[
  192. <iq type='error'
  193. from=''
  194. to=''
  195. id='neg1'>
  196. <feature xmlns=''>
  197. <x xmlns='jabber:x:data' type='form'>
  198. <field var='FORM_TYPE' type='hidden'>
  199. <value>romantic_meetings</value>
  200. </field>
  201. ...
  202. </x>
  203. </feature>
  204. <error type='modify'>
  205. <not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  206. <text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>places-to-meet</text>
  207. </error>
  208. </iq>
  209. ]]></example>
  210. </section2>
  211. <section2 topic="Querying for Negotiable Features" anchor='protocol-query'>
  212. <p>If at least one feature offered by an entity is subject to <strong>Feature Negotiation</strong>, the entity's response to a service discovery information request MUST include &lt;feature var=''/&gt; as one of the features.</p>
  213. <example caption='Client queries a chatroom for supported features'><![CDATA[
  214. <iq type='get'
  215. from=''
  216. to='balconyscene@plays.shakespeare.lit'
  217. id='neg1'>
  218. <query xmlns=''/>
  219. </iq>]]></example>
  220. <example caption='Chatroom returns supported features'><![CDATA[
  221. <iq type='result'
  222. from='balconyscene@plays.shakespeare.lit'
  223. to=''
  224. id='neg1'>
  225. <query xmlns=''>
  226. ...
  227. <feature var=''/>
  228. <feature var='muc-password'/>
  229. ...
  230. </query>
  231. </iq>]]></example>
  232. <p>The "using protocol" (in these examples, &xep0045;) SHOULD specify which features might be negotiable, either in the relevant documentation or in the entry for that feature in the service discovery features registry maintained by the &REGISTRAR;. However, the initiating entity MAY also query the responding entity in order to determine which features are negotiable, as shown below.</p>
  233. <example caption='Client queries chatroom regarding options for a negotiable feature'><![CDATA[
  234. <iq type='get'
  235. from=''
  236. to='balconyscene@plays.shakespeare.lit'
  237. id='neg2'>
  238. <feature xmlns=''>
  239. <x xmlns='jabber:x:data' type='submit'>
  240. <field var='muc-password'/>
  241. </x>
  242. </feature>
  243. </iq>]]></example>
  244. <p>If that feature is not negotiable, the responding entity SHOULD return a "Feature Not Implemented" error:</p>
  245. <example caption='Chatroom returns error'><![CDATA[
  246. <iq type='result'
  247. from='balconyscene@plays.shakespeare.lit'
  248. to=''
  249. id='neg2'>
  250. <feature xmlns=''>
  251. <x xmlns='jabber:x:data' type='submit'>
  252. <field var='muc-password'/>
  253. </x>
  254. </feature>
  255. <error type='cancel'>
  256. <feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  257. </error>
  258. </iq>]]></example>
  259. <p>If that feature is negotiable, the responding entity SHOULD return an appropriate negotiation form:</p>
  260. <example caption='Chatroom returns negotiation form'><![CDATA[
  261. <iq type='result'
  262. from='balconyscene@plays.shakespeare.lit'
  263. to=''
  264. id='neg2'>
  265. <feature xmlns=''>
  266. <x xmlns='jabber:x:data' type='result'>
  267. <field var='FORM_TYPE'>
  268. <value>MUC</value>
  269. </field>
  270. <field var='muc-password' type='list-single'>
  271. <option><value>cleartext</value></option>
  272. <option><value>SHA1</value></option>
  273. <option><value>SASL</value></option>
  274. </field>
  275. </x>
  276. </feature>
  277. </iq>]]></example>
  278. <p>The initiating entity MAY then submit a data form containing the required information.</p>
  279. </section2>
  280. </section1>
  281. <section1 topic='Security Considerations' anchor='security'>
  282. <p>If the responding entity responds to the initiating entity or returns an error (other than a &unavailable; response to an &IQ; request), the initiating entity will effectively discover the presence of the responding entity's resource. Due care must therefore be exercised in determining how to respond (or whether to respond at all to a &MESSAGE; request). For examples, the responding entity SHOULD NOT <em>automatically</em> (i.e. without first asking its human user) either respond to the initiating entity's request or return a specific error unless the initiating entity is subscribing to the responding entity's presence (and the responding entity's presence is not currently "invisible" to the initiating entity). Note: There should be no need for the responding entity's client to consult its block list, since if the initiating entity is on the list then the responding entity would not receive any requests from the initiating entity anyway.</p>
  283. </section1>
  284. <section1 topic='IANA Considerations' anchor='iana'>
  285. <p>This document requires no interaction with &IANA;.</p>
  286. </section1>
  287. <section1 topic="XMPP Registrar Considerations" anchor='registrar'>
  288. <p>In order for Jabber entities to adequately leverage <strong>Data Forms</strong> (e.g., by using machine-readable fields), it is RECOMMENDED to register standard x-data fields with the <cite>XMPP Registrar</cite> via the mechanisms defined in &xep0068;. Whether to do so for any given features and options shall be determined by the "using protocol".</p>
  289. </section1>
  290. <section1 topic='XML Schema' anchor='schema'>
  291. <code><![CDATA[
  292. <?xml version='1.0' encoding='UTF-8'?>
  293. <xs:schema
  294. xmlns:xs=''
  295. targetNamespace=''
  296. xmlns=''
  297. elementFormDefault='qualified'>
  298. <xs:import namespace='jabber:x:data'
  299. schemaLocation=''/>
  300. <xs:annotation>
  301. <xs:documentation>
  302. The protocol documented by this schema is defined in
  303. XEP-0020:
  304. </xs:documentation>
  305. </xs:annotation>
  306. <xs:element name='feature'>
  307. <xs:complexType>
  308. <xs:sequence xmlns:data='jabber:x:data'>
  309. <xs:element ref='data:x'/>
  310. </xs:sequence>
  311. </xs:complexType>
  312. </xs:element>
  313. </xs:schema>
  314. ]]></code>
  315. </section1>
  316. <section1 topic='Author Note' anchor='authornote'>
  317. <p>Peter Millard, the primary author of this specification from version 0.1 through version 1.4, died on April 26, 2006. The remaining authors are thankful for Peter's work on this specification.</p>
  318. </section1>
  319. </xep>