git-svn-id: file:///home/ksmith/gitmigration/svn/xmpp/trunk@3938 4b5297f7-1745-476d-ba37-a9c6900126ab
This commit is contained in:
Peter Saint-Andre 2010-02-17 22:37:43 +00:00
parent 5e3176e3f5
commit f75f0f1e7b
1 changed files with 45 additions and 23 deletions

View File

@ -11,6 +11,7 @@
&LEGALNOTICE;
<number>0047</number>
<status>Draft</status>
<interim/>
<type>Standards Track</type>
<sig>Standards</sig>
<dependencies>
@ -24,76 +25,82 @@
<shortname>ibb</shortname>
&infiniti;
&stpeter;
<revision>
<version>1.3rc1</version>
<date>in progress, last updated 2010-02-17</date>
<initials>psa</initials>
<remark><p>Clarified error handling.</p></remark>
</revision>
<revision>
<version>1.2</version>
<date>2009-03-17</date>
<initials>psa/jk</initials>
<remark>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.</remark>
<remark><p>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.</p></remark>
</revision>
<revision>
<version>1.1</version>
<date>2006-11-21</date>
<initials>jk</initials>
<remark>Allowed IQ for delivery.</remark>
<remark><p>Allowed IQ for delivery.</p></remark>
</revision>
<revision>
<version>1.0</version>
<date>2003-12-10</date>
<initials>psa</initials>
<remark>Per a vote of the Jabber Council, advanced status to Draft.</remark>
<remark><p>Per a vote of the Jabber Council, advanced status to Draft.</p></remark>
</revision>
<revision>
<version>0.8</version>
<date>2003-12-04</date>
<initials>jk</initials>
<remark>Add 'block-size' attribute and usage guidelines</remark>
<remark><p>Add 'block-size' attribute and usage guidelines</p></remark>
</revision>
<revision>
<version>0.7</version>
<date>2003-05-23</date>
<initials>jk</initials>
<remark>Use IQ for shutdown, remove XEP-0022 dependency, loop the counter</remark>
<remark><p>Use IQ for shutdown, remove XEP-0022 dependency, loop the counter</p></remark>
</revision>
<revision>
<version>0.6</version>
<date>2003-05-14</date>
<initials>jk</initials>
<remark>Use message for delivery</remark>
<remark><p>Use message for delivery</p></remark>
</revision>
<revision>
<version>0.5</version>
<date>2003-04-06</date>
<initials>jk</initials>
<remark>Changed newseq to prevseq, added acks, changed seq size to 32-bit</remark>
<remark><p>Changed newseq to prevseq, added acks, changed seq size to 32-bit</p></remark>
</revision>
<revision>
<version>0.4</version>
<date>2003-03-22</date>
<initials>jk</initials>
<remark>Changed protocol, added sequence id</remark>
<remark><p>Changed protocol, added sequence id</p></remark>
</revision>
<revision>
<version>0.3</version>
<date>2002-12-10</date>
<initials>jk</initials>
<remark>Removed the 'comment' block, changed namespace</remark>
<remark><p>Removed the 'comment' block, changed namespace</p></remark>
</revision>
<revision>
<version>0.2</version>
<date>2002-10-10</date>
<initials>jk</initials>
<remark>Revised the text</remark>
<remark><p>Revised the text</p></remark>
</revision>
<revision>
<version>0.1</version>
<date>2002-09-29</date>
<initials>jk</initials>
<remark>Initial version.</remark>
<remark><p>Initial version.</p></remark>
</revision>
</header>
<section1 topic='Introduction' anchor='intro'>
<p>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.</p>
<p>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.</p>
</section1>
<section1 topic='Protocol' anchor='protocol'>
@ -108,7 +115,7 @@
<ul>
<li>The REQUIRED 'block-size' attribute defines the maximum size in bytes of each data chunk (which SHOULD NOT be greater than 65535).</li>
<li>The REQUIRED 'sid' attribute defines a unique session ID for this IBB session (which SHOULD match the NMTOKEN datatype).</li>
<li>The OPTIONAL 'stanza' attribute defines whether the data will be sent using IQ stanzas or message stanzas (the default value is "iq").</li>
<li>The OPTIONAL 'stanza' attribute defines whether the data will be sent using IQ stanzas or message stanzas (the default value is "iq", and it is RECOMMENDED to send IBB data using IQ stanzas instead of message stanzas because IQ stanzas provide feedback to the sender regarding delivery to the recipient).</li>
</ul>
<example caption='Initiator requests session'><![CDATA[
<iq from='romeo@montague.net/orchard'
@ -165,7 +172,7 @@
<section2 topic='Sending Data' anchor='send'>
<p>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 <link url='#bidi'>Bidirectionality</link> section of this document for details).</p>
<p>Each chunk of data is contained in a &lt;data/&gt; 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 &lt;data/&gt; element and IQ or message stanza, MUST NOT be larger than the 'block-size' determined in the bytestream negotiation.</p>
<p>Each chunk of data is contained in a &lt;data/&gt; 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 &lt;data/&gt; element and IQ or message stanza, MUST NOT be larger than the 'block-size' determined in the bytestream negotiation.</p>
<example caption='Sending data in an IQ stanza'><![CDATA[
<iq from='romeo@montague.net/orchard'
id='kr91n475'
@ -181,19 +188,30 @@
</iq>
]]></example>
<p>Each chunk of data is included as the XML character data of the &lt;data/&gt; element after being encoded as Base64 as specified in Section 4 of &rfc4648;.</p>
<p>The &lt;data/&gt; 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.</p>
<p>The &lt;data/&gt; 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 (2<span class='super'>15</span> - 1) the 'seq' MUST start again at 0.</p>
<p>The &lt;data/&gt; element MUST also possess a 'sid' attribute that ties the data chunk to this particular IBB session.</p>
<p>In the case of IQ stanzas, if the packet can be processed then the recipient MUST reply with an IQ stanza of type "result".</p>
<example caption='Acknowledging data using IQ'><![CDATA[
<example caption='Acknowledging data received via IQ'><![CDATA[
<iq from='juliet@capulet.com/balcony'
id='kr91n475'
to='romeo@montague.net/orchard'
type='result'/>
]]></example>
<p>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.</p>
<p>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.</p>
<p>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 <cite>RFC 4648</cite>. In this case the recipient shall return an appropriate XMPP stanza error, such as &notfound;, &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 <link rel='#close'>Closing the Bytestream</link> 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).</p>
<p>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.</p>
<p>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.</p>
<p>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:</p>
<ol>
<li>Because the recipient has gone offline, the recipient's server returns a &recipient; error with a type of 'wait'.</li>
<li>Because a server-to-server link has gone down, the sender's server returns a &timeout; error with a type of 'wait'.</li>
</ol>
<p>Upon receiving an error related to delivery, the sender SHOULD temporarily suspend the stream but retry sending at a later time.</p>
<p>It is also possible that there is a problem with the data packet itself, in which case the recipient shall return an appropriate error:</p>
<ol>
<li>Because the session ID is unknown, the recipient returns an &notfound; error with a type of 'cancel'.</li>
<li>Because the sequence number has already been used, the recipient returns an &unexpected; error with a type of 'cancel'.</li>
<li>Because the data is not formatted in accordance with Section 4 of <cite>RFC 4648</cite>, the recipient returns a &badrequest; error with a type of 'cancel'.</li>
</ol>
<p>Upon receiving an error related to the data packet, the sender MUST close the bytestream as described under <link rel='#close'>Closing the Bytestream</link>.</p>
<p>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.</p>
</section2>
<section2 topic='Closing the Bytestream' anchor='close'>
@ -224,7 +242,7 @@
</error>
</iq>
]]></example>
<p>In either case, the sender MUST consider the bytestream to be closed and invalid.</p>
<p>In either case, both parties MUST consider the bytestream to be closed.</p>
</section2>
</section1>
@ -254,7 +272,7 @@
<ul>
<li>Generally, in-band bytestreams SHOULD be used only as a last resort. <strong>SOCKS5 Bytestreams</strong> will almost always be preferable.</li>
<li>A server MAY rate limit a connection, depending on the size and frequency of data packets.</li>
<li>A server MAY disconnect a connection that sends overly large packets as defined by server policy.</li>
<li>A server MAY disconnect a connection that sends overly large packets as defined by its local service policy.</li>
<li>It is RECOMMENDED to use a 'block-size' of 4096.</li>
</ul>
</section1>
@ -300,7 +318,7 @@
<xs:attribute name='stanza' use='optional' default='iq'>
<xs:simpleType>
<xs:restriction base='xs:NCName'>
<xs:enumeration value='iq'>
<xs:enumeration value='iq'/>
<xs:enumeration value='message'/>
</xs:restriction>
</xs:simpleType>
@ -341,4 +359,8 @@
]]></code>
</section1>
<section1 topic='Acknowledgements' anchor='ack'>
<p>Thanks to Fabio Forno for his feedback.</p>
</section1>
</xep>