PubSub Server Info: refactored data format

Following discussion with Flow, MattJ and Jonas`, the data format was modified to:
- group connections under a remote domain
- use attributes instead of elements where appropriate
This commit is contained in:
Guus der Kinderen 2023-12-20 12:54:11 +01:00
parent da26a65685
commit 7f522c35fa
1 changed files with 69 additions and 56 deletions

View File

@ -68,36 +68,36 @@
</iq>]]></example>
</section1>
<section1 topic="Data Format" anchor="impl">
<p>The data format uses an element named 'serverinfo' in the namespace 'urn:xmpp:serverinfo:0'. In its minimal form, it only defines the XMPP domain name in a child-element named 'domain'.</p>
<p>The data format uses an element named 'serverinfo' in the namespace 'urn:xmpp:serverinfo:0'. In its minimal form, it defines each XMPP domain name served by the local server in an attribute named 'name'.</p>
<example caption="Minimal Data Format"><![CDATA[
<serverinfo xmlns='urn:xmpp:serverinfo:0'>
<domain>shakespeare.lit</domain>
<domain name='shakespeare.lit'/>
</serverinfo>]]></example>
<p>The optional 'federation' child element is used to denote remote XMPP domains with which the local domain is federating. Each actual (eg TCP) connection to a federated domain is added as a 'connection' child-element to the 'federation' element, that has an optional 'type' attribute, defining the directionality of the connection (one of 'incoming', 'outgoing' and 'bidi'). The domain name of the remote XMPP domain is added in a 'domain' child element.</p>
<p>The optional 'federation' child element is used to denote remote XMPP domains with which the local domain is federating. Each of them are represented by an element named 'remote-domain'. The domain name of the peer in an attribute named 'name'. Optionally, each actual (e.g. TCP) connection from the local server to the peer is added as a 'connection' child-element to the 'remote-domain' element, that has an optional 'type' attribute, defining the directionality of the connection (one of 'incoming', 'outgoing' and 'bidi').</p>
<example caption="Data Format with Federated Domains"><![CDATA[
<serverinfo xmlns="urn:xmpp:serverinfo:0">
<domain>shakespeare.lit</domain>
<federation>
<connection type="incoming">
<domain>denmark.lit</domain>
</connection>
<connection type="bidi">
<domain>montague.net</domain>
</connection>
<connection type="outgoing">
<domain>capulet.com</domain>
</connection>
</federation>
<domain name="shakespeare.lit">
<federation>
<remote-domain name='denmark.li'>
<connection type="incoming"/>
<connection type="outgoing"/>
</remote-domain>
<remote-domain name='montague.net'>
<connection type="bidi"/>
</remote-domain>
</federation>
</domain>
</serverinfo>]]></example>
<p>Additional data MAY be included in child-elements of the 'server-info' element. Such data MUST be namespaced appropriately. The example below uses the 'query' element defined in &xep0092; to include information about the software application associated with the local domain.</p>
<p>Additional data MAY be included as child-elements of the 'server-info' element or any of the 'domain' elements. Such data MUST be namespaced appropriately. The example below uses the 'query' element defined in &xep0092; to include information about the software application associated with the local server.</p>
<example caption="Data Format with Software Version"><![CDATA[
<serverinfo xmlns="urn:xmpp:serverinfo:0">
<domain>shakespeare.lit</domain>
<federation>
<connection type="incoming">
<domain>denmark.lit</domain>
</connection>
</federation>
<domain name="shakespeare.lit">
<federation>
<remote-domain name='montague.net'>
<connection type="bidi"/>
</remote-domain>
</federation>
</domain>
<query xmlns='jabber:iq:version'>
<name>Openfire</name>
<version>4.8.0</version>
@ -116,18 +116,17 @@
<publish node='serverinfo'>
<item id='current'>
<serverinfo xmlns="urn:xmpp:serverinfo:0">
<domain>shakespeare.lit</domain>
<federation>
<connection type="incoming">
<domain>denmark.lit</domain>
</connection>
<connection type="bidi">
<domain>montague.net</domain>
</connection>
<connection type="outgoing">
<domain>capulet.com</domain>
</connection>
</federation>
<domain name="shakespeare.lit">
<federation>
<remote-domain name='denmark.li'>
<connection type="incoming"/>
<connection type="outgoing"/>
</remote-domain>
<remote-domain name='montague.net'>
<connection type="bidi"/>
</remote-domain>
</federation>
</domain>
</serverinfo>
</item>
</publish>
@ -165,6 +164,8 @@
XEP-0XXX: http://www.xmpp.org/extensions/xep-0XXX.html
</xs:documentation>
</xs:annotation>
<xs:element name="serverinfo" type="urn:serverinfoType" xmlns:urn="urn:xmpp:serverinfo:0"/>
<xs:simpleType name="directionType" final="restriction" >
<xs:restriction base="xs:string">
@ -174,33 +175,45 @@
</xs:restriction>
</xs:simpleType>
<xs:element name="serverinfo">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="domain"/>
<xs:element name="federation" use="optional">
<xs:complexType>
<xs:sequence>
<xs:element name="connection" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="domain"/>
</xs:sequence>
<xs:attribute type="directionType" name="type" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="connectionType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="directionType" name="type" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="remote-domainType">
<xs:sequence>
<xs:element type="urn:connectionType" name="connection" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:xmpp:serverinfo:0"/>
</xs:sequence>
<xs:attribute type="xs:string" name="name" use="optional"/>
</xs:complexType>
<xs:complexType name="federationType">
<xs:sequence>
<xs:element type="urn:remote-domainType" name="remote-domain" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:xmpp:serverinfo:0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="domainType">
<xs:sequence>
<xs:element type="urn:federationType" name="federation" xmlns:urn="urn:xmpp:serverinfo:0"/>
</xs:sequence>
<xs:attribute type="xs:string" name="name"/>
</xs:complexType>
<xs:complexType name="serverinfoType">
<xs:sequence>
<xs:element type="urn:domainType" name="domain" xmlns:urn="urn:xmpp:serverinfo:0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
]]></code>
</section1>
<section1 topic='Acknowledgements' anchor='acknowledgements'>
<p>Inspiration was taken from the (now defunct) 'server info' crawler by Thomas Leister. Many thanks to Dave Cridland, as well as 'zoidberg' from the Ignite Realtime community for helping to test the initial implementation of a graphing implementation based on this XEP.</p>
<p>Inspiration was taken from the (now defunct) 'server info' crawler by Thomas Leister. Many thanks to Dave Cridland, as well as 'zoidberg' and 'chewie' from the Ignite Realtime community for helping to test the initial implementation of a graphing implementation based on this XEP and to Florian Schmaus, Matthew Wild and Jonas Schäfer for their feedback on the earliest drafts of this document.</p>
</section1>
</xep>