-
Notifications
You must be signed in to change notification settings - Fork 119
/
xep-0135.xml
561 lines (557 loc) · 29.5 KB
/
xep-0135.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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
<?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>File Sharing</title>
<abstract>This document specifies a simple extension to existing protocols for file sharing over Jabber/XMPP.</abstract>
&LEGALNOTICE;
<number>0135</number>
<status>Deferred</status>
<type>Standards Track</type>
<sig>Standards</sig>
<approver>Council</approver>
<dependencies>
<spec>XMPP Core</spec>
<spec>XEP-0030</spec>
<spec>XEP-0096</spec>
</dependencies>
<supersedes/>
<supersededby/>
<shortname>files</shortname>
&stpeter;
<revision>
<version>0.1</version>
<date>2004-06-04</date>
<initials>psa</initials>
<remark>Initial version.</remark>
</revision>
</header>
<section1 topic='Introduction' anchor='intro'>
<p>Existing Jabber protocols provide a strong foundation for the controlled, permissions-based sharing of files between Jabber entities, e.g., to enable shared workspaces among ad-hoc workgroups and the attachment of files to &xep0045; rooms.</p>
<p>This document defines several additional building blocks (a simple request protocol along with well-known service discovery nodes) that tie together existing protocols to enable the sharing of files between Jabber entities.</p>
</section1>
<section1 topic='Requirements' anchor='reqs'>
<ol>
<li>Enable a requesting entity to find files shared by an offering entity without depending on third parties (such as &xep0060; services or dedicated <link url="#hosting">file-hosting services</link>) (REQUIRED).</li>
<li>Enable a requesting entity to discover detailed file information (OPTIONAL).</li>
<li>Enable a requesting entity to ask for files shared by an offering entity (REQUIRED).</li>
<li>Re-use existing Jabber/XMPP protocols wherever possible.</li>
</ol>
</section1>
<section1 topic='Assumptions' anchor='assumptions'>
<p>The protocol defined herein assumes that the offering entity is the file owner. The primary reason for this approach is that most likely the file owner (e.g., a chatroom or end user) knows best which files are available and which requesting entities have permission to view which files. Furthermore, for the purposes of this protocol it is unnecessary to assume that dedicated file-hosting services will exist on the Jabber network or that existing Jabber servers will offer file-hosting functionality (though see the <link url="#hosting">File-Hosting Services</link> section of this document).</p>
</section1>
<section1 topic='Discovering Support and Address of Offering Entity' anchor='disco'>
<section2 topic='Offering Entity is File Owner' anchor='disco-owner'>
<p>If an entity directly supports the protocol defined herein, it SHOULD include a feature of "http://jabber.org/protocol/files" in its response to a &xep0030; information request. The protocol flow is shown in the following example (an end user querying a chatroom):</p>
<example caption='User Queries a Room Regarding Support'><![CDATA[
<iq type='get'
from='hag66@shakespeare.lit/pda'
to='darkcave@macbeth.shakespeare.lit'
id='disco1'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
]]></example>
<example caption='Room Returns Info'><![CDATA[
<iq type='result'
from='darkcave@macbeth.shakespeare.lit'
to='hag66@shakespeare.lit/pda'
id='disco3'>
<query xmlns='http://jabber.org/protocol/disco#info'>
...
<feature var='http://jabber.org/protocol/files'/>
...
</query>
</iq>
]]></example>
<p>This document stipulates that communications regarding files MUST occur by sending stanzas to the well-known service discovery node "files" (or sub-nodes thereof as defined below). Therefore, even if (as in the foregoing example) the file owner directly supports the protocol defined herein, the requesting entity MUST send subsequent file-related service discovery requests to the node "files" (or sub-nodes thereof). The file owner also SHOULD list that node in its response to a service discovery items request, as shown in the following example:</p>
<example caption='User Queries a Room Regarding Items'><![CDATA[
<iq type='get'
from='hag66@shakespeare.lit/pda'
to='darkcave@macbeth.shakespeare.lit'
id='disco2'>
<query xmlns='http://jabber.org/protocol/disco#items'/>
</iq>
]]></example>
<example caption='Room Returns Items'><![CDATA[
<iq type='result'
from='darkcave@macbeth.shakespeare.lit'
to='hag66@shakespeare.lit/pda'
id='disco2'>
<query xmlns='http://jabber.org/protocol/disco#items'>
...
<item jid='darkcave@macbeth.shakespeare.lit'
node='files'
name='The files attached to this room'/>
...
</query>
</iq>
]]></example>
</section2>
<section2 topic='Offering Entity is not File Owner' anchor='disco-host'>
<p>It is possible that the file owner does not directly support the protocol defined herein and therefore that the offering entity has a JID different from that of the file owner. In this case, the file owner MUST NOT include a feature of "http://jabber.org/protocol/files" in its response to a service discovery information request, as shown in the following example (an end user querying another end user):</p>
<example caption='User Queries Contact Regarding Support'><![CDATA[
<iq type='get'
from='juliet@capulet.com/chamber'
to='romeo@montague.net/home'
id='disco3'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
]]></example>
<example caption='Contact Returns Info'><![CDATA[
<iq type='result'
from='romeo@montague.net/home'
to='juliet@capulet.com/chamber'
id='disco3'>
<query xmlns='http://jabber.org/protocol/disco#info'>
...
</query>
</iq>
]]></example>
<p>However, in this case the file owner SHOULD still include the offering entity (e.g., a hosting service) in its response to a service discovery items request:</p>
<example caption='User Queries Contact Regarding Items'><![CDATA[
<iq type='get'
from='juliet@capulet.com/chamber'
to='romeo@montague.net/home'
id='disco4'>
<query xmlns='http://jabber.org/protocol/disco#items'/>
</iq>
]]></example>
<example caption='Contact Returns Items'><![CDATA[
<iq type='result'
from='romeo@montague.net/home'
to='juliet@capulet.com/chamber'
id='disco4'>
<query xmlns='http://jabber.org/protocol/disco#items'>
...
<item jid='romeo@files.shakespeare.lit'
node='files'
name='Romeo's Files'/>
...
</query>
</iq>
]]></example>
</section2>
</section1>
<section1 topic='Finding Files' anchor='find'>
<section2 topic='Determining if Files are Available' anchor='find-avail'>
<p>If an offering entity has files to share, it SHOULD reply positively when a requesting entity sends a service discovery items request to the well-known service discovery node "files":</p>
<example caption='Requesting the File List'><![CDATA[
<iq type='get'
from='hag66@shakespeare.lit/pda'
to='darkcave@macbeth.shakespeare.lit'
id='avail'>
<query xmlns='http://jabber.org/protocol/disco#items'
node='files'/>
</iq>
]]></example>
<p>If the requesting entity is not allowed to view the offering entity's files (the requesting entity is not an occupant of a chatroom, is not registered with the offering entity, is not a contact in a user's roster, etc.) or the offering entity has no files to share, the offering entity SHOULD return an empty &QUERY; element:</p>
<example caption='No Files to Share'><![CDATA[
<iq type='result'
from='darkcave@macbeth.shakespeare.lit'
to='hag66@shakespeare.lit/pda'
id='avail'>
<query xmlns='http://jabber.org/protocol/disco#items'
node='files'/>
</iq>
]]></example>
<p>If the requesting entity is allowed to view the offering entity's files and the offering entity has files to share, the offering entity SHOULD return a list of items:</p>
<example caption='Returning the File List'><![CDATA[
<iq type='result'
from='darkcave@macbeth.shakespeare.lit'
to='hag66@shakespeare.lit/pda'
id='avail'>
<query xmlns='http://jabber.org/protocol/disco#items'
node='files'>
<item jid='darkcave@macbeth.shakespeare.lit'
node='files/somedir'/>
<item jid='darkcave@macbeth.shakespeare.lit'
node='files/somefile'
name='file1'/>
</query>
</iq>
]]></example>
<p>Note: The NodeID MUST begin with the string 'files' followed by the '/' character followed the name of the directory or file; further subdirectories or files within a directory MUST follow the same pattern (e.g., "files/somedir/anotherfile"). Thus the protocol defined herein enforces semantic meaning on NodeIDs; this is OPTIONAL within <strong>Service Discovery</strong> but REQUIRED by this document.</p>
<p>If the offering entity has only a few files to share, it may be appropriate to make them available via service discovery only, thus requiring the requesting entity to "walk the tree" of directories and files as described in the <link url="#find-disco">Finding All Files via Service Discovery</link> section. However, if the offering entity has a larger number of files to share, the number of service discovery requests and responses required to "walk the tree" of all directories and files might result in excessive amounts of traffic between the requesting entity and the offering entity; in this case, the offering entity SHOULD provide a "tree file" that defines the hierarchy of directories and files in the standardized format specified in the <link url="#find-tree">Retrieving the Tree File</link> section. The number of files that counts as "large" is not defined herein and is left up to the implementation or deployment; in practice, it is RECOMMENDED for the offering entity to provide a tree file if it has more than five (5) files to share.</p>
</section2>
<section2 topic='Finding All Files via Service Discovery' anchor='find-disco'>
<p>If the offering entity does not provide a tree file, the requesting entity will need to "walk the tree" via service discovery in order to find all the files shared by the offering entity. The previous example showed an offering entity that had two items available: a directory and a file. In order to determine if an item is a directory or a file, the requesting entity MUST send a disco#info request to the relevant node:</p>
<example caption='Requesting Further Information (1)'><![CDATA[
<iq type='get'
from='hag66@shakespeare.lit/pda'
to='darkcave@macbeth.shakespeare.lit'
id='info1'>
<query xmlns='http://jabber.org/protocol/disco#info'
node='files/somedir'/>
</iq>
]]></example>
<p>If the item is a directory, the offering entity SHOULD return information about the directory, including an identity whose category is "filesys" and whose type is "directory":</p>
<example caption='Returning Further Information (1)'><![CDATA[
<iq type='result'
from='darkcave@macbeth.shakespeare.lit'
to='hag66@shakespeare.lit/pda'
id='info1'>
<query xmlns='http://jabber.org/protocol/disco#info'
node='files/somedir'>
<identity category='filesys' type='directory'/>
</query>
</iq>
]]></example>
<p>If the requesting entity wants information about every item, it MUST query each item individually:</p>
<example caption='Requesting Further Information (2)'><![CDATA[
<iq type='get'
from='hag66@shakespeare.lit/pda'
to='darkcave@macbeth.shakespeare.lit'
id='info2'>
<query xmlns='http://jabber.org/protocol/disco#info'
node='files/somefile'/>
</iq>
]]></example>
<p>If the item is a file, the offering entity SHOULD return information about the file, including an identity whose category is "filesys" and whose type is "file":</p>
<example caption='Returning Further Information (2)'><![CDATA[
<iq type='result'
from='darkcave@macbeth.shakespeare.lit'
to='hag66@shakespeare.lit/pda'
id='info2'>
<query xmlns='http://jabber.org/protocol/disco#info'
node='files/somefile'>
<identity category='filesys' type='file' name='file1'/>
</query>
</iq>
]]></example>
<p>Note: The offering entity MAY also include detailed information about the file, as described in the <link url="#find-details">Determining File Details</link> section of this document.</p>
<p>If the requesting entity wants to find all files, it needs to send a disco#items query to the directory:</p>
<example caption='Requesting Further Items (1)'><![CDATA[
<iq type='get'
from='hag66@shakespeare.lit/pda'
to='darkcave@macbeth.shakespeare.lit'
id='items1'>
<query xmlns='http://jabber.org/protocol/disco#items'
node='files/somedir'/>
</iq>
]]></example>
<p>The offering entity will then return a list of files and directories contained within the queried directory:</p>
<example caption='Returning Further Items (1)'><![CDATA[
<iq type='result'
from='darkcave@macbeth.shakespeare.lit'
to='hag66@shakespeare.lit/pda'
id='items1'>
<query xmlns='http://jabber.org/protocol/disco#items'
node='files/somedir'>
<item jid='darkcave@macbeth.shakespeare.lit'
node='files/somedir/anotherdir'/>
<item jid='darkcave@macbeth.shakespeare.lit'
node='files/somedir/anotherfile'
name='file2'/>
</query>
</iq>
]]></example>
<p>The requesting entity then needs to send further disco#info and disco#items requests to the offering entity, specifying the appropriate service discovery nodes...</p>
<example caption='Requesting Further Information (3)'><![CDATA[
<iq type='get'
from='hag66@shakespeare.lit/pda'
to='darkcave@macbeth.shakespeare.lit'
id='info3'>
<query xmlns='http://jabber.org/protocol/disco#info'
node='files/somedir/anotherdir'/>
</iq>
]]></example>
<example caption='Returning Further Information (3)'><![CDATA[
<iq type='result'
from='darkcave@macbeth.shakespeare.lit'
to='hag66@shakespeare.lit/pda'
id='info3'>
<query xmlns='http://jabber.org/protocol/disco#info'
node='files/somedir/anotherdir'>
<identity category='filesys' type='directory'/>
</query>
</iq>
]]></example>
<example caption='Requesting Further Information (4)'><![CDATA[
<iq type='get'
from='hag66@shakespeare.lit/pda'
to='darkcave@macbeth.shakespeare.lit'
id='info4'>
<query xmlns='http://jabber.org/protocol/disco#info'
node='files/somedir/anotherfile'/>
</iq>
]]></example>
<example caption='Returning Further Information (4)'><![CDATA[
<iq type='result'
from='darkcave@macbeth.shakespeare.lit'
to='hag66@shakespeare.lit/pda'
id='info4'>
<query xmlns='http://jabber.org/protocol/disco#info'
node='files/somedir/anotherfile'>
<identity category='filesys' type='file' name='file2'/>
</query>
</iq>
]]></example>
<example caption='Requesting Further Items (2)'><![CDATA[
<iq type='get'
from='hag66@shakespeare.lit/pda'
to='darkcave@macbeth.shakespeare.lit'
id='items2'>
<query xmlns='http://jabber.org/protocol/disco#items'
node='files/somedir/anotherdir'/>
</iq>
]]></example>
<example caption='Returning Further Items (2)'><![CDATA[
<iq type='result'
from='darkcave@macbeth.shakespeare.lit'
to='hag66@shakespeare.lit/pda'
id='items2'>
<query xmlns='http://jabber.org/protocol/disco#items'
node='files/somedir/anotherdir'>
<item jid='darkcave@macbeth.shakespeare.lit'
node='files/somedir/anotherdir/yetanotherfile'
name='file3'/>
</query>
</iq>
]]></example>
<example caption='Requesting Further Information (5)'><![CDATA[
<iq type='get'
from='hag66@shakespeare.lit/pda'
to='darkcave@macbeth.shakespeare.lit'
id='info5'>
<query xmlns='http://jabber.org/protocol/disco#info'
node='files/somedir/anotherdir/yetanotherfile'/>
</iq>
]]></example>
<example caption='Returning Further Information (5)'><![CDATA[
<iq type='result'
from='darkcave@macbeth.shakespeare.lit'
to='hag66@shakespeare.lit/pda'
id='info5'>
<query xmlns='http://jabber.org/protocol/disco#info'
node='files/somedir/anotherdir/yetanotherfile'>
<identity category='filesys' type='file' name='file3'/>
</query>
</iq>
]]></example>
<p>In this scenario, we can reconstruct the file tree as follows:</p>
<code><![CDATA[
share
\--somefile
\--somedir
\--anotherfile
\--anotherdir
\--yetanotherfile
]]></code>
</section2>
<section2 topic='Retrieving the Tree File' anchor='find-tree'>
<p>Obviously, finding all files via service discovery is a tedious process. Therefore, it is RECOMMENDED that the offering entity provide a "tree file" if it has more than five (5) files to share. The format of the tree file is defined by the 'http://jabber.org/profile/si/profile/tree-transfer' namespace that is specified in &xep0105;. The tree file MUST be named "tree.xml" and MUST be available at the well-known service discovery node "tree.xml". The offering entity MAY create a different tree file for each requesting entity (depending on the requesting entity's permissions to view certain directories and files); for this reason, the tree file SHOULD NOT be contained in the root "files" directory itself (note that its NodeID is "tree.xml", not "files/tree.xml").</p>
<p>If the offering entity provides a tree file, it MUST communicate that fact in the disco#items result it returns to the requesting entity in response to the initial request:</p>
<example caption='Requesting the File List'><![CDATA[
<iq type='get'
from='hag66@shakespeare.lit/pda'
to='darkcave@macbeth.shakespeare.lit'
id='avail'>
<query xmlns='http://jabber.org/protocol/disco#items'
node='files'/>
</iq>
]]></example>
<example caption='Returning the File List'><![CDATA[
<iq type='result'
from='darkcave@macbeth.shakespeare.lit'
to='hag66@shakespeare.lit/pda'
id='avail'>
<query xmlns='http://jabber.org/protocol/disco#items'
node='files'>
<item jid='darkcave@macbeth.shakespeare.lit'
node='files/somedir'/>
<item jid='darkcave@macbeth.shakespeare.lit'
node='files/somefile'
name='file1'/>
<item jid='darkcave@macbeth.shakespeare.lit'
node='tree.xml'
name='Tree File'/>
</query>
</iq>
]]></example>
<p>If the offering entity includes a service discovery item whose NodeID is "tree.xml", the requesting entity SHOULD retrieve that file (using the protocol specified in the <link url="retrieve">Retrieving a File</link> section) before sending any further service discovery requests to the offering entity.</p>
<p>The following example shows the exact format of the tree file that would represent the file and directory hierarchy discovered via service discovery in the preceding section:</p>
<example caption='A Tree File'><![CDATA[
<tree xmlns='http://jabber.org/profile/si/profile/tree-transfer'
numfiles='3'
size='72521'>
<directory name='files'>
<file sid='file1' name='somefile'/>
<directory name='somedir'>
<file sid='file2' name='anotherfile'/>
<directory name='anotherdir'>
<file sid='file3' name='yetanotherfile'/>
</directory>
</directory>
</directory>
</tree>
]]></example>
<p>If the offering entity provides a tree file, it is RECOMMENDED (but not required) for the offering entity to also make information about its files discoverable via <strong>Service Discovery</strong> as described in the following section.</p>
</section2>
<section2 topic='Determining File Details' anchor='find-details'>
<p>As is evident from the foregoing examples, neither "walking the tree" via <strong>Service Discovery</strong> nor retrieving the tree file will yield the kind of detailed information about a file (MIME type, file size, descriptive text, etc.) that can help a user or application decide whether to retrieve the file.</p>
<p>To address the felt need for more detailed information about files, an offering entity MAY provide such information in response to disco#info requests sent to a specific NodeID (file or directory) by including extended information structured according to &xep0128;. The following examples illustrate this usage.</p>
<example caption='Requesting File Information'><![CDATA[
<iq type='get'
from='hag66@shakespeare.lit/pda'
to='darkcave@macbeth.shakespeare.lit'
id='file1'>
<query xmlns='http://jabber.org/protocol/disco#info'
node='files/somefile'/>
</iq>
]]></example>
<example caption='Returning Detailed File Information'><![CDATA[
<iq type='result'
from='darkcave@macbeth.shakespeare.lit'
to='hag66@shakespeare.lit/pda'
id='info2'>
<query xmlns='http://jabber.org/protocol/disco#info'
node='files/somefile'>
<identity category='filesys' type='file' name='file1'/>
<x xmlns='jabber:x:data' type='result'>
<field var='FORM_TYPE' type='hidden'>
<value>http://jabber.org/protocol/files</value>
</field>
<field var='date'>
<value>2004-05-12T02:37:07Z</value>
</field>
<field var='description'>
<value>This is just a test file.</value>
</field>
<field var='hash'>
<value>552da749930852c69ae5d2141d3766b1</value>
</field>
<field var='mime-type'>
<value>text/plain</value>
</field>
<field var='size'>
<value>1022</value>
</field>
</x>
</query>
</iq>
]]></example>
<p>The fields shown are RECOMMENDED, and are specified more fully in the <link url='#registrar'>XMPP Registrar Considerations</link> section of this document.</p>
</section2>
</section1>
<section1 topic='Retrieving a File' anchor='retrieve'>
<p>In order to retrieve a file, the requesting entity sends a retrieval request to the JID+NodeID of the relevant item:</p>
<example caption='Retrieving a File'><![CDATA[
<iq type='get'
from='hag66@shakespeare.lit/pda'
to='darkcave@macbeth.shakespeare.lit'
id='retrieve1'>
<retrieve xmlns='http://jabber.org/protocol/files'
node='files/somefile'/>
</iq>
]]></example>
<p>Note: If the requested file was found by means of the tree file rather than service discovery, the NodeID of the retrieve request MUST be constructed according to the rules specified above for service discovery NodeIDs (i.e., 'files' followed by the '/' character followed by the name of the directory or file, followed by additional '/' characters and subdirectory or file names as needed).</p>
<p>If the offering entity agrees to share the file with the requesting entity, it MUST return an IQ result to the requesting entity and then immediately initiate a file transfer to the requesting entity following the protocol defined in &xep0096;:</p>
<example caption='Offering Entity Agrees to Share File'><![CDATA[
<iq type='result' id='retrieve1'/>
]]></example>
<example caption='Offering Entity Initiates File Transfer'>
<![CDATA[
<iq type='set'
from='darkcave@macbeth.shakespeare.lit'
id='offer1'
to='hag66@shakespeare.lit/pda'>
<si xmlns='http://jabber.org/protocol/si'
id='file1'
mime-type='text/plain'
profile='http://jabber.org/protocol/si/profile/file-transfer'>
<file xmlns='http://jabber.org/protocol/si/profile/file-transfer'
name='somefile'
size='1022'/>
<feature xmlns='http://jabber.org/protocol/feature-neg'>
<x xmlns='jabber:x:data' type='form'>
<field var='stream-method' type='list-single'>
<option><value>http://jabber.org/protocol/bytestreams</value></option>
<option><value>http://jabber.org/protocol/ibb</value></option>
</field>
</x>
</feature>
</si>
</iq>
]]></example>
<p>The value of the <si/> element's 'id' attribute MUST be the same as the value of the 'sid' attribute communicated in the tree file or the 'name' attribute communicated via service discovery; for this reason, the service discovery 'name' attribute is REQUIRED for NodeIDs that correspond to files, and its value MUST follow the rules for the 'sid' attribute specified in XEP-0105.</p>
<p>Upon receiving the file transfer initiation from the offering entity, the requesting entity SHOULD check the SI 'id' in order to correlate the file transfer with the request; if there is a match, the requesting entity SHOULD silently accept the file transfer and not require intervention by a human before proceeding.</p>
<p>If the offering entity does not agree to share the file with the requesting entity, it MUST return an appropriate IQ error to the requesting entity, such as "Not Authorized", "Forbidden", "Payment Required", "Registration Required", or "Not Found" (see &xep0086; regarding error syntax).</p>
</section1>
<section1 topic='File-Hosting Services' anchor='hosting'>
<p>A dedicated file-hosting service may agree to host files on behalf of a user or other entity, in which case the hosting service (or, to be precise, a specific resource of the hosting service) becomes the offering entity in the use cases defined herein. While the nature of such hosting services is outside the scope of this document, the following guidelines may be helpful to implementers.</p>
<p>First, a file-hosting service SHOULD provide a distinct JID for each account on the service in order to enable communications between the requesting entity and the hosting service. For example, let us suppose that <files.shakespeare.lit> is a file-hosting service; specific accounts on the service could be structured as JIDs of the form <account@files.shakespeare.lit> or <files.shakespeare.lit/account>, in which case the requesting entity would communicate directly with that JID and treat that JID as the offering entity. The file-hosting service SHOULD enable the file owner (e.g., an end user whose JID is <romeo@montague.net>) to upload files to the service using standard Internet protocols (such as HTTP, FTP, scp, or XEP-0096), control who can view or retrieve files, and otherwise configure the offering entity. The file owner SHOULD also list the JID of the "offering entity" in response to service discovery items requests sent to the user's bare JID, so that requesting entities can find files hosted by the service on the file owner's behalf.</p>
<p>It is possible that some Jabber server deployments would choose to offer file-hosting capabilities for their users (if supported in the underlying server implementation), so that the offering entity would have the same <user@host> address as the file owner. In this case, the server itself can be considered a file-hosting service.</p>
</section1>
<section1 topic='Security Considerations' anchor='security'>
<p>Managing access to files and directories is the responsibility of the offering entity. However, the offering entity SHOULD NOT share files with requesting entities that are not known to it via presence subscription, prior registration, room occupancy, or some similar mechanism.</p>
</section1>
<section1 topic='IANA Considerations' anchor='iana'>
<p>No interaction with &IANA; is required as a result of this document.</p>
</section1>
<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
<section2 topic='Protocol Namespaces' anchor='registrar-ns'>
<p>Upon advancement of this document to a status of Draft, the ®ISTRAR; shall add the 'http://jabber.org/protocol/files' namespace to its registry of protocol namespaces.</p>
</section2>
<section2 topic='Well-Known Service Discovery Nodes' anchor='registrar-nodes'>
<p>Upon advancement of this document to a status of Draft, the XMPP Registrar shall add 'files' and 'tree.xml' to its registry of well-known service discovery nodes.</p>
</section2>
<section2 topic='Service Discovery Identities' anchor='registrar-identities'>
<p>Upon advancement of this document to a status of Draft, the XMPP Registrar shall add a category of 'filesys' to its registry of service discovery identities, with two associated types: 'directory' and 'file'.</p>
</section2>
<section2 topic='Field Standardization' anchor='registrar-formtype'>
<p>&xep0068; defines a process for standardizing the fields used within Data Forms scoped by a particular namespace. This document reserves the FORM_TYPE "http://jabber.org/protocol/files" as well as specific fields for use within the context of that FORM_TYPE, as specified in the following registry submission.</p>
<code caption='Registry Submission'><![CDATA[
<form_type>
<name>http://jabber.org/protocol/files</name>
<doc>XEP-01xx</doc>
<desc>Service Discovery extension for file descriptions.</desc>
<field var='date'
type='text-single'
label='Equivalent to date attribute from XEP-0096'/>
<field var='description'
type='text-single'
label='Equivalent to desc element from XEP-0096'/>
<field var='hash'
type='text-single'
label='Equivalent to hash attribute from XEP-0096'/>
<field var='mime-type'
type='text-single'
label='Equivalent to mime-type attribute from XEP-0095'/>
<field var='size'
type='text-single'
label='Equivalent to size attribute from XEP-0096'/>
</form_type>
]]></code>
</section2>
</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/files'
xmlns='http://jabber.org/protocol/files'
elementFormDefault='qualified'>
<xs:element name='retrieve'>
<xs:complexType>
<xs:simpleContent>
<xs:extension base='empty'>
<xs:attribute name='node' type='xs:string' use='required'/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:simpleType name='empty'>
<xs:restriction base='xs:string'>
<xs:enumeration value=''/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
]]></code>
</section1>
</xep>