Clarified error handling.
Encouraged use of IQ stanzas rather than message stanzas for sending data; clarified bidirectional nature of IBB; more clearly specified data handling, error conditions, XML syntax, and attribute datatypes; added optional stanza attribute as in XEP-0261.
Allowed IQ for delivery.
Per a vote of the Jabber Council, advanced status to Draft.
Add 'block-size' attribute and usage guidelines
Use IQ for shutdown, remove XEP-0022 dependency, loop the counter
Use message for delivery
Changed newseq to prevseq, added acks, changed seq size to 32-bit
Changed protocol, added sequence id
Removed the 'comment' block, changed namespace
Revised the text
Initial version.
This document describes In-Band Bytestreams (IBB), a simple XMPP protocol extension that enables two entities to establish a virtual bytestream over which they can exchange Base64-encoded chunks of data over XMPP itself. Because IBB provides a generic bytestream, its usage is open-ended. To date it has been used as a fallback method for sending files when out-of-band methods such as &xep0065; are not available. However, IBB could also be useful for any kind of relatively low-bandwidth activity, such as games, shell sessions, or encrypted communication.
+This document describes In-Band Bytestreams (IBB), an XMPP protocol extension that enables two entities to establish a virtual bytestream over which they can exchange Base64-encoded chunks of data over XMPP itself. Because IBB provides a generic bytestream, its usage is open-ended. To date it has been used as a fallback method for sending files when out-of-band methods such as &xep0065; are not available. However, IBB could also be useful for any kind of relatively low-bandwidth activity, such as games, shell sessions, or encrypted text.
If the responder informs the initiator that it wishes to proceed with the session, the initiator can begin to send data over the bytestream (in addition, because the bytestream is bidirectional, the responder can also send data; see the Bidirectionality section of this document for details).
-Each chunk of data is contained in a <data/> element qualified by the 'http://jabber.org/protocol/ibb' namespace. The data element SHOULD be sent in an IQ stanza to enable proper tracking and throttling, but MAY be sent in a message stanza. The data to be sent, prior to any wrapping in the <data/> element and IQ or message stanza, MUST NOT be larger than the 'block-size' determined in the bytestream negotiation.
+Each chunk of data is contained in a <data/> element qualified by the 'http://jabber.org/protocol/ibb' namespace. The data element SHOULD be sent in an IQ stanza to enable proper tracking and throttling, but instead MAY be sent in a message stanza. The data to be sent, prior to any wrapping in the <data/> element and IQ or message stanza, MUST NOT be larger than the 'block-size' determined in the bytestream negotiation.
Each chunk of data is included as the XML character data of the <data/> element after being encoded as Base64 as specified in Section 4 of &rfc4648;.
-The <data/> element MUST possess a 'seq' attribute; this is a 16-bit unsigned integer that acts as a counter for data chunks sent within this session. The 'seq' value starts at 0 (zero) and MUST be incremented for each packet sent. Thus, the second chunk sent has a 'seq' value of 1, the third chunk has a 'seq' value of 2, and so on. The counter loops at maximum, so that after value 65535 the 'seq' MUST start again at 0.
+The <data/> element MUST possess a 'seq' attribute; this is a 16-bit unsigned integer that acts as a counter for data chunks sent in a particular direction within this session. The 'seq' value starts at 0 (zero) for each sender and MUST be incremented for each packet sent by that entity. Thus, the second chunk sent has a 'seq' value of 1, the third chunk has a 'seq' value of 2, and so on. The counter loops at maximum, so that after value 65535 (215 - 1) the 'seq' MUST start again at 0.
The <data/> element MUST also possess a 'sid' attribute that ties the data chunk to this particular IBB session.
In the case of IQ stanzas, if the packet can be processed then the recipient MUST reply with an IQ stanza of type "result".
-The sender need not wait for these acknowledgements before sending further stanzas. However, it is RECOMMENDED that the sender does wait in order to minimize possible rate-limiting penalties.
-It is possible that delivery of the stanza might fail, e.g. because the recipient has gone offline or because a server-to-server link has gone down). In this case the entity that detects the error shall return an appropriate XMPP stanza eror, such as &recipient; or &timeout;. Upon receiving notice that delivery of a data packet has failed, the sender MUST consider the bytestream to be closed and invalid.
-It is also possible that the recipient might detect an error with the data packet, e.g. because the session ID is unknown, because the sequence number has already been used, or because the data is not formatted in accordance with Section 4 of RFC 4648. In this case the recipient shall return an appropriate XMPP stanza error, such as ¬found;, &unexpected; or &badrequest;. Upon receiving notice that a data packet cannot be processed by the recipient, the sender SHOULD close the bytestream as described under Closing the Bytestream but MAY attempt to correct the error and re-send the offending data packet using the same sequence number (the recipient MUST NOT consider a sequence number to have been used until the data packet has been successfully processed).
-Data packets MUST be processed in the order they are received. If an out-of-sequence packet is received for a particular bytestream (determined by checking the 'seq' attribute), then this indicates that a packet has been lost. The recipient MUST NOT process the data of such an out-of-sequence packet, nor any that follow it within the same bytestream; instead, the recipient MUST close the bytestream as described in the next section.
+The sender of a data chunk need not wait for these acknowledgements before sending further stanzas. However, it is RECOMMENDED that the sender does wait in order to minimize the potential for rate-limiting penalties or throttling.
+It is possible that delivery of the stanza might fail, in which case the sender's or recipient's server shall return an appropriate error:
+Upon receiving an error related to delivery, the sender SHOULD temporarily suspend the stream but retry sending at a later time.
+It is also possible that there is a problem with the data packet itself, in which case the recipient shall return an appropriate error:
+Upon receiving an error related to the data packet, the sender MUST close the bytestream as described under Closing the Bytestream.
+Data packets MUST be processed in the order they are received. If an out-of-sequence packet is received for a particular direction within a bytestream (determined by checking the 'seq' attribute), then this indicates that a packet has been lost. The recipient MUST NOT process the data of such an out-of-sequence packet, nor any that follow it within the same bytestream; instead, the recipient MUST close the bytestream as described in the next section.
In either case, the sender MUST consider the bytestream to be closed and invalid.
+In either case, both parties MUST consider the bytestream to be closed.
Thanks to Fabio Forno for his feedback.
+