No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xep-0128.xml 8.6KB

  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY % ents SYSTEM 'xep.ent'>
  4. %ents;
  5. ]>
  6. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  7. <xep>
  8. <header>
  9. <title>Service Discovery Extensions</title>
  10. <abstract>This document specifies best practices for including extended information in Service Discovery results.</abstract>
  12. <number>0128</number>
  13. <status>Active</status>
  14. <type>Informational</type>
  15. <sig>Standards</sig>
  16. <dependencies>
  17. <spec>XMPP Core</spec>
  18. <spec>XEP-0004</spec>
  19. <spec>XEP-0030</spec>
  20. <spec>XEP-0068</spec>
  21. </dependencies>
  22. <supersedes/>
  23. <supersededby/>
  24. <shortname>N/A</shortname>
  25. &stpeter;
  26. <revision>
  27. <version>1.0</version>
  28. <date>2004-10-20</date>
  29. <initials>psa</initials>
  30. <remark>Per a vote of the Jabber Council, advanced status to Active; also added implementation notes.</remark>
  31. </revision>
  32. <revision>
  33. <version>0.2</version>
  34. <date>2004-03-15</date>
  35. <initials>psa</initials>
  36. <remark>Clarified syntax and corrected several errors; added IM server example.</remark>
  37. </revision>
  38. <revision>
  39. <version>0.1</version>
  40. <date>2004-03-05</date>
  41. <initials>psa</initials>
  42. <remark>Initial version.</remark>
  43. </revision>
  44. </header>
  45. <section1 topic='Introduction' anchor='intro'>
  46. <p>Developers periodically wonder why &xep0030; does not include more bits of information. For example, why does the &lt;identity/&gt; element not include a 'description' attribute, and can we add one now? The answer is: well, it just doesn't, and at this point it's too late to make further changes (since XEP-0030 is Final). So the best approach is to specify a well-defined extension mechanism.</p>
  47. <p>Let us consider an example. A &xep0045; room might want to include additional information in its service discovery results, such as the full room description, the current discussion topic (room subject), the number of occupants in the room, and the JID of the room owner.</p>
  48. <p>Adding one new attribute to the service discovery schema (even if that were an option) would not solve the problem, since a MUC service might want to provide certain bits of information, whereas a &xep0060; service might want to provide other bits.</p>
  49. <p>A better solution would be to include extended information qualified by a namespace that provides a way to flexibly define structured data formats. Thankfully, we already possess such a protocol: &xep0004;. In addition, we possess a way to define common fields used in data forms: &xep0068;. Using these building blocks, we can define some best practices for extending service discovery results.</p>
  50. </section1>
  51. <section1 topic='Recommendations' anchor='recommendations'>
  52. <p>If an entity desires to provide extended information about itself in an IQ results stanza within the context of the <cite>Service Discovery</cite> protocol, it SHOULD do so by including each bit of information as the XML character data of the &lt;value/&gt; child of a distinct &lt;field/&gt; element, with the entire set of fields contained within an &lt;x/&gt; element of type "result" qualified by the 'jabber:x:data' namespace; this &lt;x/&gt; element SHOULD be a child of the &lt;query/&gt; element qualified by the '' namespace. Thus the IQ result SHOULD be of the following form:</p>
  53. <code><![CDATA[
  54. <iq type='result'>
  55. <query xmlns=''>
  56. ...
  57. <x type='result' xmlns='jabber:x:data'>
  58. <field var='[var-name]' label='[optional]'>
  59. <value>[var-value]</value>
  60. </field>
  61. ...
  62. </x>
  63. </query>
  64. </iq>]]></code>
  65. <p>Note: A &lt;field/&gt; element MAY contain more than one &lt;value/&gt; child if appropriate.</p>
  66. <p>If the data fields are to be used in the context of a protocol approved by the XMPP Standards Foundation, they SHOULD be described in the relevant XMPP Extension Protocol specification and registered in accordance with the rules defined in XEP-0068, resulting in the inclusion of a &lt;field/&gt; element whose 'var' attribute has a value of "FORM_TYPE" and whose 'type' attribute has a value of "hidden".</p>
  67. <p>An entity MUST NOT supply extended information about associated children communicated via the '' namespace, since a core principle of <cite>Service Discovery</cite> is that an entity must define its own identity only and must not define the identity of any children associated with the entity.</p>
  68. </section1>
  69. <section1 topic='Examples' anchor='examples'>
  70. <section2 topic='IM Server' anchor='examples-server'>
  71. <p>The following is an example of including a disco extension in the IQ result sent by a standard instant messaging server.</p>
  72. <example caption='Entity Queries Server for Information'><![CDATA[
  73. <iq type='get'
  74. from=''
  75. to='shakespeare.lit'
  76. id='disco1'>
  77. <query xmlns=''/>
  78. </iq>
  79. <iq type='result'
  80. from='shakespeare.lit'
  81. to=''
  82. id='disco1'>
  83. <query xmlns=''>
  84. <identity
  85. category='server'
  86. type='im'
  87. name='shakespeare.lit jabber server'/>
  88. <feature var='jabber:iq:register'/>
  89. <x xmlns='jabber:x:data' type='result'>
  90. <field var='FORM_TYPE' type='hidden'>
  91. <value></value>
  92. </field>
  93. <field var='c2s_port'>
  94. <value>5222</value>
  95. </field>
  96. <field var='c2s_port_ssl'>
  97. <value>5223</value>
  98. </field>
  99. <field var='http_access'>
  100. <value>http://shakespeare.lit/jabber</value>
  101. </field>
  102. <field var='ip_version'>
  103. <value>ipv4</value>
  104. <value>ipv6</value>
  105. </field>
  106. <field var='info_url'>
  107. <value>http://shakespeare.lit/support.php</value>
  108. </field>
  109. </x>
  110. </query>
  111. </iq>
  112. ]]></example>
  113. </section2>
  114. <section2 topic='Multi-User Chat Room' anchor='examples-muc'>
  115. <p>The following is an example of including a disco extension in the IQ result sent by a Multi-User Chat room.</p>
  116. <example caption='User Queries Room for Information'><![CDATA[
  117. <iq type='get'
  118. from='hag66@shakespeare.lit/pda'
  119. to='darkcave@macbeth.shakespeare.lit'
  120. id='disco1'>
  121. <query xmlns=''/>
  122. </iq>
  123. <iq type='result'
  124. from='darkcave@macbeth.shakespeare.lit'
  125. to='hag66@shakespeare.lit/pda'
  126. id='disco1'>
  127. <query xmlns=''>
  128. <identity
  129. category='conference'
  130. type='text'
  131. name='A Dark Cave'/>
  132. <feature var=''/>
  133. <feature var='jabber:iq:register'/>
  134. <x xmlns='jabber:x:data' type='result'>
  135. <field var='FORM_TYPE' type='hidden'>
  136. <value></value>
  137. </field>
  138. <field var='muc#roominfo_description' label='Description'>
  139. <value>The place for all good witches!</value>
  140. </field>
  141. <field var='muc#roominfo_subject' label='Subject'>
  142. <value>Spells</value>
  143. </field>
  144. <field var='muc#roominfo_occupants' label='Number of occupants'>
  145. <value>3</value>
  146. </field>
  147. <field var='muc#roominfo_lang' label='Language of discussion'>
  148. <value>en</value>
  149. </field>
  150. </x>
  151. </query>
  152. </iq>
  153. ]]></example>
  154. </section2>
  155. </section1>
  156. <section1 topic='Implementation Notes' anchor='impl'>
  157. <p>In general, the XMPP Standards Foundation may choose to define at most one FORM_TYPE for each service discovery identity (category+type) registered with the XMPP Registrar. In addition, particular applications may define application-specific FORM_TYPEs as well, and one entity may have multiple service discovery identities (e.g., an XMPP server might also function as a publish-subscribe service). Therefore, it is possible (and allowed) for a single service discovery result to contain multiple service discovery extension elements (potentially up to two elements for each identity). However, in practice it is unlikely that any given service discovery result will contain more than one service discovery extension element.</p>
  158. </section1>
  159. <section1 topic='Security Considerations' anchor='security'>
  160. <p>Applications SHOULD ensure that information disclosed in a disco extension is appropriate for discovery by any entity on the network.</p>
  161. </section1>
  162. <section1 topic='IANA Considerations' anchor='iana'>
  163. <p>This document requires no interaction with &IANA;.</p>
  164. </section1>
  165. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  166. <p>This document requires no interaction with the &REGISTRAR;; however, specifications following the best practices defined herein may register FORM_TYPEs and field values with the XMPP Registrar.</p>
  167. </section1>
  168. </xep>