XEP-0234: Jingle File Transfer

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.


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 should not deploy implementations of this protocol until it advances to a status of Draft.


Document Information

Series: XEP
Number: 0234
Publisher: XMPP Standards Foundation
Status: Experimental
Type: Standards Track
Version: 0.2
Last Updated: 2008-03-20
Approving Body: XMPP Council
Dependencies: XMPP Core, XEP-0096, XEP-0166
Supersedes: None
Superseded By: None
Short Name: NOT YET ASSIGNED
Wiki Page: <http://wiki.jabber.org/index.php/Jingle File Transfer (XEP-0234)>


Author Information

Peter Saint-Andre

JabberID: stpeter@jabber.org
URI: https://stpeter.im/


Legal Notices

Copyright

This XMPP Extension Protocol is copyright (c) 1999 - 2008 by the XMPP Standards Foundation (XSF).

Permissions

Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.

Disclaimer of Warranty

## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. In no event shall the XMPP Standards Foundation or the authors of this Specification be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification. ##

Limitation of Liability

In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising out of the use or inability to use the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.

IPR Conformance

This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which may be found at <http://www.xmpp.org/extensions/ipr-policy.shtml> or obtained by writing to XSF, P.O. Box 1641, Denver, CO 80201 USA).

Discussion Venue

The preferred venue for discussion of this document is the Standards discussion list: <http://mail.jabber.org/mailman/listinfo/standards>.

Errata may be sent to <editor@xmpp.org>.

Relation to XMPP

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.

Conformance Terms

The following 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".


Table of Contents


1. Introduction
2. How It Works
3. Scenarios
    3.1. Fallback
    3.2. Transport Selection
4. Implementation Notes
    4.1. Mandatory to Implement Technologies
    4.2. Preference Order of Transport Methods
    4.3. Migration from XEP-0096
5. Security Considerations
6. IANA Considerations
7. XMPP Registrar Considerations
    7.1. Protocol Namespaces
    7.2. Jingle Application Formats
    7.3. Jingle Transport Methods
8. XML Schema
Notes
Revision History


1. Introduction

SI File Transfer [1] defines the current XMPP protocol extension for file transfer. However, that protocol has several drawbacks, most related to the Stream Initiation [2] protocol on which it depends:

  1. It does not enable a true, bidirectional negotiation; instead, the initiator sets the terms for the file transfer and the receiver either accepts the terms or cancels the negotiation.
  2. It is the only technology in the Jabber/XMPP protocol "stack" that uses XEP-095: Stream Initiation. More modern technologies such as voice and video session negotiation use Jingle [3], and it would be helpful if implementors could use the same code for all negotiation use cases.

To overcome these drawbacks, this specification defines a file transfer negotiation method that meets the following requirements:

2. How It Works

This section provides a friendly introduction to Jingle file transfer.

First, the party that wishes to initiate the file transfer determines the receiver's capabilities (via Service Discovery [4] or Entity Capabilities [5]). In this example, we assume that the receiver supports the following service discovery features (note: these features may not reflect final namespace assignments):

The initiator then sends a Jingle session-initiation request to a potential receiver. The content-type of the request specifies two things:

  1. An application type of "urn:xmpp:tmp:jingle:apps:file-transfer" (see Protocol Namespaces regarding issuance of one or more permanent namespaces). 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 XEP-0096.
  2. An appropriate transport method. Because the existing transport methods used in XEP-0096 (i.e., SOCKS5 Bytestreams [6] and In-Band Bytestreams [7]) are not yet defined as Jingle transport methods, this specification registers those definitions.

In this example, the initiation request specifies a file offer and a transport method of bytestreams (i.e., XEP-065).

Example 1. Initiator sends session-initiate

<iq from='kingclaudius@shakespeare.lit/castle'
    id='jingle1'
    to='laertes@shakespeare.lit/castle'
    type='set'>
  <jingle xmlns='urn:xmpp:tmp:jingle'
          action='session-initiate'
          initiator='kingclaudius@shakespeare.lit/castle'
          sid='851ba2'>
    <content creator='initiator' name='a-file-offer'>
      <description xmlns='urn:xmpp:tmp:jingle:apps:file-transfer'>
        <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:tmp:jingle:transports:bytestreams'/>
    </content>
  </jingle>
