<?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>Server IP Check</title>
  <abstract>This specification defines a simple XMPP extension that enables a client to discover its external IP address.</abstract>
  &LEGALNOTICE;
  <number>xxxx</number>
  <status>ProtoXEP</status>
  <type>Standards Track</type>
  <sig>Standards</sig>
  <approver>Council</approver>
  <dependencies>
    <spec>XMPP Core</spec>
  </dependencies>
  <supersedes/>
  <supersededby/>
  <shortname>sic</shortname>
  &stpeter;
  <revision>
    <version>0.0.2</version>
    <date>2009-03-10</date>
    <initials>psa</initials>
    <remark><p>Removed client inclusion of its IP address; added IPv6 example.</p></remark>
  </revision>
  <revision>
    <version>0.0.1</version>
    <date>2009-03-10</date>
    <initials>psa</initials>
    <remark><p>First draft.</p></remark>
  </revision>
</header>

<section1 topic='Introduction' anchor='intro'>
  <p>There are times when a client might want or need to discover what its external Internet Protocol (IP) address is, e.g. when gathering transport candidates for &xep0065; or &xep0176;. One way to do so is for the client to ask the XMPP server to which it has connected. This simple specification defines such a method.</p>
</section1>

<section1 topic='Protocol' anchor='proto'>
  <p>First the client sends an IQ-get request to its server.</p>
  <example caption="Client requests its IP address from the server"><![CDATA[
<iq from='romeo@montague.lit/orchard'
    id='ik2s7159'
    type='get'>
  <ip xmlns='urn:xmpp:sic:0'/>
</iq>
  ]]></example>
  <p>The server then returns an IQ-result containing an &lt;ip/&gt; element whose XML character data specifies the client's IP address according to the server.</p>
  <example caption="Server returns IP address"><![CDATA[
<iq id='ik2s7159'
    to='romeo@montague.lit/orchard'
    type='result'>
  <ip xmlns='urn:xmpp:sic:0'>192.168.4.1</ip>
</iq>
  ]]></example>
  <p>The IP address could be IPv4 or IPv6.</p>
  <example caption="Server returns IPv6 address"><![CDATA[
<iq id='ik2s7159'
    to='romeo@montague.lit/orchard'
    type='result'>
  <ip xmlns='urn:xmpp:sic:0'>2001:db8::9:1</ip>
</iq>
  ]]></example>
</section1>

<section1 topic='Determining Support' anchor='support'>
  <p>If an entity supports this protocol, it MUST report that by including a service discovery feature of "urn:xmpp:sic:0" in response to disco#info requests &NSNOTE;.</p>
  <example caption="Service discovery information request"><![CDATA[
<iq from='romeo@montague.lit/orchard'
    id='ux71f395'
    to='montague.lit'
    type='get'>
  <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
  ]]></example>
  <example caption="Service discovery information response"><![CDATA[
<iq from='montague.lit'
    id='ux71f395'
    to='romeo@montague.lit/orchard'
    type='result'>
  <query xmlns='http://jabber.org/protocol/disco#info'>
    <feature var='urn:xmpp:sic:0'/>
  </query>
</iq>
  ]]></example>
</section1>

<section1 topic='Security Considerations' anchor='security'>
  <p>&rfc3920; specifies that client IP addresses shall not be made public. If a client requests its own IP address, that policy is not violated. However, a server MUST NOT return the IP address of another client (e.g., if a connected client sends a SIC request to the bare JID of another user); instead, it MUST return a &forbidden; error.</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>This specification defines the following XML namespace:</p>
    <ul>
      <li>urn:xmpp:sic:0</li>
    </ul>
    <p>Upon advancement of this specification from a status of Experimental to a status of Draft, the &REGISTRAR; shall add the foregoing namespace to the registry located at &NAMESPACES;, as described in Section 4 of &xep0053;.</p>
  </section2>
  <section2 topic='Protocol Versioning' anchor='registrar-versioning'>
    &NSVER;
  </section2>
</section1>

<section1 topic='XML Schema' anchor='schema'>
  <code><![CDATA[
<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='urn:xmpp:sic:0'
    xmlns='urn:xmpp:sic:0'
    elementFormDefault='qualified'>

  <xs:element name='ip' type='xs:string'/>

</xs:schema>
  ]]></code>
</section1>

<section1 topic='Acknowledgements' anchor='acks'>
  <p>Thanks to Thiago Camargo and Diana Cionoiu for their prodding to define this extension.</p>
</section1>

</xep>
