XEP-0215: External Service Discovery

This document specifies an XMPP protocol extension for discovering services external to the XMPP network.


WARNING: This Standards-Track document is Experimental. Publication as an XMPP Extension Protocol does not imply approval of this proposal by the XMPP Standards Foundation. Implementation of the protocol described herein is encouraged in exploratory implementations, but production systems should not deploy implementations of this protocol until it advances to a status of Draft.


Document Information

Series: XEP
Number: 0215
Publisher: XMPP Standards Foundation
Status: Experimental
Type: Standards Track
Version: 0.2
Last Updated: 2007-08-28
Approving Body: XMPP Council
Dependencies: XMPP Core
Supersedes: None
Superseded By: None
Short Name: NOT YET ASSIGNED
Wiki Page: <http://wiki.jabber.org/index.php/External Service Discovery (XEP-0215)>

Author Information

Peter Saint-Andre

Email: stpeter@jabber.org
JabberID: stpeter@jabber.org

Sean Egan

Email: seanegan@google.com
JabberID: seanegan@google.com

Legal Notice

This XMPP Extension Protocol is copyright 1999 - 2007 by the XMPP Standards Foundation (XSF) and is in full conformance with the XSF's Intellectual Property Rights Policy <http://www.xmpp.org/extensions/ipr-policy.shtml>. This material may be distributed only subject to the terms and conditions set forth in the Creative Commons Attribution License (<http://creativecommons.org/licenses/by/2.5/>).

Discussion Venue

The preferred venue for discussion of this document is the Standards discussion list: <http://mail.jabber.org/mailman/listinfo/standards>.

Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 3920) and XMPP IM (RFC 3921) specifications contributed by the XMPP Standards Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocol defined in this document has been developed outside the Internet Standards Process and is to be understood as an extension to XMPP rather than as an evolution, development, or modification of XMPP itself.

Conformance Terms

The following keywords as used in this document are to be interpreted as described in RFC 2119: "MUST", "SHALL", "REQUIRED"; "MUST NOT", "SHALL NOT"; "SHOULD", "RECOMMENDED"; "SHOULD NOT", "NOT RECOMMENDED"; "MAY", "OPTIONAL".


Table of Contents


1. Introduction
2. Protocol
3. Use Cases
    3.1. Requesting All Services
    3.2. Requesting Selected Services
4. Extended Information
5. Determining Support
6. XMPP Registrar Considerations
    6.1. Protocol Namespaces
    6.2. External Service Types Registry
7. XML Schema
Notes
Revision History


1. Introduction

An XMPP client may need to discover services external to the XMPP network in order to complete certain XMPP-related use cases. One example is the discovery of STUN servers (see RFC 3489 [1] and draft-ietf-behave-rfc3489bis-06 [2]) and STUN relays (see TURN [3]) for the sake of negotiating media exchanges via Jingle ICE Transport Method [4]. [5] An XMPP client can already discover such external services in several ways, including:

  1. The service is specified in the client's default settings.
  2. The service is manually added into the client's configuration by a human user.
  3. The service is discovered via non-XMPP service discovery protocols, such as:

Unfortunately, some of the foregoing methods are subject to human error and others are either not widely available or cannot be deployed in wide range of scenarios (e.g., when the administrators of an XMPP service do not have access to DNS SRV records). Therefore, this document defines a way for an XMPP server to provide information about external services, which may include extended information such as temporary credentials for authentication at such services. This method should be used only as a fallback when the relevant service discovery technologies (DNS SRV, DDDS, SLP, S-NAPTR, U-NAPTR, etc.) are not available to the client or server. This method does not use Service Discovery [12] since that technology is designed for discovery of XMPP entities, not entities outside an XMPP network.

2. Protocol

In order to learn about external services known to an XMPP server, a client sends an IQ-get containing an empty <services/> element qualified by the 'http://www.xmpp.org/extensions/xep-0215.html#ns' namespace (see Protocol Namespaces regarding issuance of one or more permanent namespaces), typically to its own server (but perhaps to a dedicated discovery service).