</iq>
  

The responder immediately acknowledges receipt of the session-initiate.

Example 2. Responder acknowledges session-initiate

<iq from='laertes@shakespeare.lit/castle'
    id='jingle1'
    to='kingclaudius@shakespeare.lit/castle'
    type='result'/>
  

The parties would then attempt to negotiate use of the SOCKS5 Bytestreams transport method, as described in XEP-0065.

More detailed scenarios follow.

3. Scenarios

3.1 Fallback

Currently, XEP-0096 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. Consider the following protocol flow.

Example 3. Initiator sends session-initiate

<iq from='kingclaudius@shakespeare.lit/castle'
    id='jingle1'
    to='laertes@shakespeare.lit/castle'
    type='set'>
  <jingle xmlns='urn:xmpp:tmp:jingle'
          action='session-initiate'
          initiator='kingclaudius@shakespeare.lit/castle'
          sid='851ba2'>
    <content creator='initiator' name='a-file-offer'>
      <description xmlns='urn:xmpp:tmp:jingle:apps:file-transfer'>
        <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:tmp:jingle:transports:bytestreams'/>
    </content>
  </jingle>
</iq>
    

The responder immediately acknowledges receipt of the session-initiate.

Example 4. Responder acknowledges session-initiate

<iq from='laertes@shakespeare.lit/castle'
    id='jingle1'
    to='kingclaudius@shakespeare.lit/castle'
    type='result'/>
    

The receiver would then sends a session-accept.

Example 5. Receiver sends session-accept

<iq from='laertes@shakespeare.lit/castle'
    id='accept1'
    to='kingclaudius@shakespeare.lit/castle'
    type='set'>
  <jingle xmlns='urn:xmpp:tmp:jingle'
          action='session-accept'
          initiator='kingclaudius@shakespeare.lit/castle'
          sid='a73sjjvkla37jfea'>
    <content creator='initiator' name='a-file-offer'>
      <description xmlns='urn:xmpp:tmp:jingle:apps:file-transfer'>
        <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:tmp:jingle:transports:bytestreams'/>
    </content>
  </jingle>
</iq>
    

The initiator acknowledges the session-accept action.

Example 6. Responder acknowledges session-accept

<iq from='laertes@shakespeare.lit/castle'
    id='accept1'
    to='kingclaudius@shakespeare.lit/castle'
    type='result'/>
    

Now the parties attempt to negotiate use of SOCKS5 Bytestreams as defined in XEP-0065.

However, let us imagine that the SOCKS5 Bytestreams negotiation fails. The initiator or responder can then suggest the use of In-Band Bytestreams by sending a content-replace action. Here we assume that the responder sends a content-replace action including a request for the file originally offered and a transport of IBB.

Example 7. Responder requests content-replace

<iq from='laertes@shakespeare.lit/castle'
    id='replace1'
    to='kingclaudius@shakespeare.lit/castle'
    type='set'>
  <jingle xmlns='urn:xmpp:tmp:jingle'
          action='content-replace'
          initiator='kingclaudius@shakespeare.lit/castle'
          sid='a73sjjvkla37jfea'>
    <content creator='responder' name='a-file-request'>
      <description xmlns='urn:xmpp:tmp:jingle:apps:file-transfer'>
        <request>
          <file xmlns='http://jabber.org/protocol/si/profile/file-transfer'
                hash='552da749930852c69ae5d2141d3766b1'
                name='test.txt'/>
          </file>
        </request>
      </description>
      <transport xmlns='urn:xmpp:tmp:jingle:transports:ibb'/>
    </content>
  </jingle>
</iq>
    

The initiator then acknowledges the content-replace action.

Example 8. Initiator acknowledges content-replace

<iq from='kingclaudius@shakespeare.lit/castle'
    id='replace1'
    to='laertes@shakespeare.lit/castle'
    type='result'/>
    

If the content definition is acceptable, the initiator then sends a content-accept action to the responder.

Example 9. Initiator sends content-accept

