<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
  <!ENTITY % ents SYSTEM 'xep.ent'>
%ents;
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
  <title>Out of Band Data</title>
  <abstract>This specification defines two XMPP protocol extensions for communicating URIs, one for use in XMPP message stanzas and the other for use in a structured request-response interaction via XMPP IQ stanzas. Among other things, this enables one entity to inform another entity about a file that is available at an HTTP URL.</abstract>
  &LEGALNOTICE;
  <number>0066</number>
  <status>Draft</status>
  <type>Standards Track</type>
  <sig>Standards</sig>
  <dependencies>
    <spec>XMPP Core</spec>
  </dependencies>
  <supersedes/>
  <supersededby/>
  <shortname>oob</shortname>
  <schemaloc>
    <ns>jabber:iq:oob</ns>
    <url>http://www.xmpp.org/schemas/iq-oob.xsd</url>
  </schemaloc>
  <schemaloc>
    <ns>jabber:x:oob</ns>
    <url>http://www.xmpp.org/schemas/x-oob.xsd</url>
  </schemaloc>
  &stpeter;
  <revision>
    <version>1.5</version>
    <date>2006-08-16</date>
    <initials>psa</initials>
    <remark><p>Per a vote of the Jabber Council, converted to Standards Track.</p></remark>
  </revision>
  <revision>
    <version>1.4</version>
    <date>2006-01-11</date>
    <initials>psa</initials>
    <remark><p>Removed example of including URL in presence stanza.</p></remark>
  </revision>
  <revision>
    <version>1.3</version>
    <date>2004-10-18</date>
    <initials>psa</initials>
    <remark><p>Added non-normative section on integration with stream initiation (XEP-0095); added optional sid attribute to jabber:iq:oob schema.</p></remark>
  </revision>
  <revision>
    <version>1.2</version>
    <date>2004-04-13</date>
    <initials>psa</initials>
    <remark><p>Clarified that IQ use is for basic file transfer whereas message and presence use is for communication of URIs; added presence example; added references to file transfer specifications as well as related open issue.</p></remark>
  </revision>
  <revision>
    <version>1.1</version>
    <date>2004-02-10</date>
    <initials>psa</initials>
    <remark><p>Editorial adjustments and clarifications; added references to relevant RFCs.</p></remark>
  </revision>
  <revision>
    <version>1.0</version>
    <date>2003-10-08</date>
    <initials>psa</initials>
    <remark><p>Per a vote of the Jabber Council, changed status to Active.</p></remark>
  </revision>
  <revision>
    <version>0.3</version>
    <date>2003-06-22</date>
    <initials>psa</initials>
    <remark><p>Made several small editorial changes; added XML schemas.</p></remark>
  </revision>
  <revision>
    <version>0.2</version>
    <date>2003-01-08</date>
    <initials>psa</initials>
    <remark><p>Added information about non-HTTP URIs.</p></remark>
  </revision>
  <revision>
    <version>0.1</version>
    <date>2002-12-16</date>
    <initials>psa</initials>
    <remark><p>Initial version.</p></remark>
  </revision>
</header>
<section1 topic='Introduction' anchor='intro'>
  <p>This document defines two XMPP protocol extensions for communicating URIs between Jabber entities, where the data formats are qualified by the 'jabber:iq:oob' and 'jabber:x:oob' namespaces. Although these mechanisms were originally used for out-of-band (OOB) data transfer, they are also used more generally to exchange or communicate URIs.</p>
