2006-10-02 18:22:13 -04:00
<?xml version='1.0' encoding='UTF-8'?>
2006-10-03 22:38:14 -04:00
< !DOCTYPE xep SYSTEM 'xep.dtd' [
<!ENTITY % ents SYSTEM 'xep.ent'>
2006-10-02 18:22:13 -04:00
%ents;
]>
2006-10-03 22:38:14 -04:00
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep >
2006-10-02 18:22:13 -04:00
<header >
2008-01-29 14:09:19 -05:00
<title > SI File Transfer</title>
2008-01-09 11:18:00 -05:00
<abstract > This specification defines a profile of the XMPP stream initiation extension for transferring files between two entities. The protocol provides a modular framework that enables the exchange of information about the file to be transferred as well as the negotiation of parameters such as the transport to be used.</abstract>
2006-10-02 18:22:13 -04:00
&LEGALNOTICE;
<number > 0096</number>
<status > Draft</status>
<type > Standards Track</type>
2007-01-14 22:38:19 -05:00
<sig > Standards</sig>
2006-10-02 18:22:13 -04:00
<dependencies >
<spec > XMPP Core</spec>
2006-10-03 22:38:14 -04:00
<spec > XEP-0095</spec>
2006-10-02 18:22:13 -04:00
</dependencies>
<supersedes />
<supersededby />
<shortname > si-filetransfer</shortname>
<schemaloc >
2006-10-03 22:38:14 -04:00
<url > http://www.xmpp.org/schemas/file-transfer.xsd</url>
2006-10-02 18:22:13 -04:00
</schemaloc>
&temas;
&linuxwolf;
&reatmon;
2011-01-05 13:49:49 -05:00
&stpeter;
2006-10-02 18:22:13 -04:00
<revision >
2011-06-09 18:29:57 -04:00
<version > 1.2</version>
2006-10-02 18:22:13 -04:00
<date > 2004-04-13</date>
<initials > psa</initials>
2006-10-03 22:38:14 -04:00
<remark > More fully defined the XMPP Registrar considerations.</remark>
2006-10-02 18:22:13 -04:00
</revision>
<revision >
<version > 1.1</version>
<date > 2003-12-30</date>
<initials > psa</initials>
<remark > Improved explanatory text; fixed several errors in the schema.</remark>
</revision>
<revision >
<version > 1.0</version>
<date > 2003-10-17</date>
<initials > psa</initials>
<remark > Per a vote of the Jabber Council, advanced status to Draft.</remark>
</revision>
<revision >
<version > 0.7</version>
<date > 2003-10-07</date>
<initials > tjm</initials>
<remark > Added IBB as a MUST requirement.</remark>
</revision>
<revision >
<version > 0.6</version>
<date > 2003-08-18</date>
<initials > tjm</initials>
<remark > Cleaned up some namespace inconsistencies, added the < desc>
element for file descriptions.</remark>
</revision>
<revision >
<version > 0.5</version>
<date > 2003-07-15</date>
<initials > rwe</initials>
<remark > Stream ids not needed on return results. Moved s5b, ibb, and url-data to the actual namespaces of the stream protocols.</remark>
</revision>
<revision >
<version > 0.4</version>
<date > 2003-06-30</date>
<initials > lw</initials>
<remark > Fixed various typos and inconsistencies</remark>
</revision>
<revision >
<version > 0.3</version>
<date > 2003-06-30</date>
<initials > lw</initials>
<remark > Added XML Schema</remark>
</revision>
<revision >
<version > 0.2</version>
<date > 2003-06-24</date>
<initials > tjm</initials>
<remark >
Clarified many examples, added linuxwolf as an author (again, my bad,
should have been there), clarified the allowed streams and how data is
sent over it.
</remark>
</revision>
<revision >
<version > 0.1</version>
<date > 2003-06-10</date>
<initials > tjm</initials>
<remark > Initial version.</remark>
</revision>
</header>
<section1 topic= 'Introduction' anchor= 'intro' >
2006-10-03 22:38:14 -04:00
<p > The traditional mechanism for transferring files in the Jabber community is the &xep0066; protocol. That protocol has several drawbacks:</p>
2006-10-02 18:22:13 -04:00
<ol >
<li > It is not reliable.</li>
<li > It does not work when one of the parties is behind a firewall.</li>
<li > It provides limited metadata about files to be exchanged.</li>
</ol>
2006-10-03 22:38:14 -04:00
<p > The current document defines a profile of &xep0095; that solves the problems with out-of-band data, thus providing a robust, reliable mechanism for file transfers over the Jabber network. Implementors are referred to XEP-0095 regarding the underlying concepts of stream initiation.</p>
2006-10-02 18:22:13 -04:00
</section1>
<section1 topic= 'Requirements' anchor= 'reqs' >
<ul >
<li > Enable seamless file transfer, including fall-back mechanisms as appropriate.</li>
<li > Ensure that the profile will work even when one or both parties are behind a firewall.</li>
2007-02-16 00:20:39 -05:00
<li > <p > Define a full-featured set of metadata for file transfers, including the following:</p>
2006-10-02 18:22:13 -04:00
<ul >
<li > description</li>
<li > size</li>
<li > name</li>
<li > date</li>
<li > hash</li>
</ul>
</li>
<li > Optionally support ranged transfers.</li>
</ul>
</section1>
<section1 topic= 'Protocol' anchor= 'protocol' >
<p >
The file transfer profile is in the
"http://jabber.org/protocol/si/profile/file-transfer" namespace.
The profile is fairly simple: it consists of the root element
with the possibility of one child describing the optional ranged transfers.
</p>
<p >
2011-06-09 18:22:31 -04:00
The root element is < file> and has four attributes. The attributes
2007-02-16 00:20:39 -05:00
are used only during the offer stage of stream initiation:</p>
2006-10-02 18:22:13 -04:00
<ul >
<li > <em > size</em> - The size, in bytes, of the data to be sent.</li>
<li > <em > name</em> - The name of the file that the Sender wishes to send.</li>
<li > <em > date</em> - The last modification time of the file. This is
2006-10-03 22:38:14 -04:00
specified using the DateTime profile as described in &xep0082; .</li>
2011-10-20 18:35:19 -04:00
<li > <em > hash</em> - The MD5 sum of the file contents.</li>
2006-10-02 18:22:13 -04:00
</ul>
2007-02-16 00:20:39 -05:00
<p > The <em > size</em> and <em > name</em> attributes MUST be present in the
2006-10-02 18:22:13 -04:00
profile. The other attributes MAY be present.
</p>
<p >
There are two possible child elements of the root: < desc> and
< range> . Both are OPTIONAL.
</p>
<p >
< desc> is used to provide a sender-generated description of the file so
the receiver can better understand what is being sent. It MUST NOT be sent in
the result.
</p>
<p >
When < range> is sent in the offer, it should have no
attributes. This signifies that the
sender can do ranged transfers. When a Stream Initiation result is sent
2007-02-16 00:20:39 -05:00
with the < range> element, it uses these attributes:</p>
2006-10-02 18:22:13 -04:00
<ul >
<li >
<em > offset</em> - Specifies the position, in bytes, to start
transferring the file data from. This defaults to zero (0) if not
specified.
</li>
<li >
<em > length</em> - Specifies the number of bytes to retrieve starting
at offset. This defaults to the length of the file from offset to the
end.
</li>
</ul>
2007-02-16 00:20:39 -05:00
<p > Both attributes are OPTIONAL on the < range> element. Sending no
2006-10-02 18:22:13 -04:00
attributes is synonymous with not sending the < range>
element. When no < range> element is sent in the
Stream Initiation result, the Sender MUST send the complete file starting at
offset 0. More generally, data is sent over the stream byte for byte starting
at the offset position for the length specified.
</p>
<section2 topic= 'Mandatory-to-Implement Technologies' anchor= 'protocol-tech' >
2006-10-03 22:38:14 -04:00
<p > In order to enable seamless file transfer and appropriate fall-back mechanisms, implementations of this profile MUST support both &xep0065; and &xep0047; , to be preferred in that order. The associated namespaces are to be included as option values for the "stream-method" variable as shown in the examples below.</p>
2006-10-02 18:22:13 -04:00
<p > Additionally, implementations MAY support other mechanisms.</p>
</section2>
</section1>
<section1 topic= 'Examples' anchor= 'examples' >
<example caption= 'Simple Profile Usage in Stream Initiation Offer' >
< ![CDATA[
<iq type= 'set' id= 'offer1' to= 'receiver@jabber.org/resource' >
<si xmlns= 'http://jabber.org/protocol/si'
id='a0'
mime-type='text/plain'
profile='http://jabber.org/protocol/si/profile/file-transfer'>
<file xmlns= 'http://jabber.org/protocol/si/profile/file-transfer'
name='test.txt'
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>
<example caption= 'Simple Profile Usage in Stream Initiation Result' >
< ![CDATA[
<iq type= 'result' to= 'sender@jabber.org/resource' id= 'offer1' >
<si xmlns= 'http://jabber.org/protocol/si' >
<feature xmlns= 'http://jabber.org/protocol/feature-neg' >
<x xmlns= 'jabber:x:data' type= 'submit' >
<field var= 'stream-method' >
<value > http://jabber.org/protocol/bytestreams</value>
</field>
</x>
</feature>
</si>
</iq>
]]>
</example>
<example caption= 'Complete Profile Usage in Stream Initiation Offer' >
< ![CDATA[
<iq type= 'set' id= 'offer1' to= 'receiver@jabber.org/resource' >
<si xmlns= 'http://jabber.org/protocol/si'
id='a0'
mime-type='text/plain'
profile='http://jabber.org/protocol/si/profile/file-transfer'>
<file xmlns= 'http://jabber.org/protocol/si/profile/file-transfer'
name='test.txt'
size='1022'
hash='552da749930852c69ae5d2141d3766b1'
date='1969-07-21T02:56:15Z'>
<desc > This is a test. If this were a real file...</desc>
</file>
<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>
<example caption= 'Complete Profile Usage in Stream Initiation Result' >
< ![CDATA[
<iq type= 'result' to= 'sender@jabber.org/resource' id= 'offer1' >
<si xmlns= 'http://jabber.org/protocol/si' >
2007-04-02 22:34:30 -04:00
<file xmlns= 'http://jabber.org/protocol/si/profile/file-transfer' />
2006-10-02 18:22:13 -04:00
<feature xmlns= 'http://jabber.org/protocol/feature-neg' >
<x xmlns= 'jabber:x:data' type= 'submit' >
<field var= 'stream-method' >
<value > http://jabber.org/protocol/bytestreams</value>
</field>
</x>
</feature>
</si>
</iq>
]]>
</example>
2007-04-02 22:34:30 -04:00
<p > This range should retrieve 256 bytes from the beginning of the file:</p>
2006-10-02 18:22:13 -04:00
<example >
< ![CDATA[
<range length= '256' />
]]>
</example>
2007-04-02 22:34:30 -04:00
<p > This range should retrieve 256 bytes starting from the 128th byte in the file:</p>
2006-10-02 18:22:13 -04:00
<example >
< ![CDATA[
<range offset= '128' length= '256' />
]]>
</example>
2007-04-02 22:34:30 -04:00
<p > This range should retrieve the remainder of the file starting at the 128th byte in the file:</p>
2006-10-02 18:22:13 -04:00
<example >
< ![CDATA[
<range offset= '128' />
]]>
</example>
2007-04-02 22:34:30 -04:00
<p > This range is the same as having not sent the range request and the entire file is sent:</p>
2006-10-02 18:22:13 -04:00
<example >
< ![CDATA[
<range />
]]>
</example>
</section1>
<section1 topic= 'IANA Considerations' anchor= 'iana' >
2006-10-03 22:38:14 -04:00
<p > No interaction with &IANA; is required as a result of this document.</p>
2006-10-02 18:22:13 -04:00
</section1>
2006-10-03 22:38:14 -04:00
<section1 topic= 'XMPP Registrar Considerations' anchor= 'registrar' >
2006-10-02 18:22:13 -04:00
<section2 topic= 'Stream Initiation Profiles' anchor= 'registrar-siprofiles' >
2006-10-03 22:38:14 -04:00
<p > The profile described in this document is included in the stream initiation profiles registry maintained by the ®ISTRAR; (see &SIPROFILES; ). The registry submission is as follows:</p>
2006-10-02 18:22:13 -04:00
<code > < ![CDATA[
<profile >
<name > http://jabber.org/protocol/si/profile/file-transfer</name>
2006-10-03 22:38:14 -04:00
<doc > XEP-0096</doc>
2006-10-02 18:22:13 -04:00
<desc > A profile for file transfer between any two entities.</desc>
</profile>
]]></code>
</section2>
<section2 topic= 'URI Query Types' anchor= 'registrar-querytypes' >
2006-10-03 22:38:14 -04:00
<p > As authorized by &xep0147; , the XMPP Registrar maintains a registry of queries and key-value pairs for use in XMPP URIs (see &QUERYTYPES; ).</p>
2006-10-02 18:22:13 -04:00
<p > As described below, the registered querytypes for file transfer actions are "sendfile" and "recvfile". Note well that "sendfile" means a second entity will send a file to the XMPP entity that controls the IRI/URI and that "recvfile" means a second entity will receive a file from the XMPP entity that controls the IRI/URI.</p>
<section3 topic= 'sendfile' anchor= 'registrar-querytypes-sendfile' >
<p > To enable a second entity to send a file, the IRI/URI is of the following form:</p>
<example caption= 'Sending a File: IRI/URI' > < ![CDATA[
xmpp:romeo@montague.net/orchard?sendfile
]]></example>
2006-10-03 22:38:14 -04:00
<p > The application SHOULD then present an interface enabling the user to provide information about the file to be sent (e.g., by "browsing" the file system of the user's computer in order to choose a file). As a result, the application SHOULD then send a &xep0137; message to the XMPP address encapsulated in the IRI/URI:</p>
2006-10-02 18:22:13 -04:00
<example caption= 'Sending a File: Resulting Stanza' > < ![CDATA[
<message from= 'juliet@capulet.com/balcony' to= 'romeo@montague.net' >
<sipub xmlns= 'http://jabber.org/protocol/si-pub'
id='publish-0123'
mime-type='text/plain'
profile='http://jabber.org/protocol/si/profile/file-transfer'>
<file xmlns= 'http://jabber.org/protocol/si/profile/file-transfer'
name='missive.txt'
size='1024'
date='2005-11-29T11:21Z'/>
</sipub>
</message>
]]></example>
<p > The following submission registers the "sendfile" querytype.</p>
<code > < ![CDATA[
<querytype >
<name > sendfile</name>
<proto > http://jabber.org/protocol/si/profile/file-transfer</proto>
<desc > enables initiation of an inbound file transfer to XMPP entity</desc>
2006-10-03 22:38:14 -04:00
<doc > XEP-0096</doc>
2006-10-02 18:22:13 -04:00
</querytype>
]]></code>
</section3>
<section3 topic= 'recvfile' anchor= 'registrar-querytypes-recvfile' >
<p > To enable a second entity to receive a file, the IRI/URI is of the following form:</p>
<example caption= 'Receiving a File: IRI/URI' > < ![CDATA[
2007-11-26 15:16:53 -05:00
xmpp:romeo@montague.net/orchard?recvfile;sid=pub234;mime-type=text%2Fplain;name=reply.txt;size=2048
2006-10-02 18:22:13 -04:00
]]></example>
<p > That IRI/URI is equivalent to the following XML stanza:</p>
<example caption= 'Receiving a File: Equivalent Stanza' > < ![CDATA[
<message from= 'romeo@montague.net' to= 'juliet@capulet.com/balcony' >
<sipub xmlns= 'http://jabber.org/protocol/si-pub'
id='pub234'
mime-type='text/plain'
profile='http://jabber.org/protocol/si/profile/file-transfer'>
<file xmlns= 'http://jabber.org/protocol/si/profile/file-transfer'
name='reply.txt'
size='2048'/>
</sipub>
</message>
]]></example>
2006-10-03 22:38:14 -04:00
<p > In accordance with <cite > XEP-0137</cite> , the application SHOULD then initiate a file transfer exchange with by sending a stanza of the following form:</p>
2006-10-02 18:22:13 -04:00
<example caption= 'Receiving a File: Resulting Stanza' > < ![CDATA[
<iq from= 'juliet@capulet.com/balcony' to= 'romeo@montague.net/orchard' >
<start xmlns= 'http://jabber.org/protocol/si-pub' id= 'pub234' />
</iq>
]]></example>
<p > Note well that the request to begin the stream is sent to the full JID (user@host/resource) of the XMPP entity identified by the XMPP IRI/URI. Therefore, the IRI/URI SHOULD include a full JID. If it does not, the receiver MUST discover a full JID via presence or service discovery. If the receiver cannot discover a full JID for the sender (e.g., in the last resort through sending a presence subscription request to the sender and receiving presence from the sender's resources), then it SHOULD abort the file transfer exchange.</p>
<p > The following submission registers the "recvfile" querytype.</p>
<code > < ![CDATA[
<querytype >
<name > recvfile</name>
<proto > http://jabber.org/protocol/si/profile/file-transfer</proto>
<desc > enables initiation of an outbound file transfer from XMPP entity</desc>
2006-10-03 22:38:14 -04:00
<doc > XEP-0096</doc>
2006-10-02 18:22:13 -04:00
<keys >
2011-01-05 13:49:49 -05:00
<key >
<name > algo</name>
<desc > the hash algorithm used to generate the checksum</desc>
</key>
<key >
<name > hash</name>
<desc > a checksum of the file contents</desc>
</key>
2006-10-02 18:22:13 -04:00
<key >
<name > mime-type</name>
<desc > the MIME type of the file being offered</desc>
</key>
<key >
<name > name</name>
<desc > the name of the file being offered</desc>
</key>
<key >
<name > sid</name>
<desc > the session ID associated with the file being offered</desc>
</key>
<key >
<name > size</name>
<desc > the size in bytes of the file being offered</desc>
</key>
</keys>
</querytype>
]]></code>
</section3>
</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/si/profile/file-transfer'
xmlns='http://jabber.org/protocol/si/profile/file-transfer'
elementFormDefault='qualified'>
<xs:annotation >
<xs:documentation >
The protocol documented by this schema is defined in
2006-10-03 22:38:14 -04:00
XEP-0096: http://www.xmpp.org/extensions/xep-0096.html
2006-10-02 18:22:13 -04:00
</xs:documentation>
</xs:annotation>
<xs:element name= 'file' >
<xs:complexType >
<xs:sequence minOccurs= '0' >
<xs:element name= 'desc' type= 'xs:string' />
<xs:element ref= 'range' />
</xs:sequence>
2011-06-16 14:26:30 -04:00
<xs:attribute name= 'date' type= 'xs:string' use= 'optional' />
2006-10-02 18:22:13 -04:00
<xs:attribute name= 'hash' type= 'xs:string' use= 'optional' />
<xs:attribute name= 'name' type= 'xs:string' use= 'required' />
<xs:attribute name= 'size' type= 'xs:integer' use= 'required' />
</xs:complexType>
</xs:element>
<xs:element name= 'range' >
<xs:complexType >
<xs:simpleContent >
<xs:extension base= 'empty' >
<xs:attribute name= 'length' type= 'xs:integer' use= 'optional' />
<xs:attribute name= 'offset' type= 'xs:integer' use= 'optional' />
</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>
2006-10-03 22:38:14 -04:00
</xep>