1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-23 17:52:15 -05:00
xeps/xep-0020.xml

329 lines
15 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
<!ENTITY % ents SYSTEM 'xep.ent'>
%ents;
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
<title>Feature Negotiation</title>
<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>
&LEGALNOTICE;
<number>0020</number>
2018-03-07 14:06:18 -05:00
<status>Deprecated</status>
<type>Standards Track</type>
<sig>Standards</sig>
<dependencies>
<spec>XMPP Core</spec>
<spec>XEP-0004</spec>
</dependencies>
<supersedes/>
<supersededby/>
<shortname>feature-neg</shortname>
<schemaloc>
<url>http://xmpp.org/schemas/feature-neg.xsd</url>
</schemaloc>
&pgmillard;
&stpeter;
&ianpaterson;
2018-03-07 14:06:18 -05:00
<revision>
<version>1.6</version>
<date>2018-03-07</date>
<initials>jwi (Editor)</initials>
<remark>Deprecated as per Council vote on 2018-03-07.</remark>
</revision>
<revision>
<version>1.5</version>
<date>2006-11-21</date>
<initials>ip</initials>
<remark>Added FORM_TYPEs to examples; added service-unavailable error and Security Considerations; various other updates and corrections avoiding material changes.</remark>
</revision>
<revision>
<version>1.4</version>
<date>2004-05-21</date>
<initials>psa</initials>
<remark>Moved remaining feature negotiation text from XEP-0030 to this document.</remark>
</revision>
<revision>
<version>1.3</version>
<date>2004-04-23</date>
<initials>psa</initials>
<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>
</revision>
<revision>
<version>1.2</version>
<date>2004-03-08</date>
<initials>psa</initials>
<remark>Added XMPP error handling; clarified the text; corrected the examples; fixed an error in the schema; added numerous references.</remark>
</revision>
<revision>
<version>1.1</version>
<date>2003-02-16</date>
<initials>psa</initials>
<remark>Made corrections to the text; added security and IANA considerations; added schema.</remark>
</revision>
<revision>
<version>1.0</version>
<date>2002-12-06</date>
<initials>psa</initials>
<remark>Per a vote of the Jabber Council, revision 0.4 was advanced to Draft on 2002-12-06.</remark>
</revision>
<revision>
<version>0.4</version>
<date>2002-11-17</date>
<initials>pgm</initials>
<remark>Changed protocol to use jabber:x:data.</remark>
</revision>
<revision>
<version>0.3</version>
<date>2002-10-01</date>
<initials>pgm</initials>
<remark>Added some extra text to help clarify protocol &amp; purpose.</remark>
</revision>
<revision>
<version>0.2</version>
<date>2002-05-22</date>
<initials>pgm</initials>
<remark>Changed examples.</remark>
</revision>
<revision>
<version>0.1</version>
<date>2002-02-26</date>
<initials>pgm</initials>
<remark>Initial version.</remark>
</revision>
</header>
<section1 topic="Introduction" anchor='intro'>
<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>
<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>
</section1>
<section1 topic="Protocol Details" anchor='protocol'>
<p>Features are negotiated through the exchange of &IQ; or &MESSAGE; stanzas containing &lt;feature/&gt; child elements qualified by the 'http://jabber.org/protocol/feature-neg' 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>
<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>
<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>
<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>
<section2 topic="Basic Flow" anchor='protocol-basic'>
<p>A typical negotiation flow is shown in the following example of two entities negotiating the time and place for a meeting.</p>
<example caption="Initiating entity sends offer"><![CDATA[
<iq type='set'
from='romeo@montague.net/orchard'
to='juliet@capulet.com/balcony'
id='neg1'>
<feature xmlns='http://jabber.org/protocol/feature-neg'>
<x xmlns='jabber:x:data' type='form'>
<field var='FORM_TYPE' type='hidden'>
<value>romantic_meetings</value>
</field>
<field type='list-single' var='places-to-meet'>
<option><value>Secret Grotto</value></option>
<option><value>Verona Park</value></option>
</field>
<field type='list-single' var='times-to-meet'>
<option><value>22:00</value></option>
<option><value>22:30</value></option>
<option><value>23:00</value></option>
</field>
</x>
</feature>
</iq>
]]></example>
<example caption="Responding entity sends preferred option values"><![CDATA[
<iq type='result'
id='neg1'
from='juliet@jabber.org/balcony'
to='romeo@montague.net/orchard'>
<feature xmlns='http://jabber.org/protocol/feature-neg'>
<x xmlns='jabber:x:data' type='submit'>
<field var='FORM_TYPE'>
<value>romantic_meetings</value>
</field>
<field var='places-to-meet'>
<value>Secret Grotto</value>
</field>
<field var='times-to-meet'>
<value>22:30</value>
</field>
</x>
</feature>
</iq>
]]></example>
<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>
<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>
<example caption="Responding entity does not support feature negotiation"><![CDATA[
<iq type='error'
id='neg1'
from='juliet@jabber.org/balcony'
to='romeo@montague.net/orchard'>
<feature xmlns='http://jabber.org/protocol/feature-neg'>
<x xmlns='jabber:x:data' type='form'>
<field var='FORM_TYPE' type='hidden'>
<value>romantic_meetings</value>
</field>
...
</x>
</feature>
<error type='cancel'>
<service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</iq>
]]></example>
<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>
<example caption="Responding entity does not support a feature"><![CDATA[
<iq type='error'
id='neg1'
from='juliet@jabber.org/balcony'
to='romeo@montague.net/orchard'>
<feature xmlns='http://jabber.org/protocol/feature-neg'>
<x xmlns='jabber:x:data' type='form'>
<field var='FORM_TYPE' type='hidden'>
<value>romantic_meetings</value>
</field>
...
</x>
</feature>
<error type='cancel'>
<feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>times-to-meet</text>
</error>
</iq>
]]></example>
<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>
<example caption="Responding entity supports no options"><![CDATA[
<iq type='error'
from='juliet@jabber.org/balcony'
to='romeo@montague.net/orchard'
id='neg1'>
<feature xmlns='http://jabber.org/protocol/feature-neg'>
<x xmlns='jabber:x:data' type='form'>
<field var='FORM_TYPE' type='hidden'>
<value>romantic_meetings</value>
</field>
...
</x>
</feature>
<error type='modify'>
<not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>places-to-meet</text>
</error>
</iq>
]]></example>
</section2>
<section2 topic="Querying for Negotiable Features" anchor='protocol-query'>
<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='http://jabber.org/protocol/feature-neg'/&gt; as one of the features.</p>
<example caption='Client queries a chatroom for supported features'><![CDATA[
<iq type='get'
from='juliet@capulet.com/balcony'
to='balconyscene@plays.shakespeare.lit'
id='neg1'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>]]></example>
<example caption='Chatroom returns supported features'><![CDATA[
<iq type='result'
from='balconyscene@plays.shakespeare.lit'
to='juliet@capulet.com/balcony'
id='neg1'>
<query xmlns='http://jabber.org/protocol/disco#info'>
...
<feature var='http://jabber.org/protocol/feature-neg'/>
<feature var='muc-password'/>
...
</query>
</iq>]]></example>
<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>
<example caption='Client queries chatroom regarding options for a negotiable feature'><![CDATA[
<iq type='get'
from='juliet@capulet.com/balcony'
to='balconyscene@plays.shakespeare.lit'
id='neg2'>
<feature xmlns='http://jabber.org/protocol/feature-neg'>
<x xmlns='jabber:x:data' type='submit'>
<field var='muc-password'/>
</x>
</feature>
</iq>]]></example>
<p>If that feature is not negotiable, the responding entity SHOULD return a "Feature Not Implemented" error:</p>
<example caption='Chatroom returns error'><![CDATA[
<iq type='result'
from='balconyscene@plays.shakespeare.lit'
to='juliet@capulet.com/balcony'
id='neg2'>
<feature xmlns='http://jabber.org/protocol/feature-neg'>
<x xmlns='jabber:x:data' type='submit'>
<field var='muc-password'/>
</x>
</feature>
<error type='cancel'>
<feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</iq>]]></example>
<p>If that feature is negotiable, the responding entity SHOULD return an appropriate negotiation form:</p>
<example caption='Chatroom returns negotiation form'><![CDATA[
<iq type='result'
from='balconyscene@plays.shakespeare.lit'
to='juliet@capulet.com/balcony'
id='neg2'>
<feature xmlns='http://jabber.org/protocol/feature-neg'>
<x xmlns='jabber:x:data' type='result'>
<field var='FORM_TYPE'>
<value>MUC</value>
</field>
<field var='muc-password' type='list-single'>
<option><value>cleartext</value></option>
<option><value>SHA1</value></option>
<option><value>SASL</value></option>
</field>
</x>
</feature>
</iq>]]></example>
<p>The initiating entity MAY then submit a data form containing the required information.</p>
</section2>
</section1>
<section1 topic='Security Considerations' anchor='security'>
<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>
</section1>
<section1 topic='IANA Considerations' anchor='iana'>
<p>This document requires no interaction with &IANA;.</p>
</section1>
<section1 topic="XMPP Registrar Considerations" anchor='registrar'>
<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>
</section1>
<section1 topic='XML Schema' anchor='schema'>
<code><![CDATA[
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
targetNamespace='http://jabber.org/protocol/feature-neg'
xmlns='http://jabber.org/protocol/feature-neg'
elementFormDefault='qualified'>
<xs:import namespace='jabber:x:data'
schemaLocation='http://xmpp.org/schemas/x-data.xsd'/>
<xs:annotation>
<xs:documentation>
The protocol documented by this schema is defined in
XEP-0020: http://www.xmpp.org/extensions/xep-0020.html
</xs:documentation>
</xs:annotation>
<xs:element name='feature'>
<xs:complexType>
<xs:sequence xmlns:data='jabber:x:data'>
<xs:element ref='data:x'/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
]]></code>
</section1>
<section1 topic='Author Note' anchor='authornote'>
<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>
</section1>
</xep>