The XMPP server (or service) SHOULD return the list of external services it is aware of, but MAY instead return an appropriate error, such as <service-unavailable/> if the server does not support this protocol or <forbidden/> if the requesting entity does not have permission to receive the list of external services. Each service is encapsulated via a <service/> element.

Note: The processes by which an XMPP server discovers external services for "proxying" to XMPP entities are out of scope for this specification.

The <service/> element MAY be empty or MAY include extended information about the service as described in the Extended Information section of this document.

The attributes of the <service/> element are summarized in the following table.

Table 1: Attributes

Name Definition Inclusion
host Either a fully qualified domain name (FQDN) or an IP address (IPv4 or IPv6). REQUIRED
password A service- or server-generated password for use at the service. * OPTIONAL
port The communications port to be used at the host. RECOMMENDED
transport The underlying transport protocol to be used when communicating with the service (typically either TCP or UDP). RECOMMENDED
type The service type as registered with the XMPP Registrar [13]. REQUIRED
username A service- or server-generated username for use at the service. * OPTIONAL

* Note: The processes by which an external service might generate or an XMPP server might negotiate the username and password are outside the scope of this specification. One possible approach is for the XMPP server to generate a short-term authentication credential based on a private key shared with the external service.

3. Use Cases

3.1 Requesting All Services

A client requests all services by sending a <services/> element to its server.

Example 1. Entity Requests All External Services

<iq type='get'
    from='bard@shakespeare.lit/globe'
    to='shakespeare.lit'
    id='all1'>
  <services xmlns='http://www.xmpp.org/extensions/xep-0215.html#ns'/>
</iq>
    

Example 2. XMPP Server Returns List

<iq type='result'
    from='shakespeare.lit'
    to='bard@shakespeare.lit/globe'
    id='all1'>
  <services xmlns='http://www.xmpp.org/extensions/xep-0215.html#ns'>
    <service host='stun.shakespeare.lit' port='9998' transport='udp' type='stun'/>
    <service host='stun.shakespeare.lit'
             password='jj929jkj5sadjfj93v3n'
             port='9999'
             type='stun-relay'
             username='nb78932lkjlskjfdb7g8'/>
    <service host='192.0.2.1' port='8888' transport='udp' type='stun'/>
    <service host='192.0.2.1'
             port='8889'
             password='93jn3bakj9s832lrjbbz'
             type='stun-relay'
             username='auu98sjl2wk3e9fjdsl7'/>
    <service host='ftp.shakespeare.lit' 
             password='guest' 
             port='20' 
             transport='tcp' 
             type='ftp' 
             username='guest'/>
  </services>
</iq>
    

3.2 Requesting Selected Services

A client requests selected services by sending a <services/> element to its server including a 'type' attribute specifying the service type of interest.

Example 3. Entity Requests Selected Services

<iq type='get'
    from='bard@shakespeare.lit/globe'
    to='shakespeare.lit'
    id='selected1'>
  <services xmlns='http://www.xmpp.org/extensions/xep-0215.html#ns'
            type='stun-relay'/>
</iq>
    

Example 4. XMPP Server Returns List

<iq type='result'
    from='shakespeare.lit'
    to='bard@shakespeare.lit/globe'
    id='selected1'>
  <services xmlns='http://www.xmpp.org/extensions/xep-0215.html#ns'
            type='stun-relay'>
    <service host='stun.shakespeare.lit'
             password='jj929jkj5sadjfj93v3n'
             port='9999'
             type='stun-relay'
             username='nb78932lkjlskjfdb7g8'/>
    <service host='192.0.2.1'
             port='8889'
             password='93jn3bakj9s832lrjbbz'
             type='stun-relay'
             username='auu98sjl2wk3e9fjdsl7'/>
  </services>
</iq>
    

If a client requests selected services, an XMPP server MAY as needed send an updated list of the relevant services by "pushing" the list to a client that has previously requested the list:

Example 5. Services Push

<iq type='set'
    from='shakespeare.lit'
    to='bard@shakespeare.lit/globe'
    id='push1'>
  <services xmlns='http://www.xmpp.org/extensions/xep-0215.html#ns'
            type='stun-relay'>
    <server host='stun.shakespeare.lit' 
            port='9999' 
            username='1nas9dlm3hzl89d0b9v' 
            password='gh9023ljjdk109iajqn'>
    <server host='192.0.2.2' 
            port='7778' 
            username='bnsv120afg48snsdozp' 
            password='zxp023na98dsfahn1kk'/>
  </services>
