1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-21 16:55:07 -05:00
xeps/xep-0037.xml
Peter Saint-Andre 2ac91f50c8 Initial revision
git-svn-id: file:///home/ksmith/gitmigration/svn/xmpp/trunk@2 4b5297f7-1745-476d-ba37-a9c6900126ab
2006-10-02 22:22:13 +00:00

849 lines
48 KiB
XML

<?xml-stylesheet type='text/xsl' href='../jep.xsl'?>
<!DOCTYPE jep SYSTEM '../jep.dtd' [
<!ENTITY % ents SYSTEM "../jep.ent">
%ents;
]>
<jep>
<header>
<title>DSPS - Data Stream Proxy Service</title>
<abstract>A proposal for proxy support in Jabber.</abstract>
<legal>This document has been placed in the public domain.</legal>
<number>0037</number>
<status>Rejected</status>
<type>Standards Track</type>
<jig>Standards JIG</jig>
<author>
<firstname>David</firstname>
<surname>Sutton</surname>
<email></email>
<jid></jid>
</author>
<author>
<firstname>"Bac9"</firstname>
<surname></surname>
<email>bac9@bac9.yi.org</email>
<jid>bac9@jabber.org</jid>
</author>
<revision>
<version>Version 0.8</version>
<date>2002-09-18</date>
<initials>Bac9</initials>
<remark>Streamlined and enhanced handshake procedure, and cleaned up document.</remark>
</revision>
<revision>
<version>Version 0.7</version>
<date>2002-08-20</date>
<initials>Bac9</initials>
<remark>Added public connections and reduced number of tags.</remark>
</revision>
<revision>
<version>Version 0.6</version>
<date>2002-08-11</date>
<initials>Bac9</initials>
<remark>Added data tracking, inviting peer, auto-disconnect for slow peers, elaboration on protocol and suggested example of file transfer.</remark>
</revision>
<revision>
<version>Version 0.5</version>
<date>2002-07-29</date>
<initials>Bac9</initials>
<remark>Elaborated on some functionality and cleaned up XML protocol.</remark>
</revision>
<revision>
<version>Version 0.4</version>
<date>2002-07-11</date>
<initials>lw</initials>
<remark>Reformatted to JEP XML.</remark>
</revision>
<revision>
<version>Version 0.3</version>
<date>2002-06-25</date>
<initials>Bac9</initials>
<remark>Added support for HTTP, SSL and throughput logging. Changed relay behaviour.</remark>
</revision>
<revision>
<version>Version 0.2</version>
<date>2002-06-21</date>
<initials>Bac9</initials>
<remark>Revised, standardized and extended XML protocol structure.</remark>
</revision>
<revision>
<version>Version 0.1</version>
<date></date>
<initials>rn</initials>
<remark>Initial version.</remark>
</revision>
</header>
<section1 topic='Introduction'>
<p>Data Stream Proxy Service (DSPS) is designed to be a common stream protocol for multicast (unicast as special case) over P2S2P (P2P as special case) connections.</p>
</section1>
<section1 topic='Startup'>
<p>This document follows DSPS protocol version 0.5. Any XML data not explicitly defined or mentioned will be ignored without error. On startup, full fledged DSPS starts listening on port 5290 (and 80 if HTTP handshake implemented).</p>
</section1>
<section1 topic='General Operation'>
<section2 topic='Stream Creation/Relay {optional}'>
<p><em>(optional)</em> Creating or modifying stream is done like so:</p>
<example>
&lt;iq
id='dsps1'
type='get'
from='rob@nauseum.org/dspsclient'
to='dsps.jabber.org/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a44'&gt;
&lt;query type='create'
xmlns='jabber:iq:dsps'
minthroughput='1.5KB'
maxpublic='20'&gt;
&lt;peer port='5290'&gt;
dsps.myjabber.net/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33
&lt;/peer&gt;
&lt;comment&gt;public comment&lt;/comment&gt;
&lt;/query&gt;
&lt;/iq&gt;
</example>
<ul>
<li><strong>&quot;to&quot;</strong> with resource implies reconnection to previous relay stream with previously supplied credentials and authentication as per section &quot;DSPS relay setup&quot;, otherwise implies creation of new stream where creator is granted &quot;master&quot; rights.</li>
<li><strong>&quot;minthroughput&quot;</strong> <em>(optional)</em> is minimum 16 second average throughput below which peers will be disconnected (but not dropped). Checked after every unit of outgoing transfer against the fourth value returned by &quot;who&quot; query for each peer. Legal only upon initial creation of stream. If omitted or negative, 0 is assumed.</li>
<li><strong>&quot;maxpublic&quot;</strong> <em>(optional)</em> is maximum number of peers that can join without invitation. If omitted or negative, 0 is assumed. If positive, DSPS generates globally unique id for public peers to acknowledge, reported within &quot;stats&quot; message. Said id remains constant for life of stream.</li>
<li><strong>&lt;peer/&gt;</strong> <em>(optional)</em> full JID of stream on another DSPS. Relay stream will be treated using &quot;slave&quot; rights. Legal only upon initial creation of stream. Multiple such blocks tried in series until successful connection. First successful (last if all failed) remembered by DSPS, all successive &lt;peer/&gt; ignored.. On connection, DSPS initiates handshake using peer's full JID and contents of block for destination's full JID to the relay destination as per section &quot;Connecting to DSPS via default method&quot;. Authentication is done as per section &quot;DSPS relay setup&quot;. Upon successful handshake, DSPS sends presence notification to peer as per section &quot;Acknowledge of DSPS connection&quot;.</li>
<li><strong>&quot;port&quot;</strong> <em>(optional)</em> for connecting to destination DSPS. If omitted, default is assumed.</li>
<li><strong>&lt;comment/&gt;</strong> <em>(optional)</em> all such blocks reported in &quot;stats&quot; message. Multiple such blocks allowed. Block may contain a full XML stack of elements. No order implied for &quot;stats&quot; message.</li>
</ul>
<p>Possible failure messages:</p>
<table>
<tr><th>Code</th><th>Message</th><th>Description</th></tr>
<tr><td>405</td><td>Method Not Allowed</td><td>Attempt at reconnect to relay without existing credentials, relay still connected, &lt;peer/&gt; block present in reconnect request, or feature not supported</td></tr>
<tr><td>504</td><td>Gateway Timeout</td><td>All destination DSPS are unreachable.</td></tr>
</table>
</section2>
<section2 topic='Connection waiting'>
<p>DSPS creates &quot;id&quot; (empty string is legal), used in &quot;who&quot; replies and notifies client of waiting connection like so:</p>
<example>
&lt;iq
id='dsps1'
type='result'
from='dsps.jabber.org/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33'
to='rob@nauseum.org/dspsclient'&gt;
&lt;query type='create' xmlns='jabber:iq:dsps'
wait='10'
host='dsps.jabber.org'
port='5290'
minthroughput='1.5KB'
protocol='0.5'&gt;
&lt;feature type='http' version='1.1'/&gt;
&lt;feature type='ssl' version='3.0'/&gt;
&lt;/query&gt;
&lt;/iq&gt;
</example>
<ul>
<li><strong>&quot;from&quot;</strong> full JID of DSPS, internally globally unique. Used in handshake and every subsequent communication with stream. May differ with the one specified in &quot;invite&quot; message.</li>
<li><strong>&quot;wait&quot;</strong> amount of time in <strong>milliseconds</strong> that DSPS will wait for client to initiate handshake. If timeout occurs, DSPS will totally forget prepared connection and act accordingly.</li>
<li><strong>&quot;host&quot;</strong> <em>(optional)</em> for handshake and data stream. If omitted default from the &quot;from&quot; is assumed. Intended for P2P connections to be able to report alternate hostname or IP for connection.</li>
<li><strong>&quot;port&quot;</strong> <em>(optional)</em> for handshake and data stream. If omitted default is assumed.</li>
<li><strong>&quot;minthroughput&quot;</strong> value from &quot;create&quot;.</li>
<li><strong>&quot;protocol&quot;</strong> version this DSPS supports.</li>
<li><strong>&lt;feature/&gt;</strong> <em>(optional)</em> supported by this DSPS. Type and version are properties and additional data stored in body. HTTP stream will not follow HTTP protocol. SSL handshake performed encrypted. Both HTTP and SSL connections are only between client and DSPS.</li>
</ul>
</section2>
<section2 topic='Establishing prepared connection'>
<p>Upon receipt of message as per section &quot;Connection waiting&quot;, client can either ignore it and connection will timeout, or connect to the DSPS directly via any supported connection method or via relay. There may be a maximum of 1 (one) established connection to DSPS from any Client_full_JID + DSPS_full_JID pair, deviations are handles as per section &quot;Connecting to DSPS via default method&quot;. DSPS will not discriminate method via which direct connection is made, even if prior to &quot;disconnect&quot; a different method was used. Any packet from an unauthorized connection is ignored without reporting an error.</p>
<section3 topic='DSPS relay setup {optional}'>
<p>Client may request another DSPS to relay this connection as per section &quot;Stream Creation/Relay&quot;, utilizing the &quot;create&quot; body. There is no limit on length of relay chain. Upon initiation of handshake with destination, DSPS reports key like so (message sequence unrelated to current DSPS handshake):</p>
<example>
&lt;iq
id='dsps1'
type='get'
from='dsps.jabber.org/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33'
to='rob@nauseum.org/dspsclient'&gt;
&lt;query type='create' xmlns='jabber:iq:dsps'&gt;acDgH63I27Gb1&lt;/query&gt;
&lt;/iq&gt;
</example>
<ul>
<li><strong>&quot;get&quot;</strong> denotes request for auth key.</li>
<li><strong>&quot;create&quot;</strong> body contains key returned by destination.</li>
</ul>
<p>Client must send said key to destination as per section &quot;Connecting to DSPS via default method&quot; and send response to DSPS (which will be transmitted to destination) like so:</p>
<example>
&lt;iq
id='dsps1'
type='result'
from='rob@nauseum.org/dspsclient'
to='dsps.jabber.org/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33'
&lt;query type='create' xmlns='jabber:iq:dsps'&gt;acDgH63I27Gb1&lt;/query&gt;
&lt;/iq&gt;
</example>
<ul>
<li><strong>&quot;result&quot;</strong> denotes reply with auth key.</li>
<li><strong>&quot;create&quot;</strong> body contains key returned by destination.</li>
</ul>
</section3>
<section3 topic='Connecting to DSPS via HTTP method {optional}'>
<p>Client must connect to DSPS on port 80 and initiate handshake. This may be attempted after &quot;create&quot; result received or &quot;disconnect&quot; occurred, and prior to &quot;wait&quot; timeout expiring, then send HTTP request like so:</p>
<example>
GET /DSPS/STREAM/ HTTP/1.0&lt;CR&gt;
Host: dsps.server&lt;CR&gt;
&lt;CR&gt;
</example>
<p>And will receive reply from DSPS before the start of data stream, like so:</p>
<example>
HTTP/1.0 200 OK&lt;CR&gt;
Content-Type: application/octet-stream&lt;CR&gt;
&lt;CR&gt;
</example>
<p>Upon completion, Client must resume DSPS handshake as per either section &quot;Connecting to DSPS via default method&quot; or section &quot;Connecting to DSPS via SSL method&quot; (if applicable). Subsequent data will not follow HTTP protocol. On error connection closed immediately with optional error messages.</p>
<p>Possible failure messages:</p>
<table>
<tr><th>Code</th><th>Message</th><th>Description</th></tr>
<tr><td>401</td><td>Unauthorized</td><td><em>(optional)</em> Returned if any error in HTTP handshake.</td></tr>
</table>
</section3>
<section3 topic='Connecting to DSPS via SSL method {optional}'>
<p>Client must connect to DSPS on specified port and initiate handshake. This may be attempted after &quot;create&quot; result received or &quot;disconnect&quot; occurred, and prior to &quot;wait&quot; timeout expiring, then send following on stream:</p>
<example>starttls&lt;CR&gt;</example>
<p>Next, regular TLS handshake is initiated. Upon completion, Client must resume DSPS handshake as per section &quot;Connecting to DSPS via default method&quot;. On error connection closed immediately with optional error messages.</p>
<p>Possible failure messages:</p>
<table>
<tr><th>Code</th><th>Message</th><th>Description</th></tr>
<tr><td>401</td><td>Unauthorized</td><td><em>(optional)</em> Returned if any error in SSL handshake.</td></tr>
</table>
</section3>
<section3 topic='Connecting to DSPS via default method'>
<p>Client must connect to DSPS on specified port and initiate handshake. May be attempted after &quot;create&quot; result received or &quot;disconnect&quot; occurred, and prior to &quot;wait&quot; timeout expiring. Standard and SSL handshakes are identical in decrypted state and take the form of:</p>
<example>Client_full_JID DSPS_full_JID&lt;CR&gt;</example>
<ul>
<li><strong>&quot;Client_full_JID&quot;</strong> client full JID as supplied in either the &quot;create&quot; or &quot;acknowledge&quot; message.</li>
<li><strong>&quot;DSPS_full_JID&quot;</strong> DSPS full JID as supplied in &quot;from&quot; field of &quot;create&quot; result message from section &quot;Connection waiting&quot;</li>
<li><strong>&lt;CR&gt;</strong> regular carriage return, commonly referred to as the newline character.</li>
</ul>
<p>For example, the appropriate string for the above request would be:</p>
<example>rob@nauseum.org/dspsclient dsps.jabber.org/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33</example>
<p>If Client_full_JID and DSPS_full_JID do not have an associated stream, are no longer valid, (e.g. timeout reached or client removed from stream), or connection from said Client_full_JID + DSPS_full_JID pair is in use (i.e. client is still connected to it), connection is closed immediately with possible optional error messages reported. Otherwise DSPS returns uniquely generated key followed by a &lt;CR&gt; like so:</p>
<example>uGhhb74d21</example>
<p>Client must now send key to DSPS via XML stream like so:</p>
<example>
&lt;iq
id='dsps1'
type='get'
from='rob@nauseum.org/dspsclient'
to='dsps.jabber.org/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33'&gt;
&lt;query type='auth' xmlns='jabber:iq:dsps'&gt;uGhhb74d21&lt;/query&gt;
&lt;/iq&gt;
</example>
<ul>
<li><strong>&quot;get&quot;</strong> denotes request for next auth key.</li>
<li><strong>&quot;auth&quot;</strong> body contains key returned by DSPS.</li>
</ul>
<p>DSPS will now check key, if not valid, close connection, report possible optional error message and resume waiting on original key. If valid, generate new key and send to client like so:</p>
<example>
&lt;iq
id='dsps1'
type='result'
from='dsps.jabber.org/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33'
to='rob@nauseum.org/dspsclient'
&lt;query type='auth' xmlns='jabber:iq:dsps'&gt;qgqB42Ij784&lt;/query&gt;
&lt;/iq&gt;
</example>
<ul>
<li><strong>&quot;result&quot;</strong> denotes return of next auth key.</li>
<li><strong>&quot;auth&quot;</strong> body contains key returned by DSPS.</li>
</ul>
<p>Client must now send received key to DSPS via the stream followed by a &lt;CR&gt;. Once received, DSPS checks key, on mismatch connection is closed immediately with possible optional error messages reported, waiting on key is resumed. Upon successful handshake a message is sent to members of the stream in accordance with the following rules; If the client had type &quot;master&quot; connection, all members of the stream get notified. If the client had type &quot;slave&quot; connection, only other type &quot;master&quot; members get notified. The message takes the form of:</p>
<example>
&lt;iq
id='dsps2'
type='set'
from='dsps.jabber.org/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33'
to='foo@bar.com/resource'&gt;
&lt;query type='presence' xmlns='jabber:iq:dsps'&gt;
&lt;peer status='connect'&gt;JID&lt;/peer&gt;
&lt;/query&gt;
&lt;/iq&gt;
</example>
<ul>
<li><strong>&quot;presence&quot;</strong> denotes presence change. Body may contain multiple &lt;peer/&gt; blocks where same JID peers must be placed in chronological order relative to each other from start to end of message.</li>
<li><strong>&lt;peer/&gt;</strong> body is full JID of the joined peer unless peer of type &quot;relay&quot;, in which case the resource is not reported.</li>
<li><strong>&quot;status&quot;</strong> is new status of peer.</li>
</ul>
<p>Possible failure messages:</p>
<table>
<tr><th>Code</th><th>Message</th><th>Description</th></tr>
<tr><td>401</td><td>Unauthorized</td><td><em>(optional)</em> Returned if the DSPS is not aware of said Client_full_JID + DSPS_full_JID pair. Where &quot;from&quot; contains DSPS_full_JID that was used in the handshake and &quot;to&quot; contains Client_full_JID that was used in the handshake.</td></tr>
<tr><td>409</td><td>Conflict</td><td><em>(optional)</em> Returned if connection from said full client JID and full DSPS JID is in use (i.e. client is still connected to it). Where &quot;from&quot; contains DSPS_full_JID that was used in the handshake and &quot;to&quot; contains Client_full_JID that was used in the handshake.</td></tr>
</table>
</section3>
</section2>
<section2 topic='Stream administration'>
<p>DSPS protocol allows multiple peers to use the same stream. Manipulation of the authorized peer list is done through admin functionality described in next several subsections. DSPS protocol allows for three types of peer connections: &quot;master&quot;, &quot;slave&quot;, and &quot;relay&quot;. &quot;master&quot; peers get full control of the stream, &quot;slave&quot; peers get limited control of the stream, and &quot;relay&quot; are treated similar to &quot;slave&quot; except in reporting of JIDs where the resource must be omitted.</p>
<p>&quot;master&quot; peers are allowed to invite any other user to the stream and drop any peer registered with the stream, including themselves. &quot;slave&quot; peers are only allowed to drop themselves from the stream. Any administrative changes coming from a &quot;slave&quot; peer that are not for the peer's own connection are ignored. Dropping one's own connection is the preferred way of permanently disconnecting from the stream.</p>
<p>Any data received from a &quot;master&quot; gets copied to every other peer on the stream. Any data received from a &quot;slave&quot; peer gets copied to all &quot;master&quot; peers on the stream only.</p>
<p>Stream administration request looks like so:</p>
<example>
&lt;iq
id='dsps3'
type='set'
from='rob@nauseum.org/dspsclient'
to='dsps.jabber.org/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33'&gt;
&lt;query type='admin' xmlns='jabber:iq:dsps' expire='20' wait='10'&gt;
&lt;comment&gt;welcome to the stream&lt;/comment&gt;
&lt;peer type='master'&gt;someone@somewhere.net&lt;/peer&gt;
&lt;/query&gt;
&lt;/iq&gt;
</example>
<ul>
<li><strong>&quot;admin&quot;</strong> denotes administrative functions are to follow. Any properties within this block apply to this block alone. Multiple such blocks are allowed.</li>
<li><strong>&quot;expire&quot;</strong> time DSPS should wait for the &quot;acknowledge&quot; message from any invited peer within block. An &quot;expire&quot; of 0 denotes no time limit. Actual value sent to peer as &quot;expire&quot; is <em>minimum</em> of this value and default value preset for DSPS. If value unparseable or not present, default is used.</li>
<li><strong>&quot;wait&quot;</strong> time DSPS should wait for invited peer to connect to DSPS after &quot;acknowledge&quot; is received and message from section &quot;Connection waiting&quot;. is sent. A &quot;wait&quot; of 0 denotes no time limit. Actual value sent to peer as &quot;wait&quot; is <em>minimum</em> of this value and default value preset for DSPS. If the value unparseable or not present, default is used.</li>
<li><strong>&lt;comment/&gt;</strong> <em>(optional)</em> block sent to each of the peers. Multiple such blocks are allowed. Block may contain a full XML stack of elements. All such blocks are sent to each of the invited peers as is. No guarantee is made on their order in the &lt;invite/&gt; message.</li>
<li><strong>&lt;peer/&gt;</strong> JID to execute action upon. If invitation then body will not necessarily be same full JID as one that would respond. Multiple such blocks allowed.</li>
<li><strong>&quot;type&quot;</strong> type of action to do. &quot;master&quot; denotes invitation, granting master rights. &quot;slave&quot; denotes invitation, granting slave rights. &quot;drop&quot; denotes request to drop peer from stream. &quot;relay&quot; peers may not be invited but may be dropped using this method.</li>
</ul>
<p>Possible optional errors include the following:</p>
<example>
&lt;iq
id='dsps3'
type='result'
from='dsps.jabber.org/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33'
to='user@server.org/resource'&gt;
&lt;query type='admin' xmlns='jabber:iq:dsps'&gt;
&lt;peer acknowledge='expire'&gt;abc@company.com/net&lt;/peer&gt;
&lt;peer acknowledge='reject'&gt;friend@someplace.com/home&lt;/peer&gt;
&lt;peer acknowledge='timeout'&gt;abd@company.com/net&lt;/peer&gt;
&lt;peer acknowledge='missing'&gt;who@knows.org/winjab&lt;/peer&gt;
&lt;/query&gt;
&lt;/iq&gt;
</example>
<ul>
<li><strong>&quot;admin&quot;</strong> denotes admin response, sent to sender of &quot;admin&quot; request for every peer in block. Peers may be combined from multiple &quot;admin&quot; requests or peers from single &quot;admin&quot; request may be split over multiple &quot;admin&quot; replies.</li>
<li><strong>&lt;peer/&gt;</strong> peer in question. For &quot;expire&quot; JID is one from invite request. For &quot;reject&quot; JID is one from which reject received. For &quot;timeout&quot; JID is one from invite request. For &quot;missing&quot; is one from drop request. After this DSPS will totally forget about this peer.</li>
<li><strong>&quot;acknowledge&quot;</strong> reason for failure. &quot;expire&quot; denotes &quot;expire&quot; timeout sent, has ended. &quot;reject&quot; denotes peer rejected invite. &quot;timeout&quot; denotes &quot;wait&quot; timeout sent, has ended. &quot;missing&quot; denotes peer marked for drop not found registered on tis stream.</li>
</ul>
<p>Possible failure messages:</p>
<table>
<tr><th>Code</th><th>Message</th><th>Description</th></tr>
<tr><td>403</td><td>Forbidden</td><td><em>(optional)</em> Returned if peer with &quot;slave&quot; rights attempts to use &quot;master&quot; admin privileges.</td></tr>
</table>
<section3 topic='Invitation to stream {optional}'>
<p>Upon invite DSPS will attempt to invite each of the peers like so:</p>
<example>
&lt;iq
id='dsps4'
type='get'
from='dsps.jabber.org/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33'
to='foo@bar.com/resource'&gt;
&lt;query type='acknowledge'
xmlns='jabber:iq:dsps'
status='master'
expire='20'&gt;
&lt;peer&gt;rob@nauseum.org/dspsclient&lt;/peer&gt;
&lt;comment&gt;some long comment block or structure&lt;/comment&gt;
&lt;/query&gt;
&lt;/iq&gt;
</example>
<ul>
<li><strong>&quot;from&quot;</strong> is unique JID/resource pair generated for this JID, not necessarily same as JID/resource pair specified in section &quot;Connection waiting&quot;. It is used for identification of the &quot;acknowledge&quot; message.</li>
<li><strong>&quot;acknowledge&quot;</strong> denotes request for invitation acknowledge.</li>
<li><strong>&quot;status&quot;</strong> type of connection the client is granted. Same type as tag in invitation request.</li>
<li><strong>&quot;expire&quot;</strong> time DSPS will wait for the &quot;acknowledge&quot; message.</li>
<li><strong>&lt;peer/&gt;</strong> peer who initiated this invite. Multiple such blocks may exist if multiple distinct peers sent invitation that have not yet been received by the invitee.</li>
<li><strong>&lt;comment/&gt;</strong> is &lt;comment/&gt; structure(s) sent in admin request, present if admin request contained it.</li>
</ul>
</section3>
<section3 topic='Dropping from stream'>
<p>Upon drop DSPS will immediately closes the connection to the dropped peer. It then will totally forget this peer right after sending it a notification message like so:</p>
<example>
&lt;iq
id='dsps5'
type='set'
from='dsps.jabber.org/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33'
to='foo@bar.com/resource'&gt;
&lt;query type='acknowledge' xmlns='jabber:iq:dsps' status='drop'&gt;
&lt;comment&gt;some long comment block or structure&lt;/comment&gt;
&lt;/query&gt;
&lt;/iq&gt;
</example>
<ul>
<li><strong>&quot;from&quot;</strong> is the DSPS JID/resource pair which DSPS has associated with this connection.</li>
<li><strong>&quot;acknowledge&quot;</strong> denotes drop notification. Despite the block name, this message does not require a reply.</li>
<li><strong>&quot;status&quot;</strong> drop denotes a connection drop.</li>
<li><strong>&lt;comment/&gt;</strong> is &lt;comment/&gt; structure(s) sent in admin request, preset if admin request contained it.</li>
</ul>
<p>For every successfully dropped peer a message is sent to all other stream members, following the rules stated for the &quot;presence&quot; message, and takes the form of:</p>
<example>
&lt;iq
id='dsps6'
type='set'
from='dsps.jabber.org/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33'
to='foo@bar.com/resource'&gt;
&lt;query type='presence' xmlns='jabber:iq:dsps'&gt;
&lt;peer status='drop'&gt;JID&lt;/peer&gt;
&lt;/query&gt;
&lt;/iq&gt;
</example>
<ul>
<li><strong>&quot;from&quot;</strong> is the DSPS JID/resource pair which DSPS has associated with the connection of the recipient of the message.</li>
<li><strong>&quot;presence&quot;</strong> denotes presence change. Body may contain multiple &lt;peer/&gt; blocks where same JID peers must be placed in chronological order relative to each other from start to end of message.</li>
<li><strong>&lt;peer/&gt;</strong> body is full JID of the dropped peer registered on the stream, unless peer is of type &quot;relay&quot;, in which case the resource is not reported.</li>
<li><strong>&quot;status&quot;</strong> is new status of peer.</li>
</ul>
</section3>
</section2>
<section2 topic='Invitation reply'>
<p>An invited peer has the option to accept or reject an invitation to a stream.</p>
<section3 topic='Accepting an invite'>
<p>To accept an invitation to a stream, the peer must reply like so:</p>
<example>
&lt;iq
id='dsps4'
type='result'
from='foo@bar.com/moredsps'
to='dsps.jabber.org/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33&gt;
&lt;query type='acknowledge' xmlns='jabber:iq:dsps' status='connect'/&gt;
&lt;/iq&gt;
</example>
<ul>
<li><strong>&quot;from&quot;</strong> is the JID/resource pair which will be associated with this connection, only it will be allowed to connect to this stream as this user. A peer may be registered to multiple streams from the same full JID, hence all DSPS full JIDs linked to a given peer must be unique.</li>
<li><strong>&quot;to&quot;</strong> contains the DSPS JID/resource pair which was the source in the original &quot;acknowledge&quot; message.</li>
<li><strong>&quot;acknowledge&quot;</strong> denotes acknowledgment to invitation.</li>
<li><strong>&quot;status&quot;</strong> connect denotes an acceptance of invitation.</li>
</ul>
<p>Upon receipt of this reply the DSPS creates a unique resource for this client JID/resource pair. It then prepares the &quot;create&quot; message as described in section &quot;Connection waiting&quot;.</p>
</section3>
<section3 topic='Rejecting an invite'>
<p>Rejecting an invitation can be done in two ways. A peer can forget about the invitation and let the invitation &quot;expire&quot;, or preferably a message can be sent like so:</p>
<example>
&lt;iq
id='dsps4'
type='result'
from='foo@bar.com/moredsps'
to='dsps.jabber.org/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33&gt;
&lt;query type='acknowledge' xmlns='jabber:iq:dsps' status='drop'/&gt;
&lt;/iq&gt;
</example>
<ul>
<li><strong>&quot;to&quot;</strong> contains the DSPS JID/resource pair which was the source in the original &quot;acknowledge&quot; message.</li>
<li><strong>&quot;acknowledge&quot;</strong> denotes acknowledgment to invitation.</li>
<li><strong>&quot;status&quot;</strong> drop denotes an rejection of invitation.</li>
</ul>
<p>Regardless of the way a rejection was achieved a notification message is sent to the inviting peer, as was described in section &quot;Stream administration&quot;. If unknown &quot;type&quot; is sent, it will be interpreted as a reject. A maximum of one &quot;acknowledge&quot; is allowed during the lifetime of an invitation. If multiple such tags are sent, the first tag takes precedence. Any rejection of a public connection will be ignored.</p>
</section3>
</section2>
<section2 topic='Disconnection handling'>
<p>If a peer ever disconnects without first dropping themselves, the following policy applies:</p>
<p>The peer may reconnect within the &quot;wait&quot; timeout provided in the &quot;create&quot; reply in section &quot;Connection waiting&quot;. The peer may choose any supported mode of reconnection supplied in &quot;create&quot; reply, regardless of mode previously used. The &quot;wait&quot; timeout is not cumulative over multiple disconnects. After reconnect, peer will not receive any data that exists on the stream while it was disconnected.</p>
<p>Upon such disconnection DSPS notifies all other members of the stream, following the rules stated for the &quot;presence&quot; message, and takes the form of:</p>
<example>
&lt;iq
id='dsps7'
type='set'
from='dsps.jabber.org/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33'
to='foo@bar.com/resource'&gt;
&lt;query type='presence' xmlns='jabber:iq:dsps'&gt;
&lt;peer status='waiting'&gt;JID&lt;/peer&gt;
&lt;/query&gt;
&lt;/iq&gt;
</example>
<ul>
<li><strong>&quot;from&quot;</strong> is the DSPS JID/resource pair which DSPS has associated with the connection of the recipient of the message.</li>
<li><strong>&quot;presence&quot;</strong> denotes presence change. Body may contain multiple &lt;peer/&gt; blocks where same JID peers must be placed in chronological order relative to each other from start to end of message.</li>
<li><strong>&lt;peer/&gt;</strong> body is full JID of the disconnected peer registered on the stream, unless peer is of type &quot;relay&quot;, in which case the resource is not reported.</li>
<li><strong>&quot;status&quot;</strong> is new status of peer.</li>
</ul>
<p>Upon reaching &quot;wait&quot; timeout the procedure is the same if the peer dropped its own connection.</p>
</section2>
<section2 topic='Ending a connection'>
<p>Permanent termination of connection can be done in two ways: peer may disconnect from the stream and let the &quot;wait&quot; timeout expire, or more preferably the peer will drop itself from the stream via an &quot;admin&quot; message. The &quot;admin&quot; is still allowed to contain multiple &quot;peer&quot; blocks.</p>
</section2>
<section2 topic='Stream use'>
<p>The use policy for the stream follows the standard rules described in this document. Type and structure of the data must be negotiated by the peers separately (presumably via the normal XML message stream or within &lt;comment/&gt; blocks). The DSPS stream operates at the speed of the slowest connection (or slower if it is so configured in its internal configuration).</p>
<p>Data read from peer in a unit of transfer (decided by DSPS) is sent to other peers in a format like so:</p>
<example>0&lt;size&gt;&lt;CR&gt;&lt;id&gt;&lt;CR&gt;&lt;data&gt;</example>
<ul>
<li><strong>&quot;0&quot;</strong> at beginning for checking start of block.</li>
<li><strong>&lt;size&gt;</strong> length in bytes including id and its trailing CR in form of [1-9][0-9]*[0-9A-Z], where last character is base 36 numerical equivalent power of 1024.</li>
<li><strong>&lt;id&gt;</strong> id of the sender as per &quot;who&quot; query.</li>
<li><strong>&lt;data&gt;</strong> data sent.</li>
<li><strong>&lt;CR&gt;</strong> regular carriage return, commonly referred to as the newline character.</li>
</ul>
<p>For example, the appropriate string for the above block would be:</p>
<example>
0340&lt;CR&gt;
010&lt;CR&gt;
this is the data in ASCII form
</example>
<p>First block received after connection will always be full block. If discrepancy occurs, receiving peer should disconnect and reconnect back to stream.</p>
</section2>
<section2 topic='Stream information'>
<p>Two mechanisms exists to gain information about the stream configuration and its members. They are described within next few subsections.</p>
<section3 topic='Stream peer listing'>
<p>To retrieve listing of all registered peers of this stream and their respective connection status any registered peer sends a message like so:</p>
<example>
&lt;iq
id='dsps8'
type='get'
from='rob@nauseum.org/dspsclient'
to='dsps.jabber.org/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33'&gt;
&lt;query type='who' xmlns='jabber:iq:dsps'/&gt;
&lt;/iq&gt;
</example>
<ul>
<li><strong>&quot;to&quot;</strong> has the usual meaning for this client when referring to this DSPS stream.</li>
<li><strong>&quot;who&quot;</strong> denotes that this is a listing request. It may not contain a body or attributes, otherwise it will be ignored without error.</li>
</ul>
<p>The query follows the standard rules: query originating from a &quot;master&quot; peer will return listing of all registered peers and their associated statuses, query originating from a &quot;slave&quot; peer will only return listing of all registered &quot;master&quot; peers and their associated statuses. Returned results do not have any strict order. If multiple &quot;who&quot; queries were requested by a peer that have not yet received a reply, only one reply need be sent.</p>
<p>The query reply is formatted like so:</p>
<example>
&lt;iq
id='dsps8'
type='result'
from='dsps.jabber.org/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33'
to='rob@nauseum.org/dspsclient'&gt;
&lt;query type='who' xmlns='jabber:iq:dsps'&gt;
&lt;peer
type='master'
id='0'
status='connect'
throughput='1KB////4.8KB//3KB'&gt;
rob@nauseum.org/dspsclient
&lt;/peer&gt;
&lt;/query&gt;
&lt;/iq&gt;
</example>
<ul>
<li><strong>&quot;from&quot;</strong> is unique DSPS JID/resource pair for the peer receiving the result.</li>
<li><strong>&lt;peer/&gt;</strong> body is full JID of registered peer, unless peer is of type &quot;relay&quot;, in which case the resource is not reported. A separate block exists for every viewable peer.</li>
<li><strong>&quot;type&quot;</strong> the type of connection peer has. May contain value of &quot;master&quot;, &quot;slave&quot;, or &quot;relay&quot;.</li>
<li><strong>&quot;id&quot;</strong> id prepended to data coming from this peer.</li>
<li><strong>&quot;status&quot;</strong> current status of peer. &quot;connect&quot; denotes peer able to receive data. &quot;wait&quot; denotes peer registered but not connected. &quot;expire&quot; denotes peer was invited but no reply was received yet.</li>
<li><strong>&quot;throughput&quot;</strong> shows the average throughput to that peer per second in the units specified after the number (e.g. B, KB, MB, GB, TB, EB) in capital letters. Time is measured only during data transfer. Value contains multiple fields delimited by slash (/). Each field represents time span of power of two (2), relative to its position from start of the string. Each filled-in field contains the average throughput over that timespan. e.g. (1B per sec in last sec)/(1.1B per sec in last 2 sec)/(0.9B per sec in last 4 sec). Only fields representing power of zero (2^0 sec) and power of four (2^4 sec) are required. Last field must be filled-in.</li>
</ul>
</section3>
<section3 topic='Stream status listing'>
<p>To retrieve listing of all stream configuration/statistics values or public streams, any registered peer sends a message like so:</p>
<example>
&lt;iq
id='dsps9'
type='get'
from='rob@nauseum.org/dspsclient'
to='dsps.jabber.org/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33'&gt;
&lt;query type='stats' xmlns='jabber:iq:dsps'/&gt;
&lt;/iq&gt;
</example>
<ul>
<li><strong>&quot;to&quot;</strong> if contains a resource, will return statistics for specified stream. Otherwise will return listing of public streams, i.e. any stream with &quot;maxpublic&quot; greater then 0.</li>
<li><strong>&quot;stats&quot;</strong> denotes that this is a configuration/statistics request. It may not contain a body or attributes, otherwise it will be ignored without error.</li>
</ul>
<p>The query reply is formatted like so:</p>
<example>
&lt;iq
id='dsps9'
type='result'
from='dsps.jabber.org/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33'
to='rob@nauseum.org/dspsclient'&gt;
&lt;query type='stats' xmlns='jabber:iq:dsps'
init='00000000000000'
protocol='0.5'
port='5290'
minthroughput='1.5KB'
expiredefault='150'
waitdefault='100'
wait='10'
public='5'
maxpublic='25'
mastercount='20'
slavecount='40'
relaycount='0'&gt;
&lt;feature type='http' version='1.1'/&gt;
&lt;feature type='ssl' version='3.0'/&gt;
&lt;peer&gt;mydsps@jabber.org/8xd67f56df4f546fdgsfdg65f6g58f&lt;/peer&gt;
&lt;comment&gt;some server comment&lt;/comment&gt;
&lt;/query&gt;
&lt;/iq&gt;
</example>
<ul>
<li><strong>&quot;from&quot;</strong> the DSPS JID/resource pair for the peer receiving the result.</li>
<li><strong>&quot;init&quot;</strong> UNIX timestamp of the date this stream was initiated.</li>
<li><strong>&quot;protocol&quot;</strong> protocol version this DSPS supports.</li>
<li><strong>&quot;port&quot;</strong> default port this DSPS listens for connections on.</li>
<li><strong>&quot;minthroughput&quot;</strong> as defined in &quot;create&quot;.</li>
<li><strong>&quot;expiredefault&quot;</strong> default time this DSPS will wait for an &quot;acknowledge&quot; response.</li>
<li><strong>&quot;waitdefault&quot;</strong> default time this DSPS will wait for a connection to its default port after an invitation is accepted.</li>
<li><strong>&quot;wait&quot;</strong> time this DSPS will wait for this particular client to reconnect if it ever gets disconnected. This is the same value as one sent in the &quot;create&quot; response.</li>
<li><strong>&quot;public&quot;</strong> number of &quot;slave&quot; peers registered with stream without invitation.</li>
<li><strong>&quot;maxpublic&quot;</strong> maximum number of &quot;slave&quot;peers allowed without invitation.</li>
<li><strong>&quot;mastercount&quot;</strong> number of peers with a &quot;master&quot; connection registered on this stream.</li>
<li><strong>&quot;slavecount&quot;</strong> number of peers with a &quot;slave&quot; connection registered on this stream.</li>
<li><strong>&quot;relaycount&quot;</strong> number of peers with a &quot;relay&quot; connection registered on this stream.</li>
<li><strong>&lt;feature/&gt;</strong> <em>(optional)</em> denotes a supported feature. All supported features must be listed.</li>
<li><strong>&lt;peer/&gt;</strong> <em>(optional)</em> list of public stream connections where all reported statistics match. Present only if &quot;to&quot; in original request contained no resource. Multiple allowed where statistics match for all.</li>
<li><strong>&lt;comment/&gt;</strong> <em>(optional)</em> parameter(s) with a comments from &quot;create&quot;. This block may contain full XML stack of elements. Multiple such blocks are allowed.</li>
</ul>
<p>All &quot;status&quot; attributes are required. Any other undefined blocks with any multiplicity, are legal in this block as long as their tags are not identical to any tag within the protocol. Results returned do not have any strict order. If &quot;to&quot; in original request contained no resource, multiple &quot;stats&quot; blocks are allowed, where each contains at least one &lt;peer/&gt; block which has &quot;maxpublic&quot; greater than 0. To join a public stream a client must send message as per section &quot;Accepting an invite&quot;.</p>
</section3>
</section2>
<section2 topic='Stream shutdown'>
<p>Stream exists from its &quot;create&quot;ion time to the time when there are no more &quot;master&quot; peers registered with the stream.</p>
<p>When last &quot;master&quot; peer is dropped from the stream, DSPS will make sure that all the data sent by all the &quot;master&quot; peers was actually copied to all the &quot;slave&quot; peers still present. For every remaining &quot;slave&quot; peer DSPS will initiate a drop event. Once stream is void of any peers it will be totally forgotten by the DSPS and all associated data is released.</p>
</section2>
<section2 topic='Error message format'>
<p>Error messages look like so:</p>
<example>
&lt;iq
id='dsps9'
type='error'
from='dsps.jabber.org/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33'
to='rob@nauseum.org/dspsclient'&gt;
&lt;error code='405'&gt;Method Not Allowed&lt;/error&gt;
&lt;/iq&gt;
</example>
<ul>
<li><strong>&lt;error/&gt;</strong> denotes error block where body is text description.</li>
<li><strong>&quot;code&quot;</strong> denotes error code.</li>
</ul>
</section2>
</section1>
<section1 topic='Possible applications'>
<section2 topic='File transfer'>
<p>File transfer can be easily accomplished over DSPS. Where one user invites another user to a DSPS stream. File details can be transfered in the invitation comment as such: &lt;meta type='file' name='myfile.txt' size='500K' crc32='12345' sha1='23451' mime='application/octet-stream' timestamp='12345' date='20020412T00:00:00'/&gt;. Where the &quot;size&quot; would be in bytes. All properties should reflect their appropriate values for this instance. Once the second peer has accepted, it can simply put a CR on the stream stating that transfer can begin. then the first party simply dumps the contents of file on the stream, closes the stream and &quot;drop&quot;s itself from the stream. DSPS will make sure the second party gets everything that the first party sent before closing the connection. If multiple recipients of the file are required, the sending client can save a lot of bandwidth and transmit only one copy if the file to the DSPS which in term will transmit the data over to all the other connected clients.</p>
</section2>
<section2 topic='VoIP'>
<p>Same idea as the file transfer. However if more then two parties are involved, every party must have a &quot;master&quot; connection.</p>
</section2>
<section2 topic='Multicast'>
<p>A server has a JID which it registers with a stream. Any client wishing to join the multicast sends an XML message to the server, which then invites the client with a &quot;slave&quot; connection. Thus everything the server sends is received by every client on the stream. If there are multiple back-up servers, they can be invited with a &quot;master&quot; connection, thus if one of them goes down, the others can take over.</p>
</section2>
<section2 topic='File Storage'>
<p>It has long been discussed in many Jabber places that a file storage facility is desired. The communication with such a facility can be easily accommodated with DSPS, as such a facility would merely appear as a user to DSPS which can either be &quot;invite&quot;ed or &quot;invite&quot; other users onto personal streams to transfer files as described in 6.1.</p>
</section2>
</section1>
<section1 topic='Why DSPS instead of PASS'>
<p>PASS has the following design flaws that make it unsuitable for its stated purpose of providing raw data-streams to all classes of users, including those behind firewalls or NAT.</p>
<section2 topic='Ports'>
<p>PASS requires the use of a large number of individual ports, which on a heavily loaded server can lead to the number of spare ports dropping to zero, causing connections to be refused.</p>
<p>This is also problematic if PASS is situated behind a firewall. Firewall administrators are typically loathe to allow incoming connections to a large range of ports.</p>
<p>DSPS only uses one port, and so resolves the first problem, while making the second almost a non-issue.</p>
</section2>
<section2 topic='Knowledge of IP'>
<p>PASS requires the client to have some knowledge of IP, which immediately forces the assumption that the XML stream's underlying protocol is in fact, IP. While at the time of writing this is always the case, it may not always be this way.</p>
<p>DSPS uses the Jabber ID to do its routing, and so avoids these problems. And while DSPS does use the concept of a TCP connection and an IP port, this information is never actually used anywhere on the XML stream, making the actual connection to the DSPS implementation-defined.</p>
</section2>
<section2 topic='IP Addresses'>
<p>PASS makes the IP address of the remote client available to the local client. While it is rare that this is an actual problem, many users and administrators prefer that IP address information is never actually revealed.</p>
<p>DSPS never transmits IP address information across the XML stream, and so does not have this problem.</p>
</section2>
<section2 topic='Intuitiveness'>
<p>PASS requires a client to initiate a connection by opening a (proxied) listening socket, and then soliciting connections. However, TCP works by having the client connect to a remote resource directly. This difference can make the operation of PASS difficult to understand. Also, it is left to the client to distribute the information about this listening socket, which places an additional burden on the client.</p>
<p>DSPS, while it uses listening sockets to do its work, does all the work of setting up the connection after a client initiates it. All the initiating client has to do is request a connection, connect to the DSPS, and wait - everything else is handled automatically.</p>
</section2>
<section2 topic='Scalability'>
<p>Due to the master/slave design, DSPS is already able to handle multicasts of streams or such, whilst PASS was only designed for simple p2p stream connections. This will becoming increasingly more important as more emphasis is made on streaming capabilities, for technologies such as audio and video conferencing.</p>
<p>Due to DSPS generality, the protocol can be easily used for either P2P or P2S2P needs. This eliminates the need for a separate protocol for each of the tasks.</p>
</section2>
</section1>
<section1 topic='DSPS with P2P'>
<p>It is not mandated for DSPS to reside beside a Jabber server. It is entirely possible for any client to implement a stripped down version of such a server. In such a case the only sections that are required are any error reporting, invitation acknowledgment and statistical responses. Any other area of the protocol becomes optional since the recipient peer will not have the ability to use it anyway.</p>
<p>Any client may, but is not required to utilize the striped down functionality. When utilizing such functionality the serving client sends an invitation to the recipient client to join the serving client's DSPS stream. Thus the &quot;create&quot; message would list the serving client as the DSPS and would utilize the &quot;host&quot; attribute to tell the recipient client where to connect to the DSPS.</p>
<p>This ability is advantageous since the recipient client only needs to know one protocol for data transmission over P2P or P2S2P connections, and would not see a difference between the two. The proposed method is for one side to fist try serving a connection to the other. If that fails the other side may attempt to serve the connection. If the second attempt fails the clients may utilize an external DSPS server. The negotiation of who will serve is done outside DSPS protocol. DSPS has no functionality to decide when a P2P connection is possible or desirable, nor does it have enough information to do so reliably.</p>
</section1>
</jep>