git-svn-id: file:///home/ksmith/gitmigration/svn/xmpp/trunk@3328 4b5297f7-1745-476d-ba37-a9c6900126ab
This commit is contained in:
Peter Saint-Andre 2009-07-15 03:39:10 +00:00
parent 0d6b5ea95a
commit aeb7371fe0
1 changed files with 53 additions and 15 deletions

View File

@ -27,9 +27,9 @@
&infiniti;
<revision>
<version>0.3</version>
<date>2009-07-13</date>
<date>2009-07-14</date>
<initials>dm/psa/jk</initials>
<remark><p>Major update to make Jingle S5B inherit more features from ICE and ICE-TCP. This includes priorities and candidate identifier and the renaming of the streamhost element to candidate. The candidate selection was updated to the use of priorities and it is now required for both clients to send a candidate-used or candidate-error notification. Also defined type attribute to differentiate between various kinds of candidates. Noted reuse of fast-mode methodology from older S5B optimization specification. Due to incompatibilities to previous version the namespace changed to urn:xmpp:jingle:transports:s5b:1.</p></remark>
<remark><p>Major update to make Jingle S5B inherit more features from ICE and ICE-TCP. Added priorities and candidate identifiers. Renamed streamhost element to candidate element. Updated candidate selection to use priorities, and it is now required for both clients to send a candidate-used or candidate-error notification. Defined type attribute to differentiate between various kinds of candidates. More clearly described how S5B negotiation is completed, including an activated notification from responder to initiator when the candidate used is a proxy. Noted reuse of fast-mode methodology from S5B optimization specification. Because of incompatibilities with the previous version, changed the namespace to urn:xmpp:jingle:transports:s5b:1.</p></remark>
</revision>
<revision>
<version>0.2</version>
@ -99,9 +99,9 @@ Romeo Juliet
| |
]]></code>
<p>This flow is illustrated in the following examples (to simplify the presentation these use a "stub" application instead of a real application type).</p>
<section2 topic='Exchange Candidates'>
<section2 topic='Exchanging Candidates' anchor='exchange'>
<p>First the initiator sends a Jingle session-initiate request that contains one or more transport candidates which are a mixture of <cite>XEP-0065</cite> streamhosts and ICE candidates used in <cite>XEP-0176</cite>.</p>
<p>It is RECOMMENDED that a client will offer as many &lt;candidate/&gt; elements as possible with itself as the host (i.e., non-proxy candidates). This includes opening the TCP port on all available interfaces the user wants to use (e.g. maybe not an expensive UMTS link), both the IPv4 and IPv6 addresses of that interface (if available), and using an assisting NAT protocol if possible. If the client knows it is behind a NAT and the router announces UPnP IGD or NAT-PMP support, the client SHOULD map the open port to the external interface of the router and include the public IP address and port information in the &lt;candidate/&gt; offers. To increase the chance of success without using a proxy, this specification allows the responder to also send offers, effectively equivalent to the "fast mode" for SOCKS5 Bytestreams as previously described at &lt;<link url='http://delta.affinix.com/specs/stream.html'>http://delta.affinix.com/specs/stream.html</link>&gt;.</p>
<p>It is RECOMMENDED that a client will offer as many &lt;candidate/&gt; elements as possible with itself as the host (i.e., non-proxy candidates). This includes opening the TCP port on all available interfaces the user wants to use (e.g. maybe not an expensive UMTS link), both the IPv4 and IPv6 addresses of that interface (if available), and using an assisting NAT protocol if possible. If the client knows it is behind a NAT and the router announces UPnP IGD or NAT-PMP support, the client SHOULD map the open port to the external interface of the router and include the public IP address and port information in the &lt;candidate/&gt; offers. To increase the chance of success without using a proxy, this specification allows the responder to also send offers, effectively equivalent to the "fast-mode" for SOCKS5 Bytestreams as previously described at &lt;<link url='http://delta.affinix.com/specs/stream.html'>http://delta.affinix.com/specs/stream.html</link>&gt;.</p>
<example caption="Initiator sends session-initiate (stub)"><![CDATA[
<iq from='romeo@montague.lit/orchard'
id='xn28s7gk'
@ -141,7 +141,7 @@ Romeo Juliet
type='result'/>
]]></example>
<p>Depending on the application type, a user agent controlled by a human user might need to wait for the user to affirm a desire to proceed with the session before continuing. When the user agent has received such affirmation (or if the user agent can automatically proceed for any reason, e.g. because no human intervention is expected or because a human user has configured the user agent to automatically accept sessions with a given entity), it returns a Jingle session-accept message. This message MUST contain a &TRANSPORT; element qualified by the 'urn:xmpp:jingle:transports:s5b:1' namespace, which SHOULD in turn contain one &lt;candidate/&gt; element for each SOCKS5 Bytestreams candidate generated by or known to the responder, but MAY instead be empty if the responder does not wish to offer any candidates or wishes to send each candidate as the payload of a transport-info message.</p>
<p>Note: If the responder sends candidates, the chances of a successful connection are increased. For example, the initiator might be behind a NAT or might have no access to a proxy, whereas the responder might have a public IP address, might know about a proxy, or might have NAT penetration support like NAT-PMP in the router. (Whereas this "fast mode" was a special extension previously, it is the default in Jingle.)</p>
<p>Note: If the responder sends candidates, the chances of a successful connection are increased. For example, the initiator might be behind a NAT or might have no access to a proxy, whereas the responder might have a public IP address, might know about a proxy, or might have NAT penetration support like NAT-PMP in the router. (Whereas this "fast-mode" was a special extension previously, it is the default in Jingle.)</p>
<p>In the following example, Juliet's client opens one port. The provided &lt;candidates/&gt; are the (private) IPv4 address of the interface, a (public) IPv6 address, and the public IPv4 address created by mapping the private IP address/port using NAT-PMP.</p>
<example caption="Responder sends session-accept with candidates"><![CDATA[
<iq from='juliet@capulet.lit/balcony'
@ -216,8 +216,8 @@ priority = (2^16)*(type preference) + (local preference)
</table>
<p>The local preference is used to rate different candidates of the same type, e.g. a DSL link might be preferred over a VPN connection. The value of the local preference SHOULD be between 0 and 65535. The proposed values are only guidelines. If a client wants to increase or decrease the value of a specific candidate it is free to do so. For instance, a client might have an expensive UMTS link as last resort and might rate this link lower than all SOCKS5 relays.</p>
</section2>
<section2 topic='Connecting to Candidates'>
<p>After receiving its peer's candidates, a client start to connect to them in order of the priority. The protocol is described in <cite>XEP-0065</cite> in detail. Once one client has successfully created a connection, it sends the &lt;candidate-used/&gt; element to the peer inside a transport-info Jingle message. If a client receives a candidate-used information it SHOULD continue trying to connect to candidates of its peer while it has not tried all candidates with a higher priority than the one successfully used by the peer.</p>
<section2 topic='Connecting to Candidates' anchor='connect'>
<p>After receiving its peer's candidates, a client start to connect to them in order of the priority. The protocol is described in <cite>XEP-0065</cite> in detail. Once one client has successfully created a connection, it sends the &lt;candidate-used/&gt; element to the peer inside a transport-info Jingle message. If a client receives a candidate-used information it SHOULD continue trying to connect to candidates of its peer if it has not tried all candidates with a higher priority than the one successfully used by the peer.</p>
<example caption="Initiator sends candidate-used in Jingle transport-info"><![CDATA[
<iq from='romeo@montague.lit/orchard'
id='hjdi8'
@ -235,15 +235,15 @@ priority = (2^16)*(type preference) + (local preference)
</content>
</jingle>
</iq>
]]></example>
]]></example>
<p>The peer immediately acknowledges receipt.</p>
<example caption="Responder acknowledges candidate-used message"><![CDATA[
<iq from='juliet@capulet.lit/balcony'
id='hjdi8'
to='romeo@montague.lit/orchard'
type='result'/>
]]></example>
<p>If a client was unable to connect to any candidate of its peer or stopped trying because the peer already send a candidate-used notification with a priority higher than its remaining candidates, it sends a candidate-error Jingle transport-info message (this is equivalent to the IQ-error with code="500" from the "fast-mode" extension). If both clients happen to send a candidates-used message with candidates with the same priority, the candidate chosen by the initiator wins (consistent with the rules in <cite>XEP-0166</cite>) and the responder closes the connection it was able to establish.</p>
]]></example>
<p>If a client is unable to connect to <em>any</em> candidate sent by its peer, or if it stopped trying to connect because its peer sent a candidate-used notification with a priority higher than its remaining candidate(s), it sends a candidate-error Jingle transport-info message (this is equivalent to the IQ-error with code="500" from the "fast-mode" extension).</p>
<example caption="Responder sends candidate-error in Jingle transport-info"><![CDATA[
<iq from='juliet@capulet.lit/balcony'
id='gft65ewd'
@ -261,17 +261,44 @@ priority = (2^16)*(type preference) + (local preference)
</content>
</jingle>
</iq>
]]></example>
]]></example>
<p>The peer immediately acknowledges receipt.</p>
<example caption="Responder acknowledges candidate-error message"><![CDATA[
<iq from='romeo@montague.lit/orchard'
id='gft65ewd'
to='juliet@capulet.lit/balcony'
type='result'/>
]]></example>
<p>If at least party makes a successful connection, both clients can begin sending data over the SOCKS5 bytestream as described in XEP-0065.</p>
]]></example>
</section2>
<section2 topic='Closing the Bytestream'>
<section2 topic='Completing the Negotiation' anchor='complete'>
<p>The transport negotiation is completed in one of the following ways:</p>
<ol start='1'>
<li>If both parties send a candidate-error notification then the SOCKS5 negotiation has failed and the parties need to fall back to some other transport method, typically IBB; see the <link url='#fallback'>Fallback to IBB</link> section of this document for details.</li>
<li>If one of the parties sends a candidate-error notification and the other party sends a candidate-used notification, then the candidate-used shall be considered the nominated candidate.</li>
<li>If both parties send a candidate-used notification but the candidates have a different priority, then the candidate with the lower priority shall be considered the nominated candidate.</li>
<li>If both parties send a candidate-used notification with candidates having the same priority, then the candidate chosen by the initiator shall be considered the nominated candidate (consistent with the rules in <cite>XEP-0166</cite>).</li>
</ol>
<p>The parties shall use the nominated candidate for the data transfer. If the nominated candidate is of the proxy type <em>and</em> it was offered by the responder, then the initiator has no way to know when it can send data. Therefore the responder MUST send an activated notification to the initiator once it has activated the bytestream (as described in <cite>XEP-0065</cite>); it does so by sending a transport-info message containing an &lt;activated/&gt; element as follows.</p>
<example caption="Responder informs initiator that bytestream has been activated"><![CDATA[
<iq from='juliet@capulet.lit/balcony'
id='bv73bs91'
to='romeo@montague.lit/orchard'
type='set'>
<jingle xmlns='urn:xmpp:jingle:1'>
action='transport-info'
initiator='romeo@montague.lit/orchard'
sid='a73sjjvkla37jfea'>
<content creator='initiator' name='stub'>
<transport xmlns='urn:xmpp:jingle:transports:s5b:1'
sid='vj3hs98y'>
<activated cid='xmdh4b7i'/>
</transport>
</content>
</jingle>
</iq>
]]></example>
</section2>
<section2 topic='Closing the Bytestream' anchor='close'>
<p>Once the parties have finished using the bytestream (e.g., because a complete file has been sent), either party can send a Jingle session-terminate action.</p>
<example caption="Initiator terminates the session"><![CDATA[
<iq from='romeo@montague.lit/orchard'
@ -456,6 +483,9 @@ Romeo Juliet
<xs:complexType>
<xs:choice>
<xs:element ref='candidate' minOccurs='0' maxOccurs='unbounded'/>
<xs:element ref='candidate-used' minOccurs='0' maxOccurs='1'/>
<xs:element name='candidate-error' minOccurs='0' maxOccurs='1' type='empty'/>
<xs:element ref='activated' minOccurs='0' maxOccurs='1'/>
</xs:choice>
<xs:attribute name='sid' type='xs:string' use='optional'/>
<xs:attribute name='mode' use='optional' default='tcp'>
@ -503,7 +533,15 @@ Romeo Juliet
</xs:complexType>
</xs:element>
<xs:element name='candidate-error'/>
<xs:element name='activated'>
<xs:complexType>
<xs:simpleContent>
<xs:extension base='empty'>
<xs:attribute name='cid' type='xs:string' use='required'/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:simpleType name='empty'>
<xs:restriction base='xs:string'>