1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-29 20:52:29 -05:00
xeps/xep-0177.xml

447 lines
22 KiB
XML
Raw Normal View History

<?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>Jingle Raw UDP Transport Method</title>
<abstract>This specification defines a Jingle transport method that results in sending media data using raw datagram sockets via the User Datagram Protocol (UDP). This simple transport method does not provide NAT traversal, and the ICE-UDP transport method should be used if NAT traversal is required.</abstract>
&LEGALNOTICE;
<number>0177</number>
<status>Experimental</status>
<type>Standards Track</type>
<sig>Standards</sig>
<approver>Council</approver>
<dependencies>
<spec>XMPP Core</spec>
<spec>XEP-0166</spec>
</dependencies>
<supersedes/>
<supersededby/>
<shortname>NOT_YET_ASSIGNED</shortname>
&joebeda;
&stpeter;
&scottlu;
&hildjj;
&seanegan;
<revision>
<version>0.11</version>
<date>2008-09-30</date>
<initials>psa</initials>
<remark><p>Clarified protocol flow.</p></remark>
</revision>
<revision>
<version>0.10</version>
<date>2008-09-25</date>
<initials>psa</initials>
<remark>
<ul>
<li>Added an ID attribute to the candidate, trying, and received elements for tracking purposes.</li>
<li>Specified that trying and received messages must be sent.</li>
<li>Modified namespaces to incorporate namespace versioning.</li>
<li>Cleaned up XML schemas.</li>
</ul>
</remark>
</revision>
<revision>
<version>0.9</version>
<date>2007-11-27</date>
<initials>psa</initials>
<remark><p>Further editorial review.</p></remark>
</revision>
<revision>
<version>0.8</version>
<date>2007-11-15</date>
<initials>psa</initials>
<remark><p>Editorial review and consistency check.</p></remark>
</revision>
<revision>
<version>0.7</version>
<date>2007-06-25</date>
<initials>psa</initials>
<remark><p>More clearly specified the hit-or-miss nature of the transport; corrected informational messages.</p></remark>
</revision>
<revision>
<version>0.6</version>
<date>2007-04-17</date>
<initials>psa</initials>
<remark><p>Specified Jingle conformance, including definition of transport type as datagram; added section on service discovery.</p></remark>
</revision>
<revision>
<version>0.5</version>
<date>2007-03-23</date>
<initials>psa</initials>
<remark><p>Updated to reflect changes to XEP-0166; clarified media data checking.</p></remark>
</revision>
<revision>
<version>0.4</version>
<date>2006-12-21</date>
<initials>psa</initials>
<remark><p>Recommended sending of candidate in initiation request to save a round trip and expedite the negotiation; removed name attribute; clarified flow of negotiation; modified spec to use provisional namespace before advancement to Draft (per XEP-0053).</p></remark>
</revision>
<revision>
<version>0.3</version>
<date>2006-10-31</date>
<initials>psa</initials>
<remark><p>Added informational messages; clarified connectivity checks and acceptance process; mentioned that the Raw UDP candidate is conceptually equivalent to the concept of an in-use candidate from the ICE specification; added reference to RFC 4347.</p></remark>
</revision>
<revision>
<version>0.2</version>
<date>2006-07-12</date>
<initials>se/psa</initials>
<remark><p>Removed candidate element and specified exchange of address information via transport-info messages; clarified usage of name attribute.</p></remark>
</revision>
<revision>
<version>0.1</version>
<date>2006-03-01</date>
<initials>psa/jb</initials>
<remark><p>Initial version (split from XEP-0166).</p></remark>
</revision>
</header>
<section1 topic='Introduction' anchor='intro'>
<p>&xep0166; defines a framework for negotiating and managing out-of-band data sessions over XMPP. In order to provide a flexible framework, the base Jingle specification defines neither data transport methods nor application formats, leaving that up to separate specifications. The current document defines a transport method for establishing and managing data between XMPP entities using a raw User Datagram Protocol (UDP) "connection" (see &rfc0768;). This "raw-udp" method results in a datagram transport method suitable for use in media applications where some packet loss is tolerable (e.g., audio and video).</p>
<p>Note: The Raw UDP transport does not provide end-to-end traversal of Network Address Translators (NATs); if NAT traversal is needed, Jingle clients SHOULD use &ice; as described in &xep0176;. The Raw UDP transport method is defined only for the purpose of specifying the IP address and port that an entity considers "most likely to succeed" and is a "hit-or-miss" method that might work end-to-end in some circumstances. However, this method can prove useful when the communications architecture includes intermediate gateways or relays, as described in <cite>XEP-0176</cite>.</p>
</section1>
<section1 topic='Requirements' anchor='reqs'>
<p>The Jingle transport method defined herein is designed to meet the following requirements:</p>
<ol>
<li>Make it possible to establish and manage out-of-band connections between two XMPP entities over the IP address and port that the parties consider most likely to succeed.</li>
<li>Make it relatively easy to implement support in standard Jabber/XMPP clients.</li>
<li>Where communication with non-XMPP entities is needed, push as much complexity as possible onto server-side gateways between the XMPP network and the non-XMPP network.</li>
</ol>
</section1>
<section1 topic='Jingle Conformance' anchor='conformance'>
<p>In accordance with Section 10 of <cite>XEP-0166</cite>, this document specifies the following information related to the Jingle Raw UDP transport type:</p>
<ol>
<li><p>The transport negotiation process is defined in the <link url='#protocol'>Protocol Description</link> section of this document.</p></li>
<li><p>The semantics of the &TRANSPORT; element are defined in the <link url='#initiate'>Transport Initiation</link> section of this document.</p></li>
<li><p>Successful negotiation of the Raw UDP method results in use of a datagram transport that is suitable for applications where some packet loss is tolerable, such as audio and video.</p></li>
<li><p>If multiple components are to be communicated over the transport, the first component shall be associated with the port in the transport initiation stanza and the second component (e.g., for RTCP) shall be associated with a UDP port that is one number higher than the specified port (e.g., if the specified port is 13540 then the port for the second component shall be 13541).</p></li>
</ol>
</section1>
<section1 topic='Protocol Description' anchor='protocol'>
<section2 topic='Flow' anchor='protocol-flow'>
<p>The overall protocol flow for negotiation of the Jingle Raw UDP Transport Method is as follows (note: many of these events happen simultaneously, not in sequence).</p>
<code><![CDATA[
INITIATOR RESPONDER
| |
| session-initiate (w/ candidate) |
|----------------------------------->|
| ack |
|<-----------------------------------|
| session-info: trying |
|<-----------------------------------|
| ack |
|----------------------------------->|
| transport-info: candidate |
|<-----------------------------------|
| ack |
|----------------------------------->|
| session-info: received |
|----------------------------------->|
| ack |
|<-----------------------------------|
| session-accept |
|<-----------------------------------|
| ack |
|----------------------------------->|
|<========MEDIA NOW FLOWS===========>|
| |
]]></code>
</section2>
<section2 topic='Transport Initiation' anchor='initiate'>
<p>In order for the initiator in a Jingle exchange to start the negotiation, it MUST send a Jingle "session-initiate" stanza as described in <cite>XEP-0166</cite>. This stanza MUST include at least one content type. If the initiator wishes to negotiate the Raw UDP transport for a given content type, it MUST include a &TRANSPORT; child element qualified by the 'urn:xmpp:jingle:transports:raw-udp:0' namespace &VNOTE;, which MUST <note>This is required to avoid a round trip and help expedite the negotiation.</note> include the initiator's Raw UDP candidate via the 'ip', 'port', 'generation', and 'id' attributes of the &CANDIDATE; element.</p>
<example caption="Initiation"><![CDATA[
<iq from='romeo@montague.net/orchard'
id='jingle1'
to='juliet@capulet.com/balcony'
type='set'>
<jingle xmlns='urn:xmpp:jingle:0'
action='session-initiate'
initiator='romeo@montague.net/orchard'
sid='a73sjjvkla37jfea'>
<content creator='initiator' name='this-is-the-audio-content'>
<description xmlns='urn:xmpp:jingle:apps:rtp:0' media='audio'>
<payload-type id='18' name='G729'/>
</description>
<transport xmlns='urn:xmpp:jingle:transports:raw-udp:0'>
<candidate generation='0'
id='a9j3mnbtu1'
ip='10.1.1.104'
port='13540'/>
</transport>
</content>
</jingle>
</iq>
]]></example>
<p>All attributes are REQUIRED. The 'ip' and 'port' attributes are self-explanatory. The 'generation' attribute provides a tracking mechanism for determining which version of this candidate is in force (this is useful if the candidate is redefined mid-stream, for example if the port is changed). The 'id' attribute uniquely identifies this candidate for tracking purposes.</p>
<p>Note: The "Raw UDP candidate" is the candidate that the entity has reason to believe will be most likely to succeed for that content type, and thus is equivalent to the "default" candidate as described in &ice;. This is not necessarily the entity's preferred address for communication, but instead is the "address most likely to succeed", i.e., the address that is assumed to be reachable by the vast majority of target entities. To determine reachability, the sender needs to classify ahead of time the permissiveness of the NAT or firewall it is behind, if any. It then SHOULD assign the Raw UDP candidate as follows, where the candidate types are as described in <cite>ICE</cite>:</p>
<table caption='Raw UDP Candidate Assignment'>
<tr>
<th>NAT Type</th>
<th>Recommended Raw UDP Candidate Type</th>
</tr>
<tr>
<td>None</td>
<td>Host candidate</td>
</tr>
<tr>
<td>Symmetric (not permissive)</td>
<td>Relay candidate</td>
</tr>
<tr>
<td>Permissive</td>
<td>Server reflexive or peer reflexive candidate discovered via STUN (see &rfc3489; and &rfc3489bis;)</td>
</tr>
</table>
</section2>
<section2 topic='Responder Response' anchor='response'>
<p>As described in <cite>XEP-0166</cite>, to acknowledge the session initiation request, the responder returns an IQ-result:</p>
<example caption="Responder acknowledges the session-initiate request"><![CDATA[
<iq from='juliet@capulet.com/balcony'
id='jingle1'
to='romeo@montague.net/orchard'
type='result'/>
]]></example>
<p>Once the responder acknowledges the session initiation request, it:</p>
<ol>
<li>MUST attempt to send media data via UDP to the IP and port specified in the initiator's Raw UDP candidate.</li>
<li>MUST send an informational message of &lt;trying/&gt;.</li>
<li>SHOULD send its own Raw UDP candidate to the initiator via a Jingle "transport-info" message.</li>
</ol>
<p>These are done simultaneously in order to ensure that a connection can be made, since the initiator's Raw UDP candidate might not result in success.</p>
<section3 topic='Sending Media' anchor='response-send'>
<p>The responder MUST immediately attempt to send data to the IP and port specified in the initiation request. If all goes well, the data will be received by the initiator and media will flow.</p>
</section3>
<section3 topic='Sending a Trying Message' anchor='response-trying'>
<p>When it attempts to send data to a Raw UDP candidate, a party MUST send an informational message of &lt;trying/&gt;, including the candidate ID for tracking purposes.</p>
<example caption="Responder sends trying message"><![CDATA[
<iq from='juliet@capulet.com/balcony'
id='trying1'
to='romeo@montague.net/orchard'
type='set'>
<jingle xmlns='urn:xmpp:jingle:0'
action='session-info'
initiator='romeo@montague.net/orchard'
sid='a73sjjvkla37jfea'>
<trying xmlns='urn:xmpp:jingle:transports:raw-udp:info:0'
id='a9j3mnbtu1'/>
</jingle>
</iq>
]]></example>
<example caption="Initiator acknowledges trying message"><![CDATA[
<iq from='romeo@montague.lit/orchard'
id='trying1'
to='juliet@capulet.lit/balcony'
type='result'/>
]]></example>
</section3>
<section3 topic='Sending a Candidate' anchor='response-candidate'>
<p>As noted, the responder SHOULD send its own Raw UDP candidate to the initiator by sending a transport-info message to the initiator, as shown in the following example.</p>
<example caption="Responder sends its Raw UDP candidate"><![CDATA[
<iq from='juliet@capulet.com/balcony'
id='jingle2'
to='romeo@montague.net/orchard'
type='set'>
<jingle xmlns='urn:xmpp:jingle:0'
action='transport-info'
initiator='romeo@montague.net/orchard'
sid='a73sjjvkla37jfea'>
<content creator='initiator' name='this-is-the-audio-content'>
<transport xmlns='urn:xmpp:jingle:transports:raw-udp:0'>
<candidate generation='0'
id='z7sdjb01hf'
ip='208.68.163.214'
port='9876'/>
</transport>
</content>
</jingle>
</iq>
]]></example>
<p>The initiator MUST then acknowledge receipt by returning an IQ result (or a standard XMPP error).</p>
<example caption="Initiator acknowledges receipt of candidate"><![CDATA[
<iq from='romeo@montague.net/orchard'
id='jingle2'
to='juliet@capulet.com/balcony'
type='result'/>
]]></example>
<p>Naturally, the initiator SHOULD also attempt to send media to the responder as specified above. This media, too, might or might not get through, but if it does then the other party MUST acknowledge success by sending a &lt;received/&gt; message.</p>
</section3>
<section3 topic='Sending a Received Message' anchor='response-received'>
<p>Because delivery of UDP data is not acknowledged (as is TCP data), a party that receives media MUST send an informational message of &lt;received/&gt;, including the candidate ID for tracking purposes.</p>
<example caption="Initiator sends received message"><![CDATA[
<iq from='romeo@montague.net/orchard'
id='received1'
to='juliet@capulet.com/balcony'
type='set'>
<jingle xmlns='urn:xmpp:jingle:0'
action='session-info'
initiator='romeo@montague.net/orchard'
sid='a73sjjvkla37jfea'>
<received xmlns='urn:xmpp:jingle:transports:raw-udp:info:0'
id='a9j3mnbtu1'/>
</jingle>
</iq>
]]></example>
<example caption="Responder acknowledges received message"><![CDATA[
<iq from='juliet@capulet.lit/balcony'
id='received1'
to='romeo@montague.lit/orchard'
type='result'/>
]]></example>
</section3>
</section2>
<section2 topic='Informational Messages' anchor='protocol-info'>
<p>Informational messages are sent within the context of the Raw UDP transport to communicate whether the party has attempted to send media or has received media. The informational message MUST be an IQ-set containing a &JINGLE; element of type "session-info", where the informational message is a payload element qualified by the 'urn:xmpp:jingle:transports:raw-udp:info:0' namespace &VNOTE;. The following payload elements are defined:</p>
<table caption='Information Payload Elements'>
<tr>
<th>Element</th>
<th>Meaning</th>
</tr>
<tr>
<td>&lt;received/&gt;</td>
<td>The party has received media.</td>
</tr>
<tr>
<td>&lt;trying/&gt;</td>
<td>The party is trying to send media.</td>
</tr>
</table>
<p>Note: Because the informational message is sent in an IQ-set, the receiving party MUST return either an IQ-result or an IQ-error (normally only an IQ-result to acknowledge receipt; no error flows are defined or envisioned at this time).</p>
</section2>
</section1>
<section1 topic='Determining Support' anchor='support'>
<p>If an entity supports the Jingle Raw UDP transport, it MUST return a feature of "urn:xmpp:jingle:transports:raw-udp:0" &VNOTE; in response to &xep0030; information requests.</p>
<example caption="Service discovery information request"><![CDATA[
<iq from='romeo@montague.net/orchard'
id='disco1'
to='juliet@capulet.com/balcony'
type='get'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
]]></example>
<example caption="Service discovery information response"><![CDATA[
<iq from='juliet@capulet.com/balcony'
id='disco1'
to='romeo@montague.net/orchard'
type='result'>
<query xmlns='http://jabber.org/protocol/disco#info'>
...
<feature var='urn:xmpp:jingle:transports:raw-udp:0'/>
...
</query>
</iq>
]]></example>
<p>In order for an application to determine whether an entity supports this protocol, where possible it SHOULD use the dynamic, presence-based profile of service discovery defined in &xep0115;. However, if an application has not received entity capabilities information from an entity, it SHOULD use explicit service discovery instead.</p>
</section1>
<section1 topic='Security Considerations' anchor='security'>
<p>In order to secure the data stream that is negotiated via the Jingle ICE-UDP transport, implementations SHOULD use encryption methods appropriate to the transport method and media being exchanged (for details regarding RTP sessions, refer to &xep0167;).</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'>
<section2 topic='Protocol Namespaces' anchor='registrar-ns'>
<p>This specification defines the following XML namespaces:</p>
<ul>
<li>urn:xmpp:jingle:transports:raw-udp:0</li>
<li>urn:xmpp:jingle:transports:raw-udp:info:0</li>
</ul>
<p>Upon advancement of this specification from a status of Experimental to a status of Draft, the &REGISTRAR; shall add the foregoing namespaces to the registry located at &NAMESPACES;, as described in Section 4 of &xep0053;.</p>
</section2>
<section2 topic='Protocol Versioning' anchor='registrar-versioning'>
<p>If the protocol defined in this specification undergoes a major revision that is not fully backward-compatible with an older version, or that contains significant new features, the XMPP Registrar shall increment the protocol version number found at the end of the XML namespaces defined herein, as described in Section 4 of <cite>XEP-0053</cite>.</p>
</section2>
<section2 topic='Jingle Transport Methods' anchor='registrar-transports'>
<p>The XMPP Registrar shall include "raw-udp" in its registry of Jingle transport methods. The registry submission is as follows:</p>
<code><![CDATA[
<transport>
<name>raw-udp</name>
<desc>A method for exchanging data over raw UDP datagrams.</desc>
<type>datagram</type>
<doc>XEP-0177</doc>
</transport>
]]></code>
</section2>
</section1>
<section1 topic='XML Schema' anchor='schema'>
<section2 topic='Transport' anchor='schema-transport'>
<code><![CDATA[
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
targetNamespace='urn:xmpp:jingle:transports:raw-udp:0'
xmlns='urn:xmpp:jingle:transports:raw-udp:0'
elementFormDefault='qualified'>
<xs:element name='transport'>
<xs:complexType>
<xs:sequence>
<xs:element name='candidate'
type='candidateElementType'
minOccurs='0'
maxOccurs='1'/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name='candidateElementType'>
<xs:simpleContent>
<xs:extension base='empty'>
<xs:attribute name='generation' type='xs:unsignedByte' use='required'/>
<xs:attribute name='id' type='xs:NCName' use='required'/>
<xs:attribute name='ip' type='xs:string' use='required'/>
<xs:attribute name='port' type='xs:unsignedShort' use='required'/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name='empty'>
<xs:restriction base='xs:string'>
<xs:enumeration value=''/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
]]></code>
</section2>
<section2 topic='Informational Messages' anchor='schema-info'>
<code><![CDATA[
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
targetNamespace='urn:xmpp:jingle:transports:raw-udp:info:0'
xmlns='urn:xmpp:jingle:transports:raw-udp:info:0'
elementFormDefault='qualified'>
<xs:element name='received' type='infoElementType'/>
<xs:element name='trying' type='infoElementType'/>
<xs:complexType name='infoElementType'>
<xs:simpleContent>
<xs:extension base='empty'>
<xs:attribute name='id' type='xs:NCName' use='required'/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:schema>
]]></code>
</section2>
</section1>
<section1 topic='Acknowledgements' anchor='ack'>
<p>Thanks to Steffen Larsen, Robert McQueen, and Mike Ruprecht for their feedback.</p>
</section1>
</xep>