</section1>
<section1 topic='jabber:iq:oob' anchor='iq-oob'>
  <p>The intent of the 'jabber:iq:oob' was to provide a "least common denominator" mechanism for basic file transfers. Although &xep0096; defines a more generic method for communicating file exchange options, the 'jabber:iq:oob' namespace can be included as one option therein since it provides a fallback mechanism when clients do not support file transfer options such as those defined in &xep0065; and &xep0047;.</p>
  <p>To initiate an out-of-band file transfer with an intended recipient using the 'jabber:iq:oob' namespace (whether or not negotiated via <cite>XEP-0096</cite>), the sending application sends an &IQ; of type 'set' to the recipient containing a &QUERY; child element qualified by the 'jabber:iq:oob' namespace; the &QUERY; MUST in turn contain a &lt;url/&gt; child specifying the URL of the file to be transferred, and MAY contain an optional &lt;desc/&gt; child describing the file. This usage is shown in the following example.</p>
    <example caption="Sender Initiates Request-Response"><![CDATA[
<iq type='set'
    from='stpeter@jabber.org/work'
    to='MaineBoy@jabber.org/home'
    id='oob1'>
  <query xmlns='jabber:iq:oob'>
    <url>http://www.jabber.org/images/psa-license.jpg</url>
    <desc>A license to Jabber!</desc>
  </query>
</iq>
    ]]></example>
    <p>The expected result is for the recipient to retrieve the file via an HTTP GET request and to then inform the sender of successful receipt of the file. The receiving application MUST NOT send the IQ result until it has retrieved the complete file (e.g., it MUST NOT send the IQ result if it has merely attempted to retrieve the file or the URL provided seems to be valid):</p>
    <example caption="Recipient Informs Sender of Success"><![CDATA[
<iq type='result'
    from='MaineBoy@jabber.org/home'
    to='stpeter@jabber.org/work'
    id='oob1'/>
    ]]></example>
    <p>If the recipient attempts to retrieve the file but is unable to do so, the receiving application MUST return an &IQ; of type 'error' to the sender specifying a Not Found condition:</p>
    <example caption="Recipient Informs Sender of Failure"><![CDATA[
<iq type='error'
    from='MaineBoy@jabber.org/home'
    to='stpeter@jabber.org/work'
    id='oob1'>
  <query xmlns='jabber:iq:oob'>
    <url>http://www.jabber.org/images/psa-license.jpg</url>
    <desc>A license to Jabber!</desc>
  </query>
  <error code='404' type='cancel'>
    <item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  </error>
</iq>
    ]]></example>
    <p>If the recipient rejects the request outright, the receiving application MUST return an &IQ; of type 'error' to the sender specifying a Not Acceptable condition:</p>
    <example caption="Recipient Rejects Request"><![CDATA[
<iq type='error'
    from='MaineBoy@jabber.org/home'
    to='stpeter@jabber.org/work'
    id='oob1'>
  <query xmlns='jabber:iq:oob'>
    <url>http://www.jabber.org/images/psa-license.jpg</url>
    <desc>A license to Jabber!</desc>
  </query>
  <error code='406' type='modify'>
    <not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  </error>
</iq>
    ]]></example>
</section1>
<section1 topic='jabber:x:oob' anchor='x-oob'>
  <p>The 'jabber:x:oob' namespace is used to communicate a URI to another user or application. This is done by including an &X; child element qualified by the 'jabber:x:oob' namespace in either a &MESSAGE; and &PRESENCE; stanza; the &X; child MUST contain a &lt;url/&gt; child specifying the URL of the resource, and MAY contain an optional &lt;desc/&gt; child describing the resource.</p>
    <example caption="Sender Communicates a URI"><![CDATA[
<message from='stpeter@jabber.org/work'
         to='MaineBoy@jabber.org/home'>
  <body>Yeah, but do you have a license to Jabber?</body>
  <x xmlns='jabber:x:oob'>
    <url>http://www.jabber.org/images/psa-license.jpg</url>
  </x>
</message>
    ]]></example>
</section1>
<section1 topic='Determining Support' anchor='disco'>
  <p>If an entity supports the out of band data protocol, it MUST report that by including a service discovery feature of "jabber:iq:oob" and/or "jabber:x:oob" in response to a &xep0030; information request:</p>
  <example caption="Service Discovery information request"><![CDATA[
<iq type='get'
    from='juliet@capulet.lit/balcony'
    to='romeo@montague.lit/orchard'
    id='disco1'>
  <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
  ]]></example>
  <example caption="Service Discovery information response"><![CDATA[
<iq type='result'
    from='romeo@montague.lit/orchard'
    to='juliet@capulet.lit/balcony'
    id='disco1'>
  <query xmlns='http://jabber.org/protocol/disco#info'>
    ...
    <feature var='jabber:iq:oob'/>
    <feature var='jabber:x:oob'/>
    ...
  </query>
</iq>
  ]]></example>
</section1>
<section1 topic='Use With Non-HTTP URI Schemes' anchor='nonhttp'>
  <p>The value of the &lt;url/&gt; element is not limited to URIs that conform to the http: URI scheme (as specified by &rfc2616;). For example, file transfers could also be effected using ftp: URIs as (specified by &rfc0959;). Going further afield, several existing Jabber clients use the callto: URI scheme to initiate voice conferencing via NetMeeting or GnomeMeeting. Other out-of-band communications could be initiated in a similar way via URI schemes such as sip: (as specified by &rfc3261;). All of these usages are allowed by the existing OOB namespaces, as long as the value of the &lt;url/&gt; element is a valid URI (as specified by &rfc3986;).</p>