</iq>
    

4. Extended Information

If a server or service needs to include extended information, it SHOULD do so by including each bit of information as the XML character data of the <value/> child of a distinct <field/> element, with the entire set of fields contained within an <x/> element of type "result" qualified by the 'jabber:x:data' namespace (see Data Forms [14]); this <x/> element SHOULD be a child of the <service/> element qualified by the 'http://www.xmpp.org/extensions/xep-0215.html#ns' namespace (see Protocol Namespaces regarding issuance of one or more permanent namespaces). Thus the IQ result SHOULD be of the following form:

<iq type='result'>
  <services xmlns='http://www.xmpp.org/extensions/xep-0215.html#ns'>
    <service>
      <x type='result' xmlns='jabber:x:data'>
        <field var='[var-name]' label='[optional]'>
          <value>[var-value]</value>
        </field>
        [ ... ]
      </x>
    </service>
  </services>
</iq>

Note: A <field/> element MAY contain more than one <value/> child if appropriate.

If the data fields are to be used in the context of a protocol approved by the XMPP Standards Foundation, they SHOULD be registered in accordance with the rules defined in XEP-0068, resulting in the inclusion of a <field/> element whose 'var' attribute has a value of "FORM_TYPE" and whose 'type' attribute has a value of "hidden".

Note: Although Service Discovery Extensions [15] specifies that an XMPP entity MUST NOT supply extended information about associated children communicated via the 'http://www.xmpp.org/extensions/xep-0215.html#ns' namespace, that rule does not apply to External Service Discovery since services external to the XMPP network cannot communicate via XMPP.

5. Determining Support

If an entity supports the STUN Server Discovery protocol, it MUST report that fact by including a service discovery feature of "http://www.xmpp.org/extensions/xep-0215.html#ns" (see Protocol Namespaces regarding issuance of one or more permanent namespaces) in response to a Service Discovery [16] information request:

Example 6. Service Discovery Information Request

<iq type='get'
    from='romeo@montague.lit/orchard'
    to='montague.lit'
    id='disco1'>
  <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
  

Example 7. Service Discovery Information Response

<iq type='result'
    from='montague.lit'
    to='romeo@montague.lit/orchard'
    id='disco1'>
  <query xmlns='http://jabber.org/protocol/disco#info'>
    ...
    <feature var='http://www.xmpp.org/extensions/xep-0215.html#ns'/>
    ...
  </query>
</iq>
  

6. XMPP Registrar Considerations

6.1 Protocol Namespaces

Until this specification advances to a status of Draft, its associated namespace shall be "http://www.xmpp.org/extensions/xep-0215.html#ns"; upon advancement of this specification, the XMPP Registrar shall issue a permanent namespace in accordance with the process defined in Section 4 of XMPP Registrar Function [17].

6.2 External Service Types Registry

The XMPP Registrar shall maintain a registry of external service types and their associated transport protocol(s). Such service types will probably be derived from the IANA Port Numbers Registry [18], defined DNS SRV record types, defined DDDS records for NAPTR, S-NAPTR, and U-NAPTR, and IANA Service Location Protocol, Version 2 (SLPv2) Templates [19]. A future version of this specification shall define the relevant actions requested of the XMPP Registrar.

7. XML Schema

<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='http://www.xmpp.org/extensions/xep-0215.html#ns'
    xmlns='http://www.xmpp.org/extensions/xep-0215.html#ns'
    elementFormDefault='qualified'>

  <xs:import
      namespace='jabber:x:data'
      schemaLocation='http://www.xmpp.org/schemas/x-data.xsd'/>

  <xs:element name='services'>
    <xs:complexType>
      <xs:sequence minOccurs='0'>
        <xs:element ref='service'/>
      </xs:sequence>
      <xs:attribute name='type' type='xs:NCName' use='optional'/>
    </xs:complexType>
  </xs:element>

  <xs:element name='service'>
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base='empty'>
          <xs:attribute name='host' type='xs:string' use='required'/>
          <xs:attribute name='password' type='xs:string' use='optional'/>
          <xs:attribute name='port' type='xs:string' use='required'/>
          <xs:attribute name='transport' type='xs:NCName' use='optional'/>
          <xs:attribute name='type' type='xs:NCName' use='required'/>
          <xs:attribute name='username' type='xs:string' use='optional'/>
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name='empty'>
    <xs:restriction base='xs:string'>
      <xs:enumeration value=''/>
    </xs:restriction>
  </xs:simpleType>

