<abstract>This specification defines a Jingle application type 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>
<li>Moved Jingle definitions of IBB and S5B transports to standalone documents.</li>
<li>Because the jingle-ibb and jingle-s5b transport methods are backwards-incompatible, incremented protocol version number from 0 to 1 and changed namespace from urn:xmpp:jingle:apps:file-transfer:0 to urn:xmpp:jingle:apps:file-transfer:1.</li>
<li>Simplified fallback flow by removing transport-accept round trip.</li>
<remark><p>Initial published version.</p></remark>
</revision>
<revision>
<version>0.0.3</version>
<date>2008-02-29</date>
<initials>psa</initials>
<remark><p>Corrected use of content-replace action; specified that the In-Band Bytestreams transport method is mandatory-to-implement but must have the lowest preference order.</p></remark>
</revision>
<revision>
<version>0.0.2</version>
<date>2008-02-28</date>
<initials>psa</initials>
<remark>Modified negotiation flow to use new content-replace action.</remark>
</revision>
<revision>
<version>0.0.1</version>
<date>2008-01-29</date>
<initials>psa</initials>
<remark>First draft.</remark>
</revision>
</header>
<section1topic='Introduction'anchor='intro'>
<p>&xep0096; defines the current XMPP protocol extension for file transfer. However, that protocol has several drawbacks, most related to the &xep0095; protocol on which it depends:</p>
<li>It does not enable a true, bidirectional negotiation; instead, the initiator sets the terms for the file transfer and the responder either accepts the terms or cancels the negotiation.</li>
<li>It is the only technology in the Jabber/XMPP protocol "stack" that uses <cite>XEP-095: Stream Initiation</cite>. More modern technologies such as voice and video session negotiation use &xep0166;, and it would be helpful if implementors could use the same code for all negotiation use cases.</li>
</ol>
<p>To overcome these drawbacks, this specification defines a file transfer negotiation method that meets the following requirements:</p>
<ul>
<li>Reuse the session negotiation semantics from <cite>XEP-0166</cite>.</li>
<li>Reuse the file description format from <cite>XEP-0096</cite>.</li>
<li>Define a clear upgrade path from <cite>XEP-0096</cite> to this specification.</li>
<p>Jingle file transfer is only as reliable as the transports on which it depends. In particular, SOCKS5 Bytestreams ("S5B") does not always result in NAT or firewall traversal. To work around that problem, this specification requires all implementations to support In-Band Bytestreams ("IBB"), which tends to result in a successful (if slow) file transfer. It is likely that a future version of this specification will also recommend implementation of a Jingle transport method that emulates the IETF's ICE-TCP technology, which is currently a work in progress (see &ice-tcp;); however, a Jingle ICE-TCP transport method is dependent on the outcome of IETF work in this area.</p>
<p>First, the party that wishes to initiate the file transfer determines the responder's capabilities (via &xep0030; or &xep0115;). Here we assume that the responder supports the following service discovery features (note: these features may not reflect final namespace assignments):</p>
<li>urn:xmpp:jingle:0 as described in XEP-0166</li>
<li>urn:xmpp:jingle:apps:file-transfer:1 as defined in this document</li>
<li>urn:xmpp:jingle:transports:s5b:0 as defined in xep-jingle-s5b (currently located at <linkurl='http://xmpp.org/extensions/inbox/jingle-s5b.html'>http://xmpp.org/extensions/inbox/jingle-s5b.html</link>)</li>
<li>urn:xmpp:jingle:transports:ibb:0 as defined in xep-jingle-ibb (currently located at <linkurl='http://xmpp.org/extensions/inbox/jingle-ibb.html'>http://xmpp.org/extensions/inbox/jingle-ibb.html</link>)</li>
<li>An application type of "urn:xmpp:jingle:apps:file-transfer:1" &VNOTE;. In particular, the <description/> element contains an <offer/> or <request/> element that in turn contains a <file/> element qualified by the existing 'http://jabber.org/protocol/si/profile/file-transfer' namespace from <cite>XEP-0096</cite>.</li>
<li>An appropriate transport method. So far the suggested methods are jingle-s5b and, as a fallback, jingle-ibb.</li>
<p>In this example, the initiator is <romeo@montague.lit>, the responder is <juliet@capulet.lit>, and the initiation request specifies a file offer and a transport method of jingle-s5b (i.e., XEP-0065).</p>
<p>The initiator then attempts to initiate a SOCKS5 Bytestream with the responder as described in xep-jingle-s5b and <cite>XEP-0065</cite>.</p>
<p>If the responder is able to connect to one of the streamhosts, it returns a Jingle session-accept (including only the JID of the streamhost to which it connected).</p>
<p>Currently, <cite>XEP-0096</cite> does not enable the parties to fall back to a second method (e.g., In-Band Bytestreams) if the first method tried (e.g., SOCKS5 Bytestreams) does not work. This problem is addressed by Jingle. Such a fallback scenario is especially helpful when re-using the existing SOCKS5 Bytestreams method, since if a SOCKS5 relay is not available then the S5B method does not necessarily result in NAT or firewall traversal and therefore can result in a failed attempt at setting up the initial transport. However, because In-Band Bytestreams almost always succeeds (except if the parties violate rate-limiting policies at their servers), it provides a reliable transfer method of last resort. To provide seamless fallback, the initiator or responder can counter-propose IBB if S5B setup fails.</p>
<p>The initiator then attempts to initiate a SOCKS5 Bytestream with the responder as defined in xep-jingle-s5b and XEP-0065. Here we assume that the responder tries but is unable to connect to any of the StreamHosts. However, all is not lost, because the parties can attempt to fall back to In-Band Bytestreams. Therefore the initiator sends a transport-replace action including a transport of IBB.</p>
<p>If the transport replacement is acceptable, the responder then sends a session-accept action to the initiator (if not, the responder sends a transport-reject action).</p>
<p>All implementations MUST support the In-Band Bytestreams transport method as a reliable method of last resort. An implementation SHOULD support other transport methods as well.</p>
<p>Support for Jingle file transfer can be determined through discovery of the 'urn:xmpp:jingle:apps:file-transfer:1' namespace &VNOTE;, via either service discovery (<cite>XEP-0030</cite>) or entity capabilities (<cite>XEP-0115</cite>). If the initiator knows that the responder supports Jingle file transfer, it SHOULD first attempt negotiation using XEP-0166 rather than XEP-0095.</p>
<p>In order to secure the data stream, implementations SHOULD use encryption methods appropriate to the transport method being used. For example, end-to-end encryption can be negotiated over either SOCKS5 Bytestreams or In-Band Bytestreams as described in xep-jingle-s5b and xep-jingle-ibb.</p>
<p>Upon advancement of this specification from a status of Experimental to a status of Draft, the ®ISTRAR; shall add the foregoing namespaces to the registry located at &NAMESPACES;, as described in Section 4 of &xep0053;.</p>
<p>If the protocol defined in this specification undergoes a major revision that is not fully backward-compatible with an older version, or that contains significant new features, the XMPP Registrar shall increment the protocol version number found at the end of the XML namespaces defined herein, as described in Section 4 of <cite>XEP-0053</cite>.</p>