%ents; ]>
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. &LEGALNOTICE; 0234 Experimental Standards Track Standards XMPP Core XEP-0047 XEP-0065 XEP-0096 XEP-0166 NOT_YET_ASSIGNED &stpeter; 0.6 2008-07-31 psa

Harmonized with XEP-0166; modified fallback to use transport-replace and transport-accept.

0.5 2008-06-05 psa

Modified fallback scenario to use content-replace action during pending state.

0.4 2008-06-04 psa

Harmonized negotiation flows with other Jingle application types.

0.3 2008-05-29 psa

Corrected and more clearly explained negotiation flows for consistency with XEP-0166 and other Jingle specifications.

0.2 2008-03-20 psa

Added transport negotiation scenario.

0.1 2008-03-05 psa

Initial published version.

0.0.3 2008-02-29 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.

0.0.2 2008-02-28 psa Modified negotiation flow to use new content-replace action. 0.0.1 2008-01-29 psa First draft.

&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:

  1. 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.
  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 &xep0166;, 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:

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. 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;).

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 &xep0030; or &xep0115;). Here we assume that the responder 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 responder. The content-type of the request specifies two things:

  1. An application type of "urn:xmpp:tmp:jingle:apps:file-transfer" &NSNOTE;. 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., &xep0065; and &xep0047;) are not yet defined as Jingle transport methods, this specification registers those definitions (if this specification is approved, those definitions will be moved to XEP-0047 and XEP-0065).

In this example, the initiator is <kingclaudius@shakespeare.lit>, the responder is <laertes@shakespeare.lit>, and the initiation request specifies a file offer and a transport method of bytestreams (i.e., XEP-0065).

The flow is as follows.

| | ack | |<----------------------------| | [ SOCKS5 negotiation ] | |<===========================>| | session-accept | |<----------------------------| | ack | |---------------------------->| | [ file transfer ] | |============================>| | terminate | |<----------------------------| | ack | |---------------------------->| | | ]]>

First the initiator sends a Jingle session-initiate.

This is a test. If this were a real file... ]]>

The responder immediately acknowledges receipt of the Jingle session-initiate.

]]>

The initiator then attempts to initiate a SOCKS5 Bytestream with the responder.

]]>

If the responder is willing to accept the bytestream, it MUST attempt to open a standard TCP socket on the network address of the StreamHost communicated by the initiator. If the initiator provides more than one StreamHost, the responder SHOULD try to connect to them in the order they occur.

If the responder is able to open a TCP socket on a StreamHost, it MUST utilize the SOCKS5 protocol specified in &rfc1928; to establish the connection with the StreamHost.

After the responder has authenticated with the StreamHost, it MUST send an IQ-result to the initiator indicating which StreamHost was used.

]]>

The responder then sends a Jingle session-accept.

This is a test. If this were a real file... ]]>

The initiator acknowledges the Jingle session-accept.

]]>

Now the parties exchange the file using SOCKS5 Bytestreams.

Once the transfer is completed, either party can terminate the Jingle session.

More detailed scenarios follow.

XEP-0096 enables 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 if the initiator includes more than one <content/> element (each with a different proposed transport method) and the responder removes all but its desired transport method before the session is accepted.

The protocol flow is as follows:

| | ack | |<----------------------------| | content-remove (S5B) | |<----------------------------| | ack | |---------------------------->| | [ IBB negotiation ] | |<--------------------------->| | session-accept | |<----------------------------| | ack | |---------------------------->| | [ file transfer ] | |============================>| | terminate | |<----------------------------| | ack | |---------------------------->| | | ]]>

First the initiator sends a Jingle session-initiate, in this case with multiple transports (SOCKS5 Bytestreams and IBB).

This is a test. If this were a real file... This is a test. If this were a real file... ]]>

The responder immediately acknowledges receipt of the Jingle session-initiate.

]]>

The responder then sends a Jingle content-remove (deleting SOCKS5 Bytestreams) in order to choose the desired transport, which in this case is IBB.

This is a test. If this were a real file... ]]>

The initiator acknowledges receipt of the Jingle content-remove action.

]]>

The initiator then sends an IBB initiation request to the responder.

]]> ]]>

The responder then sends a Jingle session-accept.

This is a test. If this were a real file... ]]>

The initiator acknowledges the Jingle session-accept action.

]]>

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

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. Such a fallback scenario is especially helpful when re-using the existing SOCKS5 Bytestreams method, since that method does not necessarily result in NAT or firewall traversal and therefore often results 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.

The protocol flow is as follows:

| | ack | |<----------------------------| | [ SOCKS5 failure! ] | |x---------------------------x| | content-replace (IBB) | |<----------------------------| | ack | |---------------------------->| | content-accept | |---------------------------->| | ack | |<----------------------------| | [ IBB negotiation ] | |<--------------------------->| | session-accept | |<----------------------------| | ack | |---------------------------->| | [ file transfer ] | |============================>| | terminate | |<----------------------------| | ack | |---------------------------->| | | ]]>

First the initiator sends a Jingle session-initiate, in this case with a transport of SOCKS5 Bytestreams.

This is a test. If this were a real file... ]]>

The responder immediately acknowledges receipt of the session-initiate.

]]>

The initiator then attempts to initiate a SOCKS5 Bytestream with the responder.

]]>

If the responder is willing to accept the bytestream, it MUST attempt to open a standard TCP socket on the network address of the StreamHost communicated by the initiator. If the initiator provides more than one StreamHost, the responder SHOULD try to connect to them in the order they occur.

If the responder tries but is unable to connect to any of the StreamHosts and it cannot or does not wish to attempt a connection from its side, it returns a ¬found; error to the initiator.

]]>

At this point the file transfer has failed using SOCKS5 Bytestreams. However, all is not lost, because the parties can attempt to fall back to In-Band Bytestreams. Therefore the responder sends a content-replace action including a transport of IBB and a request for the file originally offered (note the use of the <request/> element instead of the <offer/> element, since the responder wants the initiator to send the previously-offered file).

]]>

The initiator then acknowledges the content-replace action.

]]>

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

]]>

The responder then acknowledges the content-accept action.

]]>

The initiator then sends an IBB initiation request to the responder.

]]> ]]>

Now the responder sends a session-accept to the initiator.

This is a test. If this were a real file... ]]>

The initiator acknowledges the Jingle session-accept action.

]]>

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

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.

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

Support for Jingle file transfer can be determined through discovery of the 'urn:xmpp:tmp:jingle:apps:file-transfer' namespace &NSNOTE;, 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 XEP-0166 rather than XEP-0095.

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.

No interaction with &IANA; is required as a result of this document.

Until this specification advances to a status of Draft, its associated namespaces shall be 'urn:xmpp:tmp:jingle:apps:file-transfer'. Upon advancement of this specification, the ®ISTRAR; shall issue a permanent namespace in accordance with the process defined in Section 4 of &xep0053;. The namespace 'urn:xmpp:jingle:apps:file-transfer' is requested, and is thought to be unique per the XMPP Registrar's requirements.

The XMPP Registrar shall include "file-transfer" in its registry of Jingle application formats. The registry submission is as follows:

file-transfer Jingle sessions for the transfer of a file reliable XEP-0234 ]]>

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:

bytestreams A method for exchanging data over SOCKS5 Bytestreams. reliable XEP-0065 ibb A method for exchanging data over In-Band Bytestreams. reliable XEP-0047 ]]>

Note: If this specification is approved, the foregoing definitions will be moved to XEP-0047 and XEP-0065.

]]>