1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-28 04:02:20 -05:00

corrected examples

git-svn-id: file:///home/ksmith/gitmigration/svn/xmpp/trunk@3952 4b5297f7-1745-476d-ba37-a9c6900126ab
This commit is contained in:
Peter Saint-Andre 2010-02-22 00:56:36 +00:00
parent d98c56e93c
commit 87c01b6d86

View File

@ -1,4 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<![CDATA[
<!DOCTYPE xep SYSTEM 'xep.dtd' [
<!ENTITY % ents SYSTEM 'xep.ent'>
%ents;
@ -84,20 +85,20 @@
</section1>
<section1 topic='Registration/Setup'>
<p>The first step is to communicate with a PASS service to set it up.</p>
<example caption='Registration request'>
&#60;iq id='pass1' type='set' to='pass.jabber.org'&#62;
&#60;query xmlns='jabber:iq:pass'&#62;
&#60;expire&#62;600&#60;/expire&#62;
&#60;/query&#62;
&#60;/iq&#62;
</example>
<example caption='Result from PASS Service'>
&#60;iq id='pass1' type='result' from='pass.jabber.org'&#62;
&#60;query xmlns='jabber:iq:pass'&#62;
&#60;server port='43253'&#62;1.2.3.4&#60;/server&#62;
&#60;/query&#62;
&#60;/iq&#62;
</example>
<example caption='Registration request'><![CDATA[
<iq id='pass1' type='set' to='pass.jabber.org'>
<query xmlns='jabber:iq:pass'>
<expire>600</expire>
</query>
</iq>
]]></example>
<example caption='Result from PASS Service'><![CDATA[
<iq id='pass1' type='result' from='pass.jabber.org'>
<query xmlns='jabber:iq:pass'>
<server port='43253'>1.2.3.4</server>
</query>
</iq>
]]></example>
<p>At this point, the PASS service is now listening on the given IP and port for incoming connections on behalf of the Jabber Entity. The provided IP and port can now be sent to any other entity as a connection point, for file transfers or any other use.</p>
<p>The default behavior for the PASS service is to listen on the port forever, unless the requesting client specifies an &lt;expire/&gt; value (in seconds). If the service is not configured with an expire value, it will not timeout the connection, and will start listening on the port again after one of the two sides disconnects.</p>
<table caption='Error Codes'>
@ -115,97 +116,97 @@
</section1>
<section1 topic='Incoming Connections'>
<p>When an incoming connection is attempted to that IP and port, the PASS service MUST send an IQ request to the entity on whose behalf it is listening:</p>
<example caption='Request to entity'>
&#60;iq type='set'
<example caption='Request to entity'><![CDATA[
<iq type='set'
id='pass2'
to='user@jabber.org/resource'
from='pass.jabber.org'&#62;
&#60;query xmlns='jabber:iq:pass'&#62;
&#60;client port='1234'&#62;4.3.2.1&#60;/client&#62;
&#60;proxy port='43523'&#62;1.2.3.4&#60;/proxy&#62;
&#60;/query&#62;
&#60;/iq&#62;
</example>
<example caption='IQ result to accept connection'>
&#60;iq type='result'
from='pass.jabber.org'>
<query xmlns='jabber:iq:pass'>
<client port='1234'>4.3.2.1</client>
<proxy port='43523'>1.2.3.4</proxy>
</query>
</iq>
]]></example>
<example caption='IQ result to accept connection'><![CDATA[
<iq type='result'
id='pass2'
from='user@jabber.org/resource'
to='pass.jabber.org'&#62;
&#60;query xmlns='jabber:iq:pass'/&#62;
&#60;/iq&#62;
</example>
to='pass.jabber.org'>
<query xmlns='jabber:iq:pass'/>
</iq>
]]></example>
<p>The entity SHOULD now immediately connect to the given proxy IP and port, and upon connection all data written to that socket will be copied to the client connection, and vice-versa. Any disconnect on either side MUST cause a disconnect on the other (initiated by the service). If the IQ set to the entity fails or returns an error, the client socket MUST be dropped as well. The client XML element provides the information about the remote end of the incoming socket.</p>
<p>Abuse in bandwidth or resources could become an issue, so PASS implementations SHOULD include strict and detailed rate and usage limits, allowing only limited usage by single entities and rate-limiting bandwidth used if necessary for both single connections or overall usage. These limits are implementation-specific.</p>
</section1>
<section1 topic='Controls'>
<p>A Jabber client can send various controls to the PASS service via the set to control how the PASS service behaves, how the server handles a listening port.</p>
<section2 topic='&#60;expire/&#62;'>
<p>This tells the server to shut down the port after a specified number of seconds. After the timeout period, the PASS service MUST send an &#60;iq/&#62; to the JID to tell it that the port has been closed down. It notifies the client with:</p>
<example caption='Notification of expiration'>
&#60;iq type='set'
<section2 topic='<expire/>'>
<p>This tells the server to shut down the port after a specified number of seconds. After the timeout period, the PASS service MUST send an <iq/> to the JID to tell it that the port has been closed down. It notifies the client with:</p>
<example caption='Notification of expiration'><![CDATA[
<iq type='set'
id='pass3'
to='user@jabber.org/resource'
from='pass.jabber.org'&#62;
&#60;query xmlns='jabber:iq:pass'&#62;
&#60;expire/&#62;
&#60;close/&#62;
&#60;proxy port='43253'&#62;1.2.3.4&#60;/proxy&#62;
&#60;/query&#62;
&#60;/iq&#62;
</example>
<example caption='Acknowledgement of expiration'>
&#60;iq type='result'
from='pass.jabber.org'>
<query xmlns='jabber:iq:pass'>
<expire/>
<close/>
<proxy port='43253'>1.2.3.4</proxy>
</query>
</iq>
]]></example>
<example caption='Acknowledgement of expiration'><![CDATA[
<iq type='result'
id='pass3'
from='user@jabber.org/resource'
to='pass.jabber.org'&#62;
&#60;query xmlns='jabber:iq:pass'/&#62;
&#60;/iq&#62;
</example>
to='pass.jabber.org'>
<query xmlns='jabber:iq:pass'/>
</iq>
]]></example>
</section2>
<section2 topic='&#60;oneshot/&#62;'>
<p>This tells the server to listen once, and then close the port. Even if the &#60;expire/&#62; has not been met, the &#60;oneshot/&#62; overrides that and shuts down the listening port. When this happens the server notifies the client with the following packet:</p>
<example caption='Server notifies client of oneshot port closing'>
&#60;iq type='set'
<section2 topic='<oneshot/>'>
<p>This tells the server to listen once, and then close the port. Even if the <expire/> has not been met, the <oneshot/> overrides that and shuts down the listening port. When this happens the server notifies the client with the following packet:</p>
<example caption='Server notifies client of oneshot port closing'><![CDATA[
<iq type='set'
id='pass4'
to='user@jabber.org/resource'
from='pass.jabber.org'&#62;
&#60;query xmlns='jabber:iq:pass'&#62;
&#60;oneshot/&#62;
&#60;close/&#62;
&#60;proxy port='43253'&#62;1.2.3.4&#60;/proxy&#62;
&#60;/query&#62;
&#60;/iq&#62;
</example>
<example caption='Client acknowledges closing of oneshot port'>
&#60;iq type='result'
from='pass.jabber.org'>
<query xmlns='jabber:iq:pass'>
<oneshot/>
<close/>
<proxy port='43253'>1.2.3.4</proxy>
</query>
</iq>
]]></example>
<example caption='Client acknowledges closing of oneshot port'><![CDATA[
<iq type='result'
id='pass4'
from='user@jabber.org/resource'
to='pass.jabber.org'&#62;
&#60;query xmlns='jabber:iq:pass'/&#62;
&#60;/iq&#62;
</example>
to='pass.jabber.org'>
<query xmlns='jabber:iq:pass'/>
</iq>
]]></example>
</section2>
<section2 topic='&#60;close/&#62;'>
<section2 topic='<close/>'>
<p>This tells the server to explicitly shut down a listening port. Useful for when the client shuts down and can tell the PASS service to recycle the port. The server sends back:</p>
<example caption='Client request to shut down port'>
&#60;iq type='set'
<example caption='Client request to shut down port'><![CDATA[
<iq type='set'
id='pass5'
to='pass.jabber.org'
from='user@jabber.org/resource'&#62;
&#60;query xmlns='jabber:iq:pass'&#62;
&#60;close/&#62;
&#60;proxy port='43253'&#62;1.2.3.4&#60;/proxy&#62;
&#60;/query&#62;
&#60;/iq&#62;
</example>
<example caption='Server acknowledges port closing request'>
&#60;iq type='result'
from='user@jabber.org/resource'>
<query xmlns='jabber:iq:pass'>
<close/>
<proxy port='43253'>1.2.3.4</proxy>
</query>
</iq>
]]></example>
<example caption='Server acknowledges port closing request'><![CDATA[
<iq type='result'
id='pass5'
to='user@jabber.org/resource'
from='pass.jabber.org'&#62;
&#60;query xmlns='jabber:iq:pass'/&#62;
&#60;/iq&#62;
</example>
from='pass.jabber.org'>
<query xmlns='jabber:iq:pass'/>
</iq>
]]></example>
<table caption='Error Codes'>
<tr>
<th>Code</th>
@ -214,8 +215,8 @@
</tr>
<tr>
<td>400</td>
<td>Missing &#60;proxy/&#62; specification.</td>
<td>Sent a &#60;close/&#62; w/o a &#60;proxy/&#62;</td>
<td>Missing <proxy/> specification.</td>
<td>Sent a <close/> w/o a <proxy/></td>
</tr>
<tr>
<td>401</td>
@ -225,12 +226,12 @@
<tr>
<td>404</td>
<td>Port not found in registry.</td>
<td>The &#60;proxy port=''/&#62; was not a defined port.</td>
<td>The <proxy port=''/> was not a defined port.</td>
</tr>
<tr>
<td>405</td>
<td>Proxy IP does not match.</td>
<td>The IP sent in the &#60;proxy/&#62; does not match the IP of the pass-service</td>
<td>The IP sent in the <proxy/> does not match the IP of the pass-service</td>
</tr>
</table>
</section2>
@ -239,56 +240,56 @@
<section2 topic='Client Authentication'>
<p>The PASS protocol can be used for clients to talk to each other and find out information about each other. When a client wants to send a file to another client, it can use the jabber:iq:pass namespace to query the IP address of the other client. For example:</p>
<p>You send the other client:</p>
<example>
&#60;iq type='get'
<example><![CDATA[
<iq type='get'
id='pass6'
to='them@jabber.org/resource'
from='you@jabber.org/resource'&#62;
&#60;query xmlns='jabber:iq:pass'/&#62;
&#60;/iq&#62;
</example>
from='you@jabber.org/resource'>
<query xmlns='jabber:iq:pass'/>
</iq>
]]></example>
<p>The other client SHOULD send back:</p>
<example>
&#60;iq type='result'
<example><![CDATA[
<iq type='result'
id='pass6'
to='you@jabber.org/resource'
from='them@jabber.org/resource'&#62;
&#60;query xmlns='jabber:iq:pass'&#62;
&#60;client&#62;4.3.2.1&#60;/client&#62;
&#60;query&#62;
&#60;/iq&#62;
</example>
<p>Obviously the port is not going to be known, but the IP address will let you authenticate the JID via the PASS service since the PASS service tells you the &#60;client/&#62; information upon a connection.</p>
from='them@jabber.org/resource'>
<query xmlns='jabber:iq:pass'>
<client>4.3.2.1</client>
</query>
</iq>
]]></example>
<p>Obviously the port is not going to be known, but the IP address will let you authenticate the JID via the PASS service since the PASS service tells you the <client/> information upon a connection.</p>
</section2>
<section2 topic='Denying a Connection'>
<p>When a server gets an Incoming Connection notification the client has the right to deny that connection based on the &#60;client/&#62; information that it receives. It can return an error to the PASS service specifying the &#60;proxy/&#62; port and hangup on the active &#60;client/&#62; connection and start listening again. This does not affect the &#60;oneshot/&#62; control. For example:</p>
<p>When a server gets an Incoming Connection notification the client has the right to deny that connection based on the <client/> information that it receives. It can return an error to the PASS service specifying the <proxy/> port and hangup on the active <client/> connection and start listening again. This does not affect the <oneshot/> control. For example:</p>
<p>The PASS service sends you:</p>
<example>
&#60;iq type='set'
<example><![CDATA[
<iq type='set'
id='pass7'
to='user@jabber.org/resource'
from='pass.jabber.org'&#62;
&#60;query xmlns='jabber:iq:pass'&#62;
&#60;client port='1234'&#62;4.3.2.1&#60;/client&#62;
&#60;proxy port='43523'&#62;1.2.3.4&#60;/proxy&#62;
&#60;query&#62;
&#60;/iq&#62;
</example>
from='pass.jabber.org'>
<query xmlns='jabber:iq:pass'>
<client port='1234'>4.3.2.1</client>
<proxy port='43523'>1.2.3.4</proxy>
</query>
</iq>
]]></example>
<p>Your client would send back:</p>
<example>
&#60;iq type='error'
<example><![CDATA[
<iq type='error'
id='pass7'
to='pass.jabber.org'
from='user@jabber.org/resource'&#62;
&#60;query xmlns='jabber:iq:pass'&#62;
&#60;client port='1234'&#62;4.3.2.1&#60;/client&#62;
&#60;proxy port='43523'&#62;1.2.3.4&#60;/proxy&#62;
&#60;query&#62;
&#60;error code='401' type='auth'&#62;
&#60;not-authorized xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/&gt;
&#60;/error&#62;
&#60;/iq&#62;
</example>
from='user@jabber.org/resource'>
<query xmlns='jabber:iq:pass'>
<client port='1234'>4.3.2.1</client>
<proxy port='43523'>1.2.3.4</proxy>
</query>
<error code='401' type='auth'>
<not-authorized xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/&gt;
</error>
</iq>
]]></example>
<table caption='Error Codes'>
<tr>
<th>Code</th>
@ -298,7 +299,7 @@
<tr>
<td>401</td>
<td>Unauthorized</td>
<td>The incoming &#60;client/&#62; does not match the &#60;client/&#62; from the client you want to exchange data with.</td>
<td>The incoming <client/> does not match the <client/> from the client you want to exchange data with.</td>
</tr>
</table>
</section2>