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. |
Author: | Peter Saint-Andre |
Copyright: | © 1999 - 2010 XMPP Standards Foundation. SEE LEGAL NOTICES. |
Status: | Experimental |
Type: | Standards Track |
Version: | 0.11 |
Last Updated: | 2010-02-19 |
WARNING: This Standards-Track document is Experimental. Publication as an XMPP Extension Protocol does not imply approval of this proposal by the XMPP Standards Foundation. Implementation of the protocol described herein is encouraged in exploratory implementations, but production systems are advised to carefully consider whether it is appropriate to deploy implementations of this protocol before it advances to a status of Draft.
1. Introduction
2. How It Works
3. Communicating the Hash
4. Requesting a File
5. Implementation Notes
5.1. Mandatory to Implement Technologies
5.2. Preference Order of Transport Methods
5.3. Migration from XEP-0096
6. Security Considerations
7. IANA Considerations
8. XMPP Registrar Considerations
8.1. Protocol Namespaces
8.2. Namespace Versioning
8.3. Jingle Application Formats
9. XML Schema
9.1. File Transfer
9.2. File Transfer Info
10. Acknowledgements
Appendices
A: Document Information
B: Author Information
C: Legal Notices
D: Relation to XMPP
E: Discussion Venue
F: Requirements Conformance
G: Notes
H: Revision History
SI File Transfer [1] was the original XMPP protocol extension for file transfer negotiation. However, that protocol has several drawbacks, most related to the Stream Initiation [2] protocol on which it depends:
To overcome these drawbacks, this specification defines a file transfer negotiation method that meets the following requirements:
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 as a fallback mechanism In-Band Bytestreams ("IBB"), which usually results in a successful (if slow) file transfer.
Note: 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 TCP Candidates with Interactive Connectivity Establishment (ICE) [4]); however, a future Jingle ICE-TCP transport method is dependent on the outcome of IETF work in this area.
This section provides a friendly introduction to Jingle file transfer.
First, the party that wishes to initiate the file transfer determines the responder's capabilities (via Service Discovery [5] or Entity Capabilities [6]). Here we assume that the responder supports the following service discovery features:
If the protocol defined in this specification undergoes a revision that is not fully backwards-compatible with an older version, 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 XEP-0053.
The initiator then sends a Jingle session-initiation request to a potential responder. The content-type of the request specifies two things:
In this example, the initiator is <romeo@montague.lit>, the responder is <juliet@capulet.lit>, the application type is a file offer, and the transport method is jingle-s5b.
The flow is as follows.
Initiator Responder | | | session-initiate | | (with S5B) | |---------------------------->| | ack | |<----------------------------| | session-accept | |<----------------------------| | ack | |---------------------------->| | [ file transfer ] | |============================>| | session-terminate | |<----------------------------| | ack | |---------------------------->| | |
First the initiator sends a Jingle session-initiate.
<iq from='romeo@montague.lit/orchard' id='nzu25s8' to='juliet@capulet.lit/balcony' type='set'> <jingle xmlns='urn:xmpp:jingle:1' action='session-initiate' initiator='romeo@montague.lit/orchard' sid='851ba2'> <content creator='initiator' name='a-file-offer'> <description xmlns='urn:xmpp:jingle:apps:file-transfer:1'> <offer> <file xmlns='http://jabber.org/protocol/si/profile/file-transfer' date='1969-07-21T02:56:15Z' hash='552da749930852c69ae5d2141d3766b1' name='test.txt' size='1022'> <desc>This is a test. If this were a real file...</desc> </file> </offer> </description> <transport xmlns='urn:xmpp:jingle:transports:s5b:1' mode='tcp' sid='vj3hs98y'> <streamhost host='192.168.4.1' jid='romeo@montague.lit/orchard' port='5086'/> <streamhost host='24.24.24.1' jid='streamer.shakespeare.lit' type='proxy' zeroconf='_jabber.bytestreams'/> </transport> </content> </jingle> </iq>
Note: Computing the hash of the file before sending it can slow down the process of file transfer, since the sending application needs to process the file twice. The sender might prefer to send the hash after the file transfer has begun, using a transport-info message as described under Communicating the Hash.
The responder immediately acknowledges receipt of the Jingle session-initiate.
<iq from='juliet@capulet.lit/balcony' id='nzu25s8' to='romeo@montague.lit/orchard' type='result'/>
The initiator then attempts to initiate a SOCKS5 Bytestream with the responder as described in XEP-0260 and XEP-0065.
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).
<iq from='juliet@capulet.lit/balcony' id='jn2vs71g' to='romeo@montague.lit/orchard' type='set'> <jingle xmlns='urn:xmpp:jingle:1' action='session-accept' initiator='romeo@montague.lit/orchard' sid='851ba2'> <content creator='initiator' name='a-file-offer'> <description xmlns='urn:xmpp:jingle:apps:file-transfer:1'> <offer> <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> </offer> </description> <transport xmlns='urn:xmpp:jingle:transports:s5b:1'> <streamhost-used jid='streamer.shakespeare.lit'/> </transport> </content> </jingle> </iq>
The initiator acknowledges the Jingle session-accept.
<iq from='romeo@montague.lit/orchard' id='jn2vs71g' to='juliet@capulet.lit/balcony' type='result'/>
Now the parties exchange the file using the negotiated transport (here, SOCKS5 Bytestreams).
Once the transfer is completed, either party can terminate the Jingle session; preferably this is done by the entity that receives the file to ensure that the complete file (up to the advertised size) has been received.
<iq from='juliet@capulet.lit/balcony' id='og61bvs98' to='romeo@montague.lit/orchard' type='set'> <jingle xmlns='urn:xmpp:jingle:1' action='session-terminate' sid='a73sjjvkla37jfea'> <reason> <success/> </reason> </jingle> </iq>
For a description of the transport fallback scenario (from SOCK5 Bytestreams to In-Band Bytestreams), refer to XEP-0260.
At any time, the hosting entity can communicate the hash of the file to the receiving entity. This is done by sending a session-info message containing a <hash/> element qualified by the 'urn:xmpp:jingle:apps:file-transfer:info:1' namespace.
<iq from='romeo@montague.lit/orchard' id='kqh401b5' to='juliet@capulet.lit/balcony' type='set'> <jingle xmlns='urn:xmpp:jingle:1' action='session-info' initiator='romeo@montague.lit/orchard' sid='a73sjjvkla37jfea'> <hash xmlns='urn:xmpp:jingle:apps:file-transfer:info:1'>552da749930852c69ae5d2141d3766b1</hash> </jingle> </iq>
If the entity that hosts a file has advertised its existence (or if a previous file transfer attempt has failed and the receiver would like to initiate another attempt), the entity that wishes to receive the file can "pull" the file from the hosting entity. This is done by sending a Jingle session-initiate to the hosting entity, including a <description/> element qualified by the 'urn:xmpp:jingle:apps:file-transfer:1' namespace and containing a <request/> element that defines the requested file.
<iq from='juliet@capulet.lit/balcony' id='wsn361c3' to='romeo@montague.lit/orchard' type='set'> <jingle xmlns='urn:xmpp:jingle:1' action='session-initiate' initiator='romeo@montague.lit/orchard' sid='uj3b2'> <content creator='initiator' name='a-file-request'> <description xmlns='urn:xmpp:jingle:apps:file-transfer:1'> <request> <file xmlns='http://jabber.org/protocol/si/profile/file-transfer' hash='552da749930852c69ae5d2141d3766b1'/> </request> </description> <transport xmlns='urn:xmpp:jingle:transports:s5b:1' mode='tcp' sid='xig361fj'> <streamhost host='24.24.24.2' jid='proxy.capulet.lit' type='proxy'/> </transport> </content> </jingle> </iq>
The parties would then complete a session negotiation flow similar to that outlined above for offering a file.
Note: If the requesting entity knows the hash of the file, then it can include only that metadata in its request. If not, the requesting entity needs to include enough metadata to uniquely identify the file, such as the date, name, and size. For similar considerations, see RFC 5547 [9].
All implementations MUST support the Jingle In-Band Bytestreams Transport Method (XEP-0261) as a reliable method of last resort. An implementation SHOULD support other transport methods as well, especially the Jingle SOCKS5 Bytestreams Transport Method (XEP-0260).
An application MAY present transport methods in any order, except that the Jingle In-Band Bytestreams Transport Method MUST be the lowest preference.
Support for Jingle file transfer can be determined through discovery of the 'urn:xmpp:jingle:apps:file-transfer:1' namespace (see Namespace Versioning regarding the possibility of incrementing the version number), via either service discovery (XEP-0030) or entity capabilities (XEP-0115). If the initiator knows that the responder supports Jingle file transfer, it SHOULD first attempt negotiation using Jingle rather than SI.
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-0260 and XEP-0261.
Refer to XEP-0047, XEP-0065, XEP-0096, XEP-0260, and XEP-0261 for related security considerations.
No interaction with the Internet Assigned Numbers Authority (IANA) [10] is required as a result of this document.
This specification defines the following XML namespace:
Upon advancement of this specification from a status of Experimental to a status of Draft, the XMPP Registrar [11] shall add the foregoing namespace to the registry located at <http://xmpp.org/registrar/namespaces.html>, as described in Section 4 of XMPP Registrar Function [12].
If the protocol defined in this specification undergoes a revision that is not fully backwards-compatible with an older version, 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 XEP-0053.
The XMPP Registrar shall include "file-transfer" in its registry of Jingle application formats. The registry submission is as follows:
<application> <name>file-transfer</name> <desc>Jingle sessions for the transfer of a file</desc> <transport>streaming</transport> <doc>XEP-0234</doc> </application>
<?xml version='1.0' encoding='UTF-8'?> <xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='urn:xmpp:jingle:apps:file-transfer:1' xmlns='urn:xmpp:jingle:apps:file-transfer:1' elementFormDefault='qualified'> <xs:import namespace='http://jabber.org/protocol/si/profile/file-transfer' schemaLocation='http://www.xmpp.org/schemas/file-transfer.xsd'/> <xs:element name='description'> <xs:complexType> <xs:choice> <xs:element name='offer' type='fileTransferElementType'/> <xs:element name='request' type='fileTransferElementType'/> </xs:choice> </xs:complexType> </xs:element> <xs:complexType name='fileTransferElementType'> <xs:sequence xmlns:ft='http://jabber.org/protocol/si/profile/file-transfer'> <xs:element ref='ft:file'/> </xs:sequence> </xs:complexType> </xs:schema>
<?xml version='1.0' encoding='UTF-8'?> <xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='urn:xmpp:jingle:apps:file-transfer:info:1' xmlns='urn:xmpp:jingle:apps:file-transfer:info:1' elementFormDefault='qualified'> <xs:element name='hash' type='xs:string'/> </xs:schema>
Thanks to Marcus Lundblad and Jiří Zárevúcky for their feedback.
Series: XEP
Number: 0234
Publisher: XMPP Standards Foundation
Status:
Experimental
Type:
Standards Track
Version: 0.11
Last Updated: 2010-02-19
Approving Body: XMPP Council
Dependencies: XMPP Core, XEP-0047, XEP-0065, XEP-0096, XEP-0166
Supersedes: None
Superseded By: None
Short Name: NOT_YET_ASSIGNED
Source Control:
HTML
RSS
This document in other formats:
XML
PDF
Email:
stpeter@jabber.org
JabberID:
stpeter@jabber.org
URI:
https://stpeter.im/
The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 3920) and XMPP IM (RFC 3921) specifications contributed by the XMPP Standards Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocol defined in this document has been developed outside the Internet Standards Process and is to be understood as an extension to XMPP rather than as an evolution, development, or modification of XMPP itself.
The primary venue for discussion of XMPP Extension Protocols is the <standards@xmpp.org> discussion list.
Discussion on other xmpp.org discussion lists might also be appropriate; see <http://xmpp.org/about/discuss.shtml> for a complete list.
Errata can be sent to <editor@xmpp.org>.
The following requirements keywords as used in this document are to be interpreted as described in RFC 2119: "MUST", "SHALL", "REQUIRED"; "MUST NOT", "SHALL NOT"; "SHOULD", "RECOMMENDED"; "SHOULD NOT", "NOT RECOMMENDED"; "MAY", "OPTIONAL".
1. XEP-0096: SI File Transfer <http://xmpp.org/extensions/xep-0096.html>.
2. XEP-0095: Stream Initiation <http://xmpp.org/extensions/xep-0095.html>.
3. XEP-0166: Jingle <http://xmpp.org/extensions/xep-0166.html>.
4. TCP Candidates with Interactive Connectivity Establishment (ICE) <http://tools.ietf.org/html/draft-ietf-mmusic-ice-tcp>. Work in progress.
5. XEP-0030: Service Discovery <http://xmpp.org/extensions/xep-0030.html>.
6. XEP-0115: Entity Capabilities <http://xmpp.org/extensions/xep-0115.html>.
7. XEP-0260: Jingle SOCKS5 Bytestreams Transport Method <http://xmpp.org/extensions/xep-0260.html>.
8. XEP-0261: Jingle In-Band Bytestreams Transport Method <http://xmpp.org/extensions/xep-0261.html>.
9. RFC 5547: A Session Description Protocol (SDP) Offer/Answer Mechanism to Enable File Transfer <http://tools.ietf.org/html/rfc5547>.
10. The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see <http://www.iana.org/>.
11. The XMPP Registrar maintains a list of reserved protocol namespaces as well as registries of parameters used in the context of XMPP extension protocols approved by the XMPP Standards Foundation. For further information, see <http://xmpp.org/registrar/>.
12. XEP-0053: XMPP Registrar Function <http://xmpp.org/extensions/xep-0053.html>.
Note: Older versions of this specification might be available at http://xmpp.org/extensions/attic/
Added session-info message and namespace for communicating the file hash.
(psa)Described the file retrieval case; updated referenced namespaces.
(psa)Corrected fallback scenario to use transport-replace and transport-accept.
(psa)Harmonized with XEP-0166; modified fallback to use transport-replace and transport-accept.
(psa)Modified fallback scenario to use content-replace action during pending state.
(psa)Harmonized negotiation flows with other Jingle application types.
(psa)Corrected and more clearly explained negotiation flows for consistency with XEP-0166 and other Jingle specifications.
(psa)Added transport negotiation scenario.
(psa)Initial published version.
(psa)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.
(psa)END