forked from xsf/xeps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xep-0020.xml
322 lines (313 loc) · 15.1 KB
/
xep-0020.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
<?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>
<status>Draft</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;
<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 <query/> to <feature/> 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 & 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 <feature/> child elements qualified by the 'http://jabber.org/protocol/feature-neg' namespace. However, this <feature/> 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 <feature/> 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 <text/> 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 ¬acceptable; error, and SHOULD specify the relevant feature(s) in the XMPP <text/> 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 <feature var='http://jabber.org/protocol/feature-neg'/> 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 ®ISTRAR;. 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>