]>
Tubes over XMPP A protocol for extensible collaboration over XMPP, designed specifically to implement Telepathy Tubes. This document is copyright 2007 Collabora Ltd. and may be distributed under the same terms as the Telepathy specification. proto-tubes ProtoXEP External extension Telepathy project Telepathy project XMPP Core XEP-0045 XEP-0047 XEP-0095 XEP-proto-muc-bytestream NOT YET ASSIGNED Simon McVittie simon.mcvittie@collabora.co.uk simon.mcvittie@collabora.co.uk 0.0.1 2007-09-07 smcv

First draft.

The XML namespace defined here is &NS_TUBES; (NS_TUBES in the telepathy-gabble source code).

The Telepathy project defines an API called Tubes to be used by arbitrary collaborative applications to communicate with instant messaging contacts. This API is intended to be the same for several IM protocols.

Tubes can be used in two types of context, referred to in Telepathy as Tubes channels:

Each tube has a service name, used to dispatch it to an appropriate client application, and some essentially arbitrary parameters understood by that client application. The tube's initiator (the contact who started it) must also be tracked.

The following tube types are currently supported:

As well as sending and receiving data, the following operations are supported:

hello aGVsbG8= 123 -123 ]]> hello aGVsbG8= 123 -123 ]]> announcement. --> base64base64... ]]> hello aGVsbG8= 123 -123 anonymous password /plots/macbeth ]]> and not in order to disambiguate between SI-based streams in a MUC Tubes channel, and SI-based streams in a 1-1 channel between two members of a MUC. The first witch MUST NOT copy the tube into her own presence in this case - only the initiator should put stream tubes in their presence, since stream tubes cannot continue after the initiator leaves. --> ]]> hello aGVsbG8= 123 -123 ]]>

Leaving the MUC also implicitly implies leaving all tubes.

type='dbus' initiator='romeo@montague.lit' service='com.example.Chess' id='333'> montagues-vs-capulets.conf ]]> http://jabber.org/protocol/ibb ]]> type='stream' initiator='romeo@montague.lit' service='http' id='1402'> /poetry/for-juliet/ ]]> tube='1402'> http://jabber.org/protocol/ibb ]]>

If Juliet's web browser opens multiple parallel connections to her XMPP implementation, the implementation will open multiple parallel SI streams as shown above, and Romeo's XMPP implementation will open multiple parallel connections to his web server. This MUST be supported by implementations.

tube='1402'/> ]]>

The D-Bus unique names used in the MUC SHOULD be ":2." followed by the MUC nick (i.e. the resource part of the MUC JID) processed with the following algorithm:

  • Let utf8nick be the MUC nick encoded using UTF-8
  • If utf8nick has 186 octets or fewer, encode it using Base64; otherwise encode a string consisting of the first 169 octets of utf8nick, followed by the 20 octets of the SHA-1 of utf8nick (note that this is the whole of the raw binary SHA-1, and not the first half of the SHA-1 written in hexadecimal).
  • Remove all whitespace
  • Replace "+" with "_", "/" with "-" and "=" with "A"

This produces collision-free unique names of length no more than 251 octets (4/3 * 186 + 3) for nicknames no longer than 186 UTF-8 octets (replacing "=" with "A" is harmless here because XMPP resources cannot contain U+0000).

For longer nicknames it makes collisions highly unlikely, and produces 255-octet unique names (4/3 * 189 + 3), which still fit into D-Bus' 255-octet limit.

The choice of 186 and 169 for the magic numbers ensures that these long nicknames can only have unique-name collisions with other long nicknames, and that the Base64 encoding step when applied to long nicknames does not leave any trailing "=" characters.

Implementations MUST NOT use unique names that start with ":2." but are not formed according to the above rules, and SHOULD treat tube elements containing such a dbus-name as if they were invalid.

For backwards compatibility with earlier implementations, the dbus-name MAY also be ":1." followed by an arbitrary unique string of up to 252 characters chosen from A-Z, a-z, 0-9, "-" or "_".

The Tubes SI profile is indicated by the profile string &NS_TUBES;. A Tubes SI IQ can be classified as follows:

  • If the IQ contains a <tube> element with the namespace &NS_TUBES;, then the IQ represents a new tube being offered.
  • If the IQ contains a <stream> element with the namespace &NS_TUBES;, then the IQ represents a new connection to an existing stream tube in a 1-1 Tubes channel.
  • If the IQ contains a <muc-stream> element with the namespace &NS_TUBES;, then the IQ represents a new connection to an existing stream tube in a MUC Tubes channel - this message type is invalid and must be rejected unless received via a MUC.
  • Otherwise, the SI is invalid and MUST be rejected.

The allowed parameter types are:

  • "str": A Unicode string containing no zero bytes '\0'. In this implementation it cannot contain any other character forbidden by XML either. The <parameter> character content is the string itself. The corresponding D-Bus signature is 's'.
  • "bytes": An array of bytes, represented in Base64. The corresponding D-Bus signature is 'ay'.
  • "uint": An unsigned integer representable in 32 bits. The corresponding D-Bus signature is 'u' or 'q' on input, 'u' on output, and the element's character content is an ASCII unsigned decimal integer.
  • "int": A signed integer representable in 32 bits using two's complement. The corresponding D-Bus signature is 'i' or 'h' on input, 'i' on output, and the element's character content is an ASCII decimal integer, possibly starting with '-'.
  • "bool": A boolean value represented as one of the strings "0" or "1", representing False and True respectively. The corresponding D-Bus signature is 'b'.

FIXME: how big do we want to allow a message to be? In the D-Bus specification the limit is 2**27 bytes, in the default dbus-daemon configuration (as used on the system bus) it's 32M.

FIXME: limit how many messages are queued up somehow (the system bus limits it to 127M in total)

FIXME

None.

None, this isn't a real XEP (yet?).

]]>

The string "short" produces the unique name ":2.c2hvcnQA".

The string "FirstWitch", as used in the examples, produces the unique name ":2.Rmlyc3RXaXRjaAAA".

The string "Second witch", as used in the examples, produces the unique name ":2.U2Vjb25kIHdpdGNo".

The string consisting of 18 repetitions of "0123456789" followed by "012345" (186 characters) produces a unique name consisting of ":2.", followed by 6 repetitions of the 40-character string "MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5", followed by "MDEyMzQ1".

The string consisting of 18 repetitions of "0123456789" followed by "0123456" (187 characters) produces a unique name consisting of ":2.", followed by 5 repetitions of the 40-character string above, followed by "MDEyMzQ1Njc4OTAxMjM0NTY3OEVd9C5NgmmRD6jp1ftG6XUEc11x".

The string consisting of 20 repetitions of "0123456789" (200 characters) produces a unique name consisting of ":2.", followed by 5 repetitions of the 40-character string above, followed by "MDEyMzQ1Njc4OTAxMjM0NTY3OO-utwRnwcoUFhnJVMKg5pm9Hxal".