</section1>
<section1 topic='Integration With Stream Initiation' anchor='si'>
  <p><em>This section is non-normative.</em></p>
  <p>&xep0095; defines methods for negotiating content streams between any two entities, and XEP-0096 defines a profile of stream initiation for file transfer. Although the use of jabber:iq:oob is not recommended by XEP-0096, it could be offered as one option (e.g., a fallback if SOCKS5 Bytestreams and In-Band Bytestreams are not available). If so, the value of the feature negotiation option MUST be "jabber:iq:oob" and the &QUERY; element within the &IQ; stanza qualified by the 'jabber:iq:oob' namespace MUST possess a 'sid' attribute whose value is the StreamID negotiated by stream initiation.</p>
  <p>A sample protocol flow is shown below.</p>
  <example caption='Stream Initiation Offer'>
    <![CDATA[
<iq type='set' 
    from='romeo@montague.net/orchard'
    to='juliet@capulet.com/chamber'
    id='offer1'>
  <si xmlns='http://jabber.org/protocol/si' 
      id='a0'
      mime-type='text/plain'
      profile='http://jabber.org/protocol/si/profile/file-transfer'>
    <file xmlns='http://jabber.org/protocol/si/profile/file-transfer'
          name='test.txt'
          size='1022'/>
    <feature xmlns='http://jabber.org/protocol/feature-neg'>
      <x xmlns='jabber:x:data' type='form'>
        <field var='stream-method' type='list-single'>
          <option><value>http://jabber.org/protocol/bytestreams</value></option>
          <option><value>http://jabber.org/protocol/ibb</value></option>
          <option><value>jabber:iq:oob</value></option>
        </field>
      </x>
    </feature>
  </si>
</iq>
    ]]>
  </example>
  <example caption='Stream Initiation Result'>
    <![CDATA[
<iq type='result' 
    from='juliet@capulet.com/chamber'>
    to='romeo@montague.net/orchard'
    id='offer1'>
  <si xmlns='http://jabber.org/protocol/si'
      id='a0'
      profile='http://jabber.org/protocol/si/profile/file-transfer'>
    <feature xmlns='http://jabber.org/protocol/feature-neg'>
      <x xmlns='jabber:x:data' type='submit'>
        <field var='stream-method'>
          <value>jabber:iq:oob</value>
        </field>
      </x>
    </feature>
  </si>
</iq>
    ]]>
  </example>
  <example caption="Sender Initiates Request-Response"><![CDATA[
<iq type='set'
    from='romeo@montague.net/orchard'
    to='juliet@capulet.com/chamber'>
    id='send1'>
  <query xmlns='jabber:iq:oob'
         sid='a0'>
    <url>http://www.shakespeare.lit/files/letter.txt</url>
  </query>
</iq>
  ]]></example>
  <example caption="Recipient Informs Sender of Success"><![CDATA[
<iq type='result'
    from='juliet@capulet.com/chamber'>
    to='romeo@montague.net/orchard'
    id='send1'/>
  ]]></example>
</section1>
<section1 topic='Security Considerations' anchor='security'>
  <p>As with any mechanism that communicates a URI, care must be taken by the receiving application to ensure that the resource retrieved does not contain harmful or malicious data (e.g., a virus-infected file).</p>
</section1>
<section1 topic='IANA Considerations' anchor='iana'>
  <p>This document requires no interaction with &IANA;.</p>
</section1>
<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  <p>The 'jabber:iq:oob' and 'jabber:x:oob' namespaces are included in the protocol namespaces registry maintained by the &REGISTRAR; (see &NAMESPACES;).</p>
</section1>
<section1 topic='XML Schemas' anchor='schemas'>
  <section2 topic='jabber:iq:oob' anchor='schemas-iq'>
    <code><![CDATA[
<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='jabber:iq:oob'
    xmlns='jabber:iq:oob'
    elementFormDefault='qualified'>

  <xs:annotation>
    <xs:documentation>
      The protocol documented by this schema is defined in
      XEP-0066: http://www.xmpp.org/extensions/xep-0066.html
    </xs:documentation>
  </xs:annotation>

  <xs:element name='query'>
    <xs:complexType>
      <xs:sequence>
        <xs:element name='url' type='xs:string' minOccurs='1'/>
        <xs:element name='desc' type='xs:string' minOccurs='0'/>
      </xs:sequence>
      <xs:attribute name='sid' type='xs:string' use='optional'/>
    </xs:complexType>
  </xs:element>

</xs:schema>
    ]]></code>
  </section2>
  <section2 topic='jabber:x:oob' anchor='schemas-x'>
    <code><![CDATA[
<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='jabber:x:oob'
    xmlns='jabber:x:oob'
    elementFormDefault='qualified'>

  <xs:annotation>
    <xs:documentation>
      The protocol documented by this schema is defined in
      XEP-0066: http://www.xmpp.org/extensions/xep-0066.html
    </xs:documentation>
  </xs:annotation>

  <xs:element name='x'>
    <xs:complexType>
      <xs:sequence>
        <xs:element name='url' type='xs:string' minOccurs='1'/>
        <xs:element name='desc' type='xs:string' minOccurs='0'/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

</xs:schema>
    ]]></code>
  </section2>
</section1>
</xep>
