idnits 2.17.1 draft-ietf-core-resource-directory-14.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- == There are 1 instance of lines with multicast IPv4 addresses in the document. If these are generic example addresses, they should be changed to use the 233.252.0.x range defined in RFC 5771 == There are 5 instances of lines with non-RFC3849-compliant IPv6 addresses in the document. If these are example addresses, they should be changed. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Line 418 has weird spacing: '... target o----...' == Line 420 has weird spacing: '...--o rel o...' == Line 470 has weird spacing: '... base o---+...' == Line 484 has weird spacing: '...o href o----...' == Line 488 has weird spacing: '... o ep o---...' == (3 more instances...) == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'SHOULD not' in this paragraph: The commissioning tool SHOULD not send any target attributes with the links to the registration resources, and the resource directory SHOULD reject registrations that contain links with unprocessable attributes. -- The document date (July 02, 2018) is 2124 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Unused Reference: 'I-D.arkko-core-dev-urn' is defined on line 2850, but no explicit reference was found in the text == Unused Reference: 'RFC2616' is defined on line 2878, but no explicit reference was found in the text ** Obsolete normative reference: RFC 5988 (Obsoleted by RFC 8288) == Outdated reference: A later version (-02) exists of draft-bormann-t2trg-rel-impl-00 == Outdated reference: A later version (-46) exists of draft-ietf-ace-oauth-authz-12 == Outdated reference: A later version (-45) exists of draft-ietf-anima-bootstrapping-keyinfra-16 == Outdated reference: A later version (-09) exists of draft-silverajan-core-coap-protocol-negotiation-08 -- Obsolete informational reference (is this intentional?): RFC 2616 (Obsoleted by RFC 7230, RFC 7231, RFC 7232, RFC 7233, RFC 7234, RFC 7235) -- Obsolete informational reference (is this intentional?): RFC 7230 (Obsoleted by RFC 9110, RFC 9112) Summary: 1 error (**), 0 flaws (~~), 16 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 CoRE Z. Shelby 3 Internet-Draft ARM 4 Intended status: Standards Track M. Koster 5 Expires: January 3, 2019 SmartThings 6 C. Bormann 7 Universitaet Bremen TZI 8 P. van der Stok 9 consultant 10 C. Amsuess, Ed. 11 July 02, 2018 13 CoRE Resource Directory 14 draft-ietf-core-resource-directory-14 16 Abstract 18 In many M2M applications, direct discovery of resources is not 19 practical due to sleeping nodes, disperse networks, or networks where 20 multicast traffic is inefficient. These problems can be solved by 21 employing an entity called a Resource Directory (RD), which hosts 22 descriptions of resources held on other servers, allowing lookups to 23 be performed for those resources. This document specifies the web 24 interfaces that a Resource Directory supports in order for web 25 servers to discover the RD and to register, maintain, lookup and 26 remove resource descriptions. Furthermore, new link attributes 27 useful in conjunction with an RD are defined. 29 Status of This Memo 31 This Internet-Draft is submitted in full conformance with the 32 provisions of BCP 78 and BCP 79. 34 Internet-Drafts are working documents of the Internet Engineering 35 Task Force (IETF). Note that other groups may also distribute 36 working documents as Internet-Drafts. The list of current Internet- 37 Drafts is at https://datatracker.ietf.org/drafts/current/. 39 Internet-Drafts are draft documents valid for a maximum of six months 40 and may be updated, replaced, or obsoleted by other documents at any 41 time. It is inappropriate to use Internet-Drafts as reference 42 material or to cite them other than as "work in progress." 44 This Internet-Draft will expire on January 3, 2019. 46 Copyright Notice 48 Copyright (c) 2018 IETF Trust and the persons identified as the 49 document authors. All rights reserved. 51 This document is subject to BCP 78 and the IETF Trust's Legal 52 Provisions Relating to IETF Documents 53 (https://trustee.ietf.org/license-info) in effect on the date of 54 publication of this document. Please review these documents 55 carefully, as they describe your rights and restrictions with respect 56 to this document. Code Components extracted from this document must 57 include Simplified BSD License text as described in Section 4.e of 58 the Trust Legal Provisions and are provided without warranty as 59 described in the Simplified BSD License. 61 Table of Contents 63 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 64 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 4 65 3. Architecture and Use Cases . . . . . . . . . . . . . . . . . 7 66 3.1. Principles . . . . . . . . . . . . . . . . . . . . . . . 7 67 3.2. Architecture . . . . . . . . . . . . . . . . . . . . . . 7 68 3.3. RD Content Model . . . . . . . . . . . . . . . . . . . . 9 69 3.4. Use Case: Cellular M2M . . . . . . . . . . . . . . . . . 13 70 3.5. Use Case: Home and Building Automation . . . . . . . . . 14 71 3.6. Use Case: Link Catalogues . . . . . . . . . . . . . . . . 14 72 4. Finding a Resource Directory . . . . . . . . . . . . . . . . 15 73 4.1. Resource Directory Address Option (RDAO) . . . . . . . . 17 74 5. Resource Directory . . . . . . . . . . . . . . . . . . . . . 18 75 5.1. Payload Content Formats . . . . . . . . . . . . . . . . . 19 76 5.2. URI Discovery . . . . . . . . . . . . . . . . . . . . . . 19 77 5.3. Registration . . . . . . . . . . . . . . . . . . . . . . 22 78 5.3.1. Simple Registration . . . . . . . . . . . . . . . . . 27 79 5.3.2. Third-party registration . . . . . . . . . . . . . . 29 80 6. RD Groups . . . . . . . . . . . . . . . . . . . . . . . . . . 30 81 6.1. Register a Group . . . . . . . . . . . . . . . . . . . . 30 82 6.2. Group Removal . . . . . . . . . . . . . . . . . . . . . . 32 83 7. RD Lookup . . . . . . . . . . . . . . . . . . . . . . . . . . 33 84 7.1. Resource lookup . . . . . . . . . . . . . . . . . . . . . 33 85 7.2. Lookup filtering . . . . . . . . . . . . . . . . . . . . 34 86 7.3. Resource lookup examples . . . . . . . . . . . . . . . . 36 87 8. Security Considerations . . . . . . . . . . . . . . . . . . . 39 88 8.1. Endpoint Identification and Authentication . . . . . . . 39 89 8.2. Access Control . . . . . . . . . . . . . . . . . . . . . 40 90 8.3. Denial of Service Attacks . . . . . . . . . . . . . . . . 40 91 9. Authorization Server example . . . . . . . . . . . . . . . . 40 92 9.1. Registree-ep registers with RD . . . . . . . . . . . . . 42 93 9.2. Third party Commissioning Tool (CT) registers registree- 94 ep with RD. . . . . . . . . . . . . . . . . . . . . . . . 42 95 9.3. Updating multiple links . . . . . . . . . . . . . . . . . 43 96 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 43 97 10.1. Resource Types . . . . . . . . . . . . . . . . . . . . . 43 98 10.2. IPv6 ND Resource Directory Address Option . . . . . . . 44 99 10.3. RD Parameter Registry . . . . . . . . . . . . . . . . . 44 100 10.3.1. Full description of the "Endpoint Type" Registration 101 Parameter . . . . . . . . . . . . . . . . . . . . . 46 102 10.4. "Endpoint Type" (et=) RD Parameter values . . . . . . . 46 103 10.5. Multicast Address Registration . . . . . . . . . . . . . 47 104 10.6. CBOR Web Token claims . . . . . . . . . . . . . . . . . 47 105 11. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 48 106 11.1. Lighting Installation . . . . . . . . . . . . . . . . . 48 107 11.1.1. Installation Characteristics . . . . . . . . . . . . 49 108 11.1.2. RD entries . . . . . . . . . . . . . . . . . . . . . 50 109 11.2. OMA Lightweight M2M (LWM2M) Example . . . . . . . . . . 52 110 11.2.1. The LWM2M Object Model . . . . . . . . . . . . . . . 53 111 11.2.2. LWM2M Register Endpoint . . . . . . . . . . . . . . 54 112 11.2.3. LWM2M Update Endpoint Registration . . . . . . . . . 56 113 11.2.4. LWM2M De-Register Endpoint . . . . . . . . . . . . . 56 114 12. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 56 115 13. Changelog . . . . . . . . . . . . . . . . . . . . . . . . . . 56 116 14. References . . . . . . . . . . . . . . . . . . . . . . . . . 62 117 14.1. Normative References . . . . . . . . . . . . . . . . . . 63 118 14.2. Informative References . . . . . . . . . . . . . . . . . 63 119 Appendix A. Registration Management . . . . . . . . . . . . . . 65 120 A.1. Registration Update . . . . . . . . . . . . . . . . . . . 66 121 A.2. Registration Removal . . . . . . . . . . . . . . . . . . 69 122 A.3. Read Endpoint Links . . . . . . . . . . . . . . . . . . . 70 123 A.4. Update Endpoint Links . . . . . . . . . . . . . . . . . . 71 124 A.5. Endpoint and group lookup . . . . . . . . . . . . . . . . 71 125 Appendix B. Web links and the Resource Directory . . . . . . . . 73 126 B.1. A simple example . . . . . . . . . . . . . . . . . . . . 73 127 B.1.1. Resolving the URIs . . . . . . . . . . . . . . . . . 73 128 B.1.2. Interpreting attributes and relations . . . . . . . . 74 129 B.2. A slightly more complex example . . . . . . . . . . . . . 74 130 B.3. Enter the Resource Directory . . . . . . . . . . . . . . 75 131 B.4. A note on differences between link-format and Link 132 headers . . . . . . . . . . . . . . . . . . . . . . . . . 76 133 Appendix C. Syntax examples for Protocol Negotiation . . . . . . 77 134 Appendix D. Modernized Link Format parsing . . . . . . . . . . . 78 135 D.1. For endpoint developers . . . . . . . . . . . . . . . . . 79 136 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 79 138 1. Introduction 140 The work on Constrained RESTful Environments (CoRE) aims at realizing 141 the REST architecture in a suitable form for the most constrained 142 nodes (e.g., 8-bit microcontrollers with limited RAM and ROM) and 143 networks (e.g. 6LoWPAN). CoRE is aimed at machine-to-machine (M2M) 144 applications such as smart energy and building automation. 146 The discovery of resources offered by a constrained server is very 147 important in machine-to-machine applications where there are no 148 humans in the loop and static interfaces result in fragility. The 149 discovery of resources provided by an HTTP Web Server is typically 150 called Web Linking [RFC5988]. The use of Web Linking for the 151 description and discovery of resources hosted by constrained web 152 servers is specified by the CoRE Link Format [RFC6690]. However, 153 [RFC6690] only describes how to discover resources from the web 154 server that hosts them by querying "/.well-known/core". In many M2M 155 scenarios, direct discovery of resources is not practical due to 156 sleeping nodes, disperse networks, or networks where multicast 157 traffic is inefficient. These problems can be solved by employing an 158 entity called a Resource Directory (RD), which hosts descriptions of 159 resources held on other servers, allowing lookups to be performed for 160 those resources. 162 This document specifies the web interfaces that a Resource Directory 163 supports in order for web servers to discover the RD and to register, 164 maintain, lookup and remove resource descriptions. Furthermore, new 165 link attributes useful in conjunction with a Resource Directory are 166 defined. Although the examples in this document show the use of 167 these interfaces with CoAP [RFC7252], they can be applied in an 168 equivalent manner to HTTP [RFC7230]. 170 2. Terminology 172 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 173 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 174 "OPTIONAL" in this document are to be interpreted as described in 175 [RFC2119]. The term "byte" is used in its now customary sense as a 176 synonym for "octet". 178 This specification requires readers to be familiar with all the terms 179 and concepts that are discussed in [RFC3986], [RFC5988] and 180 [RFC6690]. Readers should also be familiar with the terms and 181 concepts discussed in [RFC7252]. To describe the REST interfaces 182 defined in this specification, the URI Template format is used 183 [RFC6570]. 185 This specification makes use of the following additional terminology: 187 resolve against 188 The expression "a URI-reference is _resolved against_ a base URI" 189 is used to describe the process of [RFC3986] Section 5.2. 190 Noteworthy corner cases are that resolving an absolute URI against 191 any base URI gives the original URI, and that resolving an empty 192 URI reference gives the base URI. 194 Resource Directory 195 A web entity that stores information about web resources and 196 implements the REST interfaces defined in this specification for 197 registration and lookup of those resources. 199 Sector 200 In the context of a Resource Directory, a sector is a logical 201 grouping of endpoints. 203 The abbreviation "d" is used for the sector in query parameters 204 for compatibility with deployed implementations. 206 Group 207 A group in the Resource Directory specifies a set of endpoints 208 that are enabled with the same multicast address for the purpose 209 of efficient group communications. All groups within a sector 210 have unique names. 212 Endpoint 213 Endpoint (EP) is a term used to describe a web server or client in 214 [RFC7252]. In the context of this specification an endpoint is 215 used to describe a web server that registers resources to the 216 Resource Directory. An endpoint is identified by its endpoint 217 name, which is included during registration, and has a unique name 218 within the associated sector of the registration. 220 Registration Base URI 221 The Base URI of a Registration is a URI that typically gives 222 scheme and authority information about an Endpoint. The 223 Registration Base URI is provided by the Endpoint at registration 224 time, and is used by the Resource Directory to resolve relative 225 references inside the registration into absolute URIs. 227 Target 228 The target of a link is the destination address (URI) of the link. 229 It is sometimes identified with "href=", or displayed as 230 "". Relative targets need resolving with respect to the 231 Base URI (section 5.2 of [RFC3986]). 233 This use of the term Target is consistent with [RFC8288]'s use of 234 the term. 236 Context 237 The context of a link is the source address (URI) of the link, and 238 describes which resource is linked to the target. A link's 239 context is made explicit in serialized links as the "anchor=" 240 attribute. 242 This use of the term Context is consistent with [RFC8288]'s use of 243 the term. 245 Directory Resource 246 A resource in the Resource Directory (RD) containing registration 247 resources. 249 Group Resource 250 A resource in the RD containing registration resources of the 251 Endpoints that form a group. 253 Registration Resource 254 A resource in the RD that contains information about an Endpoint 255 and its links. 257 Commissioning Tool 258 Commissioning Tool (CT) is a device that assists during the 259 installation of the network by assigning values to parameters, 260 naming endpoints and groups, or adapting the installation to the 261 needs of the applications. 263 Registree-ep 264 Registree-ep is the endpoint that is registered into the RD. The 265 registree-ep can register itself, or a CT registers the registree- 266 ep. 268 RDAO 269 Resource Directory Address Option. 271 For several operations, interface descriptions are given in list 272 form; those describe the operation participants, request codes, URIs, 273 content formats and outcomes. Those templates contain normative 274 content in their Interaction, Method, URI Template and URI Template 275 Variables sections as well as the details of the Success condition. 276 The additional sections on options like Content-Format and on Failure 277 codes give typical cases that the implementing parties should be 278 prepared to deal with. Those serve to illustrate the typical 279 responses to readers who are not yet familiar with all the details of 280 CoAP based interfaces; they do not limit what a server may respond 281 under atypical circumstances. 283 3. Architecture and Use Cases 285 3.1. Principles 287 The Resource Directory is primarily a tool to make discovery 288 operations more efficient than querying /.well-known/core on all 289 connected device, or across boundaries that would be limiting those 290 operations. 292 It provides a cache (in the high-level sense, not as defined in 293 [RFC7252]/[RFC2616]) of data that could otherwise only be obtained by 294 directly querying the /.well-known/core resource on the target 295 device, or by accessing those resources with a multicast request. 297 From that, it follows that only information should be stored in the 298 resource directory that is discovered from querying the described 299 device's /.well-known/core resource directly. 301 It also follows that data in the resource directory can only be 302 provided by the device whose descriptions are cached or a dedicated 303 Commissioning Tool (CT). These CTs are thought to act on behalf of 304 agents too constrained, or generally unable, to present that 305 information themselves. No other client can modify data in the 306 resource directory. Changes in the Resource Directory do not 307 propagate automatically back to the web server from where the links 308 originated. 310 3.2. Architecture 312 The resource directory architecture is illustrated in Figure 1. A 313 Resource Directory (RD) is used as a repository for Web Links 314 [RFC5988] about resources hosted on other web servers, which are 315 called endpoints (EP). An endpoint is a web server associated with a 316 scheme, IP address and port. A physical node may host one or more 317 endpoints. The RD implements a set of REST interfaces for endpoints 318 to register and maintain sets of Web Links (called resource directory 319 registration entries), and for clients to lookup resources from the 320 RD or maintain groups. Endpoints themselves can also act as clients. 321 An RD can be logically segmented by the use of Sectors. The set of 322 endpoints grouped for group communication can be defined by the RD or 323 configured by a Commissioning Tool. This information hierarchy is 324 shown in Figure 2. 326 A mechanism to discover an RD using CoRE Link Format [RFC6690] is 327 defined. 329 Endpoints proactively register and maintain resource directory 330 registration entries on the RD, which are soft state and need to be 331 periodically refreshed. 333 An endpoint uses specific interfaces to register, update and remove a 334 resource directory registration entry. It is also possible for an RD 335 to fetch Web Links from endpoints and add them as resource directory 336 registration entries. 338 At the first registration of a set of entries, a "registration 339 resource" is created, the location of which is returned to the 340 registering endpoint. The registering endpoint uses this 341 registration resource to manage the contents of registration entries. 343 A lookup interface for discovering any of the Web Links held in the 344 RD is provided using the CoRE Link Format. 346 Registration Lookup, Group 347 Interface Interfaces 348 +----+ | | 349 | EP |---- | | 350 +----+ ---- | | 351 --|- +------+ | 352 +----+ | ----| | | +--------+ 353 | EP | ---------|-----| RD |----|-----| Client | 354 +----+ | ----| | | +--------+ 355 --|- +------+ | 356 +----+ ---- | | 357 | EP |---- | | 358 +----+ 360 Figure 1: The resource directory architecture. 362 +------------+ 363 | Group | <-- Name, Scheme, IP, Port 364 +------------+ 365 | 366 | 367 +------------+ 368 | Endpoint | <-- Name, Scheme, IP, Port 369 +------------+ 370 | 371 | 372 +------------+ 373 | Resource | <-- Target, Parameters 374 +------------+ 376 Figure 2: The resource directory information hierarchy. 378 3.3. RD Content Model 380 The Entity-Relationship (ER) models shown in Figure 3 and Figure 4 381 model the contents of /.well-known/core and the resource directory 382 respectively, with entity-relationship diagrams [ER]. Entities 383 (rectangles) are used for concepts that exist independently. 384 Attributes (ovals) are used for concepts that exist only in 385 connection with a related entity. Relations (diamonds) give a 386 semantic meaning to the relation between entities. Numbers specify 387 the cardinality of the relations. 389 Some of the attribute values are URIs. Those values are always full 390 URIs and never relative references in the information model. They 391 can, however, be expressed as relative references in serializations, 392 and often are. 394 These models provide an abstract view of the information expressed in 395 link-format documents and a Resource Directory. They cover the 396 concepts, but not necessarily all details of an RD's operation; they 397 are meant to give an overview, and not be a template for 398 implementations. 400 +----------------------+ 401 | /.well-known/core | 402 +----------------------+ 403 | 404 | 1 405 ////////\\\\\\\ 406 < contains > 407 \\\\\\\\/////// 408 | 409 | 0+ 410 +--------------------+ 411 | link | 412 +--------------------+ 413 | 414 | 1 oooooooo 415 +-----o target o 416 | oooooooo 417 oooooooooooo 0+ | 418 o target o--------+ 419 o attribute o | 0+ oooooo 420 oooooooooooo +-----o rel o 421 | oooooo 422 | 423 | 1 ooooooooo 424 +-----o context o 425 ooooooooo 427 Figure 3: E-R Model of the content of /.well-known/core 429 The model shown in Figure 3 models the contents of /.well-known/core 430 which contains: 432 o a set of links belonging to the hosting web server 434 The web server is free to choose links it deems appropriate to be 435 exposed in its ".well-known/core". Typically, the links describe 436 resources that are served by the host, but the set can also contain 437 links to resources on other servers (see examples in [RFC6690] page 438 14). The set does not necessarily contain links to all resources 439 served by the host. 441 A link has the following attributes (see [RFC5988]): 443 o Zero or more link relations: They describe relations between the 444 link context and the link target. 446 In link-format serialization, they are expressed as space- 447 separated values in the "rel" attribute, and default to "hosts". 449 o A link context URI: It defines the source of the relation, eg. 450 _who_ "hosts" something. 452 In link-format serialization, it is expressed in the "anchor" 453 attribute. It defaults to that document's URI. 455 o A link target URI: It defines the destination of the relation (eg. 456 _what_ is hosted), and is the topic of all target attributes. 458 In link-format serialization, it is expressed between angular 459 brackets, and sometimes called the "href". 461 o Other target attributes (eg. resource type (rt), interface (if), 462 or content-type (ct)). These provide additional information about 463 the target URI. 465 +----------------------+ 1 ooooooo 466 | resource-directory | +--o href o 467 +----------------------+ | ooooooo 468 | 1 | 469 | oooooooooo 0-1 | 1 oooooo 470 | o base o---+ | +------o gp o 471 | ooooooooooo | | | oooooo 472 | | | | 473 //////\\\\ 0+ +--------+ 0-1 ooooo 474 < contains >----------------| group |------o d o 475 \\\\\///// +--------+ ooooo 476 | | 0+ 477 0+ | | 478 ooooooo 1 +---------------+ 1+ ///////\\\\\\ 479 o base o-------| registration |---------< composed of > 480 ooooooo +---------------+ \\\\\\\////// 481 | | 1 482 | +--------------+ 483 oooooooo 1 | | 484 o href o----+ /////\\\\ 485 oooooooo | < contains > 486 | \\\\\///// 487 oooooooo 1 | | 488 o ep o----+ | 0+ 489 oooooooo | +------------------+ 490 | | link | 491 oooooooo 0-1 | +------------------+ 492 o d o----+ | 493 oooooooo | | 1 oooooooo 494 | +-----o target o 495 oooooooo 1 | | oooooooo 496 o lt o----+ ooooooooooo 0+ | 497 oooooooo | o target o-----+ 498 | o attribute o | 0+ oooooo 499 ooooooooooo 0+ | ooooooooooo +-----o rel o 500 o endpoint o----+ | oooooo 501 o attribute o | 502 ooooooooooo | 1 ooooooooo 503 +----o context o 504 ooooooooo 506 Figure 4: E-R Model of the content of the Resource Directory 508 The model shown in Figure 4 models the contents of the resource 509 directory which contains in addition to /.well-known/core: 511 o 0 to n Registration (entries) of endpoints, 512 o 0 or more Groups 514 A Group has: 516 o a group name ("gp"), 518 o optionally a sector (abbreviated "d" for historical reasons), 520 o a group resource location inside the RD ("href"), 522 o zero or one multicast addresses expressed as a base URI ("base"), 524 o and is composed of zero or more registrations (endpoints). 526 A registration is associated with one endpoint. A registration can 527 be part of 0 or more Groups . A registration defines a set of links 528 as defined for /.well-known/core. A Registration has six types of 529 attributes: 531 o a unique endpoint name ("ep") 533 o a Registration Base URI ("base", a URI typically describing the 534 scheme://authority part) 536 o a lifetime ("lt"), 538 o a registration resource location inside the RD ("href"), 540 o optionally a sector ("d") 542 o optional additional endpoint attributes (from Section 10.3) 544 The cardinality of "base" is currently 1; future documents are 545 invited to extend the RD specification to support multiple values 546 (eg. [I-D.silverajan-core-coap-protocol-negotiation]). Its value is 547 used as a Base URI when resolving URIs in the links contained in the 548 endpoint. 550 Links are modelled as they are in Figure 3. 552 3.4. Use Case: Cellular M2M 554 Over the last few years, mobile operators around the world have 555 focused on development of M2M solutions in order to expand the 556 business to the new type of users: machines. The machines are 557 connected directly to a mobile network using an appropriate embedded 558 wireless interface (GSM/GPRS, WCDMA, LTE) or via a gateway providing 559 short and wide range wireless interfaces. From the system design 560 point of view, the ambition is to design horizontal solutions that 561 can enable utilization of machines in different applications 562 depending on their current availability and capabilities as well as 563 application requirements, thus avoiding silo like solutions. One of 564 the crucial enablers of such design is the ability to discover 565 resources (machines -- endpoints) capable of providing required 566 information at a given time or acting on instructions from the end 567 users. 569 Imagine a scenario where endpoints installed on vehicles enable 570 tracking of the position of these vehicles for fleet management 571 purposes and allow monitoring of environment parameters. During the 572 boot-up process endpoints register with a Resource Directory, which 573 is hosted by the mobile operator or somewhere in the cloud. 574 Periodically, these endpoints update their registration and may 575 modify resources they offer. 577 When endpoints are not always connected, for example because they 578 enter a sleep mode, a remote server is usually used to provide proxy 579 access to the endpoints. Mobile apps or web applications for 580 environment monitoring contact the RD, look up the endpoints capable 581 of providing information about the environment using an appropriate 582 set of link parameters, obtain information on how to contact them 583 (URLs of the proxy server), and then initiate interaction to obtain 584 information that is finally processed, displayed on the screen and 585 usually stored in a database. Similarly, fleet management systems 586 provide the appropriate link parameters to the RD to look up for EPs 587 deployed on the vehicles the application is responsible for. 589 3.5. Use Case: Home and Building Automation 591 Home and commercial building automation systems can benefit from the 592 use of M2M web services. The discovery requirements of these 593 applications are demanding. Home automation usually relies on run- 594 time discovery to commission the system, whereas in building 595 automation a combination of professional commissioning and run-time 596 discovery is used. Both home and building automation involve peer- 597 to-peer interactions between endpoints, and involve battery-powered 598 sleeping devices. 600 3.6. Use Case: Link Catalogues 602 Resources may be shared through data brokers that have no knowledge 603 beforehand of who is going to consume the data. Resource Directory 604 can be used to hold links about resources and services hosted 605 anywhere to make them discoverable by a general class of 606 applications. 608 For example, environmental and weather sensors that generate data for 609 public consumption may provide the data to an intermediary server, or 610 broker. Sensor data are published to the intermediary upon changes 611 or at regular intervals. Descriptions of the sensors that resolve to 612 links to sensor data may be published to a Resource Directory. 613 Applications wishing to consume the data can use RD Lookup to 614 discover and resolve links to the desired resources and endpoints. 615 The Resource Directory service need not be coupled with the data 616 intermediary service. Mapping of Resource Directories to data 617 intermediaries may be many-to-many. 619 Metadata in web link formats like [RFC6690] are supplied by Resource 620 Directories, which may be internally stored as triples, or relation/ 621 attribute pairs providing metadata about resource links. External 622 catalogues that are represented in other formats may be converted to 623 common web linking formats for storage and access by Resource 624 Directories. Since it is common practice for these to be URN 625 encoded, simple and lossless structural transforms should generally 626 be sufficient to store external metadata in Resource Directories. 628 The additional features of Resource Directory allow sectors to be 629 defined to enable access to a particular set of resources from 630 particular applications. This provides isolation and protection of 631 sensitive data when needed. Groups may be defined to support 632 efficient data transport. 634 4. Finding a Resource Directory 636 A (re-)starting device may want to find one or more resource 637 directories to make itself known with. 639 The device may be pre-configured to exercise specific mechanisms for 640 finding the resource directory: 642 1. It may be configured with a specific IP address for the RD. That 643 IP address may also be an anycast address, allowing the network 644 to forward RD requests to an RD that is topologically close; each 645 target network environment in which some of these preconfigured 646 nodes are to be brought up is then configured with a route for 647 this anycast address that leads to an appropriate RD. (Instead 648 of using an anycast address, a multicast address can also be 649 preconfigured. The RD servers then need to configure one of 650 their interfaces with this multicast address.) 652 2. It may be configured with a DNS name for the RD and a resource- 653 record type to look up under this name; it can find a DNS server 654 to perform the lookup using the usual mechanisms for finding DNS 655 servers. 657 3. It may be configured to use a service discovery mechanism such as 658 DNS-SD [RFC6763]. The present specification suggests configuring 659 the service with name rd._sub._coap._udp, preferably within the 660 domain of the querying nodes. 662 For cases where the device is not specifically configured with a way 663 to find a resource directory, the network may want to provide a 664 suitable default. 666 1. If the address configuration of the network is performed via 667 SLAAC, this is provided by the RDAO option Section 4.1. 669 2. If the address configuration of the network is performed via 670 DHCP, this could be provided via a DHCP option (no such option is 671 defined at the time of writing). 673 Finally, if neither the device nor the network offers any specific 674 configuration, the device may want to employ heuristics to find a 675 suitable resource directory. 677 The present specification does not fully define these heuristics, but 678 suggests a number of candidates: 680 1. In a 6LoWPAN, just assume the Border Router (6LBR) can act as a 681 resource directory (using the ABRO option to find that 682 [RFC6775]). Confirmation can be obtained by sending a Unicast to 683 "coap://[6LBR]/.well-known/core?rt=core.rd*". 685 2. In a network that supports multicast well, discovering the RD 686 using a multicast query for /.well-known/core as specified in 687 CoRE Link Format [RFC6690]: Sending a Multicast GET to 688 "coap://[MCD1]/.well-known/core?rt=core.rd*". RDs within the 689 multicast scope will answer the query. 691 As some of the RD addresses obtained by the methods listed here are 692 just (more or less educated) guesses, endpoints MUST make use of any 693 error messages to very strictly rate-limit requests to candidate IP 694 addresses that don't work out. For example, an ICMP Destination 695 Unreachable message (and, in particular, the port unreachable code 696 for this message) may indicate the lack of a CoAP server on the 697 candidate host, or a CoAP error response code such as 4.05 "Method 698 Not Allowed" may indicate unwillingness of a CoAP server to act as a 699 directory server. 701 If multiple candidate addresses are discovered, the device may pick 702 any of them initially, unless the discovery method indicates a more 703 precise selection scheme. 705 4.1. Resource Directory Address Option (RDAO) 707 The Resource Directory Address Option (RDAO) using IPv6 neighbor 708 Discovery (ND) carries information about the address of the Resource 709 Directory (RD). This information is needed when endpoints cannot 710 discover the Resource Directory with a link-local or realm-local 711 scope multicast address because the endpoint and the RD are separated 712 by a Border Router (6LBR). In many circumstances the availability of 713 DHCP cannot be guaranteed either during commissioning of the network. 714 The presence and the use of the RD is essential during commissioning. 716 It is possible to send multiple RDAO options in one message, 717 indicating as many resource directory addresses. 719 The RDAO format is: 721 0 1 2 3 722 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 723 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 724 | Type | Length = 3 | Valid Lifetime | 725 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 726 | Reserved | 727 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 728 | | 729 + + 730 | | 731 + RD Address + 732 | | 733 + + 734 | | 735 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 737 Fields: 739 Type: 38 741 Length: 8-bit unsigned integer. The length of 742 the option in units of 8 bytes. 743 Always 3. 745 Valid Lifetime: 16-bit unsigned integer. The length of 746 time in units of 60 seconds (relative to 747 the time the packet is received) that 748 this Resource Directory address is valid. 749 A value of all zero bits (0x0) indicates 750 that this Resource Directory address 751 is not valid anymore. 753 Reserved: This field is unused. It MUST be 754 initialized to zero by the sender and 755 MUST be ignored by the receiver. 757 RD Address: IPv6 address of the RD. 759 Figure 5: Resource Directory Address Option 761 5. Resource Directory 763 This section defines the required set of REST interfaces between a 764 Resource Directory (RD) and endpoints. Although the examples 765 throughout this section assume the use of CoAP [RFC7252], these REST 766 interfaces can also be realized using HTTP [RFC7230]. In all 767 definitions in this section, both CoAP response codes (with dot 768 notation) and HTTP response codes (without dot notation) are shown. 770 An RD implementing this specification MUST support the discovery, 771 registration, update, lookup, and removal interfaces defined in this 772 section. 774 All operations on the contents of the Resource Directory MUST be 775 atomic and idempotent. 777 A resource directory MAY make the information submitted to it 778 available to further directories, if it can ensure that a loop does 779 not form. The protocol used between directories to ensure loop-free 780 operation is outside the scope of this document. 782 5.1. Payload Content Formats 784 Resource Directory implementations using this specification MUST 785 support the application/link-format content format (ct=40). 787 Resource Directories implementing this specification MAY support 788 additional content formats. 790 Any additional content format supported by a Resource Directory 791 implementing this specification MUST have an equivalent serialization 792 in the application/link-format content format. 794 5.2. URI Discovery 796 Before an endpoint can make use of an RD, it must first know the RD's 797 address and port, and the URI path information for its REST APIs. 798 This section defines discovery of the RD and its URIs using the well- 799 known interface of the CoRE Link Format [RFC6690]. A complete set of 800 RD discovery methods is described in Section 4. 802 Discovery of the RD registration URI path is performed by sending 803 either a multicast or unicast GET request to "/.well-known/core" and 804 including a Resource Type (rt) parameter [RFC6690] with the value 805 "core.rd" in the query string. Likewise, a Resource Type parameter 806 value of "core.rd-lookup*" is used to discover the URIs for RD Lookup 807 operations, and "core.rd-group" is used to discover the URI path for 808 RD Group operations. Upon success, the response will contain a 809 payload with a link format entry for each RD function discovered, 810 indicating the URI of the RD function returned and the corresponding 811 Resource Type. When performing multicast discovery, the multicast IP 812 address used will depend on the scope required and the multicast 813 capabilities of the network. 815 A Resource Directory MAY provide hints about the content-formats it 816 supports in the links it exposes or registers, using the "ct" link 817 attribute, as shown in the example below. Clients MAY use these 818 hints to select alternate content-formats for interaction with the 819 Resource Directory. 821 HTTP does not support multicast and consequently only unicast 822 discovery can be supported using HTTP. Links to Resource Directories 823 MAY be registered in other Resource Directories. The well-known 824 entry points SHOULD be provided to enable the bootstrapping of 825 unicast discovery. 827 An implementation of this resource directory specification MUST 828 support query filtering for the rt parameter as defined in [RFC6690]. 830 While the link targets in this discovery step are often expressed in 831 path-absolute form, this is not a requirement. Clients SHOULD 832 therefore accept URIs of all schemes they support, both in absolute 833 and relative forms, and not limit the set of discovered URIs to those 834 hosted at the address used for URI discovery. 836 The URI Discovery operation can yield multiple URIs of a given 837 resource type. The client can use any of the discovered addresses 838 initially. 840 The discovery request interface is specified as follows (this is 841 exactly the Well-Known Interface of [RFC6690] Section 4, with the 842 additional requirement that the server MUST support query filtering): 844 Interaction: EP and Client -> RD 846 Method: GET 848 URI Template: /.well-known/core{?rt} 850 URI Template Variables: 852 rt := Resource Type (optional). MAY contain one of the values 853 "core.rd", "core.rd-lookup*", "core.rd-lookup-res", "core.rd- 854 lookup-ep", "core.rd-lookup-gp", "core.rd-group" or "core.rd*" 856 Content-Format: application/link-format (if any) 858 Content-Format: application/link-format+json (if any) 860 Content-Format: application/link-format+cbor (if any) 862 The following response codes are defined for this interface: 864 Success: 2.05 "Content" or 200 "OK" with an application/link-format, 865 application/link-format+json, or application/link-format+cbor 866 payload containing one or more matching entries for the RD 867 resource. 869 Failure: 4.00 "Bad Request" or 400 "Bad Request" is returned in case 870 of a malformed request for a unicast request. 872 Failure: No error response to a multicast request. 874 HTTP support : YES (Unicast only) 876 The following example shows an endpoint discovering an RD using this 877 interface, thus learning that the directory resource is, in this 878 example, at /rd, and that the content-format delivered by the server 879 hosting the resource is application/link-format (ct=40). Note that 880 it is up to the RD to choose its RD resource paths. 882 Req: GET coap://[MCD1]/.well-known/core?rt=core.rd* 884 Res: 2.05 Content 885 ;rt="core.rd";ct=40, 886 ;rt="core.rd-lookup-ep";ct=40, 887 ;rt="core.rd-lookup-res";ct=40, 888 ;rt="core.rd-lookup-gp";ct=40, 889 ;rt="core.rd-group";ct=40 891 Figure 6: Example discovery exchange 893 The following example shows the way of indicating that a client may 894 request alternate content-formats. The Content-Format code attribute 895 "ct" MAY include a space-separated sequence of Content-Format codes 896 as specified in Section 7.2.1 of [RFC7252], indicating that multiple 897 content-formats are available. The example below shows the required 898 Content-Format 40 (application/link-format) indicated as well as the 899 CBOR and JSON representation of link format. The RD resource paths 900 /rd, /rd-lookup, and /rd-group are example values. The server in 901 this example also indicates that it is capable of providing 902 observation on resource lookups. 904 [ The RFC editor is asked to replace these and later occurrences of 905 TBD64 and TBD504 with the numeric ID values assigned by IANA to 906 application/link-format+cbor and application/link-format+json, 907 respectively, as they are defined in I-D.ietf-core-links-json. ] 908 Req: GET coap://[MCD1]/.well-known/core?rt=core.rd* 910 Res: 2.05 Content 911 ;rt="core.rd";ct="40 65225", 912 ;rt="core.rd-lookup-res";ct="40 TBD64 TBD504";obs, 913 ;rt="core.rd-lookup-ep";ct="40 TBD64 TBD504", 914 ;rt="core.rd-lookup-gp";ct=40 TBD64 TBD504", 915 ;rt="core.rd-group";ct="40 TBD64 TBD504" 917 From a management and maintenance perspective, it is necessary to 918 identify the components that constitute the server. The 919 identification refers to information about for example client-server 920 incompatibilities, supported features, required updates and other 921 aspects. The URI discovery address, a described in section 4 of 922 [RFC6690] can be used to find the identification. 924 It would typically be stored in an implementation information link 925 (as described in [I-D.bormann-t2trg-rel-impl]): 927 Req: GET /.well-known/core?rel=impl-info 929 Res: 2.05 Content 930 ; 931 rel="impl-info" 933 Note that depending on the particular server's architecture, such a 934 link could be anchored at the server's root, at the discovery site 935 (as in this example) or at individual RD components. The latter is 936 to be expected when different applications are run on the same 937 server. 939 5.3. Registration 941 After discovering the location of an RD, a registree-ep or CT MAY 942 register the resources of the registree-ep using the registration 943 interface. This interface accepts a POST from an endpoint containing 944 the list of resources to be added to the directory as the message 945 payload in the CoRE Link Format [RFC6690], JSON CoRE Link Format 946 (application/link-format+json), or CBOR CoRE Link Format 947 (application/link-format+cbor) [I-D.ietf-core-links-json], along with 948 query parameters indicating the name of the endpoint, and optionally 949 the sector, lifetime and base URI of the registration. It is 950 expected that other specifications will define further parameters 951 (see Section 10.3). The RD then creates a new registration resource 952 in the RD and returns its location. The receiving endpoint MUST use 953 that location when refreshing registrations using this interface. 954 Registration resources in the RD are kept active for the period 955 indicated by the lifetime parameter. The endpoint is responsible for 956 refreshing the registration resource within this period using either 957 the registration or update interface. The registration interface 958 MUST be implemented to be idempotent, so that registering twice with 959 the same endpoint parameters ep and d (sector) does not create 960 multiple registration resources. 962 The following rules apply for an update identified by a given (ep, d) 963 value pair: 965 o when the parameter values of the Update generate the same 966 attribute values as already present, the location of the already 967 existing registration is returned. 969 o when for a given (ep, d) value pair the update generates attribute 970 values which are different from the existing one, the existing 971 registration is removed and a new registration with a new location 972 is created. 974 o when the (ep, d) value pair of the update is different from any 975 existing registration, a new registration is generated. 977 The posted link-format document can (and typically does) contain 978 relative references both in its link targets and in its anchors, or 979 contain empty anchors. The RD server needs to resolve these 980 references in order to faithfully represent them in lookups. They 981 are resolved against the base URI of the registration, which is 982 provided either explicitly in the "base" parameter or constructed 983 implicitly from the requester's network address. 985 Link format documents submitted to the resource directory are 986 interpreted as Modernized Link Format (see Appendix D) by the RD. A 987 registree-ep SHOULD NOT submit documents whose interpretations 988 according to [RFC6690] and Appendix D differ and RFC6690 989 interpretation is intended to avoid the ambiguities described in 990 Appendix B.4. 992 In practice, most links (precisely listed in Appendix D.1) can be 993 submitted without consideration for those details. 995 The registration request interface is specified as follows: 997 Interaction: EP -> RD 999 Method: POST 1001 URI Template: {+rd}{?ep,d,lt,base,extra-attrs*} 1003 URI Template Variables: 1005 rd := RD registration URI (mandatory). This is the location of 1006 the RD, as obtained from discovery. 1008 ep := Endpoint name (mostly mandatory). The endpoint name is an 1009 identifier that MUST be unique within a sector. The maximum 1010 length of this parameter is 63 bytes. If the RD is configured 1011 to recognize the endpoint (eg. based on its security context), 1012 the endpoint sets no endpoint name, and the RD assigns one 1013 based on a set of configuration parameter values. 1015 d := Sector (optional). The sector to which this endpoint 1016 belongs. The maximum length of this parameter is 63 bytes. 1017 When this parameter is not present, the RD MAY associate the 1018 endpoint with a configured default sector or leave it empty. 1019 The endpoint name and sector name are not set when one or both 1020 are set in an accompanying authorization token. 1022 lt := Lifetime (optional). Lifetime of the registration in 1023 seconds. Range of 60-4294967295. If no lifetime is included 1024 in the initial registration, a default value of 90000 (25 1025 hours) SHOULD be assumed. 1027 base := Base URI (optional). This parameter sets the base URI of 1028 the registration, under which the request's links are to be 1029 interpreted. The specified URI typically does not have a path 1030 component of its own, and MUST be suitable as a base URI to 1031 resolve any relative references given in the registration. The 1032 parameter is therefore usually of the shape 1033 "scheme://authority" for HTTP and CoAP URIs. The URI SHOULD 1034 NOT have a query or fragment component as any non-empty 1035 relative part in a reference would remove those parts from the 1036 resulting URI. 1038 In the absence of this parameter the scheme of the protocol, 1039 source address and source port of the registration request are 1040 assumed. This parameter is mandatory when the directory is 1041 filled by a third party such as an commissioning tool. 1043 If the endpoint uses an ephemeral port to register with, it 1044 MUST include the base parameter in the registration to provide 1045 a valid network path. 1047 If the endpoint which is located behind a NAT gateway is 1048 registering with a Resource Directory which is on the network 1049 service side of the NAT gateway, the endpoint MUST use a 1050 persistent port for the outgoing registration in order to 1051 provide the NAT gateway with a valid network address for 1052 replies and incoming requests. 1054 Endpoints that register with a base that contains a path 1055 component can not meaningfully use [RFC6690] Link Format due to 1056 its prevalence of the Origin concept in relative reference 1057 resolution; they can submit payloads for interpretation as 1058 Modernized Link Format. Typically, links submitted by such an 1059 endpoint are of the "path-noscheme" (starts with a path not 1060 preceded by a slash, precisely defined in [RFC3986] 1061 Section 3.3) form. 1063 extra-attrs := Additional registration attributes (optional). 1064 The endpoint can pass any parameter registered at Section 10.3 1065 to the directory. If the RD is aware of the parameter's 1066 specified semantics, it processes it accordingly. Otherwise, 1067 it MUST store the unknown key and its value(s) as an endpoint 1068 attribute for further lookup. 1070 Content-Format: application/link-format 1072 Content-Format: application/link-format+json 1074 Content-Format: application/link-format+cbor 1076 The following response codes are defined for this interface: 1078 Success: 2.01 "Created" or 201 "Created". The Location-Path option 1079 or Location header MUST be included in the response. This 1080 location MUST be a stable identifier generated by the RD as it is 1081 used for all subsequent operations on this registration resource. 1082 The registration resource location thus returned is for the 1083 purpose of updating the lifetime of the registration and for 1084 maintaining the content of the registered links, including 1085 updating and deleting links. 1087 A registration with an already registered ep and d value pair 1088 responds with the same success code and location as the original 1089 registration; the set of links registered with the endpoint is 1090 replaced with the links from the payload. 1092 The location MUST NOT have a query or fragment component, as that 1093 could conflict with query parameters during the Registration 1094 Update operation. Therefore, the Location-Query option MUST NOT 1095 be present in a successful response. 1097 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 1098 request. 1100 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 1101 Service could not perform the operation. 1103 HTTP support: YES 1105 If the registration fails with a Service Unavailable response and a 1106 Max-Age option or Retry-After header, the registering endpoint SHOULD 1107 retry the operation after the time indicated. If the registration 1108 fails in another way, including request timeouts, or if the Service 1109 Unavailable error persists after several retries, or indicates a 1110 longer time than the endpoint is willing to wait, it SHOULD pick 1111 another registration URI from the "URI Discovery" step and if there 1112 is only one or the list is exhausted, pick other choices from the 1113 "Finding a Resource Directory" step. Care has to be taken to 1114 consider the freshness of results obtained earlier, eg. of the result 1115 of a "/.well-known/core" response, the lifetime of an RDAO option and 1116 of DNS responses. Any rate limits and persistent errors from the 1117 "Finding a Resource Directory" step must be considered for the whole 1118 registration time, not only for a single operation. 1120 The following example shows a registree-ep with the name "node1" 1121 registering two resources to an RD using this interface. The 1122 location "/rd" is an example RD location discovered in a request 1123 similar to Figure 6. 1125 Req: POST coap://rd.example.com/rd?ep=node1 1126 Content-Format: 40 1127 Payload: 1128 ;ct=41;rt="temperature-c";if="sensor"; 1129 anchor="coap://spurious.example.com:5683", 1130 ;ct=41;rt="light-lux";if="sensor" 1132 Res: 2.01 Created 1133 Location-Path: /rd/4521 1135 Figure 7: Example registration payload 1137 A Resource Directory may optionally support HTTP. Here is an example 1138 of almost the same registration operation above, when done using HTTP 1139 and the JSON Link Format. 1141 Req: POST /rd?ep=node1&base=http://[2001:db8:1::1] HTTP/1.1 1142 Host: example.com 1143 Content-Type: application/link-format+json 1144 Payload: 1145 [ 1146 {"href": "/sensors/temp", "ct": "41", "rt": "temperature-c", 1147 "if": "sensor", "anchor": "coap://spurious.example.com:5683"}, 1148 {"href": "/sensors/light", "ct": "41", "rt": "light-lux", 1149 "if": "sensor"} 1150 ] 1152 Res: 201 Created 1153 Location: /rd/4521 1155 5.3.1. Simple Registration 1157 Not all endpoints hosting resources are expected to know how to 1158 upload links to an RD as described in Section 5.3. Instead, simple 1159 endpoints can implement the Simple Registration approach described in 1160 this section. An RD implementing this specification MUST implement 1161 Simple Registration. However, there may be security reasons why this 1162 form of directory discovery would be disabled. 1164 This approach requires that the registree-ep makes available the 1165 hosted resources that it wants to be discovered, as links on its 1166 "/.well-known/core" interface as specified in [RFC6690]. The links 1167 in that document are subject to the same limitations as the payload 1168 of a registration (with respect to Appendix D). 1170 The registree-ep then finds one or more addresses of the directory 1171 server as described in Section 4. 1173 The registree-ep finally asks the selected directory server to probe 1174 it for resources and publish them as follows: 1176 The registree-ep sends (and regularly refreshes with) a POST request 1177 to the "/.well-known/core" URI of the directory server of choice. 1178 The body of the POST request is empty, and triggers the resource 1179 directory server to perform GET requests at the requesting registree- 1180 ep's default discovery URI to obtain the link-format payload to 1181 register. 1183 The registree-ep includes the same registration parameters in the 1184 POST request as it would per Section 5.3. The registration base URI 1185 of the registration is taken from the requesting server's URI. 1187 The Resource Directory MUST NOT query the registree-ep's data before 1188 sending the response; this is to accommodate very limited endpoints. 1190 The success condition only indicates that the request was valid (ie. 1191 the passed parameters are valid per se), not that the link data could 1192 be obtained or parsed or was successfully registered into the RD. 1194 The simple registration request interface is specified as follows: 1196 Interaction: EP -> RD 1198 Method: POST 1200 URI Template: /.well-known/core{?ep,d,lt,extra-attrs*} 1202 URI Template Variables are as they are for registration in 1203 Section 5.3. The base attribute is not accepted to keep the 1204 registration interface simple; that rules out registration over CoAP- 1205 over-TCP or HTTP that would need to specify one. 1207 The following response codes are defined for this interface: 1209 Success: 2.04 "Changed". 1211 Failure: 4.00 "Bad Request". Malformed request. 1213 Failure: 5.03 "Service Unavailable". Service could not perform the 1214 operation. 1216 HTTP support: NO 1218 For the second interaction triggered by the above, the registree-ep 1219 takes the role of server and the RD the role of client. (Note that 1220 this is exactly the Well-Known Interface of [RFC6690] Section 4): 1222 Interaction: RD -> EP 1224 Method: GET 1226 URI Template: /.well-known/core 1228 The following response codes are defined for this interface: 1230 Success: 2.05 "Content". 1232 Failure: 4.00 "Bad Request". Malformed request. 1234 Failure: 4.04 "Not Found". /.well-known/core does not exist or is 1235 empty. 1237 Failure: 5.03 "Service Unavailable". Service could not perform the 1238 operation. 1240 HTTP support: NO 1242 The registration resources MUST be deleted after the expiration of 1243 their lifetime. Additional operations on the registration resource 1244 cannot be executed because no registration location is returned. 1246 The following example shows a registree-ep using Simple Registration, 1247 by simply sending an empty POST to a resource directory. 1249 Req:(to RD server from [2001:db8:2::1]) 1250 POST /.well-known/core?lt=6000&ep=node1 1251 No payload 1253 Res: 2.04 Changed 1255 (later) 1257 Req: (from RD server to [2001:db8:2::1]) 1258 GET /.well-known/core 1259 Accept: 40 1261 Res: 2.05 Content 1262 Content-Format: 40 1263 Payload: 1264 1266 5.3.2. Third-party registration 1268 For some applications, even Simple Registration may be too taxing for 1269 some very constrained devices, in particular if the security 1270 requirements become too onerous. 1272 In a controlled environment (e.g. building control), the Resource 1273 Directory can be filled by a third party device, called a 1274 commissioning tool. The commissioning tool can fill the Resource 1275 Directory from a database or other means. For that purpose the 1276 scheme, IP address and port of the registered device is indicated in 1277 the "base" parameter of the registration described in Section 5.3. 1279 It should be noted that the value of the "base" parameter applies to 1280 all the links of the registration and has consequences for the anchor 1281 value of the individual links as exemplified in Appendix B. An 1282 eventual (currently non-existing) "base" attribute of the link is not 1283 affected by the value of "base" parameter in the registration. 1285 6. RD Groups 1287 This section defines the REST API for the creation, management, and 1288 lookup of endpoints for group operations. Similar to endpoint 1289 registration entries in the RD, groups may be created or removed. 1290 However unlike an endpoint entry, a group entry consists of a list of 1291 endpoints and does not have a lifetime associated with it. In order 1292 to make use of multicast requests with CoAP, a group MAY have a 1293 multicast address associated with it. 1295 6.1. Register a Group 1297 In order to create a group, a commissioning tool (CT) used to 1298 configure groups, makes a request to the RD indicating the name of 1299 the group to create (or update), optionally the sector the group 1300 belongs to, and optionally the multicast address of the group. This 1301 specification does not require that the endpoints belong to the same 1302 sector as the group, but a Resource Directory implementation can 1303 impose requirements on the sectors of groups and endpoints depending 1304 on its configuration. 1306 The registration message is a list of links to registration resources 1307 of the endpoints that belong to that group. The CT can use any URI 1308 reference discovered using endpoint lookup from the same server or 1309 obtained by registering an endpoint using third party registration 1310 and enter it into a group. The use of other URIs is not specified in 1311 this document and can be defined in others. 1313 The commissioning tool SHOULD not send any target attributes with the 1314 links to the registration resources, and the resource directory 1315 SHOULD reject registrations that contain links with unprocessable 1316 attributes. 1318 Configuration of the endpoints themselves is out of scope of this 1319 specification. Such an interface for managing the group membership 1320 of an endpoint has been defined in [RFC7390]. 1322 The registration request interface is specified as follows: 1324 Interaction: CT -> RD 1326 Method: POST 1328 URI Template: {+rd-group}{?gp,d,base} 1330 URI Template Variables: 1332 rd-group := RD Group URI (mandatory). This is the location of 1333 the RD Group REST API. 1335 gp := Group Name (mandatory). The name of the group to be 1336 created or replaced, unique within that sector. The maximum 1337 length of this parameter is 63 bytes. 1339 d := Sector (optional). The sector to which this group belongs. 1340 The maximum length of this parameter is 63 bytes. When this 1341 parameter is not present, the RD MAY associate the group with a 1342 configured default sector or leave it empty. 1344 base := Group Base URI (optional). This parameter sets the 1345 scheme, address and port of the multicast address associated 1346 with the group. When base is used, scheme and host are 1347 mandatory and port parameter is optional. 1349 Content-Format: application/link-format 1351 Content-Format: application/link-format+json 1353 Content-Format: application/link-format+cbor 1355 The following response codes are defined for this interface: 1357 Success: 2.01 "Created" or 201 "Created". The Location header or 1358 Location-Path option MUST be returned in response to a successful 1359 group CREATE operation. This location MUST be a stable identifier 1360 generated by the RD as it is used for delete operations of the 1361 group resource. 1363 As with the Registration operation, the location MUST NOT have a 1364 query or fragment component. 1366 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 1367 request. 1369 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 1370 Service could not perform the operation. 1372 HTTP support: YES 1374 The following example shows an EP registering a group with the name 1375 "lights" which has two endpoints. The RD group path /rd-group is an 1376 example RD location discovered in a request similar to Figure 6. 1378 Req: POST coap://rd.example.com/rd-group?gp=lights 1379 &base=coap://[ff35:30:2001:db8::1] 1380 Content-Format: 40 1381 Payload: 1382 , 1383 1385 Res: 2.01 Created 1386 Location-Path: /rd-group/12 1388 A relative href value denotes the path to the registration resource 1389 of the Endpoint. When pointing to a registration resource on a 1390 different RD, the href value is an absolute URI. 1392 6.2. Group Removal 1394 A group can be removed simply by sending a removal message to the 1395 location of the group registration resource which was returned when 1396 initially registering the group. Removing a group MUST NOT remove 1397 the endpoints of the group from the RD. 1399 The removal request interface is specified as follows: 1401 Interaction: CT -> RD 1403 Method: DELETE 1405 URI Template: {+location} 1407 URI Template Variables: 1409 location := This is the path of the group resource returned by 1410 the RD as a result of a successful group registration. 1412 The following responses codes are defined for this interface: 1414 Success: 2.02 "Deleted" or 204 "No Content" upon successful deletion 1416 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 1417 request. 1419 Failure: 4.04 "Not Found" or 404 "Not Found". Group does not exist. 1421 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 1422 Service could not perform the operation. 1424 HTTP support: YES 1425 The following examples shows successful removal of the group from the 1426 RD with the example location value /rd-group/12. 1428 Req: DELETE /rd-group/12 1430 Res: 2.02 Deleted 1432 7. RD Lookup 1434 To discover the resources registered with the RD, a lookup interface 1435 must be provided. This lookup interface is defined as a default, and 1436 it is assumed that RDs may also support lookups to return resource 1437 descriptions in alternative formats (e.g. Atom or HTML Link) or 1438 using more advanced interfaces (e.g. supporting context or semantic 1439 based lookup). 1441 RD Lookup allows lookups for groups, endpoints and resources using 1442 attributes defined in this document and for use with the CoRE Link 1443 Format. The result of a lookup request is the list of links (if any) 1444 corresponding to the type of lookup. Thus, a group lookup MUST 1445 return a list of groups, an endpoint lookup MUST return a list of 1446 endpoints and a resource lookup MUST return a list of links to 1447 resources. 1449 The lookup type is selected by a URI endpoint, which is indicated by 1450 a Resource Type as per Table 1 below: 1452 +-------------+--------------------+-----------+ 1453 | Lookup Type | Resource Type | Mandatory | 1454 +-------------+--------------------+-----------+ 1455 | Resource | core.rd-lookup-res | Mandatory | 1456 | Endpoint | core.rd-lookup-ep | Mandatory | 1457 | Group | core.rd-lookup-gp | Optional | 1458 +-------------+--------------------+-----------+ 1460 Table 1: Lookup Types 1462 7.1. Resource lookup 1464 Resource lookup results in links that are semantically equivalent to 1465 the links submitted to the RD if they were accessed on the endpoint 1466 itself. The links and link parameters returned are equal to the 1467 submitted, except that the target and anchor references are fully 1468 resolved. 1470 Links that did not have an anchor attribute are therefore returned 1471 with the (explicitly or implicitly set) base URI of the registration 1472 as the anchor. Links whose href or anchor was submitted as an 1473 absolute URI are returned with respective attributes unmodified. 1475 Above rules allow the client to interpret the response as links 1476 without any further knowledge of what the RD does. The Resource 1477 Directory MAY replace the registration base URIs with a configured 1478 intermediate proxy, e.g. in the case of an HTTP lookup interface for 1479 CoAP endpoints. 1481 7.2. Lookup filtering 1483 Using the Accept Option, the requester can control whether the 1484 returned list is returned in CoRE Link Format ("application/link- 1485 format", default) or its alternate content-formats ("application/ 1486 link-format+json" or "application/link-format+cbor"). 1488 The page and count parameters are used to obtain lookup results in 1489 specified increments using pagination, where count specifies how many 1490 links to return and page specifies which subset of links organized in 1491 sequential pages, each containing 'count' links, starting with link 1492 zero and page zero. Thus, specifying count of 10 and page of 0 will 1493 return the first 10 links in the result set (links 0-9). Count = 10 1494 and page = 1 will return the next 'page' containing links 10-19, and 1495 so on. 1497 Multiple search criteria MAY be included in a lookup. All included 1498 criteria MUST match for a link to be returned. The Resource 1499 Directory MUST support matching with multiple search criteria. 1501 A link matches a search criterion if it has an attribute of the same 1502 name and the same value, allowing for a trailing "*" wildcard 1503 operator as in Section 4.1 of [RFC6690]. Attributes that are defined 1504 as "link-type" match if the search value matches any of their values 1505 (see Section 4.1 of [RFC6690]; eg. "?if=core.s" matches ";if="abc 1506 core.s";"). A link also matches a search criterion if the link that 1507 would be produced for any of its containing entities would match the 1508 criterion, or an entity contained in it would: A search criterion 1509 matches an endpoint if it matches the endpoint itself, any of the 1510 groups it is contained in or any resource it contains. A search 1511 criterion matches a resource if it matches the resource itself, the 1512 resource's endpoint, or any of the endpoint's groups. 1514 Note that "href" is also a valid search criterion and matches target 1515 references. Like all search criteria, on a resource lookup it can 1516 match the target reference of the resource link itself, but also the 1517 registration resource of the endpoint that registered it, or any 1518 group resource that endpoint is contained in. Queries for resource 1519 link targets MUST be in absolute form and are matched against a 1520 resolved link target. Queries for groups and endpoints SHOULD be 1521 expressed in path-absolute form if possible and MUST be expressed in 1522 absolute form otherwise; the RD SHOULD recognize either. 1524 Clients that are interested in a lookup result repeatedly or 1525 continuously can use mechanisms like ETag caching, resource 1526 observation ([RFC7641]), or any future mechanism that might allow 1527 more efficient observations of collections. These are advertised, 1528 detected and used according to their own specifications and can be 1529 used with the lookup interface as with any other resource. 1531 When resource observation is used, every time the set of matching 1532 links changes, or the content of a matching link changes, the RD 1533 sends a notification with the matching link set. The notification 1534 contains the successful current response to the given request, 1535 especially with respect to representing zero matching links (see 1536 "Success" item below). 1538 The lookup interface is specified as follows: 1540 Interaction: Client -> RD 1542 Method: GET 1544 URI Template: {+type-lookup-location}{?page,count,search*} 1546 URI Template Variables: 1548 type-lookup-location := RD Lookup URI for a given lookup type 1549 (mandatory). The address is discovered as described in 1550 Section 5.2. 1552 search := Search criteria for limiting the number of results 1553 (optional). 1555 page := Page (optional). Parameter can not be used without the 1556 count parameter. Results are returned from result set in pages 1557 that contain 'count' links starting from index (page * count). 1558 Page numbering starts with zero. 1560 count := Count (optional). Number of results is limited to this 1561 parameter value. If the page parameter is also present, the 1562 response MUST only include 'count' links starting with the 1563 (page * count) link in the result set from the query. If the 1564 count parameter is not present, then the response MUST return 1565 all matching links in the result set. Link numbering starts 1566 with zero. 1568 Content-Format: application/link-format (optional) 1570 Content-Format: application/link-format+json (optional) 1572 Content-Format: application/link-format+cbor (optional) 1574 The following responses codes are defined for this interface: 1576 Success: 2.05 "Content" or 200 "OK" with an "application/link- 1577 format", "application/link-format+cbor", or "application/link- 1578 format+json" payload containing matching entries for the lookup. 1579 The payload can contain zero links (which is an empty payload, 1580 "80" (hex) or "[]" in the respective content format), indicating 1581 that no entities matched the request. 1583 Failure: No error response to a multicast request. 1585 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 1586 request. 1588 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 1589 Service could not perform the operation. 1591 HTTP support: YES 1593 The group and endpoint lookup return registration resources which can 1594 only be manipulated by the registering endpoint. Examples of group 1595 and endpoint lookup belong to the management aspects of the RD and 1596 are shown in Appendix A.5. The resource lookup examples are shown in 1597 this section. 1599 7.3. Resource lookup examples 1601 The examples in this section assume the existence of CoAP hosts with 1602 a default CoAP port 61616. HTTP hosts are possible and do not change 1603 the nature of the examples. 1605 The following example shows a client performing a resource lookup 1606 with the example resource look-up locations discovered in Figure 6: 1608 Req: GET /rd-lookup/res?rt=temperature 1610 Res: 2.05 Content 1611 ;rt="temperature"; 1612 anchor="coap://[2001:db8:3::123]:61616" 1614 The same lookup using the CBOR Link Format media type: 1616 Req: GET /rd-lookup/res?rt=temperature 1617 Accept: TBD64 1619 Res: 2.05 Content 1620 Content-Format: TBD64 1621 Payload in Hex notation: 1622 81A3017823636F61703A2F2F5B323030313A6462383A333A3A3132335D3A363136313 1623 62F74656D7003781E636F61703A2F2F5B323030313A6462383A333A3A3132335D3A36 1624 31363136096B74656D7065726174757265 1625 Decoded payload: 1626 [{1: "coap://[2001:db8:3::123]:61616/temp", 9: "temperature", 1627 3: "coap://[2001:db8:3::123]:61616"}] 1629 A client that wants to be notified of new resources as they show up 1630 can use observation: 1632 Req: GET /rd-lookup/res?rt=light 1633 Observe: 0 1635 Res: 2.05 Content 1636 Observe: 23 1637 Payload: empty 1639 (at a later point in time) 1641 Res: 2.05 Content 1642 Observe: 24 1643 Payload: 1644 ;rt="light"; 1645 anchor="coap://[2001:db8:3::124]", 1646 ;rt="light"; 1647 anchor="coap://[2001:db8:3::124]", 1648 ;rt="light"; 1649 anchor="coap://[2001:db8:3::124]" 1651 The following example shows a client performing a paginated resource 1652 lookup 1653 Req: GET /rd-lookup/res?page=0&count=5 1655 Res: 2.05 Content 1656 ;rt=sensor;ct=60; 1657 anchor="coap://[2001:db8:3::123]:61616", 1658 ;rt=sensor;ct=60; 1659 anchor="coap://[2001:db8:3::123]:61616", 1660 ;rt=sensor;ct=60; 1661 anchor="coap://[2001:db8:3::123]:61616", 1662 ;rt=sensor;ct=60; 1663 anchor="coap://[2001:db8:3::123]:61616", 1664 ;rt=sensor;ct=60; 1665 anchor="coap://[2001:db8:3::123]:61616" 1667 Req: GET /rd-lookup/res?page=1&count=5 1669 Res: 2.05 Content 1670 ;rt=sensor;ct=60; 1671 anchor="coap://[2001:db8:3::123]:61616", 1672 ;rt=sensor;ct=60; 1673 anchor="coap://[2001:db8:3::123]:61616", 1674 ;rt=sensor;ct=60; 1675 anchor="coap://[2001:db8:3::123]:61616", 1676 ;rt=sensor;ct=60; 1677 anchor="coap://[2001:db8:3::123]:61616", 1678 ;rt=sensor;ct=60; 1679 anchor="coap://[2001:db8:3::123]:61616" 1681 The following example shows a client performing a lookup of all 1682 resources from endpoints of all endpoints of a given endpoint type. 1683 It assumes that two endpoints (with endpoint names "sensor1" and 1684 "sensor2") have previously registered with their respective addresses 1685 "coap://sensor1.example.com" and "coap://sensor2.example.com", and 1686 posted the very payload of the 6th request of section 5 of [RFC6690]. 1688 It demonstrates how absolute link targets stay unmodified, while 1689 relative ones are resolved: 1691 Req: GET /rd-lookup/res?et=oic.d.sensor 1693 ;ct=40;title="Sensor Index"; 1694 anchor="coap://sensor1.example.com", 1695 ;rt="temperature-c"; 1696 if="sensor"; anchor="coap://sensor1.example.com", 1697 ;rt="light-lux"; 1698 if="sensor"; anchor="coap://sensor1.example.com", 1699 ;rel="describedby"; 1700 anchor="coap://sensor1.example.com/sensors/temp", 1701 ;rel="alternate"; 1702 anchor="coap://sensor1.example.com/sensors/temp", 1703 ;ct=40;title="Sensor Index"; 1704 anchor="coap://sensor2.example.com", 1705 ;rt="temperature-c"; 1706 if="sensor"; anchor="coap://sensor2.example.com", 1707 ;rt="light-lux"; 1708 if="sensor"; anchor="coap://sensor2.example.com", 1709 ;rel="describedby"; 1710 anchor="coap://sensor2.example.com/sensors/temp", 1711 ;rel="alternate"; 1712 anchor="coap://sensor2.example.com/sensors/temp" 1714 8. Security Considerations 1716 The security considerations as described in Section 7 of [RFC5988] 1717 and Section 6 of [RFC6690] apply. The "/.well-known/core" resource 1718 may be protected e.g. using DTLS when hosted on a CoAP server as 1719 described in [RFC7252]. DTLS or TLS based security SHOULD be used on 1720 all resource directory interfaces defined in this document. 1722 8.1. Endpoint Identification and Authentication 1724 An Endpoint is determined to be unique within (the sector of) an RD 1725 by the Endpoint identifier parameter included during Registration, 1726 and any associated TLS or DTLS security bindings. An Endpoint MUST 1727 NOT be identified by its protocol, port or IP address as these may 1728 change over the lifetime of an Endpoint. 1730 Every operation performed by an Endpoint or Client on a resource 1731 directory SHOULD be mutually authenticated using Pre-Shared Key, Raw 1732 Public Key or Certificate based security. 1734 Consider the following threat: two devices A and B are managed by a 1735 single server. Both devices have unique, per-device credentials for 1736 use with DTLS to make sure that only parties with authorization to 1737 access A or B can do so. 1739 Now, imagine that a malicious device A wants to sabotage the device 1740 B. It uses its credentials during the DTLS exchange. Then, it puts 1741 the endpoint name of device B. If the server does not check whether 1742 the identifier provided in the DTLS handshake matches the identifier 1743 used at the CoAP layer then it may be inclined to use the endpoint 1744 name for looking up what information to provision to the malicious 1745 device. 1747 Section 9 specifies an example that removes this threat by using an 1748 Authorization Server for endpoints that have a certificate installed. 1750 8.2. Access Control 1752 Access control SHOULD be performed separately for the RD 1753 registration, Lookup, and group API paths, as different endpoints may 1754 be authorized to register with an RD from those authorized to lookup 1755 endpoints from the RD. Such access control SHOULD be performed in as 1756 fine-grained a level as possible. For example access control for 1757 lookups could be performed either at the sector, endpoint or resource 1758 level. 1760 8.3. Denial of Service Attacks 1762 Services that run over UDP unprotected are vulnerable to unknowingly 1763 become part of a DDoS attack as UDP does not require return 1764 routability check. Therefore, an attacker can easily spoof the 1765 source IP of the target entity and send requests to such a service 1766 which would then respond to the target entity. This can be used for 1767 large-scale DDoS attacks on the target. Especially, if the service 1768 returns a response that is order of magnitudes larger than the 1769 request, the situation becomes even worse as now the attack can be 1770 amplified. DNS servers have been widely used for DDoS amplification 1771 attacks. There is also a danger that NTP Servers could become 1772 implicated in denial-of-service (DoS) attacks since they run on 1773 unprotected UDP, there is no return routability check, and they can 1774 have a large amplification factor. The responses from the NTP server 1775 were found to be 19 times larger than the request. A Resource 1776 Directory (RD) which responds to wild-card lookups is potentially 1777 vulnerable if run with CoAP over UDP. Since there is no return 1778 routability check and the responses can be significantly larger than 1779 requests, RDs can unknowingly become part of a DDoS amplification 1780 attack. 1782 9. Authorization Server example 1784 When threats may occur as described in Section 8.1, an Authorization 1785 Server (AS) as specified in [I-D.ietf-ace-oauth-authz] can be used to 1786 remove the threat. An authorized registry request to the Resource 1787 Directory (RD) is accompanied by an Access Token that validates the 1788 access of the client to the RD. In this example, the contents of the 1789 Access Token is specified by a CBOR Web Token (CWT) [RFC8392]. 1790 Selecting one of the scenarios of 1791 [I-D.ietf-anima-bootstrapping-keyinfra], the registree-ep has a 1792 certificate that has been inserted at manufacturing time. The 1793 contents of the certificate will be used to generate the unique 1794 endpoint name. The certificate is uniquely identified by the 1795 leftmost CNcomponent of the subject name appended with the serial 1796 number. The unique certificate identifier is used as the unique 1797 endpoint name. The same unique identification is used for the 1798 registree-ep and the Commissioning Tool. 1800 The case of using RPK or PSK is outside the scope of this example. 1802 Figure 8 shows the example certificate used to specify the claim 1803 values in the CWT. Serial number 01:02:03:04:05:06:07:08, and CN 1804 field, Fairhair, in the subject field are concatenated to create a 1805 unique certificate identifier: Fairhair-01:02:03:04:05:06:07:08, 1806 which is used in Figure 9 and Figure 10 as "sub" claim and "epn" 1807 claim values respectively. 1809 Certificate: Data: 1810 Version: 3 (0x2) 1811 Serial Number: 01:02:03:04:05:06:07:08 1812 Signature Algorithm: md5WithRSA 1813 Encryption Issuer: C=US, ST=Florida, O=Acme, Inc., OU=Security, 1814 CN=CA 1815 Authority/emailAddress=ca@acme.com 1816 Validity Not Before: Aug 20 12:59:55 2013 GMT 1817 Not After : Aug 20 12:59:55 2013 GMT 1818 Subject: C=US, ST=Florida, O=Acme, Inc., OU=Sales, CN=Fairhair 1819 Subject Public Key 1820 Info: Public Key Algorithm: rsaEncryption 1821 RSA Public Key: (1024 bit) Modulus (1024 bit): 1822 00:be:5e:6e:f8:2c:c7:8c:07:7e:f0:ab:a5:12:db: 1823 fc:5a:1e:27:ba:49:b0:2c:e1:cb:4b:05:f2:23:09: 1824 77:13:75:57:08:29:45:29:d0:db:8c:06:4b:c3:10: 1825 88:e1:ba:5e:6f:1e:c0:2e:42:82:2b:e4:fa:ba:bc: 1826 45:e9:98:f8:e9:00:84:60:53:a6:11:2e:18:39:6e: 1827 ad:76:3e:75:8d:1e:b1:b2:1e:07:97:7f:49:31:35: 1828 25:55:0a:28:11:20:a6:7d:85:76:f7:9f:c4:66:90: 1829 e6:2d:ce:73:45:66:be:56:aa:ee:93:ae:10:f9:ba: 1830 24:fe:38:d0:f0:23:d7:a1:3b 1831 Exponent: 65537 (0x10001) 1833 Figure 8: Sample X.509 version 3 certificate for Fairhair device 1834 issued by the Acme corporation. 1836 Three sections for as many authorized RD registration scenarios 1837 describe: (1) the registree-ep registers itself with the RD, (2) a 1838 3rd party Commissioning Tool (CT) registers the registree-ep with the 1839 RD, and (3) A client updates multiple links in an RD. 1841 9.1. Registree-ep registers with RD 1843 The registree-ep sends a Request to the RD accompanied by a CBOR Web 1844 Token (CWT). To prevent ambiguities, the URI of the authorized 1845 request cannot contain the ep= or the d= parameters which are 1846 specified in the CWT. When these parameters are present in the URI, 1847 the request is rejected with CoAP response code 4.00 (bad request). 1848 The CWT of Figure 9 authorizes the registree-ep to register itself in 1849 the RD by specifying the certificate identifier of the registree-ep 1850 in the sub claim. The same value is assigned to the endpoint name of 1851 the registree-ep in the RD. 1853 The claim set of the CWT is represented in CBOR diagnostic notation 1854 { 1855 /iss/ 1: "coaps://as.example.com", / identifies the AS/ 1856 /sub/ 2: "Fairhair_01:02:03:04:05:06:07:08", 1857 / certificate identifier uniquely identifies registree-ep/ 1858 /aud/ 3: "coaps://rd.example.com" / audience is the RD/ 1859 } 1861 Figure 9: Claim set of CWT for registering registree-ep 1863 9.2. Third party Commissioning Tool (CT) registers registree-ep with 1864 RD. 1866 The CT sends a Request to the RD accompanied by a CBOR Web Token 1867 (CWT). To prevent ambiguities, the URI of an authorized request 1868 cannot contain the ep= or the d= parameters which are specified in 1869 the CWT. When these parameters are present in the URI, the request 1870 is rejected with CoAP response code 4.00 (bad request). The CWT of 1871 Figure 10 authorizes the CT to register the registree-ep by 1872 specifying the certificate identifier, 1873 Fairhair_08:07:06:05:04:03:02:01, of the CT in the "sub" claim. Next 1874 to the certificate identifier of the CT, the CWT needs to specify the 1875 security identifier of the registree-ep. The new "rd_epn" claim is 1876 used to specify the value of the certificate identifier 1877 Fairhair_01:02:03:04:05:06:07:08, of the registree-ep. The CWT may 1878 contain the optional new "rd_sct" claim to assign a sector name to 1879 the registree-ep. 1881 The claim set is represented in CBOR diagnostic notation 1882 { 1883 /iss/ 1: "coaps://as.example.com", / identifies the AS/ 1884 /sub/ 2: "Fairhair_08:07:06:05:04:03:02:01", 1885 / certificate identifier uniquely identifies CT/ 1886 /aud/ 3: "coaps://rd.example.com", / audience is the RD/ 1887 /rd_epn/ y: "Fairhair_01:02:03:04:05:06:07:08", 1888 /certificate identifier uniquely identifies registree-ep/ 1889 /rd_sct/ z: "my-devices" /optional sector name/ 1890 } 1892 Figure 10: Claim set of CWT for registering registree-ep by CT 1894 9.3. Updating multiple links 1896 Appendix A.4 of RD specifies that multiple links can be updated with 1897 a media format to be specified. The updating endpoint sends a 1898 Request to the RD accompanied by a CWT. The "sub" claim of the CWT 1899 contains the certificate identifier of the updating endpoint. 1900 Updating registrations and links cannot not change or delete the 1901 endpoint names. Consequently, the updating endpoint is authorized by 1902 the CWT to change all links of its registrations but cannot delete or 1903 add registrations. The CWT of Figure 9 and Figure 10 authorize an 1904 updating registree-ep or an updating CT respectively. 1906 10. IANA Considerations 1908 10.1. Resource Types 1910 IANA is asked to enter the following values into the Resource Type 1911 (rt=) Link Target Attribute Values subregistry of the Constrained 1912 Restful Environments (CoRE) Parameters registry defined in [RFC6690]: 1914 +--------------------+----------------------------+-----------------+ 1915 | Value | Description | Reference | 1916 +--------------------+----------------------------+-----------------+ 1917 | core.rd | Directory resource of an | RFCTHIS Section | 1918 | | RD | 5.2 | 1919 | core.rd-group | Group directory resource | RFCTHIS Section | 1920 | | of an RD | 5.2 | 1921 | core.rd-lookup-res | Resource lookup of an RD | RFCTHIS Section | 1922 | | | 5.2 | 1923 | core.rd-lookup-ep | Endpoint lookup of an RD | RFCTHIS Section | 1924 | | | 5.2 | 1925 | core.rd-lookup-gp | Group lookup of an RD | RFCTHIS Section | 1926 | | | 5.2 | 1927 | core.rd-ep | Endpoint resource of an RD | RFCTHIS Section | 1928 | | | 7 | 1929 | core.rd-gp | Group resource of an RD | RFCTHIS Section | 1930 | | | 7 | 1931 +--------------------+----------------------------+-----------------+ 1933 10.2. IPv6 ND Resource Directory Address Option 1935 This document registers one new ND option type under the subregistry 1936 "IPv6 Neighbor Discovery Option Formats": 1938 o Resource Directory address Option (38) 1940 10.3. RD Parameter Registry 1942 This specification defines a new sub-registry for registration and 1943 lookup parameters called "RD Parameters" under "CoRE Parameters". 1944 Although this specification defines a basic set of parameters, it is 1945 expected that other standards that make use of this interface will 1946 define new ones. 1948 Each entry in the registry must include 1950 o the human readable name of the parameter, 1952 o the short name as used in query parameters or link attributes, 1954 o indication of whether it can be passed as a query parameter at 1955 registration of endpoints or groups, as a query parameter in 1956 lookups, or be expressed as a link attribute, 1958 o validity requirements if any, and 1960 o a description. 1962 The query parameter MUST be both a valid URI query key [RFC3986] and 1963 a parmname as used in [RFC5988]. 1965 The description must give details on which registrations they apply 1966 to (Endpoint, group registrations or both? Can they be updated?), 1967 and how they are to be processed in lookups. 1969 The mechanisms around new RD parameters should be designed in such a 1970 way that they tolerate RD implementations that are unaware of the 1971 parameter and expose any parameter passed at registration or updates 1972 on in endpoint lookups. (For example, if a parameter used at 1973 registration were to be confidential, the registering endpoint should 1974 be instructed to only set that parameter if the RD advertises support 1975 for keeping it confidential at the discovery step.) 1977 Initial entries in this sub-registry are as follows: 1979 +--------------+-------+---------------+-----+----------------------+ 1980 | Full name | Short | Validity | Use | Description | 1981 +--------------+-------+---------------+-----+----------------------+ 1982 | Endpoint | ep | | RLA | Name of the | 1983 | Name | | | | endpoint, max 63 | 1984 | | | | | bytes | 1985 | Lifetime | lt | 60-4294967295 | R | Lifetime of the | 1986 | | | | | registration in | 1987 | | | | | seconds | 1988 | Sector | d | | RLA | Sector to which this | 1989 | | | | | endpoint belongs | 1990 | Registration | base | URI | RLA | The scheme, address | 1991 | Base URI | | | | and port and path at | 1992 | | | | | which this server is | 1993 | | | | | available | 1994 | Group Name | gp | | RLA | Name of a group in | 1995 | | | | | the RD | 1996 | Page | page | Integer | L | Used for pagination | 1997 | Count | count | Integer | L | Used for pagination | 1998 | Endpoint | et | | RLA | Semantic name of the | 1999 | Type | | | | endpoint (see | 2000 | | | | | Section 10.4) | 2001 +--------------+-------+---------------+-----+----------------------+ 2003 Table 2: RD Parameters 2005 (Short: Short name used in query parameters or link attributes. Use: 2006 R = used at registration, L = used at lookup, A = expressed in link 2007 attribute 2008 The descriptions for the options defined in this document are only 2009 summarized here. To which registrations they apply and when they are 2010 to be shown is described in the respective sections of this document. 2012 The IANA policy for future additions to the sub-registry is "Expert 2013 Review" as described in [RFC8126]. The evaluation should consider 2014 formal criteria, duplication of functionality (Is the new entry 2015 redundant with an existing one?), topical suitability (Eg. is the 2016 described property actually a property of the endpoint and not a 2017 property of a particular resource, in which case it should go into 2018 the payload of the registration and need not be registered?), and the 2019 potential for conflict with commonly used link attributes (For 2020 example, "if" could be used as a parameter for conditional 2021 registration if it were not to be used in lookup or attributes, but 2022 would make a bad parameter for lookup, because a resource lookup with 2023 an "if" query parameter could ambiguously filter by the registered 2024 endpoint property or the [RFC6690] link attribute). It is expected 2025 that the registry will receive between 5 and 50 registrations in 2026 total over the next years. 2028 10.3.1. Full description of the "Endpoint Type" Registration Parameter 2030 An endpoint registering at an RD can describe itself with endpoint 2031 types, similar to how resources are described with Resource Types in 2032 [RFC6690]. An endpoint type is expressed as a string, which can be 2033 either a URI or one of the values defined in the Endpoint Type 2034 subregistry. Endpoint types can be passed in the "et" query 2035 parameter as part of extra-attrs at the Registration step, are shown 2036 on endpoint lookups using the "et" target attribute, and can be 2037 filtered for using "et" as a search criterion in resource and 2038 endpoint lookup. Multiple endpoint types are given as separate query 2039 parameters or link attributes. 2041 Note that Endpoint Type differs from Resource Type in that it uses 2042 multiple attributes rather than space separated values. As a result, 2043 Resource Directory implementations automatically support correct 2044 filtering in the lookup interfaces from the rules for unknown 2045 endpoint attributes. 2047 10.4. "Endpoint Type" (et=) RD Parameter values 2049 This specification establishes a new sub-registry under "CoRE 2050 Parameters" called '"Endpoint Type" (et=) RD Parameter values'. The 2051 registry properties (required policy, requirements, template) are 2052 identical to those of the Resource Type parameters in [RFC6690], in 2053 short: 2055 The review policy is IETF Review for values starting with "core", and 2056 Specification Required for others. 2058 The requirements to be enforced are: 2060 o The values MUST be related to the purpose described in 2061 Section 10.3.1. 2063 o The registered values MUST conform to the ABNF reg-rel-type 2064 definition of [RFC6690] and MUST NOT be a URI. 2066 o It is recommended to use the period "." character for 2067 segmentation. 2069 The registry is initially empty. 2071 10.5. Multicast Address Registration 2073 IANA has assigned the following multicast addresses for use by CoAP 2074 nodes: 2076 IPv4 - "all CoRE resource directories" address, from the "IPv4 2077 Multicast Address Space Registry" equal to "All CoAP Nodes", 2078 224.0.1.187. As the address is used for discovery that may span 2079 beyond a single network, it has come from the Internetwork Control 2080 Block (224.0.1.x, RFC 5771). 2082 IPv6 - "all CoRE resource directories" address MCD1 (suggestions 2083 FF0X::FE), from the "IPv6 Multicast Address Space Registry", in the 2084 "Variable Scope Multicast Addresses" space (RFC 3307). Note that 2085 there is a distinct multicast address for each scope that interested 2086 CoAP nodes should listen to; CoAP needs the Link-Local and Site-Local 2087 scopes only. 2089 10.6. CBOR Web Token claims 2091 This specification registers the following new claims in the CBOR Web 2092 Token (CWT) registry of CBOR Web Token Claims: 2094 Claim "rd_epn" 2096 o Claim Name: "rd_epn" 2098 o Claim Description: The endpoint name of the RD entry as described 2099 in Section 9 of RFCTHIS. 2101 o JWT Claim Name: N/A 2102 o Claim Key: y 2104 o Claim Value Type(s): 0 (uint), 2 (byte string), 3 (text string) 2106 o Change Controller: IESG 2108 o Specification Document(s): Section 9 of RFCTHIS 2110 Claim "rd_sct" 2112 o Claim Name: "rd_sct" 2114 o Claim Description: The sector name of the RD entry as described in 2115 Section 9 of RFCTHIS. 2117 o JWT Claim Name: N/A 2119 o Claim Key: z 2121 o Claim Value Type(s): 0 (uint), 2 (byte string), 3 (text string) 2123 o Change Controller: IESG 2125 o Specification Document(s): Section 9 of RFCTHIS 2127 Mapping of claim name to CWT key 2129 +----------------+----------+-------------+ 2130 | Parameter name | CBOR key | Value type | 2131 +----------------+----------+-------------+ 2132 | rd_epn | y | Text string | 2133 | rd_sct | z | Text string | 2134 +----------------+----------+-------------+ 2136 11. Examples 2138 Two examples are presented: a Lighting Installation example in 2139 Section 11.1 and a LWM2M example in Section 11.2. 2141 11.1. Lighting Installation 2143 This example shows a simplified lighting installation which makes use 2144 of the Resource Directory (RD) with a CoAP interface to facilitate 2145 the installation and start up of the application code in the lights 2146 and sensors. In particular, the example leads to the definition of a 2147 group and the enabling of the corresponding multicast address. No 2148 conclusions must be drawn on the realization of actual installation 2149 or naming procedures, because the example only "emphasizes" some of 2150 the issues that may influence the use of the RD and does not pretend 2151 to be normative. 2153 11.1.1. Installation Characteristics 2155 The example assumes that the installation is managed. That means 2156 that a Commissioning Tool (CT) is used to authorize the addition of 2157 nodes, name them, and name their services. The CT can be connected 2158 to the installation in many ways: the CT can be part of the 2159 installation network, connected by WiFi to the installation network, 2160 or connected via GPRS link, or other method. 2162 It is assumed that there are two naming authorities for the 2163 installation: (1) the network manager that is responsible for the 2164 correct operation of the network and the connected interfaces, and 2165 (2) the lighting manager that is responsible for the correct 2166 functioning of networked lights and sensors. The result is the 2167 existence of two naming schemes coming from the two managing 2168 entities. 2170 The example installation consists of one presence sensor, and two 2171 luminaries, luminary1 and luminary2, each with their own wireless 2172 interface. Each luminary contains three lamps: left, right and 2173 middle. Each luminary is accessible through one endpoint. For each 2174 lamp a resource exists to modify the settings of a lamp in a 2175 luminary. The purpose of the installation is that the presence 2176 sensor notifies the presence of persons to a group of lamps. The 2177 group of lamps consists of: middle and left lamps of luminary1 and 2178 right lamp of luminary2. 2180 Before commissioning by the lighting manager, the network is 2181 installed and access to the interfaces is proven to work by the 2182 network manager. 2184 At the moment of installation, the network under installation is not 2185 necessarily connected to the DNS infra structure. Therefore, SLAAC 2186 IPv6 addresses are assigned to CT, RD, luminaries and sensor shown in 2187 Table 3 below: 2189 +--------------------+----------------+ 2190 | Name | IPv6 address | 2191 +--------------------+----------------+ 2192 | luminary1 | 2001:db8:4::1 | 2193 | luminary2 | 2001:db8:4::2 | 2194 | Presence sensor | 2001:db8:4::3 | 2195 | Resource directory | 2001:db8:4::ff | 2196 +--------------------+----------------+ 2198 Table 3: interface SLAAC addresses 2200 In Section 11.1.2 the use of resource directory during installation 2201 is presented. 2203 11.1.2. RD entries 2205 It is assumed that access to the DNS infrastructure is not always 2206 possible during installation. Therefore, the SLAAC addresses are 2207 used in this section. 2209 For discovery, the resource types (rt) of the devices are important. 2210 The lamps in the luminaries have rt: light, and the presence sensor 2211 has rt: p-sensor. The endpoints have names which are relevant to the 2212 light installation manager. In this case luminary1, luminary2, and 2213 the presence sensor are located in room 2-4-015, where luminary1 is 2214 located at the window and luminary2 and the presence sensor are 2215 located at the door. The endpoint names reflect this physical 2216 location. The middle, left and right lamps are accessed via path 2217 /light/middle, /light/left, and /light/right respectively. The 2218 identifiers relevant to the Resource Directory are shown in Table 4 2219 below: 2221 +----------------+------------------+---------------+---------------+ 2222 | Name | endpoint | resource path | resource type | 2223 +----------------+------------------+---------------+---------------+ 2224 | luminary1 | lm_R2-4-015_wndw | /light/left | light | 2225 | luminary1 | lm_R2-4-015_wndw | /light/middle | light | 2226 | luminary1 | lm_R2-4-015_wndw | /light/right | light | 2227 | luminary2 | lm_R2-4-015_door | /light/left | light | 2228 | luminary2 | lm_R2-4-015_door | /light/middle | light | 2229 | luminary2 | lm_R2-4-015_door | /light/right | light | 2230 | Presence | ps_R2-4-015_door | /ps | p-sensor | 2231 | sensor | | | | 2232 +----------------+------------------+---------------+---------------+ 2234 Table 4: Resource Directory identifiers 2236 It is assumed that the CT knows the RD's address, and has performed 2237 URI discovery on it that returned a response like the one in the 2238 Section 5.2 example. 2240 The CT inserts the endpoints of the luminaries and the sensor in the 2241 RD using the registration base URI parameter (base) to specify the 2242 interface address: 2244 Req: POST coap://[2001:db8:4::ff]/rd 2245 ?ep=lm_R2-4-015_wndw&base=coap://[2001:db8:4::1]&d=R2-4-015 2246 Payload: 2247 ;rt="light", 2248 ;rt="light", 2249 ;rt="light" 2251 Res: 2.01 Created 2252 Location-Path: /rd/4521 2254 Req: POST coap://[2001:db8:4::ff]/rd 2255 ?ep=lm_R2-4-015_door&base=coap://[2001:db8:4::2]&d=R2-4-015 2256 Payload: 2257 ;rt="light", 2258 ;rt="light", 2259 ;rt="light" 2261 Res: 2.01 Created 2262 Location-Path: /rd/4522 2264 Req: POST coap://[2001:db8:4::ff]/rd 2265 ?ep=ps_R2-4-015_door&base=coap://[2001:db8:4::3]d&d=R2-4-015 2266 Payload: 2267 ;rt="p-sensor" 2269 Res: 2.01 Created 2270 Location-Path: /rd/4523 2272 The sector name d=R2-4-015 has been added for an efficient lookup 2273 because filtering on "ep" name is more awkward. The same sector name 2274 is communicated to the two luminaries and the presence sensor by the 2275 CT. 2277 The group is specified in the RD. The base parameter is set to the 2278 site-local multicast address allocated to the group. In the POST in 2279 the example below, these two endpoints and the endpoint of the 2280 presence sensor are registered as members of the group. 2282 Req: POST coap://[2001:db8:4::ff]/rd-group 2283 ?gp=grp_R2-4-015&base=coap://[ff05::1] 2284 Payload: 2285 , 2286 , 2287 2289 Res: 2.01 Created 2290 Location-Path: /rd-group/501 2292 After the filling of the RD by the CT, the application in the 2293 luminaries can learn to which groups they belong, and enable their 2294 interface for the multicast address. 2296 The luminary, knowing its sector and own IPv6 address, looks up the 2297 groups containing light resources it is assigned to: 2299 Req: GET coap://[2001:db8:4::ff]/rd-lookup/gp 2300 ?d=R2-4-015&base=coap://[2001:db8:4::1]&rt=light 2302 Res: 2.05 Content 2303 ;gp="grp_R2-4-015";base="coap://[ff05::1]" 2305 From the returned base parameter value, the luminary learns the 2306 multicast address of the multicast group. 2308 Alternatively, the CT can communicate the multicast address directly 2309 to the luminaries by using the "coap-group" resource specified in 2310 [RFC7390]. 2312 Req: POST coap://[2001:db8:4::1]/coap-group 2313 Content-Format: application/coap-group+json 2314 Payload: 2315 { "a": "[ff05::1]", "n": "grp_R2-4-015"} 2317 Res: 2.01 Created 2318 Location-Path: /coap-group/1 2320 Dependent on the situation, only the address, "a", or the name, "n", 2321 is specified in the coap-group resource. 2323 11.2. OMA Lightweight M2M (LWM2M) Example 2325 This example shows how the OMA LWM2M specification makes use of 2326 Resource Directory (RD). 2328 OMA LWM2M is a profile for device services based on CoAP(OMA Name 2329 Authority). LWM2M defines a simple object model and a number of 2330 abstract interfaces and operations for device management and device 2331 service enablement. 2333 An LWM2M server is an instance of an LWM2M middleware service layer, 2334 containing a Resource Directory along with other LWM2M interfaces 2335 defined by the LWM2M specification. 2337 CoRE Resource Directory (RD) is used to provide the LWM2M 2338 Registration interface. 2340 LWM2M does not provide for registration sectors and does not 2341 currently use the rd-group or rd-lookup interfaces. 2343 The LWM2M specification describes a set of interfaces and a resource 2344 model used between a LWM2M device and an LWM2M server. Other 2345 interfaces, proxies, and applications are currently out of scope for 2346 LWM2M. 2348 The location of the LWM2M Server and RD URI path is provided by the 2349 LWM2M Bootstrap process, so no dynamic discovery of the RD is used. 2350 LWM2M Servers and endpoints are not required to implement the /.well- 2351 known/core resource. 2353 11.2.1. The LWM2M Object Model 2355 The OMA LWM2M object model is based on a simple 2 level class 2356 hierarchy consisting of Objects and Resources. 2358 An LWM2M Resource is a REST endpoint, allowed to be a single value or 2359 an array of values of the same data type. 2361 An LWM2M Object is a resource template and container type that 2362 encapsulates a set of related resources. An LWM2M Object represents 2363 a specific type of information source; for example, there is a LWM2M 2364 Device Management object that represents a network connection, 2365 containing resources that represent individual properties like radio 2366 signal strength. 2368 Since there may potentially be more than one of a given type object, 2369 for example more than one network connection, LWM2M defines instances 2370 of objects that contain the resources that represent a specific 2371 physical thing. 2373 The URI template for LWM2M consists of a base URI followed by Object, 2374 Instance, and Resource IDs: 2376 {/base-uri}{/object-id}{/object-instance}{/resource-id}{/resource- 2377 instance} 2378 The five variables given here are strings. base-uri can also have 2379 the special value "undefined" (sometimes called "null" in RFC 6570). 2380 Each of the variables object-instance, resource-id, and resource- 2381 instance can be the special value "undefined" only if the values 2382 behind it in this sequence also are "undefined". As a special case, 2383 object-instance can be "empty" (which is different from "undefined") 2384 if resource-id is not "undefined". 2386 base-uri := Base URI for LWM2M resources or "undefined" for default 2387 (empty) base URI 2389 object-id := OMNA (OMA Name Authority) registered object ID (0-65535) 2391 object-instance := Object instance identifier (0-65535) or 2392 "undefined"/"empty" (see above)) to refer to all instances of an 2393 object ID 2395 resource-id := OMNA (OMA Name Authority) registered resource ID 2396 (0-65535) or "undefined" to refer to all resources within an instance 2398 resource-instance := Resource instance identifier or "undefined" to 2399 refer to single instance of a resource 2401 LWM2M IDs are 16 bit unsigned integers represented in decimal (no 2402 leading zeroes except for the value 0) by URI format strings. For 2403 example, a LWM2M URI might be: 2405 /1/0/1 2407 The base uri is empty, the Object ID is 1, the instance ID is 0, the 2408 resource ID is 1, and the resource instance is "undefined". This 2409 example URI points to internal resource 1, which represents the 2410 registration lifetime configured, in instance 0 of a type 1 object 2411 (LWM2M Server Object). 2413 11.2.2. LWM2M Register Endpoint 2415 LWM2M defines a registration interface based on the REST API, 2416 described in Section 5. The RD registration URI path of the LWM2M 2417 Resource Directory is specified to be "/rd". 2419 LWM2M endpoints register object IDs, for example , to indicate 2420 that a particular object type is supported, and register object 2421 instances, for example , to indicate that a particular instance 2422 of that object type exists. 2424 Resources within the LWM2M object instance are not registered with 2425 the RD, but may be discovered by reading the resource links from the 2426 object instance using GET with a CoAP Content-Format of application/ 2427 link-format. Resources may also be read as a structured object by 2428 performing a GET to the object instance with a Content-Format of 2429 senml+json. 2431 When an LWM2M object or instance is registered, this indicates to the 2432 LWM2M server that the object and its resources are available for 2433 management and service enablement (REST API) operations. 2435 LWM2M endpoints may use the following RD registration parameters as 2436 defined in Table 2 : 2438 ep - Endpoint Name 2439 lt - registration lifetime 2441 Endpoint Name, Lifetime, and LWM2M Version are mandatory parameters 2442 for the register operation, all other registration parameters are 2443 optional. 2445 Additional optional LWM2M registration parameters are defined: 2447 +-----------+-------+-------------------------------+---------------+ 2448 | Name | Query | Validity | Description | 2449 +-----------+-------+-------------------------------+---------------+ 2450 | Binding | b | {"U",UQ","S","SQ","US","UQS"} | Available | 2451 | Mode | | | Protocols | 2452 | | | | | 2453 | LWM2M | ver | 1.0 | Spec Version | 2454 | Version | | | | 2455 | | | | | 2456 | SMS | sms | | MSISDN | 2457 | Number | | | | 2458 +-----------+-------+-------------------------------+---------------+ 2460 Table 5: LWM2M Additional Registration Parameters 2462 The following RD registration parameters are not currently specified 2463 for use in LWM2M: 2465 et - Endpoint Type 2466 base - Registration Base URI 2468 The endpoint registration must include a payload containing links to 2469 all supported objects and existing object instances, optionally 2470 including the appropriate link-format relations. 2472 Here is an example LWM2M registration payload: 2474 ,,, 2476 This link format payload indicates that object ID 1 (LWM2M Server 2477 Object) is supported, with a single instance 0 existing, object ID 3 2478 (LWM2M Device object) is supported, with a single instance 0 2479 existing, and object 5 (LWM2M Firmware Object) is supported, with no 2480 existing instances. 2482 11.2.3. LWM2M Update Endpoint Registration 2484 The LwM2M update is really very similar to the registration update as 2485 described in Appendix A.1, with the only difference that there are 2486 more parameters defined and available. All the parameters listed in 2487 that section are also available with the initial registration but are 2488 all optional: 2490 lt - Registration Lifetime 2491 b - Protocol Binding 2492 sms - MSISDN 2493 link payload - new or modified links 2495 A Registration update is also specified to be used to update the 2496 LWM2M server whenever the endpoint's UDP port or IP address are 2497 changed. 2499 11.2.4. LWM2M De-Register Endpoint 2501 LWM2M allows for de-registration using the delete method on the 2502 returned location from the initial registration operation. LWM2M de- 2503 registration proceeds as described in Appendix A.2. 2505 12. Acknowledgments 2507 Oscar Novo, Srdjan Krco, Szymon Sasin, Kerry Lynn, Esko Dijk, Anders 2508 Brandt, Matthieu Vial, Jim Schaad, Mohit Sethi, Hauke Petersen, 2509 Hannes Tschofenig, Sampo Ukkola, Linyi Tian, and Jan Newmarch have 2510 provided helpful comments, discussions and ideas to improve and shape 2511 this document. Zach would also like to thank his colleagues from the 2512 EU FP7 SENSEI project, where many of the resource directory concepts 2513 were originally developed. 2515 13. Changelog 2517 changes from -13 to -14 2519 o Rename "registration context" to "registration base URI" (and 2520 "con" to "base") and "domain" to "sector" (where the abbreviation 2521 "d" stays for compatibility reasons) 2523 o Introduced resource types core.rd-ep and core.rd-gp 2525 o Registration management moved to appendix A, including endpoint 2526 and group lookup 2528 o Minor editorial changes 2530 * PATCH/iPATCH is clearly deferred to another document 2532 * Recommend against query / fragment identifier in con= 2534 * Interface description lists are described as illustrative 2536 * Rewording of Simple Registration 2538 o Simple registration carries no error information and succeeds 2539 immediately (previously, sequence was unspecified) 2541 o Lookup: href are matched against resolved values (previously, this 2542 was unspecified) 2544 o Lookup: lt are not exposed any more 2546 o con/base: Paths are allowed 2548 o Registration resource locations can not have query or fragment 2549 parts 2551 o Default life time extended to 25 hours 2553 o clarified registration update rules 2555 o lt-value semantics for lookup clarified. 2557 o added template for simple registration 2559 changes from -12 to -13 2561 o Added "all resource directory" nodes MC address 2563 o Clarified observation behavior 2565 o version identification 2567 o example rt= and et= values 2569 o domain from figure 2 2570 o more explanatory text 2572 o endpoints of a groups hosted by different RD 2574 o resolve RFC6690-vs-8288 resolution ambiguities: 2576 * require registered links not to be relative when using anchor 2578 * return absolute URIs in resource lookup 2580 changes from -11 to -12 2582 o added Content Model section, including ER diagram 2584 o removed domain lookup interface; domains are now plain attributes 2585 of groups and endpoints 2587 o updated chapter "Finding a Resource Directory"; now distinguishes 2588 configuration-provided, network-provided and heuristic sources 2590 o improved text on: atomicity, idempotency, lookup with multiple 2591 parameters, endpoint removal, simple registration 2593 o updated LWM2M description 2595 o clarified where relative references are resolved, and how context 2596 and anchor interact 2598 o new appendix on the interaction with RFCs 6690, 5988 and 3986 2600 o lookup interface: group and endpoint lookup return group and 2601 registration resources as link targets 2603 o lookup interface: search parameters work the same across all 2604 entities 2606 o removed all methods that modify links in an existing registration 2607 (POST with payload, PATCH and iPATCH) 2609 o removed plurality definition (was only needed for link 2610 modification) 2612 o enhanced IANA registry text 2614 o state that lookup resources can be observable 2616 o More examples and improved text 2617 changes from -09 to -10 2619 o removed "ins" and "exp" link-format extensions. 2621 o removed all text concerning DNS-SD. 2623 o removed inconsistency in RDAO text. 2625 o suggestions taken over from various sources 2627 o replaced "Function Set" with "REST API", "base URI", "base path" 2629 o moved simple registration to registration section 2631 changes from -08 to -09 2633 o clarified the "example use" of the base RD resource values /rd, 2634 /rd-lookup, and /rd-group. 2636 o changed "ins" ABNF notation. 2638 o various editorial improvements, including in examples 2640 o clarifications for RDAO 2642 changes from -07 to -08 2644 o removed link target value returned from domain and group lookup 2645 types 2647 o Maximum length of domain parameter 63 bytes for consistency with 2648 group 2650 o removed option for simple POST of link data, don't require a 2651 .well-known/core resource to accept POST data and handle it in a 2652 special way; we already have /rd for that 2654 o add IPv6 ND Option for discovery of an RD 2656 o clarify group configuration section 6.1 that endpoints must be 2657 registered before including them in a group 2659 o removed all superfluous client-server diagrams 2661 o simplified lighting example 2663 o introduced Commissioning Tool 2664 o RD-Look-up text is extended. 2666 changes from -06 to -07 2668 o added text in the discovery section to allow content format hints 2669 to be exposed in the discovery link attributes 2671 o editorial updates to section 9 2673 o update author information 2675 o minor text corrections 2677 Changes from -05 to -06 2679 o added note that the PATCH section is contingent on the progress of 2680 the PATCH method 2682 changes from -04 to -05 2684 o added Update Endpoint Links using PATCH 2686 o http access made explicit in interface specification 2688 o Added http examples 2690 Changes from -03 to -04: 2692 o Added http response codes 2694 o Clarified endpoint name usage 2696 o Add application/link-format+cbor content-format 2698 Changes from -02 to -03: 2700 o Added an example for lighting and DNS integration 2702 o Added an example for RD use in OMA LWM2M 2704 o Added Read Links operation for link inspection by endpoints 2706 o Expanded DNS-SD section 2708 o Added draft authors Peter van der Stok and Michael Koster 2710 Changes from -01 to -02: 2712 o Added a catalogue use case. 2714 o Changed the registration update to a POST with optional link 2715 format payload. Removed the endpoint type update from the update. 2717 o Additional examples section added for more complex use cases. 2719 o New DNS-SD mapping section. 2721 o Added text on endpoint identification and authentication. 2723 o Error code 4.04 added to Registration Update and Delete requests. 2725 o Made 63 bytes a SHOULD rather than a MUST for endpoint name and 2726 resource type parameters. 2728 Changes from -00 to -01: 2730 o Removed the ETag validation feature. 2732 o Place holder for the DNS-SD mapping section. 2734 o Explicitly disabled GET or POST on returned Location. 2736 o New registry for RD parameters. 2738 o Added support for the JSON Link Format. 2740 o Added reference to the Groupcomm WG draft. 2742 Changes from -05 to WG Document -00: 2744 o Updated the version and date. 2746 Changes from -04 to -05: 2748 o Restricted Update to parameter updates. 2750 o Added pagination support for the Lookup interface. 2752 o Minor editing, bug fixes and reference updates. 2754 o Added group support. 2756 o Changed rt to et for the registration and update interface. 2758 Changes from -03 to -04: 2760 o Added the ins= parameter back for the DNS-SD mapping. 2762 o Integrated the Simple Directory Discovery from Carsten. 2764 o Editorial improvements. 2766 o Fixed the use of ETags. 2768 o Fixed tickets 383 and 372 2770 Changes from -02 to -03: 2772 o Changed the endpoint name back to a single registration parameter 2773 ep= and removed the h= and ins= parameters. 2775 o Updated REST interface descriptions to use RFC6570 URI Template 2776 format. 2778 o Introduced an improved RD Lookup design as its own function set. 2780 o Improved the security considerations section. 2782 o Made the POST registration interface idempotent by requiring the 2783 ep= parameter to be present. 2785 Changes from -01 to -02: 2787 o Added a terminology section. 2789 o Changed the inclusion of an ETag in registration or update to a 2790 MAY. 2792 o Added the concept of an RD Domain and a registration parameter for 2793 it. 2795 o Recommended the Location returned from a registration to be 2796 stable, allowing for endpoint and Domain information to be changed 2797 during updates. 2799 o Changed the lookup interface to accept endpoint and Domain as 2800 query string parameters to control the scope of a lookup. 2802 14. References 2803 14.1. Normative References 2805 [I-D.ietf-core-links-json] 2806 Li, K., Rahman, A., and C. Bormann, "Representing 2807 Constrained RESTful Environments (CoRE) Link Format in 2808 JSON and CBOR", draft-ietf-core-links-json-10 (work in 2809 progress), February 2018. 2811 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2812 Requirement Levels", BCP 14, RFC 2119, 2813 DOI 10.17487/RFC2119, March 1997, 2814 . 2816 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 2817 Resource Identifier (URI): Generic Syntax", STD 66, 2818 RFC 3986, DOI 10.17487/RFC3986, January 2005, 2819 . 2821 [RFC5988] Nottingham, M., "Web Linking", RFC 5988, 2822 DOI 10.17487/RFC5988, October 2010, 2823 . 2825 [RFC6570] Gregorio, J., Fielding, R., Hadley, M., Nottingham, M., 2826 and D. Orchard, "URI Template", RFC 6570, 2827 DOI 10.17487/RFC6570, March 2012, 2828 . 2830 [RFC6690] Shelby, Z., "Constrained RESTful Environments (CoRE) Link 2831 Format", RFC 6690, DOI 10.17487/RFC6690, August 2012, 2832 . 2834 [RFC6763] Cheshire, S. and M. Krochmal, "DNS-Based Service 2835 Discovery", RFC 6763, DOI 10.17487/RFC6763, February 2013, 2836 . 2838 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 2839 Writing an IANA Considerations Section in RFCs", BCP 26, 2840 RFC 8126, DOI 10.17487/RFC8126, June 2017, 2841 . 2843 14.2. Informative References 2845 [ER] Chen, P., "The entity-relationship model---toward a 2846 unified view of data", ACM Transactions on Database 2847 Systems Vol. 1, pp. 9-36, DOI 10.1145/320434.320440, March 2848 1976. 2850 [I-D.arkko-core-dev-urn] 2851 Arkko, J., Jennings, C., and Z. Shelby, "Uniform Resource 2852 Names for Device Identifiers", draft-arkko-core-dev-urn-05 2853 (work in progress), October 2017. 2855 [I-D.bormann-t2trg-rel-impl] 2856 Bormann, C., "impl-info: A link relation type for 2857 disclosing implementation information", draft-bormann- 2858 t2trg-rel-impl-00 (work in progress), January 2018. 2860 [I-D.ietf-ace-oauth-authz] 2861 Seitz, L., Selander, G., Wahlstroem, E., Erdtman, S., and 2862 H. Tschofenig, "Authentication and Authorization for 2863 Constrained Environments (ACE) using the OAuth 2.0 2864 Framework (ACE-OAuth)", draft-ietf-ace-oauth-authz-12 2865 (work in progress), May 2018. 2867 [I-D.ietf-anima-bootstrapping-keyinfra] 2868 Pritikin, M., Richardson, M., Behringer, M., Bjarnason, 2869 S., and K. Watsen, "Bootstrapping Remote Secure Key 2870 Infrastructures (BRSKI)", draft-ietf-anima-bootstrapping- 2871 keyinfra-16 (work in progress), June 2018. 2873 [I-D.silverajan-core-coap-protocol-negotiation] 2874 Silverajan, B. and M. Ocak, "CoAP Protocol Negotiation", 2875 draft-silverajan-core-coap-protocol-negotiation-08 (work 2876 in progress), March 2018. 2878 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 2879 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 2880 Transfer Protocol -- HTTP/1.1", RFC 2616, 2881 DOI 10.17487/RFC2616, June 1999, 2882 . 2884 [RFC6775] Shelby, Z., Ed., Chakrabarti, S., Nordmark, E., and C. 2885 Bormann, "Neighbor Discovery Optimization for IPv6 over 2886 Low-Power Wireless Personal Area Networks (6LoWPANs)", 2887 RFC 6775, DOI 10.17487/RFC6775, November 2012, 2888 . 2890 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 2891 Protocol (HTTP/1.1): Message Syntax and Routing", 2892 RFC 7230, DOI 10.17487/RFC7230, June 2014, 2893 . 2895 [RFC7252] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained 2896 Application Protocol (CoAP)", RFC 7252, 2897 DOI 10.17487/RFC7252, June 2014, 2898 . 2900 [RFC7390] Rahman, A., Ed. and E. Dijk, Ed., "Group Communication for 2901 the Constrained Application Protocol (CoAP)", RFC 7390, 2902 DOI 10.17487/RFC7390, October 2014, 2903 . 2905 [RFC7641] Hartke, K., "Observing Resources in the Constrained 2906 Application Protocol (CoAP)", RFC 7641, 2907 DOI 10.17487/RFC7641, September 2015, 2908 . 2910 [RFC8132] van der Stok, P., Bormann, C., and A. Sehgal, "PATCH and 2911 FETCH Methods for the Constrained Application Protocol 2912 (CoAP)", RFC 8132, DOI 10.17487/RFC8132, April 2017, 2913 . 2915 [RFC8288] Nottingham, M., "Web Linking", RFC 8288, 2916 DOI 10.17487/RFC8288, October 2017, 2917 . 2919 [RFC8392] Jones, M., Wahlstroem, E., Erdtman, S., and H. Tschofenig, 2920 "CBOR Web Token (CWT)", RFC 8392, DOI 10.17487/RFC8392, 2921 May 2018, . 2923 Appendix A. Registration Management 2925 This section describes how the registering endpoint can maintain the 2926 registries that it created. The registering endpoint can be the 2927 registree-ep or the CT. An endpoint SHOULD NOT use this interface 2928 for registries that it did not create. The registries are resources 2929 of the RD. 2931 After the initial registration, the registering endpoint retains the 2932 returned location of the Registration Resource for further 2933 operations, including refreshing the registration in order to extend 2934 the lifetime and "keep-alive" the registration. When the lifetime of 2935 the registration has expired, the RD SHOULD NOT respond to discovery 2936 queries concerning this endpoint. The RD SHOULD continue to provide 2937 access to the Registration Resource after a registration time-out 2938 occurs in order to enable the registering endpoint to eventually 2939 refresh the registration. The RD MAY eventually remove the 2940 registration resource for the purpose of garbage collection and 2941 remove it from any group it belongs to. If the Registration Resource 2942 is removed, the corresponding endpoint will need to be re-registered. 2944 The Registration Resource may also be used to inspect the 2945 registration resource using GET, update the registration, cancel the 2946 registration using DELETE, do an endpoint lookup, or a group lookup. 2948 These operations are described below. 2950 A.1. Registration Update 2952 The update interface is used by the registering endpoint to refresh 2953 or update its registration with an RD. To use the interface, the 2954 registering endpoint sends a POST request to the registration 2955 resource returned by the initial registration operation. 2957 An update MAY update the lifetime- or the context- registration 2958 parameters "lt", "base" as in Section 5.3. Parameters that are not 2959 being changed SHOULD NOT be included in an update. Adding parameters 2960 that have not changed increases the size of the message but does not 2961 have any other implications. Parameters MUST be included as query 2962 parameters in an update operation as in Section 5.3. 2964 A registration update resets the timeout of the registration to the 2965 (possibly updated) lifetime of the registration, independent of 2966 whether a "lt" parameter was given. 2968 If the context of the registration is changed in an update explicitly 2969 or implicitly, relative references submitted in the original 2970 registration or later updates are resolved anew against the new 2971 context (like in the original registration). 2973 The registration update operation only describes the use of POST with 2974 an empty payload. Future standards might describe the semantics of 2975 using content formats and payloads with the POST method to update the 2976 links of a registration (see Appendix A.4). 2978 The update registration request interface is specified as follows: 2980 Interaction: EP -> RD 2982 Method: POST 2984 URI Template: {+location}{?lt,con,extra-attrs*} 2986 URI Template Variables: 2988 location := This is the Location returned by the RD as a result 2989 of a successful earlier registration. 2991 lt := Lifetime (optional). Lifetime of the registration in 2992 seconds. Range of 60-4294967295. If no lifetime is included, 2993 the previous last lifetime set on a previous update or the 2994 original registration (falling back to 90000) SHOULD be used. 2996 base := Base URI (optional). This parameter updates the context 2997 established in the original registration to a new value. If 2998 the parameter is set in an update, it is stored by the RD as 2999 the new Base URI under which to interpret the links of the 3000 registration, following the same restrictions as in the 3001 registration. If the parameter is not set and was set 3002 explicitly before, the previous Base URI value is kept 3003 unmodified. If the parameter is not set and was not set 3004 explicitly before either, the source address and source port of 3005 the update request are stored as the Base URI. 3007 extra-attrs := Additional registration attributes (optional). As 3008 with the registration, the RD processes them if it knows their 3009 semantics. Otherwise, unknown attributes are stored as 3010 endpoint attributes, overriding any previously stored endpoint 3011 attributes of the same key. 3013 Content-Format: none (no payload) 3015 The following response codes are defined for this interface: 3017 Success: 2.04 "Changed" or 204 "No Content" if the update was 3018 successfully processed. 3020 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 3021 request. 3023 Failure: 4.04 "Not Found" or 404 "Not Found". Registration does not 3024 exist (e.g. may have expired). 3026 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 3027 Service could not perform the operation. 3029 HTTP support: YES 3031 If the registration update fails with a "Service Unavailable" 3032 response and a Max-Age option or Retry-After header, the registering 3033 endpoint SHOULD retry the operation after the time indicated. If the 3034 registration fails in another way, including request timeouts, or if 3035 the time indicated excedes the remaining lifetime, the registering 3036 endpoint SHOULD attempt registration again. 3038 The following example shows the registering endpoint updates its 3039 registration resource at an RD using this interface with the example 3040 location value: /rd/4521. 3042 Req: POST /rd/4521 3044 Res: 2.04 Changed 3046 The following example shows the registering endpoint updating its 3047 registration resource at an RD using this interface with the example 3048 location value: /rd/4521. The initial registration by the 3049 registering endpoint set the following values: 3051 o endpoint name (ep)=endpoint1 3053 o lifetime (lt)=500 3055 o context (con)=coap://local-proxy-old.example.com:5683 3057 o payload of Figure 7 3059 The initial state of the Resource Directory is reflected in the 3060 following request: 3062 Req: GET /rd-lookup/res?ep=endpoint1 3064 Res: 2.01 Content 3065 Payload: 3066 ;ct=41; 3067 rt="temperature"; anchor="coap://spurious.example.com:5683", 3068 ;ct=41; 3069 rt="light-lux"; if="sensor"; 3070 anchor="coap://local-proxy-old.example.com:5683" 3072 The following example shows the registering endpoint changing the 3073 context to "coaps://new.example.com:5684": 3075 Req: POST /rd/4521?con=coaps://new.example.com:5684 3077 Res: 2.04 Changed 3079 The consecutive query returns: 3081 Req: GET /rd-lookup/res?ep=endpoint1 3083 Res: 2.01 Content 3084 Payload: 3085 ;ct=41;rt="temperature"; 3086 anchor="coap://spurious.example.com:5683", 3087 ;ct=41;rt="light-lux"; 3088 if="sensor"; anchor="coaps://new.example.com:5684", 3090 A.2. Registration Removal 3092 Although RD entries have soft state and will eventually timeout after 3093 their lifetime, the registering endpoint SHOULD explicitly remove an 3094 entry from the RD if it knows it will no longer be available (for 3095 example on shut-down). This is accomplished using a removal 3096 interface on the RD by performing a DELETE on the endpoint resource. 3098 Removed registrations are implicitly removed from the groups to which 3099 they belong. 3101 The removal request interface is specified as follows: 3103 Interaction: EP -> RD 3105 Method: DELETE 3107 URI Template: {+location} 3109 URI Template Variables: 3111 location := This is the Location returned by the RD as a result 3112 of a successful earlier registration. 3114 The following response codes are defined for this interface: 3116 Success: 2.02 "Deleted" or 204 "No Content" upon successful deletion 3118 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 3119 request. 3121 Failure: 4.04 "Not Found" or 404 "Not Found". Registration does not 3122 exist (e.g. may have expired). 3124 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 3125 Service could not perform the operation. 3127 HTTP support: YES 3128 The following examples shows successful removal of the endpoint from 3129 the RD with example location value /rd/4521. 3131 Req: DELETE /rd/4521 3133 Res: 2.02 Deleted 3135 A.3. Read Endpoint Links 3137 Some registering endpoints may wish to manage their links as a 3138 collection, and may need to read the current set of links stored in 3139 the registration resource, in order to determine link maintenance 3140 operations. 3142 One or more links MAY be selected by using query filtering as 3143 specified in [RFC6690] Section 4.1 3145 If no links are selected, the Resource Directory SHOULD return an 3146 empty payload. 3148 The read request interface is specified as follows: 3150 Interaction: EP -> RD 3152 Method: GET 3154 URI Template: {+location}{?href,rel,rt,if,ct} 3156 URI Template Variables: 3158 location := This is the Location returned by the RD as a result 3159 of a successful earlier registration. 3161 href,rel,rt,if,ct := link relations and attributes specified in 3162 the query in order to select particular links based on their 3163 relations and attributes. "href" denotes the URI target of the 3164 link. See [RFC6690] Sec. 4.1 3166 The following response codes are defined for this interface: 3168 Success: 2.05 "Content" or 200 "OK" upon success with an 3169 "application/link-format", "application/link-format+cbor", or 3170 "application/link-format+json" payload. 3172 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 3173 request. 3175 Failure: 4.04 "Not Found" or 404 "Not Found". Registration does not 3176 exist (e.g. may have expired). 3178 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 3179 Service could not perform the operation. 3181 HTTP support: YES 3183 The following examples show successful read of the endpoint links 3184 from the RD, with example location value /rd/4521 and example 3185 registration payload of Figure 7. 3187 Req: GET /rd/4521 3189 Res: 2.01 Content 3190 Payload: 3191 ;ct=41;rt="temperature-c";if="sensor"; 3192 anchor="coap://spurious.example.com:5683", 3193 ;ct=41;rt="light-lux";if="sensor" 3195 A.4. Update Endpoint Links 3197 An iPATCH (or PATCH) update ([RFC8132]) can add, remove or change the 3198 links of a registration. 3200 Those operations are out of scope of this document, and will require 3201 media types suitable for modifying sets of links. 3203 A.5. Endpoint and group lookup 3205 Endpoint and group lookups result in links to registration resources 3206 and group resources, respectively. Endpoint registration resources 3207 are annotated with their endpoint names (ep), sectors (d, if present) 3208 and registration base URI (base) as well as a constant resource type 3209 (rt="core.rd-ep"); the lifetime (lt) is not reported. Additional 3210 endpoint attributes are added as link attributes to their endpoint 3211 link unless their specification says otherwise. 3213 Group resources are annotated with their group names (gp), sector (d, 3214 if present) and multicast address (base, if present) as well as a 3215 constant resource type (rt="core.rd-gp"). 3217 Serializations derived from Link Format, SHOULD present links to 3218 groups and endpoints in path-absolute form or, if required, as 3219 absolute references. (This approach avoids the RFC6690 ambiguities.) 3220 While Endpoint Lookup does expose the registration resources, the RD 3221 does not need to make them accessible to clients. Clients SHOULD NOT 3222 attempt to dereference or manipulate them. 3224 A Resource Directory can report endpoints or groups in lookup that 3225 are not hosted at the same address. Lookup clients MUST be prepared 3226 to see arbitrary URIs as registration or group resources in the 3227 results and treat them as opaque identifiers; the precise semantics 3228 of such links are left to future specifications. 3230 For groups, a Resource Directory as specified here does not provide a 3231 lookup mechanism for the resources that can be accessed on a group's 3232 multicast address (ie. no lookup will return links like 3233 ";..." for a group registered 3234 with "base=coap://[ff35...]"). Such an additional lookup interface 3235 could be specified in an extension document. 3237 The following example shows a client performing an endpoint type (et) 3238 lookup with the value oic.d.sensor (which is currently a registered 3239 rt value): 3241 Req: GET /rd-lookup/ep?et=oic.d.sensor 3243 Res: 2.05 Content 3244 ;base="coap://[2001:db8:3::127]:61616";ep="node5"; 3245 et="oic.d.sensor";ct="40", 3246 ;base="coap://[2001:db8:3::129]:61616";ep="node7"; 3247 et="oic.d.sensor";ct="40";d="floor-3" 3249 The following example shows a client performing a group lookup for 3250 all groups: 3252 Req: GET /rd-lookup/gp 3254 Res: 2.05 Content 3255 ;gp="lights1";d="example.com"; 3256 base="coap://[ff35:30:2001:db8::1]", 3257 ;gp="lights2";d="example.com"; 3258 base="coap://[ff35:30:2001:db8::2]" 3260 The following example shows a client performing a lookup for all 3261 groups the endpoint "node1" belongs to: 3263 Req: GET /rd-lookup/gp?ep=node1 3265 Res: 2.05 Content 3266 ;gp="lights1" 3268 Appendix B. Web links and the Resource Directory 3270 Understanding the semantics of a link-format document and its URI 3271 references is a journey through different documents ([RFC3986] 3272 defining URIs, [RFC6690] defining link-format documents based on 3273 [RFC8288] which defines link headers, and [RFC7252] providing the 3274 transport). This appendix summarizes the mechanisms and semantics at 3275 play from an entry in ".well-known/core" to a resource lookup. 3277 This text is primarily aimed at people entering the field of 3278 Constrained Restful Environments from applications that previously 3279 did not use web mechanisms. 3281 B.1. A simple example 3283 Let's start this example with a very simple host, "2001:db8:f0::1". 3284 A client that follows classical CoAP Discovery ([RFC7252] Section 7), 3285 sends the following multicast request to learn about neighbours 3286 supporting resources with resource-type "temperature". 3288 The client sends a link-local multicast: 3290 GET coap://[ff02::fd]:5683/.well-known/core?rt=temperature 3292 RES 2.05 Content 3293 ;rt=temperature;ct=0 3295 where the response is sent by the server, "[2001:db8:f0::1]:5683". 3297 While the client - on the practical or implementation side - can just 3298 go ahead and create a new request to "[2001:db8:f0::1]:5683" with 3299 Uri-Path: "temp", the full resolution steps without any shortcuts 3300 are: 3302 B.1.1. Resolving the URIs 3304 The client parses the single returned record. The link's target 3305 (sometimes called "href") is ""/temp"", which is a relative URI that 3306 needs resolving. As long as all involved links follow the 3307 restrictions set forth for this document (see Appendix B.4), the base 3308 URI to resolve this against the requested URI. 3310 The URI of the requested resource can be composed by following the 3311 steps of [RFC7252] section 6.5 (with an addition at the end of 8.2) 3312 into ""coap://[2001:db8:f0::1]/.well-known/core"". 3314 The record's target is resolved by replacing the path ""/.well-known/ 3315 core"" from the Base URI (section 5.2 [RFC3986]) with the relative 3316 target URI ""/temp"" into ""coap://[2001:db8:f0::1]/temp"". 3318 B.1.2. Interpreting attributes and relations 3320 Some more information but the record's target can be obtained from 3321 the payload: the resource type of the target is "temperature", and 3322 its content type is text/plain (ct=0). 3324 A relation in a web link is a three-part statement that the context 3325 resource has a named relation to the target resource, like "_This 3326 page_ has _its table of contents_ at _/toc.html_". In [RFC6690] 3327 link-format documents, there is an implicit "host relation" specified 3328 with default parameter: rel="hosts". 3330 In our example, the context of the link is the URI of the requested 3331 document itself. A full English expression of the "host relation" 3332 is: 3334 '"coap://[2001:db8:f0::1]/.well-known/core" is hosting the resource 3335 "coap://[2001:db8:f0::1]/temp", which is of the resource type 3336 "temperature" and can be accessed using the text/plain content 3337 format.' 3339 B.2. A slightly more complex example 3341 Omitting the "rt=temperature" filter, the discovery query would have 3342 given some more records in the payload: 3344 ;rt=temperature;ct=0, 3345 ;rt=light-lux;ct=0, 3346 ;anchor="/sensors/temp";rel=alternate, 3347 ;anchor="/sensors/temp"; 3348 rel="describedby" 3350 Parsing the third record, the client encounters the "anchor" 3351 parameter. It is a URI relative to the document's Base URI and is 3352 thus resolved to ""coap://[2001:db8:f0::1]/sensors/temp"". That is 3353 the context resource of the link, so the "rel" statement is not about 3354 the target and the document Base URI any more, but about the target 3355 and that address. 3357 Thus, the third record could be read as 3358 ""coap://[2001:db8:f0::1]/sensors/temp" has an alternate 3359 representation at "coap://[2001:db8:f0::1]/t"". 3361 The fourth record can be read as ""coap://[2001:db8:f0::1]/sensors/ 3362 temp" is described by "http://www.example.com/sensors/t123"". 3364 B.3. Enter the Resource Directory 3366 The resource directory tries to carry the semantics obtainable by 3367 classical CoAP discovery over to the resource lookup interface as 3368 faithfully as possible. 3370 For the following queries, we will assume that the simple host has 3371 used Simple Registration to register at the resource directory that 3372 was announced to it, sending this request from its UDP port 3373 "[2001:db8:f0::1]:6553": 3375 POST coap://[2001:db8:f01::ff]/.well-known/core?ep=simple-host1 3377 The resource directory would have accepted the registration, and 3378 queried the simple host's ".well-known/core" by itself. As a result, 3379 the host is registered as an endpoint in the RD with the name 3380 "simple-host1". The registration is active for 90000 seconds, and 3381 the endpoint registration Base URI is ""coap://[2001:db8:f0::1]/"" 3382 because that is the address the registration was sent from (and no 3383 explicit "con=" was given). 3385 If the client now queries the RD as it would previously have issued a 3386 multicast request, it would go through the RD discovery steps by 3387 fetching "coap://[2001:db8:f0::ff]/.well-known/core?rt=core.rd- 3388 lookup-res", obtain "coap://[2001:db8:f0::ff]/rd-lookup/res" as the 3389 resource lookup endpoint, and issue a request to 3390 "coap://[2001:db8:f0::ff]/rd-lookup/res?rt=temperature" to receive 3391 the following data: 3393 ;rt=temperature;ct=0; 3394 anchor="coap://[2001:db8:f0::1]" 3396 This is not _literally_ the same response that it would have received 3397 from a multicast request, but it would contain the (almost) same 3398 statement: 3400 '"coap://[2001:db8:f0::1]" is hosting the resource 3401 "coap://[2001:db8:f0::1]/temp", which is of the resource type 3402 "temperature" and can be accessed using the text/plain content 3403 format.' 3405 (The difference is whether "/" or "/.well-known/core" hosts the 3406 resources, which is subject of ongoing discussion about RFC6690). 3408 To complete the examples, the client could also query all resources 3409 hosted at the endpoint with the known endpoint name "simple-host1". 3410 A request to "coap://[2001:db8:f0::ff]/rd-lookup/res?ep=simple-host1" 3411 would return 3413 ;rt=temperature;ct=0; 3414 anchor="coap://[2001:db8:f0::1]", 3415 ;rt=light-lux;ct=0; 3416 anchor="coap://[2001:db8:f0::1]", 3417 ; 3418 anchor="coap://[2001:db8:f0::1]/sensors/temp";rel=alternate, 3419 ; 3420 anchor="coap://[2001:db8:f0::1]/sensors/temp";rel="describedby" 3422 All the target and anchor references are already in absolute form 3423 there, which don't need to be resolved any further. 3425 Had the simple host registered with an explicit context (eg. 3426 "?ep=simple-host1&con=coap+tcp://simple-host1.example.com"), that 3427 context would have been used to resolve the relative anchor values 3428 instead, giving 3430 ;rt=temperature;ct=0; 3431 anchor="coap+tcp://simple-host1.example.com" 3433 and analogous records. 3435 B.4. A note on differences between link-format and Link headers 3437 While link-format and Link headers look very similar and are based on 3438 the same model of typed links, there are some differences between 3439 [RFC6690] and [RFC5988], which are dealt with differently: 3441 o "Resolving the target against the anchor": [RFC6690] Section 2.1 3442 states that the anchor of a link is used as the Base URI against 3443 which the term inside the angle brackets (the target) is resolved, 3444 falling back to the resource's URI with paths stripped off (its 3445 "Origin"). [RFC8288] Section B.2 describes that the anchor is 3446 immaterial to the resolution of the target reference. 3448 RFC6690, in the same section, also states that absent anchors set 3449 the context of the link to the target's URI with its path stripped 3450 off, while according to [RFC8288] Section 3.2, the context is the 3451 resource's base URI. 3453 In the context of a Resource Directory, the authors decided not to 3454 not let this become an issue by requiring that RFC6690 links be 3455 serialized in a way that either rule set can be applied and give 3456 the same results. Note that all examples of [RFC6690], [RFC8288] 3457 and this document comply with that rule. 3459 The Modernized Link Format is introduced in Appendix D to 3460 formalize what it means to apply the ruleset of RFC8288 to Link 3461 Format documents. 3463 o There is no percent encoding in link-format documents. 3465 A link-format document is a UTF-8 encoded string of Unicode 3466 characters and does not have percent encoding, while Link headers 3467 are practically ASCII strings that use percent encoding for non- 3468 ASCII characters, stating the encoding explicitly when required. 3470 For example, while a Link header in a page about a Swedish city 3471 might read 3473 "Link: ;rel="live-environment-data"" 3475 a link-format document from the same source might describe the 3476 link as 3478 ";rel="live-environment-data"" 3480 Parsers and producers of link-format and header data need to be 3481 aware of this difference. 3483 Appendix C. Syntax examples for Protocol Negotiation 3485 [ This appendix should not show up in a published version of this 3486 document. ] 3488 The protocol negotiation that is being worked on in 3489 [I-D.silverajan-core-coap-protocol-negotiation] makes use of the 3490 Resource Directory. 3492 Until that document is update to use the latest resource-directory 3493 specification, here are some examples of protocol negotiation with 3494 the current Resource Directory: 3496 An endpoint could register as follows from its address 3497 "[2001:db8:f1::2]:5683": 3499 Req: POST coap://rd.example.com/rd?ep=node1 3500 &at=coap+tcp://[2001:db8:f1::2] 3501 Content-Format: 40 3502 Payload: 3503 ;ct=0;rt="temperature";if="core.s" 3505 Res: 2.01 Created 3506 Location-Path: /rd/1234 3508 An endpoint lookup would just reflect the registered attributes: 3510 Req: GET /rd-lookup/ep 3512 Res: 2.05 Content 3513 ;ep="node1";con="coap://[2001:db8:f1::2]:5683"; 3514 at="coap+tcp://[2001:db8:f1::2]" 3516 A UDP client would then see the following in a resource lookup: 3518 Req: GET /rd-lookup/res?rt=temperature 3520 Res: 2.05 Content 3521 ;ct=0;rt="temperature"; 3522 if="core.s"; anchor="coap://[2001:db8:f1::2]" 3524 while a TCP capable client could say: 3526 Req: GET /rd-lookup/res?rt=temperature&tt=tcp 3528 Res: 2.05 Content 3529 ;ct=0;rt="temperature"; 3530 if="core.s";anchor="coap+tcp://[2001:db8:f1::2]" 3532 Appendix D. Modernized Link Format parsing 3534 The CoRE Link Format as described in [RFC6690] is unsuitable for some 3535 use cases of the Resource Directory, and their resolution scheme is 3536 often misunderstood by developers familiar with [RFC8288]. 3538 For the correct application of base URIs, we describe the 3539 interpretation of a Link Format document as a Modernized Link Format. 3540 In Modernized Link Format, the document is processed as in Link 3541 Format, with the exception of Section 2.1 of [RFC6690]: 3543 o The URI-reference inside angle brackets ("<>") describes the 3544 target URI of the link. If it is a relative reference, it is 3545 resolved against the base URI of the document. 3547 o The context of the link is expressed by the "anchor" parameter; if 3548 it is a relative reference, it is resolved against the document's 3549 base URI. In absence of the "anchor" attribute, the base URI is 3550 the link's context. 3552 Content formats derived from [RFC6690] which inherit its resolution 3553 rules, like JSON and CBOR link format of [I-D.ietf-core-links-json], 3554 can be interpreted in analogy to that. 3556 For where the Resource Directory is concerned, all common forms of 3557 links (eg. all the examples of RFC6690) yield identical results. 3558 When interpreting data read from ".well-known/core", differences in 3559 interpretation only affect links where the absent anchor attribute 3560 means "coap://host/" according to RFC6690 and "coap://host/.well- 3561 known/core" according to Modernized Link format; those typically only 3562 occur in conjunction with the vaguely defined implicit "hosts" 3563 relationship. 3565 D.1. For endpoint developers 3567 When developing endpoints, ie. when generating documents that will be 3568 submitted to a Resource Directory, the differences between Modernized 3569 Link Format and RFC6690 can be ignored as long as all relative 3570 references start with a slash, and any of the following applies: 3572 o There is no anchor attribute, and the context of the link does not 3573 matter to the application. 3575 Example: ";ct=40" 3577 o The anchor is a relative reference. 3579 Example: ";anchor="/sensors/temp";rel="alternate" 3581 o The target is an absolute reference. 3583 Example: ";anchor="/sensors/ 3584 temp";rel="describedby"" 3586 Authors' Addresses 3587 Zach Shelby 3588 ARM 3589 150 Rose Orchard 3590 San Jose 95134 3591 USA 3593 Phone: +1-408-203-9434 3594 Email: zach.shelby@arm.com 3596 Michael Koster 3597 SmartThings 3598 665 Clyde Avenue 3599 Mountain View 94043 3600 USA 3602 Phone: +1-707-502-5136 3603 Email: Michael.Koster@smartthings.com 3605 Carsten Bormann 3606 Universitaet Bremen TZI 3607 Postfach 330440 3608 Bremen D-28359 3609 Germany 3611 Phone: +49-421-218-63921 3612 Email: cabo@tzi.org 3614 Peter van der Stok 3615 consultant 3617 Phone: +31-492474673 (Netherlands), +33-966015248 (France) 3618 Email: consultancy@vanderstok.org 3619 URI: www.vanderstok.org 3621 Christian Amsuess (editor) 3622 Hollandstr. 12/4 3623 1020 3624 Austria 3626 Phone: +43-664-9790639 3627 Email: christian@amsuess.com