<!-- TODO: Sub-namespace for Registration Clients.
urn:xmpp:iot:discovery:regunit - Registration Units (can claim ownership)
-->
<!-- TODO: TBD items -->
<!DOCTYPE xep SYSTEM 'xep.dtd' [
<!ENTITY % ents SYSTEM 'xep.ent'>
%ents;
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
<title>Internet of Things - Discovery</title>
<abstract>This specification describes an architecture based on the XMPP protocol whereby Things can be installed and safely discovered by their owners and connected into networks of Things.</abstract>
<p>Introduced possibility for hosting Thing Registry as a Jabber Server Component, using XEP-0114.</p>
<p>
Expanded de section <linkurl='#support'>Determining Support</link>, explaining how to search through server components.
</p>
<p>Removed the possibility to search for nick names, as a way of finding Thing Registries.</p>
<p>Added Security and Implementation Notes describing the pros and cons of hosting a Thing Registry as a Server Component vs. as a Client.</p>
</remark>
</revision>
<revision>
<version>0.0.2</version>
<date>2014-04-07</date>
<initials>pw</initials>
<remark>
<p>Removed any hard-coded account names.</p>
</remark>
</revision>
<revision>
<version>0.0.1</version>
<date>2014-03-11</date>
<initials>pw,rk</initials>
<remark>
<p>First draft.</p>
</remark>
</revision>
</header>
<section1topic='Introduction'anchor='intro'>
<p>
When installing massive amounts of Things into public networks care has to be taken to make installation simple, but at the same time secure so that the Things cannot be
hijacked or hacked, making sure access to the Thing is controlled by the physical owner of the Thing. One of the main problems is how
to match the characteristics of a Thing, like serial number, manufacturer, model, etc., with information automatically created by the Thing itself, like perhaps its JID, in
an environment with massive amount of Things without rich user interfaces. Care has also to be taken when specifying rules for access rights and user privileges.
</p>
<p>
This document provides a network architecture based on the XMPP protocol that provides a means to safely install, configure, find and connect massive amounts of Things together, and
at the same time minimizing the risk that Things get hijacked. It also provides information how each individual step in the process can be performed with as little manual intervention
as possible, aiming where possible at zero-configuration networking. Furthermore, this document specifies how to create a registry that allows simple access to public Things
without risking their integrity unnecessarily.
</p>
<p>
Internet of Things contains many different architectures and use cases. For this reason, the IoT standards have been divided into multiple XEPs according to the following table:
</p>
<tablecaption='Internet of Things XEPs'>
<tr>
<th>XEP</th>
<th>Description</th>
</tr>
<tr>
<td>xep-0000-IoT-BatteryPoweredSensors</td>
<td>Defines how to handle the peculiars related to battery powered devices, and other devices intermittently available on the network.</td>
</tr>
<tr>
<td>xep-0000-IoT-Events</td>
<td>Defines how Things send events, how event subscription, hysteresis levels, etc., are configured.</td>
</tr>
<tr>
<td>xep-0000-IoT-Interoperability</td>
<td>Defines guidelines for how to achieve interoperability in Internet of Things, publishing interoperability interfaces for different types of devices.</td>
</tr>
<tr>
<td>xep-0000-IoT-Multicast</td>
<td>Defines how sensor data can be multicast in efficient ways.</td>
</tr>
<tr>
<td>xep-0000-IoT-PubSub</td>
<td>Defines how efficient publication of sensor data can be made in Internet of Things.</td>
</tr>
<tr>
<td>xep-0000-IoT-Chat</td>
<td>Defines how human-to-machine interfaces should be constructed using chat messages to be user friendly, automatable and consistent with other IoT extensions and possible underlying architecture.</td>
</tr>
<tr>
<td>XEP-0322</td>
<td>
Defines how to EXI can be used in XMPP to achieve efficient compression of data. Albeit not an Internet of Things specific XEP, this XEP should be considered
in all Internet of Things implementations where memory and packet size is an issue.
</td>
</tr>
<tr>
<td>XEP-0323</td>
<td>
Provides the underlying architecture, basic operations and data structures for sensor data communication over XMPP networks.
It includes a hardware abstraction model, removing any technical detail implemented in underlying technologies. This XEP is used by all other
Internet of Things XEPs.
</td>
</tr>
<tr>
<td>XEP-0324</td>
<td>Defines how provisioning, the management of access privileges, etc., can be efficiently and easily implemented.</td>
</tr>
<tr>
<td>XEP-0325</td>
<td>Defines how to control actuators and other devices in Internet of Things.</td>
</tr>
<tr>
<td>XEP-0326</td>
<td>Defines how to handle architectures containing concentrators or servers handling multiple Things.</td>
</tr>
<tr>
<td>XEP-0331</td>
<td>Defines extensions for how color parameters can be handled, based on &xep0004;</td>
</tr>
<tr>
<td>XEP-0336</td>
<td>Defines extensions for how dynamic forms can be created, based on &xep0004;, &xep0122;, &xep0137; and &xep0141;.</td>
<td>This specification. Defines the peculiars of Thing discovery in Internet of Things. Apart from discovering Things by JID, it also defines how to discover Things based on location, etc.</td>
<p>The following table lists common terms and corresponding descriptions.</p>
<dl>
<di>
<dt>Actuator</dt>
<dd>Device containing at least one configurable property or output that can and should be controlled by some other entity or device.</dd>
</di>
<di>
<dt>Authority</dt>
<dd>Used synonymously with Provisioning Server.</dd>
</di>
<di>
<dt>Computed Value</dt>
<dd>A value that is computed instead of measured.</dd>
</di>
<di>
<dt>Concentrator</dt>
<dd>Device managing a set of devices which it publishes on the XMPP network.</dd>
</di>
<di>
<dt>Field</dt>
<dd>
One item of sensor data. Contains information about: Node, Field Name, Value, Precision, Unit, Value Type, Status, Timestamp, Localization information, etc.
Fields should be unique within the triple (Node ID, Field Name, Timestamp).
</dd>
</di>
<di>
<dt>Field Name</dt>
<dd>Name of a field of sensor data. Examples: Energy, Volume, Flow, Power, etc.</dd>
</di>
<di>
<dt>Field Type</dt>
<dd>What type of value the field represents. Examples: Momentary Value, Status Value, Identification Value, Calculated Value, Peak Value, Historical Value, etc.</dd>
</di>
<di>
<dt>Historical Value</dt>
<dd>A value stored in memory from a previous timestamp.</dd>
</di>
<di>
<dt>Identification Value</dt>
<dd>A value that can be used for identification. (Serial numbers, meter IDs, locations, names, etc.)</dd>
</di>
<di>
<dt>Localization information</dt>
<dd>Optional information for a field, allowing the sensor to control how the information should be presented to human viewers.</dd>
</di>
<di>
<dt>Meter</dt>
<dd>A device possible containing multiple sensors, used in metering applications. Examples: Electricity meter, Water Meter, Heat Meter, Cooling Meter, etc.</dd>
</di>
<di>
<dt>Momentary Value</dt>
<dd>A momentary value represents a value measured at the time of the read-out.</dd>
</di>
<di>
<dt>Node</dt>
<dd>
Graphs contain nodes and edges between nodes. In Internet of Things, sensors, actuators, meters, devices, gateways, etc., are often depicted as nodes whereas links between sensors (friendships)
are depicted as edges. In abstract terms, it's easier to talk about a Node, rather than list different possible node types (sensors, actuators, meters, devices, gateways, etc.).
Each Node has a Node ID.
</dd>
</di>
<di>
<dt>Node ID</dt>
<dd>
An ID uniquely identifying a node within its corresponding context. If a globally unique ID is desired, an architecture should be used using a universally accepted
ID scheme.
</dd>
</di>
<di>
<dt>Parameter</dt>
<dd>
Readable and/or writable property on a node/device. The XEP-0326 &xep0326; deals with reading and writing parameters
on nodes/devices. Fields are not parameters, and parameters are not fields.
</dd>
</di>
<di>
<dt>Peak Value</dt>
<dd>A maximum or minimum value during a given period.</dd>
</di>
<di>
<dt>Provisioning Server</dt>
<dd>
An application that can configure a network and provide services to users or Things. In Internet of Things, a Provisioning Server knows who knows whom,
what privileges users have, who can read what data and who can control what devices and what parts of these devices.
</dd>
</di>
<di>
<dt>Precision</dt>
<dd>
In physics, precision determines the number of digits of precision. In sensor networks however, this definition is not easily applicable. Instead, precision
determines, for example, the number of decimals of precision, or power of precision. Example: 123.200 MWh contains 3 decimals of precision. All entities parsing and
delivering field information in sensor networks should always retain the number of decimals in a message.
</dd>
</di>
<di>
<dt>Sensor</dt>
<dd>
Device measuring at least one digital value (0 or 1) or analog value (value with precision and physical unit). Examples: Temperature sensor, pressure sensor, etc.
Sensor values are reported as fields during read-out. Each sensor has a unique Node ID.
</dd>
</di>
<di>
<dt>SN</dt>
<dd>Sensor Network. A network consisting, but not limited to sensors, where transport and use of sensor data is of primary concern. A sensor network may contain actuators, network applications, monitors, services, etc.</dd>
</di>
<di>
<dt>Status Value</dt>
<dd>A value displaying status information about something.</dd>
</di>
<di>
<dt>Timestamp</dt>
<dd>Timestamp of value, when the value was sampled or recorded.</dd>
</di>
<di>
<dt>Thing</dt>
<dd>
Internet of Things basically consists of Things connected to the Internet. Things can be any device, sensor, actuator etc., that can have an
Internet connection.
</dd>
</di>
<di>
<dt>Thing Registry</dt>
<dd>
A registry where Things can register for simple and secure discovery by the owner of the Thing. The registry can also be used as a database for meta information
about Things in the network.
</dd>
</di>
<di>
<dt>Token</dt>
<dd>
A client, device or user can get a token from a provisioning server. These tokens can be included in requests to other entities in the network, so these entities can validate
access rights with the provisioning server.
</dd>
</di>
<di>
<dt>Unit</dt>
<dd>Physical unit of value. Example: MWh, l/s, etc.</dd>
</di>
<di>
<dt>Value</dt>
<dd>A field value.</dd>
</di>
<di>
<dt>Value Status</dt>
<dd>Status of field value. Contains important status information for Quality of Service purposes. Examples: Ok, Error, Warning, Time Shifted, Missing, Signed, etc.</dd>
</di>
<di>
<dt>Value Type</dt>
<dd>Can be numeric, string, boolean, Date & Time, Time Span or Enumeration.</dd>
</di>
<di>
<dt>WSN</dt>
<dd>Wireless Sensor Network, a sensor network including wireless devices.</dd>
</di>
<di>
<dt>XMPP Client</dt>
<dd>Application connected to an XMPP network, having a JID. Note that sensors, as well as applications requesting sensor data can be XMPP clients.</dd>
</di>
</dl>
</section1>
<section1topic='Use Cases'anchor='usecases'>
<p>
The life cycle of a Thing can be divided into multiple steps. The following sections will list many of these steps in possible order of occurrence during the
During production of a Thing, decisions have to be made whether the following parameters should be pre-configured, manually entered after installation or
automatically found and/or created by the device if possible (zero-configuration networking):
</p>
<ul>
<li>
Address and domain of XMPP Server.
</li>
<li>
JID of the Thing.
</li>
<li>
JID of Thing Registry, if separate from the XMPP Server.
</li>
<li>
JID of first Provisioning Server, if separate from Thing Registry or XMPP Server.
</li>
</ul>
<p>
A decision has to be made at this point if global/manufacturer/customer servers should be used, or if local resources should be searched for and used if found.
The first option is easy to configure in a production environment and might have commercial significance,
but cannot use local resources where available. The second leaves much responsibility to the Thing for finding local resources, but has the advantage of allowing for a more
decentralized network architecture. A detailed discussion of the two alternatives goes beyond the scope of this specification, and will not be presented here.
Apart from physical installation, and connection to power and communication infrastructure, the installation phase of a Thing might also require manual entry of values that
could not be set in the production environment. Since Things might have very limited human user interfaces, external tools might be required to provide this information. Due
to its complexity, any manual entry of configuration parameters should be avoided, if possible. However, manual entry of some parameters might allow for Things to use local
resources where such cannot be found nor set in a production environment.
If the address of an XMPP Server is not preconfigured, the Thing must attempt to find one in its local surroundings. This can be done using one of several methods:
</p>
<ul>
<li>DHCP</li>
<li>Multicast DNS</li>
<li>SSDP/UPnP</li>
</ul>
<p>
The following sections describe them in more detail.
DHCP offers an internal structure for advertising configuration information to clients in a network.
This includes configuration parameters and other control elements, which are transmitted in special marked data elements, called 'options', as described in
<linkurl='http://www.iana.org/assignments/bootp-dhcp-parameters/bootp-dhcp-parameters.txt'>Dynamic Host Configuration Protocol (DHCP) and Bootstrap Protocol (BOOTP) Parameters</link> lists currently assigned 'options' by IANA.
<strong>Note:</strong> There does exist no 'option' for XMPP at the moment.
Options 224 to 254 are marked as 'site-specific option range' to support local (to a site) configuration options (i.e., reserved as 'Private Use').
</p>
<p>
Possible codes for the XMPP server option:
</p>
<ul>
<li>Use 'site-specific option range'. Use of 'option-code' 224.</li>
<li>
<strong>TBD:</strong> Define and register DHCP and BOOTP option as described in <linkurl='#option'>Parameters for IoT Discovery</link>. Use of 'option-code' 84.
This option specifies the name of the XMPP server.
The name may or may not be qualified with the local domain name.
See &rfc1035; for character set restrictions.
</p>
<p>
The code for this option is 224 (for 'site-specific option range') or 84 (for <linkurl='#option'>DHCP and BOOTP Parameters for IoT Discovery</link>), and its minimum length is 1.
</p>
<examplecaption='IoT Discovery DHCP Option'>
<![CDATA[
<optioncode><datalength> machine]]>
</example>
<p>So, for example, if the machine name is "pronto", the code for the option is 224, the XMPP server option would be as follows:</p>
<p>The following parameters in use as of MONTH 201x. Refer to the DHCP and BOOTP parameters itself for a complete and current list of parameters (this specification might or might not be revised when new parameters are registered).</p>
<examplecaption='IoT Discovery DHCP and BOOTP Parameters Registry'>
A TXT record whose name is the same as the SRV record and whose value follows the format described in the <linkurl='#txt'>TXT Record</link> section of this document, consisting of a set of strings that typically represent a series of key-value pairs such as the following:
</p>
<examplecaption='TXT record'>
<![CDATA[
txtvers=1
ordom=example.com
regis=registry
provis=provisioning]]>
</example>
<p>Note: The DNS-SD specification stipulates that the TXT record MUST be published, but that it MAY contain no more than a single zero byte (e.g., if the server does not wish to publish any personal information).</p>
</li>
</ol>
<p>
For the purpose of IoT Discovery we are interested only in the "xmpp-client" service.
An XMPP server MUST publish four different kinds of DNS records to advertise its availability using the services of type "xmpp-client".
An XMPP chat client (actually its mDNS daemon) can send out multicast DNS queries for services of type "xmpp-client".
<strong>Note:</strong> the service of type "xmpp-client" is the reservered name for client-to-server connections by IANA, as described in &rfc6120;.
</p>
<p>So, for example, if the machine name is "pronto", the IP address is "10.2.1.188", and the personal information, the DNS records would be as follows:</p>
<examplecaption='IoT Discovery DNS Records Example'>
<p>The IPv4 and IPv6 addresses associated with a machine might vary depending on the local network to which the machine is connected. For example, on an Ethernet connection the physical address might be "192.168.0.100" but when the machine is connected to a wireless network the physical address might change to "10.10.1.188". See &rfc3927; for details.</p>
<p>If the machine name asserted by a client is already taken by another machine on the network, the client MUST assert a different machine name, which SHOULD be formed by adding the character "-" and digit "1" to the end of the machine name string (e.g., "pronto-1"), adding the character "-" and digit "2" if the resulting machine name is already taken (e.g., "pronto-2"), and similarly incrementing the digit until a unique machine name is constructed.</p>
<p>
<strong>Note:</strong> DNS-SD enables service definitions to include a TXT record that specifies parameters to be used in the context of the relevant service type. For detailed information refer to &xep0174; (Link-Local Messaging - TXT Record).
</p>
</section4>
<section4topic='IoT Discovery TXT Record Parameters Registry'anchor='txt'>
<p>The registration process is described in &xep0174; (Link-Local Messaging - Registration Process).</p>
<p>The following submission registers parameters in use as of MONTH 201x. Refer to the registry itself for a complete and current list of parameters (this specification might or might not be revised when new parameters are registered).</p>
<examplecaption='IoT Discovery TXT Record Parameters Registry'>
<![CDATA[
<param>
<name>ordom</name>
<desc>The "origin domain" of the XMPP service.</desc>
<status>recommended</status>
</param>
<param>
<name>regis</name>
<desc>
The username portion of the JID to Thing Registry;
can contain a space-separated list of more than one JID.
</desc>
<status>optional</status>
</param>
<param>
<name>provis</name>
<desc>
The username portion of the JID to provisioning server;
can contain a space-separated list of more than one JID.
<strong>Note:</strong> If server-less messaging is to be used, as described in &xep0174; this step can be used to find the Thing Registry and optionally the
Provisioning Server and other peers it want to connect to. The next section can thus be skipped.
Once an XMPP Server has been found, a connection can be made. If multiple XMPP Servers are found, the client is free to choose the one that best suits its purposes.
</p>
<p>
If the Thing does not have an account already, an account can be registered along what is specified in &xep0077;. If multiple servers are available, the first XMPP server that
If a Thing Registry is not preconfigured, one must be found. A Thing Registry can be hosted either as a server component using &xep0114; or as an XMPP Client accessible through
a JID. The following lists methods to obtaining the Component Address or JID for the Thing Registry. Note that the last one has <linkurl='#security'>security considerations</link>
that need to be taken into account, if implemented.
</p>
<ol>
<li>
Preconfigured Component Address of Thing Registry. A Component address is normally a subdomain to the domain of the XMPP Server that hosts the component.
</li>
<li>
Preconfigured bare JID of Thing Registry.
</li>
<li>
Preconfigured subdomain part of Component Address. This will be added to the domain of the XMPP Server used to connet to.
</li>
<li>
Preconfigured user name of JID. This will be added to the domain of the XMPP Server used to connected to.
</li>
<li>
Searching through Server Components on the XMPP Server currently connected to, as described in <linkurl='#support'>Determining Support</link>.
There are two types of tags: Tags with string values and tags with numerical values. The distinction is important, since the type of value affects how
comparisons are made later when performing searches in the registry.
</p>
<p>
The Thing should only register parameters required to be known by the owner of the Thing. Dynamic meta information must be avoided at this point.
To claim the ownership of the Thing, the owner needs to present the same meta information as registered by the Thing. Before an owner has claimed
ownership of the Thing, it will not be returned in any search results. A list of predefined meta tag names can be found in the <linkurl='#tags'>Meta Tags</link>
section below.
</p>
<p>
The Thing can register itself as many times as it wants, and the response is always empty. Only one record per resource-less JID must be created. A new
registration overrides any previous information, including meta tags previously reported but not available in the new registration. Once a Thing has been
claimed by an owner, it should not register itself again, unless it is reset and the installation process restarted.
</p>
<p>
If the Thing tries to register itself even though the Thing has already been claimed in the registry, the registry must not update any meta data in the registry, and instead
respond with the following response. When the thing receives this, it can safely extract the JID of the owner and switch its internal state to claimed.
</p>
<examplecaption='Registration response when alrady claimed'>
If a thing is self-owned, it can register itself with the Registry as normal, with the addition of setting the attribute <strong>selfOwned</strong> to <strong>true</strong>,
as is shown below. This registers the Thing directly as PUBLIC CLAIMED, with no need for an owner to claim ownership of the device. This can be useful if
installing Things that should be publically available.
A Thing might reside behind a gateway or concentrator and might not be directly connected to the XMPP network itself, as is described in &xep0326;. In these cases, there are three optional
attributes that can be used to identify the Thing behind the JID: The <strong>nodeId</strong> attribute gives the ID of the Thing (a.k.a. "Node"). The Node might reside in
specific Data Source (large systems might have multiple sources of nodes). In this case, the data source is specified in the <strong>sourceId</strong> attribute. Normally, the Node ID
is considered to be unique within the concentrator. If multiple data sources are available, the Node ID is unique within the data source. However, a third attribute allows the uniqueness
to be restricted to a given <strong>cacheType</strong>. Finally, it is the triple (<strong>nodeId</strong>, <strong>sourceId</strong>, <strong>cacheType</strong>) which guarantees
uniqueness within the concentrator.
</p>
<p>
For a Thing controlled by a concentrator to register itself in the Thing Registry, it simply adds the optional attributes <strong>nodeId</strong>, <strong>sourceId</strong>
and <strong>cacheType</strong> as appropriate to the registration request, as follows:
If the Thing behind the concentrator is self-owned, it simply adds the <strong>selfOwned</strong> attribute to the request and sets it to <strong>true</strong>.
As mentioned above, the owner of the Thing must provide the information provided by the Thing to the Registry, in order to claim ownership over it. To avoid the
possibility that somebody can guess the information, the information must necessarily be long. This creates the problem of transfer of information. One method to solve this
is through the use of QR-codes. Such codes can be either printed on a sticker and put on the Thing itself, its wrapping, or displayed on its display when not claimed.
This QR-code can then be photographed by a smart phone or tablet, decoded and the information retrieved can be used in the ownership claim call.
</p>
<p>
If QR-codes are used to transfer Thing meta data for ownership claims, it must be generated as follows: To the string "IoTDisco" is appended all meta tags in order.
Each tag name is prefixed by a semi-colon (;), and if the tag is numeric, the tag is prefixed by an additional hash sign (#). Each tag value is prefixed by a colon (:).
If the meta value contains semi-colons or back-slashes, each one is prefixed by a back-slash. When decoding the string, this allows the decoder to correctly differ
If this claim is successful, the Thing is marked as a public claimed Thing. The thing can always be removed later, but after the claim, the Thing is public. If you want to claim
a private Thing, you can add the <strong>public</strong> attribute with value <strong>false</strong> to the claim, as follows:
</p>
<examplecaption='Claim Ownership of private Thing'>
In this case, if the claim is successful, the Thing will not be made public in the Thing Registry, after the claim.
</p>
<p>
If a claim is successful, i.e. there's a Thing that has not been claimed with EXACTLY the same meta data (however, the order is not important), the Thing is marked in the
Registry as CLAIMED, and as public or private depending on the <strong>public</strong> attribute, and an empty result is returned as follows. If there's a claimed Thing with
exactly the same meta data, and the JID of the claimant (without resource) matches the JID of the claimer (without resource), a success response is also returned, containing
If the Thing that has been claimed resides behind a concentrator, the result will contain those of the attributes <strong>nodeId</strong>, <strong>sourceId</strong>
and <strong>cacheType</strong> that are required to access the Thing in calls made using &xep0323;, &xep0324;, &xep0325; and &xep0326;. The following example illustrates
a response where a Thing behind a Concentrator has been claimed:
</p>
<examplecaption='Ownership claim of a Thing behind a concentrator successful'>
If, on the other hand, no such Thing was found, or if such a Thing was found, but it is already claimed by somebody else, a failure response is returned. This response
should avoid to inform the client in detail why the claim failed, as follows:
When the Thing has been successfully claimed, the Registry sends information about this to the Thing, to inform it that it has been claimed and the resource-less JID of owner.
After receiving this information, it doesn't need to register itself with the Registry anymore.
After receiving this, the thing knows it can accept friendship requests from the corresponding owner. It can also safely send a friendship request to the owner.
</p>
<p>
<strong>Note:</strong> Meta Tag names are case insensitive. In this document, all tag names have been written using upper case letters.
After a Thing has been claimed and is registed as a PUBLIC CLAIMED Thing in the Registry, it implies the Thing is available in searches. The owner can choose to remove
the Thing from the Registry, to avoid that the Thing appears in searches. To remove a Thing from the Registry the owner simply sends a removal request to the Registry
with the resource-less JID of the Thing to remove, as follows:
If such a Thing is found and is owned by the caller, it is removed from the Registry, and an empty response is returned, to acknowledge the removal of the Thing
After successfully removing a Thing from the Registry, and if the Thing is friend to the Registry, the Registry informs the Thing it has been removed from the Registry.
It does this, so the Thing can remove the friendship and stop any meta data updates to the Registry.
</p>
<examplecaption='Thing removed from registry by owner'>
Up to this point only basic configuration and ownership and visibility of a Thing has been covered. For more advanced operations, a Thing might be required to
use a Provisioning Server to whom it can delegate trust and allow making decisions, controlling access rights and privileges for the Thing, as described in &xep0324;.
If a Provisioning Server is not preconfigured, one must be found. The following lists methods to obtaining the JID for the Provisioning Server.
</p>
<ol>
<li>
Preconfigured Component Address of Provisioning Server. A Component address is normally a subdomain to the domain of the XMPP Server that hosts the component.
</li>
<li>
Preconfigured bare JID of Provisioning Server.
</li>
<li>
Preconfigured subdomain part of Component Address. This will be added to the domain of the XMPP Server used to connet to.
</li>
<li>
Preconfigured user name of JID. This will be added to the domain of the XMPP Server used to connected to.
</li>
<li>
The Thing Registry itself can be a Provisioning Server. This can be found out by sending a discovery request to the Thing Registry,
as described in <linkurl='#support'>Determining Support</link>.
</li>
<li>
The Owner itself can be a Provisioning Server. This can be found out by sending a discovery request to the Owner,
as described in <linkurl='#support'>Determining Support</link>.
</li>
<li>
Searching through Server Components on the XMPP Server currently connected to, as described in <linkurl='#support'>Determining Support</link>.
Once a Thing has been claimed and chooses to reside as a public Thing in the registry, it can update its meta information at any time. This meta information
will be available in searches made to the registry by third parties and is considered public. However, the Thing should be connected to a provisioning server
at this point, so that correct decisions can be made regarding to friendship, readout and control requests made by parties other than the owner.
</p>
<p>
Meta information updated in this way will only overwrite tags provided in the request, and leave other tags previously reported as is. To remove a string-valued tag,
it should be updated with an empty value. It is also recommended that key meta information required to claim ownership of the Thing after a factory reset is
either removed, truncated or otherwise modified after it has been claimed so that third parties with physical access to a public Thing cannot hijack it by searching
for it, extracting its meta information from the registry, then resetting it and then claiming ownership of it.
</p>
<p>
To update meta data about itself, a Thing simply sends a request to the Thing Registry, as follows:
However, if the Thing is not found in the registry, probably because the owner has removed it from the registry, an error response is returned. When receiving
such a response, the Thing should assume it is the owner who has removed it from the registry, and that further meta data updates are not desired. The Thing
can then unfriend the registry and stop further meta data updates. The error response from the registry would look as follows:
</p>
<examplecaption='Update Meta Data request failure'>
If the Thing on the other hand is found in the Registry, but is not claimed, the registry must not update any meta data in the registry, and instead
respond with the following response. When the thing receives this, the Thing can assume it has been disowned, and perform a new registration in the Registry so
that it can be re-claimed.
</p>
<examplecaption='Update Meta Data response to request from disowned Thing'>
An owner of a thing can also update the metadata of a thing it has claimed. To do this, you simply add a <strong>jid</strong> attribute containing the JID of the thing to the
The owner can update metadata of things behind concentrators also. To do this, the corresponding attributes <strong>nodeId</strong>, <strong>sourceId</strong>
If the Thing is found in the registry and it is claimed by the sender of the current message (i.e. owner is the sender), the registry simply acknowledges the update as follows:
</p>
<examplecaption='Owner updating thing Meta Data request acknowledgement'>
But if the owner is not the sender of the current message (i.e. owner is somebody else), or if the thing is not found at all, the server must report the node as
It is possible for anyone with access to the Thing Registry to search for public Things that have been claimed, including self-owned Things. Such searches
will never return things that have not been claimed or have been removed from the registry.
</p>
<p>
A search is performed by providing one or more comparison operators in a search request to the registry. If more than one comparison operator is provided, the
search is assumed to be performed on the intersection (i.e. AND) of all operators. If the union (i.e. OR) of different conditions is desired, multiple consecutive
searches have to be performed.
</p>
<p>
The following table lists available search operators, their element names and meanings:
</p>
<tablecaption='Search operators'>
<tr>
<th>Element</th>
<th>Type</th>
<th>Operator</th>
<th>Description</th>
</tr>
<tr>
<td>strEq</td>
<td>String</td>
<td>tag = c</td>
<td>Searches for string values tags with values equal to a provided constant value.</td>
</tr>
<tr>
<td>strNEq</td>
<td>String</td>
<td>tag <> c</td>
<td>Searches for string values tags with values not equal to a provided constant value.</td>
</tr>
<tr>
<td>strGt</td>
<td>String</td>
<td>tag > c</td>
<td>Searches for string values tags with values greater than a provided constant value.</td>
</tr>
<tr>
<td>strGtEq</td>
<td>String</td>
<td>tag >= c</td>
<td>Searches for string values tags with values greater than or equal to a provided constant value.</td>
</tr>
<tr>
<td>strLt</td>
<td>String</td>
<td>tag < c</td>
<td>Searches for string values tags with values lesser than a provided constant value.</td>
</tr>
<tr>
<td>strLtEq</td>
<td>String</td>
<td>tag <= c</td>
<td>Searches for string values tags with values lesser than or equal to a provided constant value.</td>
</tr>
<tr>
<td>strRange</td>
<td>String</td>
<td>min <(=) tag <(=) max</td>
<td>Searches for string values tags with values within a specified range of values. The endpoints can be included or excluded in the search.</td>
</tr>
<tr>
<td>strNRange</td>
<td>String</td>
<td>tag <(=) min OR tag >(=) max</td>
<td>Searches for string values tags with values outside of a specified range of values. The endpoints can be included or excluded in the range (and therefore correspondingly excluded or included in the search).</td>
</tr>
<tr>
<td>strMask</td>
<td>String</td>
<td>tag LIKE c</td>
<td>Searches for string values tags with values similar to a provided constant value including wildcards.</td>
</tr>
<tr>
<td>numEq</td>
<td>Numeric</td>
<td>tag = c</td>
<td>Searches for numerical values tags with values equal to a provided constant value.</td>
</tr>
<tr>
<td>numNEq</td>
<td>Numeric</td>
<td>tag <> c</td>
<td>Searches for numerical values tags with values not equal to a provided constant value.</td>
</tr>
<tr>
<td>numGt</td>
<td>Numeric</td>
<td>tag > c</td>
<td>Searches for numerical values tags with values greater than a provided constant value.</td>
</tr>
<tr>
<td>numGtEq</td>
<td>Numeric</td>
<td>tag >= c</td>
<td>Searches for numerical values tags with values greater than or equal to a provided constant value.</td>
</tr>
<tr>
<td>numLt</td>
<td>Numeric</td>
<td>tag < c</td>
<td>Searches for numerical values tags with values lesser than a provided constant value.</td>
</tr>
<tr>
<td>numLtEq</td>
<td>Numeric</td>
<td>tag <= c</td>
<td>Searches for numerical values tags with values lesser than or equal to a provided constant value.</td>
</tr>
<tr>
<td>numRange</td>
<td>Numeric</td>
<td>min <(=) tag <(=) max</td>
<td>Searches for numerical values tags with values within a specified range of values. The endpoints can be included or excluded in the search.</td>
</tr>
<tr>
<td>numNRange</td>
<td>Numeric</td>
<td>tag <(=) min OR tag >(=) max</td>
<td>Searches for numerical values tags with values outside of a specified range of values. The endpoints can be included or excluded in the range (and therefore correspondingly excluded or included in the search).</td>
</tr>
</table>
<p>
The following example shows how a search for specific devices within a specific geographic area can be found. More precisely, it searches for a certain kind of PLC
produced by a certain manufacturer, but only versions 1.0 <= v < 2.0 and with serial numbers beginning with 39487. The PLCs must also lie within latitude 33 ad 34
degrees south and between longitude 70 and 72 west.
The <strong>offset</strong> attribute tells the registry the number of responses to skip before returning found things. It provides a mechanism to page result sets
that are too large to return in one response. the <strong>maxCount</strong> attribute contains the desired maximum number of things to return in the response. The
registry can lower this value, if it decides the requested maximum number is too large.
</p>
<p>
If tag names are not found corresponding to the names provided in the search, the result set will always be empty. There's a reserved tag named <strong>KEY</strong>
that can be used to provide information shared only between things and their owners. If a search contains an operator referencing this tag name, the result set
must also always be empty. Searches on <strong>KEY</strong> MUST never find things. Furthermore, search results must never return <strong>KEY</strong> tags.
</p>
<p>
The registry returns any things found in a response similar to the following:
If more results are available in the search (accessible by using the <strong>offset</strong> attribute in a new search), the <strong>more</strong> attribute is
present with value <strong>true</strong>.
</p>
<p>
<strong>Note:</strong> Meta Tag names are case insensitive. In this document, all tag names have been written using upper case letters.
A thing can unregister itself from the Registry. This can be done in an uninstallation procedure for instance. To unregister from the registry, it simply sends
an un-registration request to the registry as follows.
If such a Thing is found, and it is owned by the caller, but not online as a friend, the Thing cannot be disowned, since it would put the Thing in a state from which
it cannot be re-claimed. Therefore, the Thing Registry must respond in the following manner:
</p>
<examplecaption='Failure to disown Thing - Offline'>
When receiving the acknowledgement from the Thing, the Thing is set as an unclaimed Thing in the Registry. Furthermore, all tags corresponding to the Thing are removed from the
registry, and a random KEY tag is added of sufficient complexity to make sure other clients cannot claim the Thing by guessing. Finally, an empty response is returned, to
If for any reason, the Thing does not acknowledge the disowned request, or an error occurs, the Registry returns the same error as if the Thing would have been offline.
If an entity is a Thing Registry and supports the protocol specified herein, it MUST advertise that fact by returning a feature of "urn:xmpp:iot:discovery" in response
to &xep0030; information requests.
</p>
<examplecaption="Service discovery information request">
<section2topic='JID vs Component Thing Registries'anchor='jidvscomponent'>
<p>
A client must treat the connection between a Thing Registry differently if it is hosted as a client, having a JID, or if it is hosted as a Jabber Server Component.
If it is hosted as a server component, there's no need for the thing to become friends with the Thing Registry. Messages and requests can be made directly to the
server component without having to add it to the roster or request presence subscriptions. If the Thing Registry is hosted as a client, having a JID (@ in the address),
the Thing Registry must be added to the roster of the client before the client can communicate with the Thing Registry.
</p>
</section2>
<section2topic='Meta Tags'anchor='tags'>
<p>
This document does not limit the number or names of tags used by Things to register meta information about themselves. However, it provides some general limits and defines
the meaning of a few tags that must have the meanings specified herein.
</p>
<p>
The maximum length of a tag name is <strong>32</strong> characters. Tag names must not include colon (:), hash sign (#) or white space characters. String tag values
must not exceed 128 characters in length.
</p>
<p>
The following table lists predefined tag names and their corresponding meanings.
</p>
<tablecaption='Predefined tags'>
<tr>
<th>Tag Name</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>ALT</td>
<td>Numeric</td>
<td>Altitude (meters)</td>
</tr>
<tr>
<td>APT</td>
<td>String</td>
<td>Apartment associated with the Thing</td>
</tr>
<tr>
<td>AREA</td>
<td>String</td>
<td>Area associated with the Thing</td>
</tr>
<tr>
<td>BLD</td>
<td>String</td>
<td>Building associated with the Thing</td>
</tr>
<tr>
<td>CITY</td>
<td>String</td>
<td>City associated with the Thing</td>
</tr>
<tr>
<td>CLASS</td>
<td>String</td>
<td>Class of Thing</td>
</tr>
<tr>
<td>COUNTRY</td>
<td>String</td>
<td>Country associated with the Thing</td>
</tr>
<tr>
<td>KEY</td>
<td>String</td>
<td>Key, shared between thing and owner.</td>
</tr>
<tr>
<td>LAT</td>
<td>Numeric</td>
<td>Latitude (degrees)</td>
</tr>
<tr>
<td>LON</td>
<td>Numeric</td>
<td>Longitude (degrees)</td>
</tr>
<tr>
<td>MAN</td>
<td>String</td>
<td>Domain name owned by the Manufacturer</td>
</tr>
<tr>
<td>MLOC</td>
<td>String</td>
<td>Meter Location ID</td>
</tr>
<tr>
<td>MNR</td>
<td>String</td>
<td>Meter Number</td>
</tr>
<tr>
<td>MODEL</td>
<td>String</td>
<td>Name of Model</td>
</tr>
<tr>
<td>NAME</td>
<td>String</td>
<td>Name associated with the Thing</td>
</tr>
<tr>
<td>PURL</td>
<td>String</td>
<td>URL to product information for the Thing.</td>
It is up to the Thing Registry to choose which tags it persists and which tags it doesn't. To avoid the possibility of malicious reporting of tags, some limit should be
imposed on what tags are supported. As a minimum, a Thing Registry must support all predefined tags, as listed above.
</p>
<p>
<strong>Note:</strong> Meta Tag names are case insensitive. In this document, all tag names have been written using upper case letters.
In the case the Thing Registry is not the XMPP Server to which the Thing is connected, a friendship relationship between the Thing and the Thing Registry needs to be handled.
To minimize the number of concurrent friends the Thing Registry needs to maintain, a Thing must only maintain an active friendship with the registry if it needs to
communicate with the registry. This means that unless updating meta data frequently, the Thing must unfriend the Registry when done with its communication. If only
updating meta data intermittently, the friendship can be reestablished when needed, and removed when done.
The &xep0114; provides an elegant way to introduce external services as server components using a third port into the server (the first two being the client-to-server port
and the server-to-server port). But since XEP-0114 is historical, meaning it is not guaranteed to conform to v1.0 of the XMPP specification, it has some serious security
issues:
</p>
<ol>
<li>It lacks SSL/TLS support, or the starttls element to switch to TLS after connecting. This makes it possible to sniff traffic in this port.</li>
<li>It lacks SASL authentication. Instead a simple handshake is performed</li>
<li>There is no way to actually verify that the server is the server. This makes it possible to create a simple Man-in-the-middle attack.</li>
For these reasons, it is not recommended that a Thing Registry service, publishing itself as a Jabber Server Component, does so from outside of the network. Instead,
the Thing Registry should be installed on the same server or on a server in the same local area network, so that the Jabber Component protocol port is closed to the
Internet.
</p>
<p>
Since it is not guaranteed that an XMPP Server operator allows installation of third party products (such as a Thing Registry), the option to host a Thing Registry using
a normal JID is still available. It can be used in proof of concepts, etc. For scalability issues it is recommended that the Thing Registry be hosted as a Jabber Server
It might be possible for third parties to register these predefined account names, and pretend to be a Thing Registry or Provisioning Server and in this way hijack
unsuspecting Things. If installing things using this method of finding a Thing Registry or Provisioning Server, these accounts must be registered beforehand, to make
The combination of visible key meta information (perhaps in a visible QR-code) and a factory default reset button on a Thing, opens up the possibility to hijack the Thing.
To avoid this, at least one of the two should be removed after successful installation. Either the key meta information (QR-code) should be placed on the package or separate
paper and not on the thing itself, or the factory default reset button should be sealed or hidden and only accessible by licensed maintenance personell. If using an electronic
means to present the key meta information (for instance by displayed a QR-code on a display on the thing), care should be taken so that the information cannot be displayed
without breaking a seal, or other means to protect the Thing.
</p>
<p>
Regardless the above security measures, a Thing can be hijacked by a third party in the time window between successful installation of the device and until the correct owner
has claimed ownership of the device. Minimizing this time window, and using a shared secret (KEY tag) between the Thing and its owner, decreases the possibility of getting the
Care should be taken what key meta information is used to accept an ownership claim. After a successful claim, this meta information is still available in the registry,
at least until the Thing is removed from the registry. While public in the registry, the meta information can be searched and presented to third parties. Access to this
information can help third parties to hijack Things, if they can reset them to factory default settings.
</p>
<p>
To avoid this, the Thing can do three things after a successful ownership claim:
</p>
<ul>
<li>
Including a <strong>KEY</strong> tag in the key meta information. The <strong>KEY</strong> tag is not searchable nor presented in search results.
</li>
<li>
Remove, truncate or change some key meta information after a successful ownership claim. Partial information is not sufficient for a successful ownership claim.
The <strong>KEY</strong> tag is unique in that it is not searchable nor available is search results. For this reason it is ideal for providing secrets shared only
between the Thing and the owner. By providing a sufficiently long KEY value in the key meta information required to claim the Thing, guessing the information even though
the other meta information is available, will be sufficiently hard to make it practically impossible.
</p>
<p>
Even though the <strong>KEY</strong> tag is not searchable or available in search results, it should be emptied by the Thing after a successful claim, just to make sure
the key cannot be learned by looking into the database of the registry, or by some other means.
This document does not limit tag names or the number of tags that can be used by Things. This opens up the possibility of tag spam. Malicious things could fill the database
of the registry by reporting random tag names until the database is full.
</p>
<p>
To prevent such malicious attacks, the registry could limit the tags it allows to be stored in the database. The registry must however allow the storage of the predefined
tag names defined in this document. If it has a configurable list of approved tags that can be stored, or if it allows any tags is an implementation decision.
If using external services when creating QR-codes, like the Google Charts API used in this document, make sure HTTPS is used and certificates validated. If HTTP is used,
The <linkurl="#schema">protocol schema</link> needs to be added to the list of <linkurl="http://xmpp.org/resources/schemas/">XMPP protocol schemas</link>.
<section1topic='For more information'anchor='moreinfo'>
<p>
For more information, please see the following resources:
</p>
<ul>
<li>
<p>
The <linkurl='http://wiki.xmpp.org/web/Tech_pages/SensorNetworks'>Sensor Network section of the XMPP Wiki</link> contains further information about the
use of the sensor network XEPs, links to implementations, discussions, etc.
</p>
</li>
<li>
<p>
The XEP's and related projects are also available on <linkurl='https://github.com/joachimlindborg/'>github</link>, thanks to Joachim Lindborg.
</p>
</li>
<li>
<p>
A presentation giving an overview of all extensions related to Internet of Things can be found here:
Thanks to Eelco Cramer, Henrik Svedlund, Ivan Vučica, Joachim Lindborg, Joakim Eriksson, Joakim Ramberg, Johannes Hund, Karin Forsell, Kevin Smith, Lance Stout, Lars Åkerskog,