<iq to='kingclaudius@shakespeare.lit/castle'
    id='accept2'
    to='laertes@shakespeare.lit/castle'
    type='set'>
  <jingle xmlns='urn:xmpp:tmp:jingle'
          action='content-accept'
          initiator='kingclaudius@shakespeare.lit/castle'
          sid='a73sjjvkla37jfea'>
    <content creator='responder' name='a-file-request'>
      <description xmlns='urn:xmpp:tmp:jingle:apps:file-transfer'>
        <request>
          <file xmlns='http://jabber.org/protocol/si/profile/file-transfer'
                hash='552da749930852c69ae5d2141d3766b1'
                name='test.txt'/>
          </file>
        </request>
      </description>
      <transport xmlns='urn:xmpp:tmp:jingle:transports:ibb'/>
    </content>
  </jingle>
</iq>
    

The responder then acknowledges the content-accept action.

Example 10. Responder acknowledges content-accept

<iq from='laertes@shakespeare.lit/castle'
    id='accept2'
    to='kingclaudius@shakespeare.lit/castle'
    type='result'/>
    

The parties then attempt to use In-Band Bytestreams.

3.2 Transport Selection

XEP-0096 enable the initiator to offer more than one transport and for the receiving party to choose its desired transport. This flow can be emulated in Jingle negotiation as follows.

Example 11. Initiator sends session-initiate with multiple transports

<iq from='kingclaudius@shakespeare.lit/castle'
    id='jingle1'
    to='laertes@shakespeare.lit/castle'
    type='set'>
  <jingle xmlns='urn:xmpp:tmp:jingle'
          action='session-initiate'
          initiator='kingclaudius@shakespeare.lit/castle'
          sid='851ba2'>
    <content creator='initiator' name='first-transport'>
      <description xmlns='urn:xmpp:tmp:jingle:apps:file-transfer'>
        <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:tmp:jingle:transports:bytestreams'/>
    </content>
    <content creator='initiator' name='second-transport'>
      <description xmlns='urn:xmpp:tmp:jingle:apps:file-transfer'>
        <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:tmp:jingle:transports:ibb'/>
    </content>
  </jingle>
</iq>
    

The responder immediately acknowledges receipt of the session-initiate.

Example 12. Responder acknowledges session-initiate

<iq from='laertes@shakespeare.lit/castle'
    id='jingle1'
    to='kingclaudius@shakespeare.lit/castle'
    type='result'/>
    

The receiver then sends a content-remove in order to choose the desired transport, which in this case is IBB.

Example 13. Receiver sends content-remove

<iq from='laertes@shakespeare.lit/castle'
    id='remove1'
    to='kingclaudius@shakespeare.lit/castle'
    type='set'>
  <jingle xmlns='urn:xmpp:tmp:jingle'
          action='content-remove'
          initiator='kingclaudius@shakespeare.lit/castle'
          sid='a73sjjvkla37jfea'>
    <content creator='initiator' name='first-transport'>
      <description xmlns='urn:xmpp:tmp:jingle:apps:file-transfer'>
        <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:tmp:jingle:transports:bytestreams'/>
    </content>
  </jingle>
</iq>
    

The initiator acknowledges the content-remove action.

Example 14. Responder acknowledges content-remove

<iq from='laertes@shakespeare.lit/castle'
    id='remove1'
    to='kingclaudius@shakespeare.lit/castle'
    type='result'/>
    

The receiver then sends a session-accept.

Example 15. Receiver sends session-accept

<iq from='laertes@shakespeare.lit/castle'
    id='accept1'
    to='kingclaudius@shakespeare.lit/castle'
    type='set'>
  <jingle xmlns='urn:xmpp:tmp:jingle'
          action='session-accept'
          initiator='kingclaudius@shakespeare.lit/castle'
          sid='a73sjjvkla37jfea'>
    <content creator='initiator' name='a-file-offer'>
      <description xmlns='urn:xmpp:tmp:jingle:apps:file-transfer'>
        <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:tmp:jingle:transports:bytestreams'/>
    </content>
  </jingle>
</iq>
    

The initiator acknowledges the session-accept action.

Example 16. Responder acknowledges session-accept

<iq from='laertes@shakespeare.lit/castle'
    id='accept1'
    to='kingclaudius@shakespeare.lit/castle'
    type='result'/>
    

Now the initiator sends the file using In-Band Bytestreams as defined in XEP-0047.

