Sensor Measurement Lists (SenML) Features and VersionsUniversität Bremen TZIPostfach 330440BremenD-28359Germany+49-421-218-63921cabo@tzi.orgCoREInternet of Things (IoT)Internet of ThingsIOTdata modelThis short document updates RFC 8428, "Sensor Measurement Lists
(SenML)", by specifying the use of independently selectable "SenML
Features" and mapping them to SenML version numbers.Status of This Memo
This is an Internet Standards Track document.
This document is a product of the Internet Engineering Task Force
(IETF). It represents the consensus of the IETF community. It has
received public review and has been approved for publication by
the Internet Engineering Steering Group (IESG). Further
information on Internet Standards is available in Section 2 of
RFC 7841.
Information about the current status of this document, any
errata, and how to provide feedback on it may be obtained at
.
Copyright Notice
Copyright (c) 2021 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents
() in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with
respect to this document. Code Components extracted from this
document must include Simplified BSD License text as described in
Section 4.e of the Trust Legal Provisions and are provided without
warranty as described in the Simplified BSD License.
Table of Contents
IntroductionThe Sensor Measurement Lists (SenML) specification provides a version number that is
initially set to 10, without further specification on the way to make
use of different version numbers.The common idea of using a version number to indicate the
evolution of an interchange format generally assumes an incremental
progression of the version number as the format accretes additional
features over time. However, in the case of SenML, it is expected that
the likely evolution will be for independently selectable capability
features to be added to the basic specification that is
indicated by version number 10. To support this model, this document
repurposes the single version number accompanying a pack of SenML
records so that it is interpreted as a bitmap that indicates the set of
features a recipient would need to have implemented to be able to
process the pack.This short document specifies the use of SenML Features and maps them
to SenML version number space, updating .TerminologyThe key words "MUST", "MUST NOT",
"REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT",
"RECOMMENDED", "NOT RECOMMENDED",
"MAY", and "OPTIONAL" in this document
are to be interpreted as described in BCP 14 when, and
only when, they appear in all capitals, as shown here.Where bit arithmetic is explained, this document uses the notation
familiar from the programming language C , including the 0b prefix for binary
numbers defined in Section 5.13.2 of the C++ language standard , except that superscript
notation (example for two to the power of 64: 264) denotes
exponentiation; in the plain text version of this document, superscript
notation is rendered in paragraph text by C-incompatible surrogate
notation as seen in this example, and in display math by a crude
plain text representation, as is the sum (Sigma) sign.Feature Codes and the Version NumberThe present specification defines "SenML Features", each identified
by a "feature name" (a text string) and a "feature code" (an unsigned
integer less than 53).The specific version of a SenML pack is composed of a set of
features. The SenML version number (bver field) is then a
bitmap of these features represented as an unsigned integer,
specifically the sum of, for each feature present, two taken to the
power of the feature code of that feature ().where present(fc) is 1 if the feature with the feature code fc is
present, 0 otherwise.
(The expression 2fc can be implemented as 1 << fc in C
and related languages.)DiscussionRepresenting features as a bitmap within a number is quite
efficient as long as feature codes are sparingly allocated (see also
).Compatibility with the existing SenML version number, 10 decimal
(0b1010), requires reserving four of the least significant bit
positions for the base version as described in . There is an upper limit to the range of the
integer numbers that can be represented in all SenML representations:
practical JSON limits this to 253-1 . This means the feature codes 4 to 52 are
available, one of which is taken by the feature defined in , leaving 48 for
allocation. (The current version 10 (with all other feature codes
unset) can be visualized as
0b00000000000000000000000000000000000000000000000001010.)
For a lifetime of this scheme of several decades, approximately two
feature codes per year or fewer should be allocated. Note that less
generally applicable features can always be communicated via fields
labeled with names that end with the "_" character ("must-understand
fields"). See for details.Most representations visible to engineers working with SenML will
use decimal numbers. For instance, 26 (0b11010, 0x1a) denotes a version that adds
the "Secondary Units" feature (). This is slightly unwieldy but will be quickly
memorized in practice.As a general observation, ending up over time with dozens of
individually selectable optional extensions may lead to too many
variants of what is supported by different implementations, reducing
interoperability. So, in practice, it is still desirable to batch up
extensions that are expected to be supported together into a single
feature bit, leading to a sort of hybrid between completely
independent extensions and a linear version scheme. This is also
another reason why a space of 48 remaining feature codes should
suffice for a while.Updating Section 4.4 of RFC 8428The last paragraph of may be read to give the impression
that SenML version numbers are totally ordered, i.e., that an
implementation that understands version n also always understands all
versions k < n. If this ever was true for SenML versions before
10, it certainly is no longer true with this specification.Any SenML pack that sets feature bits beyond the first four will
lead to a version number that actually is greater than 10, so the
requirement in will prevent false
interoperability with version 10 implementations.Implementations that do implement feature bits beyond the first four,
i.e., versions greater than 10, will instead need to perform a bitwise
comparison of the feature bitmap as described in this specification
and ensure that all features indicated are understood before using the
pack.
For example, an implementation that implements basic SenML (version number
10) plus only a future feature code 5 will accept version number 42,
but it would not be able to work with a pack indicating version number
26 (base specification plus feature code 4).
(If the implementation requires feature code 5 without being
backwards compatible, it will accept 42, but not 10.)Features: Reserved0, Reserved1, Reserved2, Reserved3For SenML version 10 as described in , the feature codes 0 to 3 are already in use.
Reserved1 (1) and Reserved3 (3) are always present, and the features
Reserved0 (0) and Reserved2 (2) are always absent, i.e., the four
least significant bits set to 0b1010 indicate a version number of 10 if
no other feature is in use. These four reserved feature codes are not
to be used with any more specific semantics except in a specification
that updates the present specification. (Note that Reserved0 and
Reserved2 could be used in such a specification in a way similar to that
of feature codes 4 to 52 in the present specification.)Feature: Secondary UnitsThe feature "Secondary Units" (code number 4) indicates that
secondary unit names MAY be used in the "u" field of SenML records in addition
to the primary unit names already allowed by .Note that the most basic use of this feature simply sets the SenML
version number to 26 (10 + 24).Security ConsiderationsThe security considerations of apply.
This specification provides structure to the interpretation of the
SenML version number, which poses no additional security
considerations except for some potential for surprise that version
numbers do not simply increase linearly.IANA ConsiderationsIANA has created a new ""
subregistry within the "Sensor Measurement Lists (SenML)" registry with the registration policy
"Specification Required" and
the columns:
Feature Code (an unsigned integer less than 53)
Feature Name (text)
Reference
To facilitate the use of feature names in programs, the designated
expert is requested to ensure that feature names are usable as
identifiers in most programming languages, after lowercasing the feature
name in the registry entry and replacing blank space with underscores or
hyphens, and that they also are distinct in this form.The initial content of this registry is as follows:
Features Defined for SenML at the Time of Writing
Feature Code
Feature Name
Reference
0
Reserved0
[RFC9100]
1
Reserved1
[RFC9100]
2
Reserved2
[RFC9100]
3
Reserved3
[RFC9100]
4
Secondary Units
[RFC9100]
As the number of features that can be registered has a hard limit (48
codes left at the time of writing), the designated expert is
specifically instructed to maintain a frugal regime of code point
allocation, keeping code points available for SenML Features that are
likely to be useful for non-trivial subsets of the SenML ecosystem.
Quantitatively, the expert could, for instance, steer the allocation to
a target of not allocating more than 10% of the remaining set per year.Where the specification of the feature code is provided in a document
that is separate from the specification of the feature itself (as with
feature code 4 above), both specifications should be listed.ReferencesNormative ReferencesInformation technology - Programming languages - CInternational Organization for StandardizationProgramming languages - C++International Organization for StandardizationSensor Measurement Lists (SenML)IANAKey words for use in RFCs to Indicate Requirement LevelsIn many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.Guidelines for Writing an IANA Considerations Section in RFCsMany protocols make use of points of extensibility that use constants to identify various protocol parameters. To ensure that the values in these fields do not have conflicting uses and to promote interoperability, their allocations are often coordinated by a central record keeper. For IETF protocols, that role is filled by the Internet Assigned Numbers Authority (IANA).To make assignments in a given registry prudently, guidance describing the conditions under which new values should be assigned, as well as when and how modifications to existing values can be made, is needed. This document defines a framework for the documentation of these guidelines by specification authors, in order to assure that the provided guidance for the IANA Considerations is clear and addresses the various issues that are likely in the operation of a registry.This is the third edition of this document; it obsoletes RFC 5226.Ambiguity of Uppercase vs Lowercase in RFC 2119 Key WordsRFC 2119 specifies common key words that may be used in protocol specifications. This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the defined special meanings.Sensor Measurement Lists (SenML)This specification defines a format for representing simple sensor measurements and device parameters in Sensor Measurement Lists (SenML). Representations are defined in JavaScript Object Notation (JSON), Concise Binary Object Representation (CBOR), Extensible Markup Language (XML), and Efficient XML Interchange (EXI), which share the common SenML data model. A simple sensor, such as a temperature sensor, could use one of these media types in protocols such as HTTP or the Constrained Application Protocol (CoAP) to transport the measurements of the sensor or to be configured.Additional Units for Sensor Measurement Lists (SenML)The Sensor Measurement Lists (SenML) media type supports the indication of units for a quantity represented. This short document registers a number of additional unit names in the IANA registry for units in SenML. It also defines a registry for secondary units that cannot be in SenML's main registry, as they are derived by linear transformation from units already in that registry.Informative ReferencesThe I-JSON Message FormatI-JSON (short for "Internet JSON") is a restricted profile of JSON designed to maximize interoperability and increase confidence that software can process it successfully with predictable results.Acknowledgements proposed to use the version number
as a bitmap and provided further input on this specification. helped clarify the document by providing a
review and acted as Document Shepherd. provided a detailed GENART
review with directly implementable text suggestions that now form part
of this specification. supplied
comments, one of which became the last paragraph of ; helped with .
Additional thanks go to the other IESG reviewers.Author's AddressUniversität Bremen TZIPostfach 330440BremenD-28359Germany+49-421-218-63921cabo@tzi.org