</xs:schema>
  

Notes

1. RFC 3489: STUN - Simple Traversal of User Datagram Protocol (UDP) Through Network Address Translators (NATs) <http://tools.ietf.org/html/rfc3489>.

2. Session Traversal Utilities for NAT (STUN) <http://tools.ietf.org/html/draft-ietf-behave-rfc3489bis>.

3. Traversal Using Relays around NAT (TURN): Relay Extensions to Session Traversal Utilities for NAT (STUN) <http://tools.ietf.org/html/draft-ietf-behave-turn>. Work in progress.

4. XEP-0176: Jingle ICE Transport Method <http://www.xmpp.org/extensions/xep-0176.html>.

5. The protocol specified herein is functionally equivalent to the protocol currently used in the Google Talk service for discovery of STUN servers, as documented at <http://code.google.com/apis/talk/jep_extensions/jingleinfo.html>, but has been broadened in scope to address additional use cases if desired.

6. RFC 2782: A DNS RR for specifying the location of services (DNS SRV) <http://tools.ietf.org/html/rfc2782>.

7. RFC 2608: Service Location Protocol, Version 2 <http://tools.ietf.org/html/rfc2608>.

8. RFC 3401: Dynamic Delegation Discovery System (DDDS) Part One: The Comprehensive DDDS <http://tools.ietf.org/html/rfc3401>.

9. RFC 3403: Dynamic Delegation Discovery System (DDDS) Part Three: The Domain Name System (DNS) Database <http://tools.ietf.org/html/rfc3403>.

10. RFC 3958: Domain-Based Application Service Location Using SRV RRs and the Dynamic Delegation Discovery Service (DDDS) <http://tools.ietf.org/html/rfc3958>.

11. RFC 4848: Domain-Based Application Service Location Using URIs and the Dynamic Delegation Discovery Service (DDDS) <http://tools.ietf.org/html/rfc4848>.

12. XEP-0030: Service Discovery <http://www.xmpp.org/extensions/xep-0030.html>.

13. The XMPP Registrar maintains a list of reserved protocol namespaces as well as registries of parameters used in the context of XMPP extension protocols approved by the XMPP Standards Foundation. For further information, see <http://www.xmpp.org/registrar/>.

14. XEP-0004: Data Forms <http://www.xmpp.org/extensions/xep-0004.html>.

15. XEP-0128: Service Discovery Extensions <http://www.xmpp.org/extensions/xep-0128.html>.

16. XEP-0030: Service Discovery <http://www.xmpp.org/extensions/xep-0030.html>.

17. XEP-0053: XMPP Registrar Function <http://www.xmpp.org/extensions/xep-0053.html>.

18. IANA registry of port numbers <http://www.iana.org/assignments/port-numbers>.

19. IANA registry of parameters related to the Service Location Protocol templates <http://www.iana.org/assignments/svrloc-templates.htm>.


Revision History

Version 0.2 (2007-08-28)

Broadened scope from discovery of STUN servers to discovery of any external (non-XMPP) service.

(psa)

Version 0.1 (2007-05-16)

Initial published version.

(psa/se)

Version 0.0.5 (2007-05-10)

Added attributes for username and password; reverted to IQ method since credentials are individualized.

(psa)

Version 0.0.4 (2007-04-18)

Modified to use a well-known publish-subscribe node instead of a dedicated IQ exchange.

(psa)

Version 0.0.3 (2007-03-30)

Made port mandatory since spec assumes that SRV is not available; added XML schema.

(psa)

Version 0.0.2 (2007-03-27)

Made port optional.

(psa)

Version 0.0.1 (2007-03-23)

First draft.

(psa/se)

END