This document specifies best practices for generating and handling extended content in XMPP message stanzas.
WARNING: This Informational document is Experimental. Publication as an XMPP Extension Protocol does not imply approval of this proposal by the XMPP Standards Foundation. Implementation of the best practice or protocol profile described herein is encouraged in exploratory implementations, although production systems should not deploy implementations of this protocol until it advances to a status of Draft.
Series: XEP
Number: 0226
Publisher: XMPP Standards Foundation
Status:
Experimental
Type:
Informational
Version: 0.2
Last Updated: 2008-10-01
Approving Body: XMPP Council
Dependencies: None
Supersedes: None
Superseded By: None
Short Name: N/A
Email:
justin@affinix.com
JabberID:
justin@andbit.net
JabberID:
stpeter@jabber.org
URI:
https://stpeter.im/
The preferred venue for discussion of this document is the Standards discussion list: <http://mail.jabber.org/mailman/listinfo/standards>.
Errata may be sent to <editor@xmpp.org>.
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.
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".
1. Introduction
2. Elements
3. Rules
4. Profiles
4.1. IM
4.2. Data Forms
4.3. RPC
4.4. Feature Negotiation
4.5. HTTP Authentication
4.6. SOAP
4.7. Stanza Session Negotiation
5. Metadata Elements
6. Implementation Notes
7. Security Considerations
8. IANA Considerations
9. XMPP Registrar Considerations
Notes
Revision History
The definition of XMPP stanzas in XMPP Core [1] and XMPP IM [2] allows a <message/> stanza to include any number of child elements that define extended content. The fact that a message stanza may contain multiple instances of extended content can make it difficult for sending entities to know what is appropriate for inclusion in a message stanza and for receiving entities to know exactly how to process a message stanza.
Consider the following hypothetical example:
<message from='romeo@montague.lit' to='juliet@capulet.com' id='msg_1'> <body>Shall we meet?</body <html xmlns='http://jabber.org/protocol/xhtml-im'> <body xmlns='http://www.w3.org/1999/xhtml'> <p style='font-weight:bold'>Shall we meet?</p> </body> </html> <feature xmlns='http://jabber.org/protocol/feature-neg'> <x xmlns='jabber:x:data' type='form'> <field var='FORM_TYPE' type='hidden'> <value>romantic_meetings</value> </field> <field type='list-single' var='places-to-meet'> <option><value>Secret Grotto</value></option> <option><value>Verona Park</value></option> </field> <field type='list-single' var='times-to-meet'> <option><value>22:00</value></option> <option><value>22:30</value></option> <option><value>23:00</value></option> </field> </x> </feature> <headers xmlns='http://jabber.org/protocol/shim'> <header name='Urgency'>high</header> </headers> <amp xmlns='http://jabber.org/protocol/amp' per-hop='true'> <rule condition='expire-at' action='drop' value='2007-08-01T23:30:00Z'/> </amp> <geoloc xmlns='http://jabber.org/protocol/geoloc' xml:lang='en'> <country>Italy</country> <lat>45.44</lat> <locality>Venice</locality> <lon>12.33</lon> </geoloc> <mood xmlns='http://jabber.org/protocol/mood'> <flirtatious/> </mood> <data xmlns='http://jabber.org/protocol/ibb' sid='ft_session_2' seq='84'> qANQR1DBwU4DX7jmYZnncmUQB/9KuKBddzQH+tZ1ZywKK0yHKnq57kWq+RFtQdCJ WpdWpR0uQsuJe7+vh3NWn59/gTc5MDlX8dS9p0ovStmNcyLhxVgmqS8ZKhsblVeu IpQ0JgavABqibJolc3BKrVtVV1igKiX/N7Pi8RtY1K18toaMDhdEfhBRzO/XB0+P AQhYlRjNacGcslkhXqNjK5Va4tuOAPy2n1Q8UUrHbUd0g+xJ9Bm0G0LZXyvCWyKH kuNEHFQiLuCY6Iv0myq6iX6tjuHehZlFSh80b5BVV9tNLwNR5Eqz1klxMhoghJOA </data> </message>
What to make of a message like this? The import seems to be that Romeo, being in a flirtatious mood (User Mood [3]) and currently located near Juliet's abode (User Geolocation [4]), would urgently (Stanza Headers and Internet Metadata [5]) like to meet with Juliet (message body) and proposes two convenient places (Feature Negotiation [6]) for an evening tryst, but no later than midnight (Advanced Message Processing [7]), and for good measure would like to transport the 85th packet of a file transfer. But how is Juliet's client supposed to figure that out? That is, what should her client present to the user? And should Romeo's client even send a monstrosity such as this?
To clarify such matters, this document introduces the concept of "message stanza profiles". Each profile defines a set of elements that are allowed for use, and each message stanza must only be processed under the rules of a single profile. Therefore, at best, Juliet's client in the above example would process the message for just one of its many intended purposes. At worst, the message would be rejected by Juliet's client as invalid. Romeo's client should not be sending such a monstrosity.
Elements used in a message stanza are either profile elements (for example, <body> or <data xmlns='http://jabber.org/protocol/ibb'>) or metadata elements (for example, <error> or <amp xmlns='http://jabber.org/protocol/amp'>). A message stanza SHOULD only contain profile elements that are part of the same profile. A message stanza MAY contain as many metadata elements as desired.
Metadata elements are included to define how the message stanza shall be routed, delivered, or processed in transit. Metadata elements shall not be used to determine which profile applies. If a message stanza includes only metadata elements, it can be considered to have no profile.
A sender MAY mix elements of different profiles only for the purposes of fallback. For example, it may be useful to include a <body> element in a message that is not intended to be displayed as a text message, in case the recipient does not support the primary profile of the message.
<message from='romeo@montague.lit' to='juliet@capulet.com' id='msg_1'> <body>If you read this message then you don't support IBB.</body <data xmlns='http://jabber.org/protocol/ibb' sid='ft_session_2' seq='84'> qANQR1DBwU4DX7jmYZnncmUQB/9KuKBddzQH+tZ1ZywKK0yHKnq57kWq+RFtQdCJ WpdWpR0uQsuJe7+vh3NWn59/gTc5MDlX8dS9p0ovStmNcyLhxVgmqS8ZKhsblVeu IpQ0JgavABqibJolc3BKrVtVV1igKiX/N7Pi8RtY1K18toaMDhdEfhBRzO/XB0+P AQhYlRjNacGcslkhXqNjK5Va4tuOAPy2n1Q8UUrHbUd0g+xJ9Bm0G0LZXyvCWyKH kuNEHFQiLuCY6Iv0myq6iX6tjuHehZlFSh80b5BVV9tNLwNR5Eqz1klxMhoghJOA </data> </message>
A receiver MUST only process the message for a single profile. The above example message would be processed either as an IBB data packet or as an instant message, but never both.
We stipulate the following rules:
If a message stanza is received that combines multiple profiles, or the profile cannot be determined, the receiving client MAY return a stanza error, which SHOULD be <not-acceptable/>.
<message from='juliet@capulet.com' id='msg_1' to='romeo@montague.lit' type='error'> <error type='cancel'> <not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> </error> </message>
Profiles should be defined in whichever specifications define elements or processing behavior of message stanzas. However, a few profiles are defined here.
The instant messaging (IM) profile is the "default" profile for message stanzas. For example, if a message stanza includes only elements that are defined for the 'jabber:client' namespace then it is in the IM profile. If a message stanza includes both IM profile elements and other elements, the IM elements should be considered a fallback and the profile should be determined based on the other elements if supported (e.g., a data form). A sending entity should limit the elements it includes to IM profile elements, unless the IM elements are a fallback.
The extended content defined in the following specifications is considered to be in the IM profile:
Extended content elements defined in Data Forms [15] are considered to be in the Data Forms profile.
Extended content elements defined in Jabber-RPC [16] are considered to be in the RPC profile.
Extended content elements defined in Feature Negotiation [17] are considered to be in the Feature Negotiation profile.
Extended content elements defined in Verifying HTTP Requests via XMPP [18] are considered to be in the HTTP Authentication profile.
Extended content elements defined in SOAP over XMPP [19] are considered to be in the SOAP profile.
Extended content elements defined in Stanza Session Negotiation [20] are considered to be in the Stanza Session Negotiation profile.
Metadata elements should be defined in whichever specifications define elements or processing behavior of message stanzas. However, a few metadata elements are defined here.
The extended content elements defined in the following specifications are considered to be metadata elements:
Since each message is unambiguously determined to be of a specific profile, implementations that use filtering to pass message stanzas to an appropriate handler (a very common XMPP implementation approach) need not be concerned with the filtering order. This is because only one handler should ever match on the filter expression.
This document adds no security concerns or consideration above and beyond those specified in the specifications to which it refers.
This document requires no interaction with the Internet Assigned Numbers Authority (IANA) [25].
A future version of this specification may call for the XMPP Registrar [26] to establish a registry of message stanza profiles, so that each relevant specification shall define which profile applies to extended content qualified by the relevant namespace.
1. RFC 3920: Extensible Messaging and Presence Protocol (XMPP): Core <http://tools.ietf.org/html/rfc3920>.
2. RFC 3921: Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence <http://tools.ietf.org/html/rfc3921>.
3. XEP-0107: User Mood <http://www.xmpp.org/extensions/xep-0107.html>.
4. XEP-0080: User Geolocation <http://www.xmpp.org/extensions/xep-0080.html>.
5. XEP-0131: Stanza Headers and Internet Metadata <http://www.xmpp.org/extensions/xep-0131.html>.
6. XEP-0020: Feature Negotiation <http://www.xmpp.org/extensions/xep-0020.html>.
7. XEP-0079: Advanced Message Processing <http://www.xmpp.org/extensions/xep-0079.html>.
8. RFC 3921: Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence <http://tools.ietf.org/html/rfc3921>.
9. XEP-0045: Multi-User Chat <http://www.xmpp.org/extensions/xep-0045.html>.
10. XEP-0066: Out of Band Data <http://www.xmpp.org/extensions/xep-0066.html>.
11. XEP-0071: XHTML-IM <http://www.xmpp.org/extensions/xep-0071.html>.
12. XEP-0085: Chat State Notifications <http://www.xmpp.org/extensions/xep-0085.html>.
13. XEP-0144: Roster Item Exchange <http://www.xmpp.org/extensions/xep-0144.html>.
14. XEP-0172: User Nickname <http://www.xmpp.org/extensions/xep-0172.html>.
15. XEP-0004: Data Forms <http://www.xmpp.org/extensions/xep-0004.html>.
16. XEP-0009: Jabber-RPC <http://www.xmpp.org/extensions/xep-0009.html>.
17. XEP-0020: Feature Negotiation <http://www.xmpp.org/extensions/xep-0020.html>.
18. XEP-0070: Verifying HTTP Requests via XMPP <http://www.xmpp.org/extensions/xep-0070.html>.
19. XEP-0072: SOAP over XMPP <http://www.xmpp.org/extensions/xep-0072.html>.
20. XEP-0155: Stanza Session Negotiation <http://www.xmpp.org/extensions/xep-0155.html>.
21. XEP-0033: Extended Stanza Addressing <http://www.xmpp.org/extensions/xep-0033.html>.
22. XEP-0079: Advanced Message Processing <http://www.xmpp.org/extensions/xep-0079.html>.
23. XEP-0131: Stanza Headers and Internet Metadata <http://www.xmpp.org/extensions/xep-0131.html>.
24. XEP-0203: Delayed Delivery <http://www.xmpp.org/extensions/xep-0203.html>.
25. The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see <http://www.iana.org/>.
26. 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/>.
Revised/reordered text.
(jk)Initial published version; specified more granular profiles; renamed transmission elements to metadata elements.
(psa)Clarified that message profiles apply to sending entities as well as receiving entities.
(psa)First draft.
(jk/psa)END