[Standards-JIG] Datagram flow

Justin Karneges justin-keyword-jabber.093179 at affinix.com
Wed Apr 21 23:47:28 UTC 2004


Hi all,

I'd like to prepare a JEP for ensuring proper UDP flow between two Jabber 
endpoints, for use with real-time data transfers.  Even though UDP is 
connectionless, Jabber allows us to easily determine if UDP exchanges are 
possible between peers before invoking some external UDP-based application.  
Knowing this information in advance leads to a better user experience and 
means we can do things like negotiate a UDP proxy.

Below is my rough idea, which follows the same design pattern as JEP-0065.

If the Initiator wishes to use a proxy, it will need to query the proxy for 
port information:

<iq type='get' to='proxy' from='initiator' id='discover'>
  <query xmlns='http://jabber.org/protocol/datagrams' sid='mySID' nports='2'/>
</iq>

This is slightly different than JEP-0065, in that the sid and number of ports 
needed must be given to the proxy.

The proxy replies:

<iq type='result' from='proxy' to='initiator' id='discover'>
  <query xmlns='http://jabber.org/protocol/datagrams'>
    <packethost jid='proxy' host='proxy' ports='9000-9001'/>
  </query>
</iq>

The Initiator informs the Target of the UDP interfaces available:

<iq type='set' to='target' from='initiator' id='dg1'>
  <query xmlns='http://jabber.org/protocol/datagrams' sid='mySID'>
    <packethost jid='initiator' host='123.132.213.231' ports='4588-4589'/>
    <packethost jid='proxy' host='proxy' ports='9000-9001'/>
  </query>
</iq>

At this point, the peers will begin exchanging UDP packets.  All packets have 
the format:
  "XMPP" + Type + SHA1 Hash of: (SID + Initiator JID + Target JID)
where 'Type' is a single letter, depending on the context.

The Target sends a UDP packet to all ports of the packethost(s), using Type=T.

The proxyhosts will then reply on each port with a UDP packet, using Type=R.  
The Target must receive a reply on each port before the packethost can be 
considered working.  As UDP does not have delivery guarantees, the Target may 
resend UDP packets as desired until a reply is received.

If the Target gives up:

<iq type='error' to='initiator' id='dg1'>
  <error code='404' type='cancel'>
    <item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  </error>
</iq>

If the Target succeeds:

<iq type='result' to='initiator' id='dg1'>
  <query xmlns='http://jabber.org/protocol/datagrams'>
    <packethost-used jid='proxy'/>
  </query>
</iq>

If the packethost is not the Initiator itself, in other words a proxy, then 
the Initiator will need to establish a datagram flow with the proxy.  This is 
done by the Initiator sending a packet of Type=I to each port of the proxy 
and the proxy replying with Type=R.  When flow with the proxy is considered 
working, the Initiator must activate the proxy session:

<iq type='set' to='proxy' id='activate'>
  <query xmlns='http://jabber.org/protocol/datagrams' sid='mySID'>
    <activate>target</activate>
  </query>
</iq>

And the proxy responds:

<iq type='result' from='proxy' id='activate'/>

Once the flow is prepared and working, the ports can immediately be used for 
their intended purpose, and all packets are to be treated as-is.  This 
protocol does not wrap or encapsulate packets.

Comments please.

-Justin



More information about the Standards mailing list