4. Implementation Notes

4.1 Mandatory to Implement Technologies

All implementations MUST support the In-Band Bytestreams transport method.

4.2 Preference Order of Transport Methods

An application MAY present transport methods in any order, except that the In-Band Bytestreams method MUST be the lowest preference.

4.3 Migration from XEP-0096

Support for Jingle file transfer can be determined through discovery of the 'urn:xmpp:tmp:jingle:apps:file-transfer' namespace (see Protocol Namespaces regarding issuance of one or more permanent namespaces), via either service discovery or entity capabilities. If the initiator knows that the receiver supports Jingle file transfer, it SHOULD attempt negotiation using XEP-0166 rather than XEP-0095.

5. Security Considerations

In order to secure the data stream, implementations SHOULD use encryption methods appropriate to the transport method being used. For details, refer to the specifications for those transport methods.

6. IANA Considerations

No interaction with the Internet Assigned Numbers Authority (IANA) [8] is required as a result of this document.

7. XMPP Registrar Considerations

7.1 Protocol Namespaces

Until this specification advances to a status of Draft, its associated namespaces shall be:

Upon advancement of this specification, the XMPP Registrar [9] shall issue permanent namespaces in accordance with the process defined in Section 4 of XMPP Registrar Function [10].

The following namespaces are requested, and are thought to be unique per the XMPP Registrar's requirements:

7.2 Jingle Application Formats

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>reliable</transport>
  <doc>XEP-xxxx</doc>
</application>
    

7.3 Jingle Transport Methods

The XMPP Registrar shall add to its registry of Jingle transport methods definitions for the reliable transport methods defined in XEP-0047 and XEP-0065. The registry submissions are as follows:

<transport>
  <name>bytestreams</name>
  <desc>A method for exchanging data over SOCKS5 Bytestreams.</desc>
  <type>reliable</type>
  <doc>XEP-0065</doc>
</transport>
<transport>
  <name>ibb</name>
  <desc>A method for exchanging data over In-Band Bytestreams.</desc>
  <type>reliable</type>
  <doc>XEP-0047</doc>
</transport>
    

8. XML Schema

<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='urn:xmpp:tmp:jingle:apps:file-transfer'
    xmlns='urn:xmpp:tmp:jingle:apps:file-transfer'
    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 ref='offer'/>
        <xs:element ref='request'/>
      </xs:choice>
    </xs:complexType>
  </xs:element>

  <xs:element name='offer'>
    <xs:complexType>
      <xs:sequence xmlns:ft='http://jabber.org/protocol/si/profile/file-transfer'>
        <xs:element ref='ft:file'/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name='request'>
    <xs:complexType>
      <xs:sequence xmlns:ft='http://jabber.org/protocol/si/profile/file-transfer'>
        <xs:element ref='ft:file'/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

</xs:schema>
    

Notes

1. XEP-0096: SI File Transfer <http://www.xmpp.org/extensions/xep-0096.html>.

2. XEP-0095: Stream Initiation <http://www.xmpp.org/extensions/xep-0095.html>.

3. XEP-0166: Jingle <http://www.xmpp.org/extensions/xep-0166.html>.

4. XEP-0030: Service Discovery <http://www.xmpp.org/extensions/xep-0030.html>.

5. XEP-0115: Entity Capabilities <http://www.xmpp.org/extensions/xep-0115.html>.

6. XEP-0065: SOCKS5 Bytestreams <http://www.xmpp.org/extensions/xep-0065.html>.

7. XEP-0047: In-Band Bytestreams <http://www.xmpp.org/extensions/xep-0047.html>.

8. 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/>.

9. 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://www.xmpp.org/registrar/>.

10. XEP-0053: XMPP Registrar Function <http://www.xmpp.org/extensions/xep-0053.html>.


Revision History

Version 0.2 (2008-03-20)

Added transport negotiation scenario.

(psa)

Version 0.1 (2008-03-05)

Initial published version.

(psa)

Version 0.0.3 (2008-02-29)

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)

Version 0.0.2 (2008-02-28)

Modified negotiation flow to use new content-replace action. (psa)

Version 0.0.1 (2008-01-29)

First draft. (psa)

END