1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-24 10:12:19 -05:00
xeps/xep-0168.xml

342 lines
17 KiB
XML
Raw Normal View History

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
<!ENTITY % ents SYSTEM 'xep.ent'>
%ents;
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
<title>Resource Application Priority</title>
<abstract>This document defines an XMPP protocol extension to indicate the presence priority of XMPP resources for applications other than messaging.</abstract>
&LEGALNOTICE;
<number>0168</number>
<status>Experimental</status>
<type>Standards Track</type>
<jig>Standards JIG</jig>
<approver>Council</approver>
<dependencies>
<spec>XMPP Core</spec>
<spec>XMPP IM</spec>
<spec>XEP-0030</spec>
</dependencies>
<supersedes/>
<supersededby/>
<shortname>rap</shortname>
&stpeter;
&hildjj;
<revision>
<version>0.3</version>
<date>2006-09-17</date>
<initials>psa</initials>
<remark><p>Changed im application type to messaging; added jingle-video.</p></remark>
</revision>
<revision>
<version>0.2</version>
<date>2005-12-19</date>
<initials>psa</initials>
<remark><p>Clarified structure of, and added schema for, RAP request namespace.</p></remark>
</revision>
<revision>
<version>0.1</version>
<date>2005-12-15</date>
<initials>psa</initials>
<remark><p>Initial version.</p></remark>
</revision>
<revision>
<version>0.0.6</version>
<date>2005-11-29</date>
<initials>psa</initials>
<remark><p>Document cleanup.</p></remark>
</revision>
<revision>
<version>0.0.5</version>
<date>2005-11-17</date>
<initials>psa</initials>
<remark><p>Added support for RAP requests via IQ.</p></remark>
</revision>
<revision>
<version>0.0.4</version>
<date>2005-10-27</date>
<initials>psa/jjh</initials>
<remark><p>Defined registry of application types; clarified business rules; corrected schema.</p></remark>
</revision>
<revision>
<version>0.0.3</version>
<date>2005-10-24</date>
<initials>psa/jjh</initials>
<remark><p>Broadened previous resource flagging proposal to include priority for applications other than messaging.</p></remark>
</revision>
<revision>
<version>0.0.2</version>
<date>2005-09-26</date>
<initials>psa/jjh</initials>
<remark><p>Added more business rules and examples; defined service discovery guidelines.</p></remark>
</revision>
<revision>
<version>0.0.1</version>
<date>2005-09-23</date>
<initials>psa/jjh</initials>
<remark><p>First draft.</p></remark>
</revision>
</header>
<section1 topic='Introduction' anchor='intro'>
<p>Within the Extensible Messaging and Presence Protocol (XMPP; see &rfc3920;), presence indicates availability for communication -- specifically, communication via XMPP messaging (usually in the form of "instant messaging" or IM as described in &rfc3921;). However, a wide variety of entities might provide XMPP presence, including entities that are not primarily focused on IM (e.g., phones) or even entities that do not support XMPP messaging at all.</p>
<p>Consider a scenario in which a contact wants to initiate a voice chat (e.g., via &xep0166;) with a user who has the following three XMPP resources:</p>
<table caption='Application Presence'>
<tr>
<th>Resource</th>
<th>Messaging Priority</th>
<th>Voice Chat Priority</th>
</tr>
<tr>
<td>desktop</td>
<td>10</td>
<td>5</td>
</tr>
<tr>
<td>pda</td>
<td>5</td>
<td>-1</td>
</tr>
<tr>
<td>mobile</td>
<td>-1</td>
<td>10</td>
</tr>
</table>
<p>If the contact chooses the resource with which it initiates a voice chat based on the user's default XMPP presence priority (i.e., priority for XMPP messaging), the resulting behavior could be misleading (i.e., initiating the voice chat with the "desktop" resource rather than the "mobile" resource).</p>
<p>What is needed is a way for the user's clients to indicate that the application priority for the three resources is different from the standard XMPP messaging priority. This document defines such a mechanism via an optional XMPP presence extension.</p>
<p>In addition, this document also defines a way for an XMPP server to flag which resource it considers to be primary for any given application type, if it has information -- such as communication preferences -- that can help determine the primary resource.</p>
</section1>
<section1 topic='Application Priority' anchor='primary'>
<p>Consider the three resources ("desktop", "pda", and "mobile") mentioned above. The presence stanzas received by a contact for those three resources would be as follows:</p>
<example caption='Contact receives presence from user'><![CDATA[
<presence from='juliet@capulet.com/desktop' to='romeo@montague.net/home'>
<priority>10</priority>
<rap xmlns='http://jabber.org/protocol/rap' app='jingle-audio' num='5'/>
</presence>
<presence from='juliet@capulet.com/pda' to='romeo@montague.net/home'>
<priority>5</priority>
<rap xmlns='http://jabber.org/protocol/rap' app='jingle-audio' num='-1'/>
</presence>
<presence from='juliet@capulet.com/mobile' to='romeo@montague.net/home'>
<priority>-1</priority>
<rap xmlns='http://jabber.org/protocol/rap' app='jingle-audio' num='10'/>
</presence>
]]></example>
<p>(Note: This protocol uses a 'num' attribute rather than a 'priority' attribute to reduce confusion with XMPP presence and also to save some bytes.)</p>
<p>The following business rules apply to resource application presence provided by the client:</p>
<ol start='1'>
<li><p>A client SHOULD NOT specify resource application presence if the priority for that application is not different from the resource's XMPP messaging priority.</p></li>
<li><p>A client MUST NOT generate a &lt;rap/&gt; element that has an 'app' attribute whose value is "messaging" or that has no 'app' attribute (since the default 'app' is "messaging").</p></li>
</ol>
</section1>
<section1 topic='Flagging the Primary Resource for a Given Application Type' anchor='primary'>
<p>The user's server may have special information that enables it to flag a resource as primary for a given application type. For instance, the server may include a communication policy service that enables the user to define (outside the context of any presence priorities) that she would prefer to be called at her "desktop" resource only between the hours of 9:00 AM and 5:00 PM local time, prefer to be called on her mobile at all other times, and so on.</p>
<p>To flag the primary resource related to a specific application type, the server shall add a &lt;primary/&gt; child to the relevant RAP element. Here is an example:</p>
<example caption='Primary resource flag'><![CDATA[
<presence from='juliet@capulet.com/mobile'>
<priority>-1</priority>
<rap xmlns='http://jabber.org/protocol/rap' app='jingle-audio' num='10'>
<primary/>
</rap>
</presence>
]]></example>
<p>The following business rules apply to resource flagging by the server:</p>
<ol start='1'>
<li><p>A server MAY add the primary resource flag to the presence broadcasts generated by the resource it determines is "most available" for a given application type.</p></li>
<li><p>Because the default 'app' is "im", to flag the primary resource for XMPP messaging the server SHOULD NOT include an 'app' attribute, SHOULD NOT include a 'num' attribute, and MUST include a &lt;primary/&gt; child.</p></li>
<li><p>An available resource that has specified a negative priority for an application type MUST NOT be flagged as the primary resource for that application type.</p></li>
<li><p>A client SHOULD NOT include the primary resource flag in presence stanzas that it generates; however, if a client includes the primary resource flag in a presence stanza, the server SHOULD remove or overwrite the flag.</p></li>
<li><p>In response to a presence probe, a server SHOULD send presence from the primary resource first (this enables the receiving client to skip any local most-available algorithms it might implement).</p></li>
<li><p>If the primary resource changes for a given application type, a server MUST push presence (including the primary resource flag) for the new primary resource. If the change in primary resource occurs because of a presence broadcast from the current primary resource, the server MUST push presence from the current primary resource (without the primary resource flag) before pushing presence from the new primary resource (including the primary resource flag).</p></li>
</ol>
</section1>
<section1 topic='Requesting RAP Data Via IQ' anchor='raprequest'>
<p>In the interest of saving bandwidth, a server MAY choose to strip all RAP data out of presence stanzas and instead provide RAP data only on request via IQ interactions.
A likely scenario is as follows:</p>
<ol start='1'>
<li><p>Contact's client sends &xep0030; information request to user's client or receives &xep0115; data from user's client, and thereby discovers that user's client supports the 'http://jabber.org/protocol/rap' namespace.</p></li>
<li><p>User's client publishes RAP extensions but user's server strips them out in presence broadcasts.</p></li>
<li><p>Contact decides to initiate a non-IM interaction with user.</p></li>
<li><p>Contact's client notices the lack of RAP data from user (despite discovered support) and sends disco#info request to user's server, which signals that it supports the 'http://jabber.org/protocol/raprequest' namespace.</p></li>
<li><p>Contact's client sends RAP request to user's bare JID (&BAREJID;).</p></li>
<li><p>If contact is authorized to view user's presence data, user's server returns the latest RAP data for all of the user's resources. (Note: See the <link url='#security'>Security Considerations</link> section of this document for an important proviso regarding access to RAP data.)</p></li>
</ol>
<p>An example protocol flow for the last two steps is as follows...</p>
<p>First, the contact's client requests the user's RAP data by sending a request to the user's bare JID:</p>
<example caption='Contact requests RAP data from user&apos;s server'><![CDATA[
<iq type='get' from='romeo@montague.net/home' to='juliet@capulet.com'>
<raprequest xmlns='http://jabber.org/protocol/raprequest'/>
</iq>
]]></example>
<p>On behalf of the user, the user's server then returns the full &PRESENCE; stanzas (containing RAP data) for each of the user's connected clients:</p>
<example caption='User&apos;s server returns RAP data'><![CDATA[
<iq type='result' from='romeo@montague.net/home' to='juliet@capulet.com'>
<raprequest xmlns='http://jabber.org/protocol/raprequest'>
<presence from='juliet@capulet.com/desktop' xmlns='jabber:client'>
<priority>10</priority>
<rap xmlns='http://jabber.org/protocol/rap' app='jingle-audio' num='5'/>
</presence>
<presence from='juliet@capulet.com/pda' xmlns='jabber:client'>
<priority>5</priority>
<rap xmlns='http://jabber.org/protocol/rap' app='jingle-audio' num='-1'/>
</presence>
<presence from='juliet@capulet.com/mobile' xmlns='jabber:client'>
<priority>-1</priority>
<rap xmlns='http://jabber.org/protocol/rap' app='jingle-audio' num='10'/>
</presence>
</raprequest>
</iq>
]]></example>
<p>Note: The XML data of the server's response to a RAP request may seem to be potentially confusing, but it is fully consistent with &w3xmlnamespaces; as well as the schemas for the 'jabber:client' and 'http://jabber.org/protocol/raprequest' namespaces.</p>
</section1>
<section1 topic='Service Discovery' anchor='disco'>
<p>In order to discover whether a server or other entity supports this protocol, an entity MUST use &xep0030;.</p>
<example caption='Entity queries a server regarding protocol support'><![CDATA[
<iq type='get'
from='juliet@capulet.com/balcony'
to='capulet.com'
id='disco1'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
]]></example>
<p>If the queried entity supports resource application presence, it MUST return a feature of "http://jabber.org/protocol/rap":</p>
<example caption='Server communicates protocol support for RAP'><![CDATA[
<iq type='result'
from='capulet.com'
to='juliet@capulet.com/balcony'
id='disco1'>
<query xmlns='http://jabber.org/protocol/disco#info'>
...
<feature var='http://jabber.org/protocol/rap'/>
...
</query>
</iq>
]]></example>
<p>If the queried entity supports resource application presence as well as RAP requests (see the <link url='raprequest'>Requesting RAP Data Via IQ</link> section of this document), it MUST return features of "http://jabber.org/protocol/rap" and "http://jabber.org/protocol/raprequest":</p>
<example caption='Server communicates protocol support for RAP as well as RAP Request'><![CDATA[
<iq type='result'
from='capulet.com'
to='juliet@capulet.com/balcony'
id='disco1'>
<query xmlns='http://jabber.org/protocol/disco#info'>
...
<feature var='http://jabber.org/protocol/rap'/>
<feature var='http://jabber.org/protocol/raprequest'/>
...
</query>
</iq>
]]></example>
</section1>
<section1 topic='Security Considerations' anchor='security'>
<p>Neither client publishing of resource application priority nor server flagging of the primary resource introduces any known security vulnerabilities or compromises of user privacy.</p>
<p>If a server supports RAP requests, it MUST carefully control access to RAP data in order to guard against presence leaks and directory harvest attacks. Specifically, if the requesting entity is not authorized (e.g., a contact with a presence subscription of "both" or "from" as described in <cite>RFC 3921</cite>) or is not explicitly trusted (e.g., a server in a trusted network), the server MUST return a &forbidden; error in response to RAP requests.</p>
</section1>
<section1 topic='IANA Considerations' anchor='iana'>
<p>This document requires no interaction with &IANA;.</p>
</section1>
<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
<section2 topic='Protocol Namespaces' anchor='registrar-ns'>
<p>The &REGISTRAR; shall include the following namespaces in its registry of protocol namespaces:</p>
<ul>
<li>http://jabber.org/protocol/rap</li>
<li>http://jabber.org/protocol/raprequest</li>
</ul>
</section2>
<section2 topic='Application Types Registry' anchor='registrar-apps'>
<p>The XMPP Registrar shall maintain a registry of application types. Although strictly speaking this should not be necessary, it is desirable to maintain a list of "short names" for various application types rather than using long XML namespaces, especially in presence broadcasts. For example, a short name of "jingle-audio" is only 12 characters long, whereas the full XML namespace "http://jabber.org/protocol/jingle/description/audio" is 48 characters long. The difference can be quite significant when many presence stanzas are sent.</p>
<section3 topic='Process' anchor='registrar-apps-process'>
&REGPROCESS;
<code><![CDATA[
<app>
<name>the value of the 'app' attribute</name>
<ns>the full namespace associated with the relevant protocol</ns>
<desc>a natural-language description of the application type</desc>
<doc>the document in which this application type is specified</doc>
</app>
]]></code>
</section3>
<section3 topic='Initial Registration' anchor='registrar-apps-init'>
<code><![CDATA[
<app>
<name>jingle-audio</name>
<ns>http://jabber.org/protocol/jingle/description/audio</ns>
<desc>Jingle audio sessions</desc>
<doc>XEP-0167</doc>
</app>
<app>
<name>jingle-video</name>
<ns>http://jabber.org/protocol/jingle/description/video</ns>
<desc>Jingle video sessions</desc>
<doc>XEP-0180</doc>
</app>
<app>
<name>messaging</name>
<ns>jabber:client</ns>
<desc>Standard XMPP messaging</desc>
<doc>RFC 3921</doc>
</app>
]]></code>
</section3>
</section2>
</section1>
<section1 topic='XML Schemas' anchor='schema'>
<section2 topic='RAP' anchor='schema-rap'>
<code><![CDATA[
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
targetNamespace='http://jabber.org/protocol/rap'
xmlns='http://jabber.org/protocol/rap'
elementFormDefault='qualified'>
<xs:element name='rap'>
<xs:complexType>
<xs:sequence>
<xs:element name='primary' type='empty' minOccurs='0'/>
</xs:sequence>
<xs:attribute name='app' type='xs:nmtoken' default='messaging'/>
<xs:attribute name='num' type='xs:byte'/>
</xs:complexType>
</xs:element>
<xs:simpleType name='empty'>
<xs:restriction base='xs:string'>
<xs:enumeration value=''/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
]]></code>
</section2>
<section2 topic='RAP Request' anchor='schema-raprequest'>
<code><![CDATA[
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
targetNamespace='http://jabber.org/protocol/raprequest'
xmlns='http://jabber.org/protocol/raprequest'
elementFormDefault='qualified'>
<xs:import namespace='jabber:client'/>
<xs:element name='raprequest'>
<xs:complexType>
<xs:sequence xmlns:xmpp='jabber:client'>
<xs:element name='xmpp:presence' minOccurs='0'/>
</xs:sequence>
</xs:complexType>
</xs:element>
]]></code>
</section2>
</section1>
</xep>