idnits 2.17.1 draft-ietf-core-resource-directory-16.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 3 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 422 has weird spacing: '... target o----...' == Line 424 has weird spacing: '...--o rel o...' == Line 475 has weird spacing: '... base o---+...' == Line 489 has weird spacing: '...o href o----...' == Line 493 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 (October 23, 2018) is 2012 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 2836, but no explicit reference was found in the text == Unused Reference: 'I-D.ietf-anima-bootstrapping-keyinfra' is defined on line 2853, but no explicit reference was found in the text == Unused Reference: 'RFC2616' is defined on line 2864, but no explicit reference was found in the text == Unused Reference: 'RFC8392' is defined on line 2905, 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-16 == Outdated reference: A later version (-45) exists of draft-ietf-anima-bootstrapping-keyinfra-16 -- 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 (~~), 17 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: April 26, 2019 SmartThings 6 C. Bormann 7 Universitaet Bremen TZI 8 P. van der Stok 9 consultant 10 C. Amsuess, Ed. 11 October 23, 2018 13 CoRE Resource Directory 14 draft-ietf-core-resource-directory-16 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 registrations 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 for web servers to 25 discover the RD and to register, maintain, lookup and remove resource 26 descriptions. Furthermore, new link attributes useful in conjunction 27 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 April 26, 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 . . . . . . . . . . . . . . . . . . . . . . . . 3 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 policies . . . . . . . . . . . . . . . . . . . . . . 39 88 8.1. Secure RD discovery . . . . . . . . . . . . . . . . . . . 40 89 8.2. Secure RD filtering . . . . . . . . . . . . . . . . . . . 41 90 8.3. Secure endpoint Name assignment . . . . . . . . . . . . . 41 91 9. Security Considerations . . . . . . . . . . . . . . . . . . . 41 92 9.1. Endpoint Identification and Authentication . . . . . . . 41 93 9.2. Access Control . . . . . . . . . . . . . . . . . . . . . 42 94 9.3. Denial of Service Attacks . . . . . . . . . . . . . . . . 42 95 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 43 96 10.1. Resource Types . . . . . . . . . . . . . . . . . . . . . 43 97 10.2. IPv6 ND Resource Directory Address Option . . . . . . . 43 98 10.3. RD Parameter Registry . . . . . . . . . . . . . . . . . 43 99 10.3.1. Full description of the "Endpoint Type" Registration 100 Parameter . . . . . . . . . . . . . . . . . . . . . 46 101 10.4. "Endpoint Type" (et=) RD Parameter values . . . . . . . 46 102 10.5. Multicast Address Registration . . . . . . . . . . . . . 47 103 11. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 47 104 11.1. Lighting Installation . . . . . . . . . . . . . . . . . 47 105 11.1.1. Installation Characteristics . . . . . . . . . . . . 47 106 11.1.2. RD entries . . . . . . . . . . . . . . . . . . . . . 48 107 11.2. OMA Lightweight M2M (LWM2M) Example . . . . . . . . . . 51 108 11.2.1. The LWM2M Object Model . . . . . . . . . . . . . . . 52 109 11.2.2. LWM2M Register Endpoint . . . . . . . . . . . . . . 53 110 11.2.3. LWM2M Update Endpoint Registration . . . . . . . . . 55 111 11.2.4. LWM2M De-Register Endpoint . . . . . . . . . . . . . 55 112 12. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 55 113 13. Changelog . . . . . . . . . . . . . . . . . . . . . . . . . . 55 114 14. References . . . . . . . . . . . . . . . . . . . . . . . . . 62 115 14.1. Normative References . . . . . . . . . . . . . . . . . . 62 116 14.2. Informative References . . . . . . . . . . . . . . . . . 63 117 Appendix A. Registration Management . . . . . . . . . . . . . . 65 118 A.1. Registration Update . . . . . . . . . . . . . . . . . . . 65 119 A.2. Registration Removal . . . . . . . . . . . . . . . . . . 68 120 A.3. Read Endpoint Links . . . . . . . . . . . . . . . . . . . 69 121 A.4. Update Endpoint Links . . . . . . . . . . . . . . . . . . 70 122 A.5. Endpoint and group lookup . . . . . . . . . . . . . . . . 71 123 Appendix B. Web links and the Resource Directory . . . . . . . . 72 124 B.1. A simple example . . . . . . . . . . . . . . . . . . . . 72 125 B.1.1. Resolving the URIs . . . . . . . . . . . . . . . . . 73 126 B.1.2. Interpreting attributes and relations . . . . . . . . 73 127 B.2. A slightly more complex example . . . . . . . . . . . . . 74 128 B.3. Enter the Resource Directory . . . . . . . . . . . . . . 74 129 B.4. A note on differences between link-format and Link 130 headers . . . . . . . . . . . . . . . . . . . . . . . . . 76 131 Appendix C. Syntax examples for Protocol Negotiation . . . . . . 77 132 Appendix D. Modernized Link Format parsing . . . . . . . . . . . 78 133 D.1. For endpoint developers . . . . . . . . . . . . . . . . . 79 134 D.2. Examples of links with differing interpretations . . . . 79 135 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 80 137 1. Introduction 139 The work on Constrained RESTful Environments (CoRE) aims at realizing 140 the REST architecture in a suitable form for the most constrained 141 nodes (e.g., 8-bit microcontrollers with limited RAM and ROM) and 142 networks (e.g. 6LoWPAN). CoRE is aimed at machine-to-machine (M2M) 143 applications such as smart energy and building automation. 145 The discovery of resources offered by a constrained server is very 146 important in machine-to-machine applications where there are no 147 humans in the loop and static interfaces result in fragility. The 148 discovery of resources provided by an HTTP Web Server is typically 149 called Web Linking [RFC5988]. The use of Web Linking for the 150 description and discovery of resources hosted by constrained web 151 servers is specified by the CoRE Link Format [RFC6690]. However, 152 [RFC6690] only describes how to discover resources from the web 153 server that hosts them by querying "/.well-known/core". In many M2M 154 scenarios, direct discovery of resources is not practical due to 155 sleeping nodes, disperse networks, or networks where multicast 156 traffic is inefficient. These problems can be solved by employing an 157 entity called a Resource Directory (RD), which hosts registrations of 158 resources held on other servers, allowing lookups to be performed for 159 those resources. 161 This document specifies the web interfaces that a Resource Directory 162 supports for web servers to discover the RD and to register, 163 maintain, lookup and remove resource descriptions. Furthermore, new 164 link attributes useful in conjunction with a Resource Directory are 165 defined. Although the examples in this document show the use of 166 these interfaces with CoAP [RFC7252], they can be applied in an 167 equivalent manner to HTTP [RFC7230]. 169 2. Terminology 171 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 172 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 173 "OPTIONAL" in this document are to be interpreted as described in 174 [RFC2119]. The term "byte" is used in its now customary sense as a 175 synonym for "octet". 177 This specification requires readers to be familiar with all the terms 178 and concepts that are discussed in [RFC3986], [RFC5988] and 179 [RFC6690]. Readers should also be familiar with the terms and 180 concepts discussed in [RFC7252]. To describe the REST interfaces 181 defined in this specification, the URI Template format is used 182 [RFC6570]. 184 This specification makes use of the following additional terminology: 186 resolve against 187 The expression "a URI-reference is _resolved against_ a base URI" 188 is used to describe the process of [RFC3986] Section 5.2. 189 Noteworthy corner cases are that if the URI-reference is a (full) 190 URI and resolved against any base URI, that gives the original 191 full URI, and that resolving an empty URI reference gives the base 192 URI without any fragment identifier. 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 at registration time, and is 224 used by the Resource Directory to resolve relative references of 225 the registration into 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 Registrant-ep 264 Registrant-ep is the endpoint that is registered into the RD. The 265 registrant-ep can register itself, or a CT registers the 266 registrant-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 an implementation of the RD should deal 278 with. Those serve to illustrate the typical responses to readers who 279 are not yet familiar with all the details of CoAP based interfaces; 280 they do not limit what a server may respond under atypical 281 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 devices, 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 Only information SHOULD be stored in the resource directory that is 298 discoverable from querying the described device's /.well-known/core 299 resource directly. 301 Data in the resource directory can only be provided by the device 302 which hosts those data or a dedicated Commissioning Tool (CT). These 303 CTs are thought to act on behalf of endpoints too constrained, or 304 generally unable, to present that information themselves. No other 305 client can modify data in the resource directory. Changes in the 306 Resource Directory do not propagate automatically back to the web 307 server from where the links originated. 309 3.2. Architecture 311 The resource directory architecture is illustrated in Figure 1. A 312 Resource Directory (RD) is used as a repository for Web Links 313 [RFC5988] describing resources hosted on other web servers, also 314 called endpoints (EP). An endpoint is a web server associated with a 315 scheme, IP address and port. A physical node may host one or more 316 endpoints. The RD implements a set of REST interfaces for endpoints 317 to register and maintain sets of Web Links (called resource directory 318 registration entries), and for endpoints to lookup resources from the 319 RD or maintain groups. An RD can be logically segmented by the use 320 of Sectors. The set of endpoints grouped for group communication can 321 be defined by the RD or configured by a Commissioning Tool. This 322 information hierarchy is shown in Figure 2. 324 A mechanism to discover an RD using CoRE Link Format [RFC6690] is 325 defined. 327 Registration entries in the RD are soft state and need to be 328 periodically refreshed. 330 An endpoint uses specific interfaces to register, update and remove a 331 resource directory registration entry. It is also possible for an RD 332 to fetch Web Links from endpoints and add them as resource directory 333 registration entries. 335 At the first registration of a set of entries, a "registration 336 resource" is created, the location of which is returned to the 337 registering endpoint. The registering endpoint uses this 338 registration resource to manage the contents of registration entries. 340 A lookup interface for discovering any of the Web Links held in the 341 RD is provided using the CoRE Link Format. 343 Registration Lookup, Group 344 Interface Interfaces 345 +----+ | | 346 | EP |---- | | 347 +----+ ---- | | 348 --|- +------+ | 349 +----+ | ----| | | +--------+ 350 | EP | ---------|-----| RD |----|-----| Client | 351 +----+ | ----| | | +--------+ 352 --|- +------+ | 353 +----+ ---- | | 354 | EP |---- | | 355 +----+ 357 Figure 1: The resource directory architecture. 359 +------------+ 360 | Group | <-- Name, Scheme, IP, Port 361 +------------+ 362 | 363 | 364 +------------+ 365 | Endpoint | <-- Name, Scheme, IP, Port 366 +------------+ 367 | 368 | 369 +------------+ 370 | Resource | <-- Target, Parameters 371 +------------+ 373 Figure 2: The resource directory information hierarchy. 375 A Registrant-EP MAY keep concurrent registrations to more than one RD 376 at the same time if explicitly configured to do so, but that is not 377 expected to be supported by typical EP implementations. Any such 378 registrations are independent of each other. The usual expectation 379 when multiple discovery mechanisms or addresses are configured is 380 that they constitute a fallback path for a single registration. 382 3.3. RD Content Model 384 The Entity-Relationship (ER) models shown in Figure 3 and Figure 4 385 model the contents of /.well-known/core and the resource directory 386 respectively, with entity-relationship diagrams [ER]. Entities 387 (rectangles) are used for concepts that exist independently. 388 Attributes (ovals) are used for concepts that exist only in 389 connection with a related entity. Relations (diamonds) give a 390 semantic meaning to the relation between entities. Numbers specify 391 the cardinality of the relations. 393 Some of the attribute values are URIs. Those values are always full 394 URIs and never relative references in the information model. They 395 can, however, be expressed as relative references in serializations, 396 and often are. 398 These models provide an abstract view of the information expressed in 399 link-format documents and a Resource Directory. They cover the 400 concepts, but not necessarily all details of an RD's operation; they 401 are meant to give an overview, and not be a template for 402 implementations. 404 +----------------------+ 405 | /.well-known/core | 406 +----------------------+ 407 | 408 | 1 409 ////////\\\\\\\ 410 < contains > 411 \\\\\\\\/////// 412 | 413 | 0+ 414 +--------------------+ 415 | link | 416 +--------------------+ 417 | 418 | 1 oooooooo 419 +-----o target o 420 | oooooooo 421 oooooooooooo 0+ | 422 o target o--------+ 423 o attribute o | 0+ oooooo 424 oooooooooooo +-----o rel o 425 | oooooo 426 | 427 | 1 ooooooooo 428 +-----o context o 429 ooooooooo 431 Figure 3: E-R Model of the content of /.well-known/core 433 The model shown in Figure 3 models the contents of /.well-known/core 434 which contains: 436 o a set of links belonging to the hosting web server 438 The web server is free to choose links it deems appropriate to be 439 exposed in its ".well-known/core". Typically, the links describe 440 resources that are served by the host, but the set can also contain 441 links to resources on other servers (see examples in [RFC6690] page 442 14). The set does not necessarily contain links to all resources 443 served by the host. 445 A link has the following attributes (see [RFC5988]): 447 o Zero or more link relations: They describe relations between the 448 link context and the link target. 450 In link-format serialization, they are expressed as space- 451 separated values in the "rel" attribute, and default to "hosts". 453 o A link context URI: It defines the source of the relation, e.g. 454 _who_ "hosts" something. 456 In link-format serialization, it is expressed in the "anchor" 457 attribute. It defaults to that document's URI. 459 o A link target URI: It defines the destination of the relation 460 (e.g. _what_ is hosted), and is the topic of all target 461 attributes. 463 In link-format serialization, it is expressed between angular 464 brackets, and sometimes called the "href". 466 o Other target attributes (e.g. resource type (rt), interface (if), 467 or content-type (ct)). These provide additional information about 468 the target URI. 470 +----------------------+ 1 ooooooo 471 | resource-directory | +--o href o 472 +----------------------+ | ooooooo 473 | 1 | 474 | oooooooooo 0-1 | 1 oooooo 475 | o base o---+ | +------o gp o 476 | ooooooooooo | | | oooooo 477 | | | | 478 //////\\\\ 0+ +--------+ 0-1 ooooo 479 < contains >----------------| group |------o d o 480 \\\\\///// +--------+ ooooo 481 | | 0+ 482 0+ | | 483 ooooooo 1 +---------------+ 1+ ///////\\\\\\ 484 o base o-------| registration |---------< composed of > 485 ooooooo +---------------+ \\\\\\\////// 486 | | 1 487 | +--------------+ 488 oooooooo 1 | | 489 o href o----+ /////\\\\ 490 oooooooo | < contains > 491 | \\\\\///// 492 oooooooo 1 | | 493 o ep o----+ | 0+ 494 oooooooo | +------------------+ 495 | | link | 496 oooooooo 0-1 | +------------------+ 497 o d o----+ | 498 oooooooo | | 1 oooooooo 499 | +-----o target o 500 oooooooo 1 | | oooooooo 501 o lt o----+ ooooooooooo 0+ | 502 oooooooo | o target o-----+ 503 | o attribute o | 0+ oooooo 504 ooooooooooo 0+ | ooooooooooo +-----o rel o 505 o endpoint o----+ | oooooo 506 o attribute o | 507 ooooooooooo | 1 ooooooooo 508 +----o context o 509 ooooooooo 511 Figure 4: E-R Model of the content of the Resource Directory 513 The model shown in Figure 4 models the contents of the resource 514 directory which contains in addition to /.well-known/core: 516 o 0 to n Registration (entries) of endpoints, 517 o 0 or more Groups 519 A Group has: 521 o a group name ("gp"), 523 o optionally a sector (abbreviated "d" for historical reasons), 525 o a group resource location inside the RD ("href"), 527 o zero or one multicast addresses expressed as a base URI ("base"), 529 o and is composed of zero or more registrations (endpoints). 531 A registration is associated with one endpoint. A registration can 532 be part of 0 or more Groups . A registration defines a set of links 533 as defined for /.well-known/core. A Registration has six types of 534 attributes: 536 o a unique endpoint name ("ep") within a sector 538 o a Registration Base URI ("base", a URI typically describing the 539 scheme://authority part) 541 o a lifetime ("lt"), 543 o a registration resource location inside the RD ("href"), 545 o optionally a sector ("d") 547 o optional additional endpoint attributes (from Section 10.3) 549 The cardinality of "base" is currently 1; future documents are 550 invited to extend the RD specification to support multiple values 551 (e.g. [I-D.silverajan-core-coap-protocol-negotiation]). Its value 552 is used as a Base URI when resolving URIs in the links contained in 553 the endpoint. 555 Links are modelled as they are in Figure 3. 557 3.4. Use Case: Cellular M2M 559 Over the last few years, mobile operators around the world have 560 focused on development of M2M solutions in order to expand the 561 business to the new type of users: machines. The machines are 562 connected directly to a mobile network using an appropriate embedded 563 wireless interface (GSM/GPRS, WCDMA, LTE) or via a gateway providing 564 short and wide range wireless interfaces. From the system design 565 point of view, the ambition is to design horizontal solutions that 566 can enable utilization of machines in different applications 567 depending on their current availability and capabilities as well as 568 application requirements, thus avoiding silo like solutions. One of 569 the crucial enablers of such design is the ability to discover 570 resources (machines -- endpoints) capable of providing required 571 information at a given time or acting on instructions from the end 572 users. 574 Imagine a scenario where endpoints installed on vehicles enable 575 tracking of the position of these vehicles for fleet management 576 purposes and allow monitoring of environment parameters. During the 577 boot-up process endpoints register with a Resource Directory, which 578 is hosted by the mobile operator or somewhere in the cloud. 579 Periodically, these endpoints update their registration and may 580 modify resources they offer. 582 When endpoints are not always connected, for example because they 583 enter a sleep mode, a remote server is usually used to provide proxy 584 access to the endpoints. Mobile apps or web applications for 585 environment monitoring contact the RD, look up the endpoints capable 586 of providing information about the environment using an appropriate 587 set of link parameters, obtain information on how to contact them 588 (URLs of the proxy server), and then initiate interaction to obtain 589 information that is finally processed, displayed on the screen and 590 usually stored in a database. Similarly, fleet management systems 591 provide the appropriate link parameters to the RD to look up for EPs 592 deployed on the vehicles the application is responsible for. 594 3.5. Use Case: Home and Building Automation 596 Home and commercial building automation systems can benefit from the 597 use of M2M web services. The discovery requirements of these 598 applications are demanding. Home automation usually relies on run- 599 time discovery to commission the system, whereas in building 600 automation a combination of professional commissioning and run-time 601 discovery is used. Both home and building automation involve peer- 602 to-peer interactions between endpoints, and involve battery-powered 603 sleeping devices. 605 3.6. Use Case: Link Catalogues 607 Resources may be shared through data brokers that have no knowledge 608 beforehand of who is going to consume the data. Resource Directory 609 can be used to hold links about resources and services hosted 610 anywhere to make them discoverable by a general class of 611 applications. 613 For example, environmental and weather sensors that generate data for 614 public consumption may provide data to an intermediary server, or 615 broker. Sensor data are published to the intermediary upon changes 616 or at regular intervals. Descriptions of the sensors that resolve to 617 links to sensor data may be published to a Resource Directory. 618 Applications wishing to consume the data can use RD Lookup to 619 discover and resolve links to the desired resources and endpoints. 620 The Resource Directory service need not be coupled with the data 621 intermediary service. Mapping of Resource Directories to data 622 intermediaries may be many-to-many. 624 Metadata in web link formats like [RFC6690] which may be internally 625 stored as triples, or relation/attribute pairs providing metadata 626 about resource links, need to be supported by Resource Directories . 627 External catalogues that are represented in other formats may be 628 converted to common web linking formats for storage and access by 629 Resource Directories. Since it is common practice for these to be 630 URN encoded, simple and lossless structural transforms should 631 generally be sufficient to store external metadata in Resource 632 Directories. 634 The additional features of Resource Directory allow sectors to be 635 defined to enable access to a particular set of resources from 636 particular applications. This provides isolation and protection of 637 sensitive data when needed. Groups may be defined to support 638 efficient data transport. 640 4. Finding a Resource Directory 642 A (re-)starting device may want to find one or more resource 643 directories for discovery purposes. 645 The device may be pre-configured to exercise specific mechanisms for 646 finding the resource directory: 648 1. It may be configured with a specific IP address for the RD. That 649 IP address may also be an anycast address, allowing the network 650 to forward RD requests to an RD that is topologically close; each 651 target network environment in which some of these preconfigured 652 nodes are to be brought up is then configured with a route for 653 this anycast address that leads to an appropriate RD. (Instead 654 of using an anycast address, a multicast address can also be 655 preconfigured. The RD servers then need to configure one of 656 their interfaces with this multicast address.) 658 2. It may be configured with a DNS name for the RD and use DNS to 659 return the IP address of the RD; it can find a DNS server to 660 perform the lookup using the usual mechanisms for finding DNS 661 servers. 663 3. It may be configured to use a service discovery mechanism such as 664 DNS-SD [RFC6763]. The present specification suggests configuring 665 the service with name rd._sub._coap._udp, preferably within the 666 domain of the querying nodes. 668 For cases where the device is not specifically configured with a way 669 to find a resource directory, the network may want to provide a 670 suitable default. 672 1. If the address configuration of the network is performed via 673 SLAAC, this is provided by the RDAO option Section 4.1. 675 2. If the address configuration of the network is performed via 676 DHCP, this could be provided via a DHCP option (no such option is 677 defined at the time of writing). 679 Finally, if neither the device nor the network offers any specific 680 configuration, the device may want to employ heuristics to find a 681 suitable resource directory. 683 The present specification does not fully define these heuristics, but 684 suggests a number of candidates: 686 1. In a 6LoWPAN, just assume the Border Router (6LBR) can act as a 687 resource directory (using the ABRO option to find that 688 [RFC6775]). Confirmation can be obtained by sending a Unicast to 689 "coap://[6LBR]/.well-known/core?rt=core.rd*". 691 2. In a network that supports multicast well, discovering the RD 692 using a multicast query for /.well-known/core as specified in 693 CoRE Link Format [RFC6690]: Sending a Multicast GET to 694 "coap://[MCD1]/.well-known/core?rt=core.rd*". RDs within the 695 multicast scope will answer the query. 697 As some of the RD addresses obtained by the methods listed here are 698 just (more or less educated) guesses, endpoints MUST make use of any 699 error messages to very strictly rate-limit requests to candidate IP 700 addresses that don't work out. For example, an ICMP Destination 701 Unreachable message (and, in particular, the port unreachable code 702 for this message) may indicate the lack of a CoAP server on the 703 candidate host, or a CoAP error response code such as 4.05 "Method 704 Not Allowed" may indicate unwillingness of a CoAP server to act as a 705 directory server. 707 If multiple candidate addresses are discovered, the device may pick 708 any of them initially, unless the discovery method indicates a more 709 precise selection scheme. 711 4.1. Resource Directory Address Option (RDAO) 713 The Resource Directory Address Option (RDAO) using IPv6 Neighbor 714 Discovery (ND) carries information about the address of the Resource 715 Directory (RD). This information is needed when endpoints cannot 716 discover the Resource Directory with a link-local or realm-local 717 scope multicast address because the endpoint and the RD are separated 718 by a Border Router (6LBR). In many circumstances the availability of 719 DHCP cannot be guaranteed either during commissioning of the network. 720 The presence and the use of the RD is essential during commissioning. 722 It is possible to send multiple RDAO options in one message, 723 indicating as many resource directory addresses. 725 The RDAO format is: 727 0 1 2 3 728 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 729 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 730 | Type | Length = 3 | Valid Lifetime | 731 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 732 | Reserved | 733 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 734 | | 735 + + 736 | | 737 + RD Address + 738 | | 739 + + 740 | | 741 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 743 Fields: 745 Type: 38 747 Length: 8-bit unsigned integer. The length of 748 the option in units of 8 bytes. 749 Always 3. 751 Valid Lifetime: 16-bit unsigned integer. The length of 752 time in units of 60 seconds (relative to 753 the time the packet is received) that 754 this Resource Directory address is valid. 755 A value of all zero bits (0x0) indicates 756 that this Resource Directory address 757 is not valid anymore. 759 Reserved: This field is unused. It MUST be 760 initialized to zero by the sender and 761 MUST be ignored by the receiver. 763 RD Address: IPv6 address of the RD. 765 Figure 5: Resource Directory Address Option 767 5. Resource Directory 769 This section defines the required set of REST interfaces between a 770 Resource Directory (RD) and endpoints. Although the examples 771 throughout this section assume the use of CoAP [RFC7252], these REST 772 interfaces can also be realized using HTTP [RFC7230]. In all 773 definitions in this section, both CoAP response codes (with dot 774 notation) and HTTP response codes (without dot notation) are shown. 776 An RD implementing this specification MUST support the discovery, 777 registration, update, lookup, and removal interfaces defined in this 778 section. 780 All operations on the contents of the Resource Directory MUST be 781 atomic and idempotent. 783 A resource directory MAY make the information submitted to it 784 available to further directories, if it can ensure that a loop does 785 not form. The protocol used between directories to ensure loop-free 786 operation is outside the scope of this document. 788 5.1. Payload Content Formats 790 Resource Directory implementations using this specification MUST 791 support the application/link-format content format (ct=40). 793 Resource Directories implementing this specification MAY support 794 additional content formats. 796 Any additional content format supported by a Resource Directory 797 implementing this specification MUST have an equivalent serialization 798 in the application/link-format content format. 800 5.2. URI Discovery 802 Before an endpoint can make use of an RD, it must first know the RD's 803 address and port, and the URI path information for its REST APIs. 804 This section defines discovery of the RD and its URIs using the well- 805 known interface of the CoRE Link Format [RFC6690]. A complete set of 806 RD discovery methods is described in Section 4. 808 Discovery of the RD registration URI path is performed by sending 809 either a multicast or unicast GET request to "/.well-known/core" and 810 including a Resource Type (rt) parameter [RFC6690] with the value 811 "core.rd" in the query string. Likewise, a Resource Type parameter 812 value of "core.rd-lookup*" is used to discover the URIs for RD Lookup 813 operations, core.rd* is used to discover all URI paths for RD 814 operations, and "core.rd-group" is used to discover the URI path for 815 RD Group operations. Upon success, the response will contain a 816 payload with a link format entry for each RD function discovered, 817 indicating the URI of the RD function returned and the corresponding 818 Resource Type. When performing multicast discovery, the multicast IP 819 address used will depend on the scope required and the multicast 820 capabilities of the network (see Section 10.5. 822 A Resource Directory MAY provide hints about the content-formats it 823 supports in the links it exposes or registers, using the "ct" link 824 attribute, as shown in the example below. Clients MAY use these 825 hints to select alternate content-formats for interaction with the 826 Resource Directory. 828 HTTP does not support multicast and consequently only unicast 829 discovery can be supported using HTTP. The well-known entry points 830 SHOULD be provided to enable unicast discovery. 832 An implementation of this resource directory specification MUST 833 support query filtering for the rt parameter as defined in [RFC6690]. 835 While the link targets in this discovery step are often expressed in 836 path-absolute form, this is not a requirement. Clients of the RD 837 SHOULD therefore accept URIs of all schemes they support, both as 838 URIs and relative references, and not limit the set of discovered 839 URIs to those hosted at the address used for URI discovery. 841 The URI Discovery operation can yield multiple URIs of a given 842 resource type. The client of the RD can use any of the discovered 843 addresses initially. 845 The discovery request interface is specified as follows (this is 846 exactly the Well-Known Interface of [RFC6690] Section 4, with the 847 additional requirement that the server MUST support query filtering): 849 Interaction: EP and Client -> RD 851 Method: GET 853 URI Template: /.well-known/core{?rt} 855 URI Template Variables: 857 rt := Resource Type. SHOULD contain one of the values "core.rd", 858 "core.rd-lookup*", "core.rd-lookup-res", "core.rd-lookup-ep", 859 "core.rd-lookup-gp", "core.rd-group" or "core.rd*" 861 Content-Format: application/link-format (if any) 863 Content-Format: application/link-format+json (if any) 865 Content-Format: application/link-format+cbor (if any) 867 The following response codes are defined for this interface: 869 Success: 2.05 "Content" or 200 "OK" with an application/link-format, 870 application/link-format+json, or application/link-format+cbor 871 payload containing one or more matching entries for the RD 872 resource. 874 Failure: 4.00 "Bad Request" or 400 "Bad Request" is returned in case 875 of a malformed request for a unicast request. 877 Failure: No error response to a multicast request. 879 HTTP support : YES (Unicast only) 881 The following example shows an endpoint discovering an RD using this 882 interface, thus learning that the directory resource location, in 883 this example, is /rd, and that the content-format delivered by the 884 server hosting the resource is application/link-format (ct=40). Note 885 that it is up to the RD to choose its RD locations. 887 Req: GET coap://[MCD1]/.well-known/core?rt=core.rd* 889 Res: 2.05 Content 890 ;rt="core.rd";ct=40, 891 ;rt="core.rd-lookup-ep";ct=40, 892 ;rt="core.rd-lookup-res";ct=40, 893 ;rt="core.rd-lookup-gp";ct=40, 894 ;rt="core.rd-group";ct=40 896 Figure 6: Example discovery exchange 898 The following example shows the way of indicating that a client may 899 request alternate content-formats. The Content-Format code attribute 900 "ct" MAY include a space-separated sequence of Content-Format codes 901 as specified in Section 7.2.1 of [RFC7252], indicating that multiple 902 content-formats are available. The example below shows the required 903 Content-Format 40 (application/link-format) indicated as well as the 904 CBOR and JSON representation of link format. The RD resource 905 locations /rd, /rd-lookup, and /rd-group are example values. The 906 server in this example also indicates that it is capable of providing 907 observation on resource lookups. 909 [ The RFC editor is asked to replace these and later occurrences of 910 MCD1, TBD64 and TBD504 with the assigned IPv6 site-local address for 911 "all CoRE Resource Directories" and the numeric ID values assigned by 912 IANA to application/link-format+cbor and application/link- 913 format+json, respectively, as they are defined in I-D.ietf-core- 914 links-json. ] 915 Req: GET coap://[MCD1]/.well-known/core?rt=core.rd* 917 Res: 2.05 Content 918 ;rt="core.rd";ct="40 65225", 919 ;rt="core.rd-lookup-res";ct="40 TBD64 TBD504";obs, 920 ;rt="core.rd-lookup-ep";ct="40 TBD64 TBD504", 921 ;rt="core.rd-lookup-gp";ct=40 TBD64 TBD504", 922 ;rt="core.rd-group";ct="40 TBD64 TBD504" 924 From a management and maintenance perspective, it is necessary to 925 identify the components that constitute the RD server. The 926 identification refers to information about for example client-server 927 incompatibilities, supported features, required updates and other 928 aspects. The URI discovery address, a described in section 4 of 929 [RFC6690] can be used to find the identification. 931 It would typically be stored in an implementation information link 932 (as described in [I-D.bormann-t2trg-rel-impl]): 934 Req: GET /.well-known/core?rel=impl-info 936 Res: 2.05 Content 937 ; 938 rel="impl-info" 940 Note that depending on the particular server's architecture, such a 941 link could be anchored at the RD server's root, at the discovery site 942 (as in this example) or at individual RD components. The latter is 943 to be expected when different applications are run on the same 944 server. 946 5.3. Registration 948 After discovering the location of an RD, a registrant-ep or CT MAY 949 register the resources of the registrant-ep using the registration 950 interface. This interface accepts a POST from an endpoint containing 951 the list of resources to be added to the directory as the message 952 payload in the CoRE Link Format [RFC6690], JSON CoRE Link Format 953 (application/link-format+json), or CBOR CoRE Link Format 954 (application/link-format+cbor) [I-D.ietf-core-links-json], along with 955 query parameters indicating the name of the endpoint, and optionally 956 the sector, lifetime and base URI of the registration. It is 957 expected that other specifications will define further parameters 958 (see Section 10.3). The RD then creates a new registration resource 959 in the RD and returns its location. The receiving endpoint MUST use 960 that location when refreshing registrations using this interface. 961 Registration resources in the RD are kept active for the period 962 indicated by the lifetime parameter. The creating endpoint is 963 responsible for refreshing the registration resource within this 964 period using either the registration or update interface. The 965 registration interface MUST be implemented to be idempotent, so that 966 registering twice with the same endpoint parameters ep and d (sector) 967 does not create multiple registration resources. 969 The following rules apply for an update identified by a given (ep, d) 970 value pair: 972 o when the parameter values of the Update generate the same 973 attribute values as already present, the location of the already 974 existing registration is returned. 976 o when for a given (ep, d) value pair the update generates attribute 977 values which are different from the existing one, the existing 978 registration is removed and a new registration with a new location 979 is created. 981 o when the (ep, d) value pair of the update is different from any 982 existing registration, a new registration is generated. 984 The posted link-format document can (and typically does) contain 985 relative references both in its link targets and in its anchors, or 986 contain empty anchors. The RD server needs to resolve these 987 references in order to faithfully represent them in lookups. They 988 are resolved against the base URI of the registration, which is 989 provided either explicitly in the "base" parameter or constructed 990 implicitly from the requester's URI as constructed from its network 991 address and scheme. 993 Link format documents submitted to the resource directory are 994 interpreted as Modernized Link Format (see Appendix D) by the RD. A 995 registrant-ep SHOULD NOT submit documents whose interpretations 996 according to [RFC6690] and Appendix D differ to avoid the ambiguities 997 described in Appendix B.4. 999 In practice, most links (precisely listed in Appendix D.1) can be 1000 submitted without consideration for those details. 1002 The registration request interface is specified as follows: 1004 Interaction: EP -> RD 1006 Method: POST 1008 URI Template: {+rd}{?ep,d,lt,base,extra-attrs*} 1010 URI Template Variables: 1012 rd := RD registration URI (mandatory). This is the location of 1013 the RD, as obtained from discovery. 1015 ep := Endpoint name (mostly mandatory). The endpoint name is an 1016 identifier that MUST be unique within a sector. The maximum 1017 length of this parameter is 63 bytes. If the RD is configured 1018 to recognize the endpoint (e.g. based on its security context), 1019 the endpoint sets no endpoint name, and the RD assigns one 1020 based on a set of configuration parameter values. 1022 d := Sector (optional). The sector to which this endpoint 1023 belongs. The maximum length of this parameter is 63 bytes. 1024 When this parameter is not present, the RD MAY associate the 1025 endpoint with a configured default sector or leave it empty. 1026 The endpoint name and sector name are not set when one or both 1027 are set in an accompanying authorization token. 1029 lt := Lifetime (optional). Lifetime of the registration in 1030 seconds. Range of 60-4294967295. If no lifetime is included 1031 in the initial registration, a default value of 90000 (25 1032 hours) SHOULD be assumed. 1034 base := Base URI (optional). This parameter sets the base URI of 1035 the registration, under which the relative links in the payload 1036 are to be interpreted. The specified URI typically does not 1037 have a path component of its own, and MUST be suitable as a 1038 base URI to resolve any relative references given in the 1039 registration. The parameter is therefore usually of the shape 1040 "scheme://authority" for HTTP and CoAP URIs. The URI SHOULD 1041 NOT have a query or fragment component as any non-empty 1042 relative part in a reference would remove those parts from the 1043 resulting URI. 1045 In the absence of this parameter the scheme of the protocol, 1046 source address and source port of the registration request are 1047 assumed. That Base URI is constructed by concatenating the 1048 used protcol's scheme with the characters "://", the 1049 requester's source address as an address literal and ":" 1050 followed by its port (if it was not the protocol's default one) 1051 in analogy to [RFC7252] Section 6.5. 1053 This parameter is mandatory when the directory is filled by a 1054 third party such as an commissioning tool. 1056 If the registrant-ep uses an ephemeral port to register with, 1057 it MUST include the base parameter in the registration to 1058 provide a valid network path. 1060 If the registrant-ep, located behind a NAT gateway, is 1061 registering with a Resource Directory which is on the network 1062 service side of the NAT gateway, the endpoint MUST use a 1063 persistent port for the outgoing registration in order to 1064 provide the NAT gateway with a valid network address for 1065 replies and incoming requests. 1067 Endpoints that register with a base that contains a path 1068 component can not meaningfully use [RFC6690] Link Format due to 1069 its prevalence of the Origin concept in relative reference 1070 resolution; they can submit payloads for interpretation as 1071 Modernized Link Format. Typically, links submitted by such an 1072 endpoint are of the "path-noscheme" (starts with a path not 1073 preceded by a slash, precisely defined in [RFC3986] 1074 Section 3.3) form. 1076 extra-attrs := Additional registration attributes (optional). 1077 The endpoint can pass any parameter registered at Section 10.3 1078 to the directory. If the RD is aware of the parameter's 1079 specified semantics, it processes it accordingly. Otherwise, 1080 it MUST store the unknown key and its value(s) as an endpoint 1081 attribute for further lookup. 1083 Content-Format: application/link-format 1085 Content-Format: application/link-format+json 1087 Content-Format: application/link-format+cbor 1089 The following response codes are defined for this interface: 1091 Success: 2.01 "Created" or 201 "Created". The Location-Path option 1092 or Location header MUST be included in the response. This 1093 location MUST be a stable identifier generated by the RD as it is 1094 used for all subsequent operations on this registration resource. 1095 The registration resource location thus returned is for the 1096 purpose of updating the lifetime of the registration and for 1097 maintaining the content of the registered links, including 1098 updating and deleting links. 1100 A registration with an already registered ep and d value pair 1101 responds with the same success code and location as the original 1102 registration; the set of links registered with the endpoint is 1103 replaced with the links from the payload. 1105 The location MUST NOT have a query or fragment component, as that 1106 could conflict with query parameters during the Registration 1107 Update operation. Therefore, the Location-Query option MUST NOT 1108 be present in a successful response. 1110 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 1111 request. 1113 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 1114 Service could not perform the operation. 1116 HTTP support: YES 1118 If the registration fails with a Service Unavailable response and a 1119 Max-Age option or Retry-After header, the registering endpoint SHOULD 1120 retry the operation after the time indicated. If the registration 1121 fails in another way, including request timeouts, or if the Service 1122 Unavailable error persists after several retries, or indicates a 1123 longer time than the endpoint is willing to wait, it SHOULD pick 1124 another registration URI from the "URI Discovery" step and if there 1125 is only one or the list is exhausted, pick other choices from the 1126 "Finding a Resource Directory" step. Care has to be taken to 1127 consider the freshness of results obtained earlier, e.g. of the 1128 result of a "/.well-known/core" response, the lifetime of an RDAO 1129 option and of DNS responses. Any rate limits and persistent errors 1130 from the "Finding a Resource Directory" step must be considered for 1131 the whole registration time, not only for a single operation. 1133 The following example shows a registrant-ep with the name "node1" 1134 registering two resources to an RD using this interface. The 1135 location "/rd" is an example RD location discovered in a request 1136 similar to Figure 6. 1138 Req: POST coap://rd.example.com/rd?ep=node1 1139 Content-Format: 40 1140 Payload: 1141 ;ct=41;rt="temperature-c";if="sensor"; 1142 anchor="coap://spurious.example.com:5683", 1143 ;ct=41;rt="light-lux";if="sensor" 1145 Res: 2.01 Created 1146 Location-Path: /rd/4521 1148 Figure 7: Example registration payload 1150 A Resource Directory may optionally support HTTP. Here is an example 1151 of almost the same registration operation above, when done using HTTP 1152 and the JSON Link Format. 1154 Req: POST /rd?ep=node1&base=http://[2001:db8:1::1] HTTP/1.1 1155 Host: example.com 1156 Content-Type: application/link-format+json 1157 Payload: 1158 [ 1159 {"href": "/sensors/temp", "ct": "41", "rt": "temperature-c", 1160 "if": "sensor", "anchor": "coap://spurious.example.com:5683"}, 1161 {"href": "/sensors/light", "ct": "41", "rt": "light-lux", 1162 "if": "sensor"} 1163 ] 1165 Res: 201 Created 1166 Location: /rd/4521 1168 5.3.1. Simple Registration 1170 Not all endpoints hosting resources are expected to know how to 1171 upload links to an RD as described in Section 5.3. Instead, simple 1172 endpoints can implement the Simple Registration approach described in 1173 this section. An RD implementing this specification MUST implement 1174 Simple Registration. However, there may be security reasons why this 1175 form of directory discovery would be disabled. 1177 This approach requires that the registrant-ep makes available the 1178 hosted resources that it wants to be discovered, as links on its 1179 "/.well-known/core" interface as specified in [RFC6690]. The links 1180 in that document are subject to the same limitations as the payload 1181 of a registration (with respect to Appendix D). 1183 The registrant-ep finds one or more addresses of the directory server 1184 as described in Section 4. 1186 The registrant-ep asks the selected directory server to probe its 1187 /.well-known/core and publish the links as follows: 1189 The registrant-ep sends (and regularly refreshes with) a POST request 1190 to the "/.well-known/core" URI of the directory server of choice. 1191 The body of the POST request is empty, and triggers the resource 1192 directory server to perform GET requests at the requesting 1193 registrant-ep's /.well-known/core to obtain the link-format payload 1194 to register. 1196 The registrant-ep includes the same registration parameters in the 1197 POST request as it would per Section 5.3. The registration base URI 1198 of the registration is taken from the requesting server's URI. 1200 The Resource Directory MUST NOT query the registrant-ep's data before 1201 sending the response; this is to accommodate very limited endpoints. 1203 The success condition only indicates that the request was valid (i.e. 1204 the passed parameters are valid per se), not that the link data could 1205 be obtained or parsed or was successfully registered into the RD. 1207 The simple registration request interface is specified as follows: 1209 Interaction: EP -> RD 1211 Method: POST 1213 URI Template: /.well-known/core{?ep,d,lt,extra-attrs*} 1215 URI Template Variables are as they are for registration in 1216 Section 5.3. The base attribute is not accepted to keep the 1217 registration interface simple; that rules out registration over CoAP- 1218 over-TCP or HTTP that would need to specify one. 1220 The following response codes are defined for this interface: 1222 Success: 2.04 "Changed". 1224 Failure: 4.00 "Bad Request". Malformed request. 1226 Failure: 5.03 "Service Unavailable". Service could not perform the 1227 operation. 1229 HTTP support: NO 1231 For the second interaction triggered by the above, the registrant-ep 1232 takes the role of server and the RD the role of client. (Note that 1233 this is exactly the Well-Known Interface of [RFC6690] Section 4): 1235 Interaction: RD -> EP 1237 Method: GET 1239 URI Template: /.well-known/core 1241 The following response codes are defined for this interface: 1243 Success: 2.05 "Content". 1245 Failure: 4.00 "Bad Request". Malformed request. 1247 Failure: 4.04 "Not Found". /.well-known/core does not exist or is 1248 empty. 1250 Failure: 5.03 "Service Unavailable". Service could not perform the 1251 operation. 1253 HTTP support: NO 1255 The registration resources MUST be deleted after the expiration of 1256 their lifetime. Additional operations on the registration resource 1257 cannot be executed because no registration location is returned. 1259 The following example shows a registrant-ep using Simple 1260 Registration, by simply sending an empty POST to a resource 1261 directory. 1263 Req:(to RD server from [2001:db8:2::1]) 1264 POST /.well-known/core?lt=6000&ep=node1 1265 No payload 1267 Res: 2.04 Changed 1269 (later) 1271 Req: (from RD server to [2001:db8:2::1]) 1272 GET /.well-known/core 1273 Accept: 40 1275 Res: 2.05 Content 1276 Content-Format: 40 1277 Payload: 1278 1280 5.3.2. Third-party registration 1282 For some applications, even Simple Registration may be too taxing for 1283 some very constrained devices, in particular if the security 1284 requirements become too onerous. 1286 In a controlled environment (e.g. building control), the Resource 1287 Directory can be filled by a third party device, called a 1288 Commissioning Tool (CT). The commissioning tool can fill the 1289 Resource Directory from a database or other means. For that purpose 1290 scheme, IP address and port of the URI of the registered device is 1291 the value of the "base" parameter of the registration described in 1292 Section 5.3. 1294 It should be noted that the value of the "base" parameter applies to 1295 all the links of the registration and has consequences for the anchor 1296 value of the individual links as exemplified in Appendix B. An 1297 eventual (currently non-existing) "base" attribute of the link is not 1298 affected by the value of "base" parameter in the registration. 1300 6. RD Groups 1302 This section defines the REST API for the creation, management, and 1303 lookup of endpoints for group operations. Similar to endpoint 1304 registration entries in the RD, groups may be created or removed. 1305 However unlike an endpoint entry, a group entry consists of a list of 1306 endpoints and does not have a lifetime associated with it. To make 1307 use of multicast requests with CoAP, a group MAY have a multicast 1308 address associated with it, and should share a common set of 1309 resources. 1311 6.1. Register a Group 1313 To create a group, a commissioning tool (CT) used to configure 1314 groups, makes a request to the RD indicating the name of the group to 1315 create (or update), optionally the sector the group belongs to, and 1316 optionally the multicast address of the group. This specification 1317 does not require that the endpoints belong to the same sector as the 1318 group, but a Resource Directory implementation can impose 1319 requirements on the sectors of groups and endpoints depending on its 1320 configuration. 1322 The registration message is a list of links to registration resources 1323 of the endpoints that belong to that group. The CT can use any URI 1324 reference discovered using endpoint lookup from the same server or 1325 obtained by registering an endpoint using third party registration 1326 and enter it into a group. 1328 The commissioning tool SHOULD not send any target attributes with the 1329 links to the registration resources, and the resource directory 1330 SHOULD reject registrations that contain links with unprocessable 1331 attributes. 1333 Configuration of the endpoints themselves is out of scope of this 1334 specification. Such an interface for managing the group membership 1335 of an endpoint has been defined in [RFC7390]. 1337 The registration request interface is specified as follows: 1339 Interaction: CT -> RD 1341 Method: POST 1343 URI Template: {+rd-group}{?gp,d,base} 1344 URI Template Variables: 1346 rd-group := RD Group URI (mandatory). This is the location of 1347 the RD Group REST API. 1349 gp := Group Name (mandatory). The name of the group to be 1350 created or replaced, unique within that sector. The maximum 1351 length of this parameter is 63 bytes. 1353 d := Sector (optional). The sector to which this group belongs. 1354 The maximum length of this parameter is 63 bytes. When this 1355 parameter is not present, the RD MAY associate the group with a 1356 configured default sector or leave it empty. 1358 base := Group Base URI (optional). This parameter sets the 1359 scheme, address and port of the multicast address associated 1360 with the group. When base is used, scheme and host are 1361 mandatory and port parameter is optional. 1363 Content-Format: application/link-format 1365 Content-Format: application/link-format+json 1367 Content-Format: application/link-format+cbor 1369 The following response codes are defined for this interface: 1371 Success: 2.01 "Created" or 201 "Created". The Location header or 1372 Location-Path option MUST be returned in response to a successful 1373 group CREATE operation. This location MUST be a stable identifier 1374 generated by the RD as it is used for delete operations of the 1375 group resource. 1377 As with the Registration operation, the location MUST NOT have a 1378 query or fragment component. 1380 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 1381 request. 1383 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 1384 Service could not perform the operation. 1386 HTTP support: YES 1388 The following example shows an EP registering a group with the name 1389 "lights" which has two endpoints. The RD group path /rd-group is an 1390 example RD location discovered in a request similar to Figure 6. 1392 Req: POST coap://rd.example.com/rd-group?gp=lights 1393 &base=coap://[ff35:30:2001:db8::1] 1394 Content-Format: 40 1395 Payload: 1396 , 1397 1399 Res: 2.01 Created 1400 Location-Path: /rd-group/12 1402 A relative href value denotes the path to the registration resource 1403 of the Endpoint. When pointing to a registration resource on a 1404 different RD, the href value is a URI. 1406 6.2. Group Removal 1408 A group can be removed simply by sending a removal message to the 1409 location of the group registration resource which was returned when 1410 initially registering the group. Removing a group MUST NOT remove 1411 the endpoints of the group from the RD. 1413 The removal request interface is specified as follows: 1415 Interaction: CT -> RD 1417 Method: DELETE 1419 URI Template: {+location} 1421 URI Template Variables: 1423 location := This is the path of the group resource returned by 1424 the RD as a result of a successful group registration. 1426 The following responses codes are defined for this interface: 1428 Success: 2.02 "Deleted" or 204 "No Content" upon successful deletion 1430 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 1431 request. 1433 Failure: 4.04 "Not Found" or 404 "Not Found". Group does not exist. 1435 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 1436 Service could not perform the operation. 1438 HTTP support: YES 1439 The following examples shows successful removal of the group from the 1440 RD with the example location value /rd-group/12. 1442 Req: DELETE /rd-group/12 1444 Res: 2.02 Deleted 1446 7. RD Lookup 1448 To discover the resources registered with the RD, a lookup interface 1449 must be provided. This lookup interface is defined as a default, and 1450 it is assumed that RDs may also support lookups to return resource 1451 descriptions in alternative formats (e.g. Atom or HTML Link) or 1452 using more advanced interfaces (e.g. supporting context or semantic 1453 based lookup). 1455 RD Lookup allows lookups for groups, endpoints and resources using 1456 attributes defined in this document and for use with the CoRE Link 1457 Format. The result of a lookup request is the list of links (if any) 1458 corresponding to the type of lookup. Thus, a group lookup MUST 1459 return a list of groups, an endpoint lookup MUST return a list of 1460 endpoints and a resource lookup MUST return a list of links to 1461 resources. 1463 The lookup type is selected by a URI endpoint, which is indicated by 1464 a Resource Type as per Table 1 below: 1466 +-------------+--------------------+-----------+ 1467 | Lookup Type | Resource Type | Mandatory | 1468 +-------------+--------------------+-----------+ 1469 | Resource | core.rd-lookup-res | Mandatory | 1470 | Endpoint | core.rd-lookup-ep | Mandatory | 1471 | Group | core.rd-lookup-gp | Optional | 1472 +-------------+--------------------+-----------+ 1474 Table 1: Lookup Types 1476 7.1. Resource lookup 1478 Resource lookup results in links that are semantically equivalent to 1479 the links submitted to the RD. The links and link parameters 1480 returned by the lookup are equal to the submitted ones, except that 1481 the target and anchor references are fully resolved. 1483 Links that did not have an anchor attribute are therefore returned 1484 with the base URI of the registration as the anchor. Links of which 1485 href or anchor was submitted as a (full) URI are returned with these 1486 attributes unmodified. 1488 Above rules allow the client to interpret the response as links 1489 without any further knowledge of the storage conventions of the RD. 1490 The Resource Directory MAY replace the registration base URIs with a 1491 configured intermediate proxy, e.g. in the case of an HTTP lookup 1492 interface for CoAP endpoints. 1494 7.2. Lookup filtering 1496 Using the Accept Option, the requester can control whether the 1497 returned list is returned in CoRE Link Format ("application/link- 1498 format", default) or its alternate content-formats ("application/ 1499 link-format+json" or "application/link-format+cbor"). 1501 The page and count parameters are used to obtain lookup results in 1502 specified increments using pagination, where count specifies how many 1503 links to return and page specifies which subset of links organized in 1504 sequential pages, each containing 'count' links, starting with link 1505 zero and page zero. Thus, specifying count of 10 and page of 0 will 1506 return the first 10 links in the result set (links 0-9). Count = 10 1507 and page = 1 will return the next 'page' containing links 10-19, and 1508 so on. 1510 Multiple search criteria MAY be included in a lookup. All included 1511 criteria MUST match for a link to be returned. The Resource 1512 Directory MUST support matching with multiple search criteria. 1514 A link matches a search criterion if it has an attribute of the same 1515 name and the same value, allowing for a trailing "*" wildcard 1516 operator as in Section 4.1 of [RFC6690]. Attributes that are defined 1517 as "link-type" match if the search value matches any of their values 1518 (see Section 4.1 of [RFC6690]; e.g. "?if=core.s" matches ";if="abc 1519 core.s";"). A link also matches a search criterion if the link that 1520 would be produced for any of its containing entities would match the 1521 criterion, or an entity contained in it would: A search criterion 1522 matches an endpoint if it matches the endpoint itself, any of the 1523 groups it is contained in or any resource it contains. A search 1524 criterion matches a resource if it matches the resource itself, the 1525 resource's endpoint, or any of the endpoint's groups. 1527 Note that "href" is a valid search criterion and matches target 1528 references. Like all search criteria, on a resource lookup it can 1529 match the target reference of the resource link itself, but also the 1530 registration resource of the endpoint that registered it, or any 1531 group resource that endpoint is contained in. Queries for resource 1532 link targets MUST be in URI form (i.e. not relative references) and 1533 are matched against a resolved link target. Queries for groups and 1534 endpoints SHOULD be expressed in path-absolute form if possible and 1535 MUST be expressed in URI form otherwise; the RD SHOULD recognize 1536 either. 1538 Endpoints that are interested in a lookup result repeatedly or 1539 continuously can use mechanisms like ETag caching, resource 1540 observation ([RFC7641]), or any future mechanism that might allow 1541 more efficient observations of collections. These are advertised, 1542 detected and used according to their own specifications and can be 1543 used with the lookup interface as with any other resource. 1545 When resource observation is used, every time the set of matching 1546 links changes, or the content of a matching link changes, the RD 1547 sends a notification with the matching link set. The notification 1548 contains the successful current response to the given request, 1549 especially with respect to representing zero matching links (see 1550 "Success" item below). 1552 The lookup interface is specified as follows: 1554 Interaction: Client -> RD 1556 Method: GET 1558 URI Template: {+type-lookup-location}{?page,count,search*} 1560 URI Template Variables: 1562 type-lookup-location := RD Lookup URI for a given lookup type 1563 (mandatory). The address is discovered as described in 1564 Section 5.2. 1566 search := Search criteria for limiting the number of results 1567 (optional). 1569 page := Page (optional). Parameter cannot be used without the 1570 count parameter. Results are returned from result set in pages 1571 that contain 'count' links starting from index (page * count). 1572 Page numbering starts with zero. 1574 count := Count (optional). Number of results is limited to this 1575 parameter value. If the page parameter is also present, the 1576 response MUST only include 'count' links starting with the 1577 (page * count) link in the result set from the query. If the 1578 count parameter is not present, then the response MUST return 1579 all matching links in the result set. Link numbering starts 1580 with zero. 1582 Content-Format: application/link-format (optional) 1583 Content-Format: application/link-format+json (optional) 1585 Content-Format: application/link-format+cbor (optional) 1587 The following responses codes are defined for this interface: 1589 Success: 2.05 "Content" or 200 "OK" with an "application/link- 1590 format", "application/link-format+cbor", or "application/link- 1591 format+json" payload containing matching entries for the lookup. 1592 The payload can contain zero links (which is an empty payload, 1593 "80" (hex) or "[]" in the respective content format), indicating 1594 that no entities matched the request. 1596 Failure: No error response to a multicast request. 1598 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 1599 request. 1601 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 1602 Service could not perform the operation. 1604 HTTP support: YES 1606 The group and endpoint lookup return registration resources which can 1607 only be manipulated by the registering endpoint. Examples of group 1608 and endpoint lookup belong to the management aspects of the RD and 1609 are shown in Appendix A.5. The resource lookup examples are shown in 1610 this section. 1612 7.3. Resource lookup examples 1614 The examples in this section assume the existence of CoAP hosts with 1615 a default CoAP port 61616. HTTP hosts are possible and do not change 1616 the nature of the examples. 1618 The following example shows a client performing a resource lookup 1619 with the example resource look-up locations discovered in Figure 6: 1621 Req: GET /rd-lookup/res?rt=temperature 1623 Res: 2.05 Content 1624 ;rt="temperature"; 1625 anchor="coap://[2001:db8:3::123]:61616" 1627 The same lookup using the CBOR Link Format media type: 1629 Req: GET /rd-lookup/res?rt=temperature 1630 Accept: TBD64 1632 Res: 2.05 Content 1633 Content-Format: TBD64 1634 Payload in Hex notation: 1635 81A3017823636F61703A2F2F5B323030313A6462383A333A3A3132335D3A363136313 1636 62F74656D7003781E636F61703A2F2F5B323030313A6462383A333A3A3132335D3A36 1637 31363136096B74656D7065726174757265 1638 Decoded payload: 1639 [{1: "coap://[2001:db8:3::123]:61616/temp", 9: "temperature", 1640 3: "coap://[2001:db8:3::123]:61616"}] 1642 A client that wants to be notified of new resources as they show up 1643 can use observation: 1645 Req: GET /rd-lookup/res?rt=light 1646 Observe: 0 1648 Res: 2.05 Content 1649 Observe: 23 1650 Payload: empty 1652 (at a later point in time) 1654 Res: 2.05 Content 1655 Observe: 24 1656 Payload: 1657 ;rt="light"; 1658 anchor="coap://[2001:db8:3::124]", 1659 ;rt="light"; 1660 anchor="coap://[2001:db8:3::124]", 1661 ;rt="light"; 1662 anchor="coap://[2001:db8:3::124]" 1664 The following example shows a client performing a paginated resource 1665 lookup 1666 Req: GET /rd-lookup/res?page=0&count=5 1668 Res: 2.05 Content 1669 ;rt=sensor;ct=60; 1670 anchor="coap://[2001:db8:3::123]:61616", 1671 ;rt=sensor;ct=60; 1672 anchor="coap://[2001:db8:3::123]:61616", 1673 ;rt=sensor;ct=60; 1674 anchor="coap://[2001:db8:3::123]:61616", 1675 ;rt=sensor;ct=60; 1676 anchor="coap://[2001:db8:3::123]:61616", 1677 ;rt=sensor;ct=60; 1678 anchor="coap://[2001:db8:3::123]:61616" 1680 Req: GET /rd-lookup/res?page=1&count=5 1682 Res: 2.05 Content 1683 ;rt=sensor;ct=60; 1684 anchor="coap://[2001:db8:3::123]:61616", 1685 ;rt=sensor;ct=60; 1686 anchor="coap://[2001:db8:3::123]:61616", 1687 ;rt=sensor;ct=60; 1688 anchor="coap://[2001:db8:3::123]:61616", 1689 ;rt=sensor;ct=60; 1690 anchor="coap://[2001:db8:3::123]:61616", 1691 ;rt=sensor;ct=60; 1692 anchor="coap://[2001:db8:3::123]:61616" 1694 The following example shows a client performing a lookup of all 1695 resources from endpoints of all endpoints of a given endpoint type. 1696 It assumes that two endpoints (with endpoint names "sensor1" and 1697 "sensor2") have previously registered with their respective addresses 1698 "coap://sensor1.example.com" and "coap://sensor2.example.com", and 1699 posted the very payload of the 6th request of section 5 of [RFC6690]. 1701 It demonstrates how absolute link targets stay unmodified, while 1702 relative ones are resolved: 1704 Req: GET /rd-lookup/res?et=oic.d.sensor 1706 ;ct=40;title="Sensor Index"; 1707 anchor="coap://sensor1.example.com", 1708 ;rt="temperature-c"; 1709 if="sensor"; anchor="coap://sensor1.example.com", 1710 ;rt="light-lux"; 1711 if="sensor"; anchor="coap://sensor1.example.com", 1712 ;rel="describedby"; 1713 anchor="coap://sensor1.example.com/sensors/temp", 1714 ;rel="alternate"; 1715 anchor="coap://sensor1.example.com/sensors/temp", 1716 ;ct=40;title="Sensor Index"; 1717 anchor="coap://sensor2.example.com", 1718 ;rt="temperature-c"; 1719 if="sensor"; anchor="coap://sensor2.example.com", 1720 ;rt="light-lux"; 1721 if="sensor"; anchor="coap://sensor2.example.com", 1722 ;rel="describedby"; 1723 anchor="coap://sensor2.example.com/sensors/temp", 1724 ;rel="alternate"; 1725 anchor="coap://sensor2.example.com/sensors/temp" 1727 8. Security policies 1729 The Resource Directory (RD) provides assistance to applications 1730 situated on a selection of nodes to discover endpoints on connected 1731 nodes. This section discusses different security aspects of 1732 accessing the RD. 1734 The contents of the RD are inserted in two ways: 1736 1. The node hosting the discoverable endpoint fills the RD with the 1737 contents of /.well-known/core by: 1739 * Storing the contents directly into RD (see Section 5.3) 1741 * Requesting the RD to load the contents from /.well-known/core 1742 (see Section 5.3.1) 1744 2. A Commissioning Tool (CT) fills the RD with endpoint information 1745 for a set of discoverable nodes. (see Section 5.3 with 1746 base=authority parameter value) 1748 In both cases, the nodes filling the RD should be authenticated and 1749 authorized to change the contents of the RD. An Authorization Server 1750 (AS) is responsible to assign a token to the registering node to 1751 authorize the node to discover or register endpoints in a given RD 1752 [I-D.ietf-ace-oauth-authz]. 1754 It can be imagined that an installation is divided in a set of 1755 security regions, each one with its own RD(s) to discover the 1756 endpoints that are part of a given security region. An endpoint that 1757 wants to discover an RD, responsible for a given region, needs to be 1758 authorized to learn the contents of a given RD. Within a region, for 1759 a given RD, a more fine-grained security division is possible based 1760 on the values of the endpoint registration parameters. Authorization 1761 to discover endpoints with a given set of filter values is 1762 recommended for those cases. 1764 When a node registers its endpoints, criteria are needed to authorize 1765 the node to enter them. An important aspect is the uniqueness of the 1766 (endpoint name, and optional sector) pair within the RD. Consider 1767 the two cases separately: (1) CT registers endpoints, and (2) the 1768 registering node registers its own endpoint(s). * A CT needs 1769 authorization to register a set of endpoints. This authorization can 1770 be based on the region, i.e. a given CT is authorized to register any 1771 endpoint (endpoint name, sector) into a given RD, or to register an 1772 endpoint with (endpoint name, sector) value pairs assigned by the AS, 1773 or can be more fine-grained, including a subset of registration 1774 parameter values. * A given endpoint that registers itself, needs to 1775 proof its possession of its unique (endpoint name, sector) value 1776 pair. Alternatively, the AS can authorize the endpoint to register 1777 with an (endpoint name, sector) value pair assigned by the AS. * A 1778 separate document needs to specify these aspects to ensure 1779 interoperability between registering nodes and RD. The subsections 1780 below give some hints how to handle a subset of the different 1781 aspects. 1783 8.1. Secure RD discovery 1785 The Resource Server (RS) discussed in [I-D.ietf-ace-oauth-authz] is 1786 equated to the RD. The client (C) needs to discover the RD as 1787 discussed in Section 4. C can discover the related AS by sending a 1788 request to the RD. The RD denies the request by sending the address 1789 of the related AS, as discussed in section 5.1 of 1790 [I-D.ietf-ace-oauth-authz]. The client MUST send an authorization 1791 request to the AS. When appropriate, the AS returns a token that 1792 specifies the authorization permission which needs to be specified in 1793 a separate document. 1795 8.2. Secure RD filtering 1797 The authorized parameter values for the queries by a given endpoint 1798 must be registered by the AS. The AS communicates the parameter 1799 values in the token. A separate document needs to specify the 1800 parameter value combinations and their storage in the token. The RD 1801 decodes the token and checks the validity of the queries of the 1802 client. 1804 8.3. Secure endpoint Name assignment 1806 This section only considers the assignment of a name to the endpoint 1807 based on an automatic mechanism without use of AS. More elaborate 1808 protocols are out of scope. The registering endpoint is authorized 1809 by the AS to discover the RD and add registrations. A token is 1810 provided by the AS and communicated from registering endpoint to RD. 1811 It is assumed that DTLS is used to secure the channel between 1812 registering endpoint and RD, where the registering endpoint is the 1813 DTLS client. Assuming that the client is provided by a certificate 1814 at manufacturing time, the certificate is uniquely identified by the 1815 CN field and the serial number. The RD can assign a unique endpoint 1816 name by using the certificate identifier as endpoint name. Proof of 1817 possession of the endpoint name by the registering endpoint is 1818 checked by encrypting the certificate identifier with the private key 1819 of the registering endpoint, which the RD can decrypt with the public 1820 key stored in the certificate. Even simpler, the authorized 1821 registering endpoint can generate a random number (or string) that 1822 identifies the endpoint. The RD can check for the improbable 1823 replication of the random value. The RD MUST check that registering 1824 endpoint uses only one random value for each authorized endpoint. 1826 9. Security Considerations 1828 The security considerations as described in Section 7 of [RFC5988] 1829 and Section 6 of [RFC6690] apply. The "/.well-known/core" resource 1830 may be protected e.g. using DTLS when hosted on a CoAP server as 1831 described in [RFC7252]. DTLS or TLS based security SHOULD be used on 1832 all resource directory interfaces defined in this document. 1834 9.1. Endpoint Identification and Authentication 1836 An Endpoint (name, sector) pair is unique within the et of endpoints 1837 regsitered by the RD. An Endpoint MUST NOT be identified by its 1838 protocol, port or IP address as these may change over the lifetime of 1839 an Endpoint. 1841 Every operation performed by an Endpoint on a resource directory 1842 SHOULD be mutually authenticated using Pre-Shared Key, Raw Public Key 1843 or Certificate based security. 1845 Consider the following threat: two devices A and B are registered at 1846 a single server. Both devices have unique, per-device credentials 1847 for use with DTLS to make sure that only parties with authorization 1848 to access A or B can do so. 1850 Now, imagine that a malicious device A wants to sabotage the device 1851 B. It uses its credentials during the DTLS exchange. Then, it 1852 specifies the endpoint name of device B as the name of its own 1853 endpoint in device A. If the server does not check whether the 1854 identifier provided in the DTLS handshake matches the identifier used 1855 at the CoAP layer then it may be inclined to use the endpoint name 1856 for looking up what information to provision to the malicious device. 1858 Section 8.3 specifies an example that removes this threat for 1859 endpoints that have a certificate installed. 1861 9.2. Access Control 1863 Access control SHOULD be performed separately for the RD 1864 registration, Lookup, and group API paths, as different endpoints may 1865 be authorized to register with an RD from those authorized to lookup 1866 endpoints from the RD. Such access control SHOULD be performed in as 1867 fine-grained a level as possible. For example access control for 1868 lookups could be performed either at the sector, endpoint or resource 1869 level. 1871 9.3. Denial of Service Attacks 1873 Services that run over UDP unprotected are vulnerable to unknowingly 1874 become part of a DDoS attack as UDP does not require return 1875 routability check. Therefore, an attacker can easily spoof the 1876 source IP of the target entity and send requests to such a service 1877 which would then respond to the target entity. This can be used for 1878 large-scale DDoS attacks on the target. Especially, if the service 1879 returns a response that is order of magnitudes larger than the 1880 request, the situation becomes even worse as now the attack can be 1881 amplified. DNS servers have been widely used for DDoS amplification 1882 attacks. There is also a danger that NTP Servers could become 1883 implicated in denial-of-service (DoS) attacks since they run on 1884 unprotected UDP, there is no return routability check, and they can 1885 have a large amplification factor. The responses from the NTP server 1886 were found to be 19 times larger than the request. A Resource 1887 Directory (RD) which responds to wild-card lookups is potentially 1888 vulnerable if run with CoAP over UDP. Since there is no return 1889 routability check and the responses can be significantly larger than 1890 requests, RDs can unknowingly become part of a DDoS amplification 1891 attack. 1893 10. IANA Considerations 1895 10.1. Resource Types 1897 IANA is asked to enter the following values into the Resource Type 1898 (rt=) Link Target Attribute Values sub-registry of the Constrained 1899 Restful Environments (CoRE) Parameters registry defined in [RFC6690]: 1901 +--------------------+----------------------------+-----------------+ 1902 | Value | Description | Reference | 1903 +--------------------+----------------------------+-----------------+ 1904 | core.rd | Directory resource of an | RFCTHIS Section | 1905 | | RD | 5.2 | 1906 | core.rd-group | Group directory resource | RFCTHIS Section | 1907 | | of an RD | 5.2 | 1908 | core.rd-lookup-res | Resource lookup of an RD | RFCTHIS Section | 1909 | | | 5.2 | 1910 | core.rd-lookup-ep | Endpoint lookup of an RD | RFCTHIS Section | 1911 | | | 5.2 | 1912 | core.rd-lookup-gp | Group lookup of an RD | RFCTHIS Section | 1913 | | | 5.2 | 1914 | core.rd-ep | Endpoint resource of an RD | RFCTHIS Section | 1915 | | | 7 | 1916 | core.rd-gp | Group resource of an RD | RFCTHIS Section | 1917 | | | 7 | 1918 +--------------------+----------------------------+-----------------+ 1920 10.2. IPv6 ND Resource Directory Address Option 1922 This document registers one new ND option type under the sub-registry 1923 "IPv6 Neighbor Discovery Option Formats": 1925 o Resource Directory address Option (38) 1927 10.3. RD Parameter Registry 1929 This specification defines a new sub-registry for registration and 1930 lookup parameters called "RD Parameters" under "CoRE Parameters". 1931 Although this specification defines a basic set of parameters, it is 1932 expected that other standards that make use of this interface will 1933 define new ones. 1935 Each entry in the registry must include 1936 o the human readable name of the parameter, 1938 o the short name as used in query parameters or link attributes, 1940 o indication of whether it can be passed as a query parameter at 1941 registration of endpoints or groups, as a query parameter in 1942 lookups, or be expressed as a link attribute, 1944 o validity requirements if any, and 1946 o a description. 1948 The query parameter MUST be both a valid URI query key [RFC3986] and 1949 a parmname as used in [RFC5988]. 1951 The description must give details on which registrations they apply 1952 to (Endpoint, group registrations or both? Can they be updated?), 1953 and how they are to be processed in lookups. 1955 The mechanisms around new RD parameters should be designed in such a 1956 way that they tolerate RD implementations that are unaware of the 1957 parameter and expose any parameter passed at registration or updates 1958 on in endpoint lookups. (For example, if a parameter used at 1959 registration were to be confidential, the registering endpoint should 1960 be instructed to only set that parameter if the RD advertises support 1961 for keeping it confidential at the discovery step.) 1963 Initial entries in this sub-registry are as follows: 1965 +--------------+-------+---------------+-----+----------------------+ 1966 | Full name | Short | Validity | Use | Description | 1967 +--------------+-------+---------------+-----+----------------------+ 1968 | Endpoint | ep | | RLA | Name of the | 1969 | Name | | | | endpoint, max 63 | 1970 | | | | | bytes | 1971 | Lifetime | lt | 60-4294967295 | R | Lifetime of the | 1972 | | | | | registration in | 1973 | | | | | seconds | 1974 | Sector | d | | RLA | Sector to which this | 1975 | | | | | endpoint belongs | 1976 | Registration | base | URI | RLA | The scheme, address | 1977 | Base URI | | | | and port and path at | 1978 | | | | | which this server is | 1979 | | | | | available | 1980 | Group Name | gp | | RLA | Name of a group in | 1981 | | | | | the RD | 1982 | Page | page | Integer | L | Used for pagination | 1983 | Count | count | Integer | L | Used for pagination | 1984 | Endpoint | et | | RLA | Semantic name of the | 1985 | Type | | | | endpoint (see | 1986 | | | | | Section 10.4) | 1987 +--------------+-------+---------------+-----+----------------------+ 1989 Table 2: RD Parameters 1991 (Short: Short name used in query parameters or link attributes. Use: 1992 R = used at registration, L = used at lookup, A = expressed in link 1993 attribute 1995 The descriptions for the options defined in this document are only 1996 summarized here. To which registrations they apply and when they are 1997 to be shown is described in the respective sections of this document. 1999 The IANA policy for future additions to the sub-registry is "Expert 2000 Review" as described in [RFC8126]. The evaluation should consider 2001 formal criteria, duplication of functionality (Is the new entry 2002 redundant with an existing one?), topical suitability (E.g. is the 2003 described property actually a property of the endpoint and not a 2004 property of a particular resource, in which case it should go into 2005 the payload of the registration and need not be registered?), and the 2006 potential for conflict with commonly used link attributes (For 2007 example, "if" could be used as a parameter for conditional 2008 registration if it were not to be used in lookup or attributes, but 2009 would make a bad parameter for lookup, because a resource lookup with 2010 an "if" query parameter could ambiguously filter by the registered 2011 endpoint property or the [RFC6690] link attribute). It is expected 2012 that the registry will receive between 5 and 50 registrations in 2013 total over the next years. 2015 10.3.1. Full description of the "Endpoint Type" Registration Parameter 2017 An endpoint registering at an RD can describe itself with endpoint 2018 types, similar to how resources are described with Resource Types in 2019 [RFC6690]. An endpoint type is expressed as a string, which can be 2020 either a URI or one of the values defined in the Endpoint Type sub- 2021 registry. Endpoint types can be passed in the "et" query parameter 2022 as part of extra-attrs at the Registration step, are shown on 2023 endpoint lookups using the "et" target attribute, and can be filtered 2024 for using "et" as a search criterion in resource and endpoint lookup. 2025 Multiple endpoint types are given as separate query parameters or 2026 link attributes. 2028 Note that Endpoint Type differs from Resource Type in that it uses 2029 multiple attributes rather than space separated values. As a result, 2030 Resource Directory implementations automatically support correct 2031 filtering in the lookup interfaces from the rules for unknown 2032 endpoint attributes. 2034 10.4. "Endpoint Type" (et=) RD Parameter values 2036 This specification establishes a new sub-registry under "CoRE 2037 Parameters" called '"Endpoint Type" (et=) RD Parameter values'. The 2038 registry properties (required policy, requirements, template) are 2039 identical to those of the Resource Type parameters in [RFC6690], in 2040 short: 2042 The review policy is IETF Review for values starting with "core", and 2043 Specification Required for others. 2045 The requirements to be enforced are: 2047 o The values MUST be related to the purpose described in 2048 Section 10.3.1. 2050 o The registered values MUST conform to the ABNF reg-rel-type 2051 definition of [RFC6690] and MUST NOT be a URI. 2053 o It is recommended to use the period "." character for 2054 segmentation. 2056 The registry is initially empty. 2058 10.5. Multicast Address Registration 2060 IANA has assigned the following multicast addresses for use by CoAP 2061 nodes: 2063 IPv4 - "all CoRE resource directories" address, from the "IPv4 2064 Multicast Address Space Registry" equal to "All CoAP Nodes", 2065 224.0.1.187. As the address is used for discovery that may span 2066 beyond a single network, it has come from the Internetwork Control 2067 Block (224.0.1.x, RFC 5771). 2069 IPv6 - "all CoRE resource directories" address MCD1 (suggestions 2070 FF0X::FE), from the "IPv6 Multicast Address Space Registry", in the 2071 "Variable Scope Multicast Addresses" space (RFC 3307). Note that 2072 there is a distinct multicast address for each scope that interested 2073 CoAP nodes should listen to; CoAP needs the Link-Local and Site-Local 2074 scopes only. 2076 11. Examples 2078 Two examples are presented: a Lighting Installation example in 2079 Section 11.1 and a LWM2M example in Section 11.2. 2081 11.1. Lighting Installation 2083 This example shows a simplified lighting installation which makes use 2084 of the Resource Directory (RD) with a CoAP interface to facilitate 2085 the installation and start up of the application code in the lights 2086 and sensors. In particular, the example leads to the definition of a 2087 group and the enabling of the corresponding multicast address. No 2088 conclusions must be drawn on the realization of actual installation 2089 or naming procedures, because the example only "emphasizes" some of 2090 the issues that may influence the use of the RD and does not pretend 2091 to be normative. 2093 11.1.1. Installation Characteristics 2095 The example assumes that the installation is managed. That means 2096 that a Commissioning Tool (CT) is used to authorize the addition of 2097 nodes, name them, and name their services. The CT can be connected 2098 to the installation in many ways: the CT can be part of the 2099 installation network, connected by WiFi to the installation network, 2100 or connected via GPRS link, or other method. 2102 It is assumed that there are two naming authorities for the 2103 installation: (1) the network manager that is responsible for the 2104 correct operation of the network and the connected interfaces, and 2105 (2) the lighting manager that is responsible for the correct 2106 functioning of networked lights and sensors. The result is the 2107 existence of two naming schemes coming from the two managing 2108 entities. 2110 The example installation consists of one presence sensor, and two 2111 luminaries, luminary1 and luminary2, each with their own wireless 2112 interface. Each luminary contains three lamps: left, right and 2113 middle. Each luminary is accessible through one endpoint. For each 2114 lamp a resource exists to modify the settings of a lamp in a 2115 luminary. The purpose of the installation is that the presence 2116 sensor notifies the presence of persons to a group of lamps. The 2117 group of lamps consists of: middle and left lamps of luminary1 and 2118 right lamp of luminary2. 2120 Before commissioning by the lighting manager, the network is 2121 installed and access to the interfaces is proven to work by the 2122 network manager. 2124 At the moment of installation, the network under installation is not 2125 necessarily connected to the DNS infra structure. Therefore, SLAAC 2126 IPv6 addresses are assigned to CT, RD, luminaries and sensor shown in 2127 Table 3 below: 2129 +--------------------+----------------+ 2130 | Name | IPv6 address | 2131 +--------------------+----------------+ 2132 | luminary1 | 2001:db8:4::1 | 2133 | luminary2 | 2001:db8:4::2 | 2134 | Presence sensor | 2001:db8:4::3 | 2135 | Resource directory | 2001:db8:4::ff | 2136 +--------------------+----------------+ 2138 Table 3: interface SLAAC addresses 2140 In Section 11.1.2 the use of resource directory during installation 2141 is presented. 2143 11.1.2. RD entries 2145 It is assumed that access to the DNS infrastructure is not always 2146 possible during installation. Therefore, the SLAAC addresses are 2147 used in this section. 2149 For discovery, the resource types (rt) of the devices are important. 2150 The lamps in the luminaries have rt: light, and the presence sensor 2151 has rt: p-sensor. The endpoints have names which are relevant to the 2152 light installation manager. In this case luminary1, luminary2, and 2153 the presence sensor are located in room 2-4-015, where luminary1 is 2154 located at the window and luminary2 and the presence sensor are 2155 located at the door. The endpoint names reflect this physical 2156 location. The middle, left and right lamps are accessed via path 2157 /light/middle, /light/left, and /light/right respectively. The 2158 identifiers relevant to the Resource Directory are shown in Table 4 2159 below: 2161 +----------------+------------------+---------------+---------------+ 2162 | Name | endpoint | resource path | resource type | 2163 +----------------+------------------+---------------+---------------+ 2164 | luminary1 | lm_R2-4-015_wndw | /light/left | light | 2165 | luminary1 | lm_R2-4-015_wndw | /light/middle | light | 2166 | luminary1 | lm_R2-4-015_wndw | /light/right | light | 2167 | luminary2 | lm_R2-4-015_door | /light/left | light | 2168 | luminary2 | lm_R2-4-015_door | /light/middle | light | 2169 | luminary2 | lm_R2-4-015_door | /light/right | light | 2170 | Presence | ps_R2-4-015_door | /ps | p-sensor | 2171 | sensor | | | | 2172 +----------------+------------------+---------------+---------------+ 2174 Table 4: Resource Directory identifiers 2176 It is assumed that the CT knows the RD's address, and has performed 2177 URI discovery on it that returned a response like the one in the 2178 Section 5.2 example. 2180 The CT inserts the endpoints of the luminaries and the sensor in the 2181 RD using the registration base URI parameter (base) to specify the 2182 interface address: 2184 Req: POST coap://[2001:db8:4::ff]/rd 2185 ?ep=lm_R2-4-015_wndw&base=coap://[2001:db8:4::1]&d=R2-4-015 2186 Payload: 2187 ;rt="light", 2188 ;rt="light", 2189 ;rt="light" 2191 Res: 2.01 Created 2192 Location-Path: /rd/4521 2193 Req: POST coap://[2001:db8:4::ff]/rd 2194 ?ep=lm_R2-4-015_door&base=coap://[2001:db8:4::2]&d=R2-4-015 2195 Payload: 2196 ;rt="light", 2197 ;rt="light", 2198 ;rt="light" 2200 Res: 2.01 Created 2201 Location-Path: /rd/4522 2203 Req: POST coap://[2001:db8:4::ff]/rd 2204 ?ep=ps_R2-4-015_door&base=coap://[2001:db8:4::3]d&d=R2-4-015 2205 Payload: 2206 ;rt="p-sensor" 2208 Res: 2.01 Created 2209 Location-Path: /rd/4523 2211 The sector name d=R2-4-015 has been added for an efficient lookup 2212 because filtering on "ep" name is more awkward. The same sector name 2213 is communicated to the two luminaries and the presence sensor by the 2214 CT. 2216 The group is specified in the RD. The base parameter is set to the 2217 site-local multicast address allocated to the group. In the POST in 2218 the example below, two luminary endpoints are registered as members 2219 of the group. They share a common resource set to which a multicast 2220 request can be sent and executed by all members of the group. 2222 Req: POST coap://[2001:db8:4::ff]/rd-group 2223 ?gp=grp_R2-4-015&base=coap://[ff05::1] 2224 Payload: 2225 , 2226 2228 Res: 2.01 Created 2229 Location-Path: /rd-group/501 2231 After the filling of the RD by the CT, the application in the 2232 luminaries can learn to which groups they belong, and enable their 2233 interface for the multicast address. 2235 The luminary, knowing its sector and own IPv6 address, looks up the 2236 groups containing light resources it is assigned to: 2238 Req: GET coap://[2001:db8:4::ff]/rd-lookup/gp 2239 ?d=R2-4-015&base=coap://[2001:db8:4::1]&rt=light 2241 Res: 2.05 Content 2242 ;gp="grp_R2-4-015";base="coap://[ff05::1]" 2244 From the returned base parameter value, the luminary learns the 2245 multicast address of the multicast group. 2247 Alternatively, the CT can communicate the multicast address directly 2248 to the luminaries by using the "coap-group" resource specified in 2249 [RFC7390]. 2251 Req: POST coap://[2001:db8:4::1]/coap-group 2252 Content-Format: application/coap-group+json 2253 Payload: 2254 { "a": "[ff05::1]", "n": "grp_R2-4-015"} 2256 Res: 2.01 Created 2257 Location-Path: /coap-group/1 2259 Dependent on the situation, only the address, "a", or the name, "n", 2260 is specified in the coap-group resource. 2262 The presence sensor can learn the presence of groups that support 2263 resources with rt=light in its own sector by sending the request: 2265 Req: GET coap://[2001:db8:4::ff]/rd-lookup/gp?d=R2-4-015&rt=light 2267 Res: 2.05 Content 2268 ;gp="grp_R2-4-015";base="coap://[ff05::1]" 2270 The presence sensor learns the multicast address to use for sending 2271 messages to the luminaries. 2273 11.2. OMA Lightweight M2M (LWM2M) Example 2275 This example shows how the OMA LWM2M specification makes use of 2276 Resource Directory (RD). 2278 OMA LWM2M is a profile for device services based on CoAP(OMA Name 2279 Authority). LWM2M defines a simple object model and a number of 2280 abstract interfaces and operations for device management and device 2281 service enablement. 2283 An LWM2M server is an instance of an LWM2M middleware service layer, 2284 containing a Resource Directory along with other LWM2M interfaces 2285 defined by the LWM2M specification. 2287 CoRE Resource Directory (RD) is used to provide the LWM2M 2288 Registration interface. 2290 LWM2M does not provide for registration sectors and does not 2291 currently use the rd-group or rd-lookup interfaces. 2293 The LWM2M specification describes a set of interfaces and a resource 2294 model used between a LWM2M device and an LWM2M server. Other 2295 interfaces, proxies, and applications are currently out of scope for 2296 LWM2M. 2298 The location of the LWM2M Server and RD URI path is provided by the 2299 LWM2M Bootstrap process, so no dynamic discovery of the RD is used. 2300 LWM2M Servers and endpoints are not required to implement the /.well- 2301 known/core resource. 2303 11.2.1. The LWM2M Object Model 2305 The OMA LWM2M object model is based on a simple 2 level class 2306 hierarchy consisting of Objects and Resources. 2308 An LWM2M Resource is a REST endpoint, allowed to be a single value or 2309 an array of values of the same data type. 2311 An LWM2M Object is a resource template and container type that 2312 encapsulates a set of related resources. An LWM2M Object represents 2313 a specific type of information source; for example, there is a LWM2M 2314 Device Management object that represents a network connection, 2315 containing resources that represent individual properties like radio 2316 signal strength. 2318 Since there may potentially be more than one of a given type object, 2319 for example more than one network connection, LWM2M defines instances 2320 of objects that contain the resources that represent a specific 2321 physical thing. 2323 The URI template for LWM2M consists of a base URI followed by Object, 2324 Instance, and Resource IDs: 2326 {/base-uri}{/object-id}{/object-instance}{/resource-id}{/resource- 2327 instance} 2329 The five variables given here are strings. base-uri can also have 2330 the special value "undefined" (sometimes called "null" in RFC 6570). 2331 Each of the variables object-instance, resource-id, and resource- 2332 instance can be the special value "undefined" only if the values 2333 behind it in this sequence also are "undefined". As a special case, 2334 object-instance can be "empty" (which is different from "undefined") 2335 if resource-id is not "undefined". 2337 base-uri := Base URI for LWM2M resources or "undefined" for default 2338 (empty) base URI 2340 object-id := OMNA (OMA Name Authority) registered object ID (0-65535) 2342 object-instance := Object instance identifier (0-65535) or 2343 "undefined"/"empty" (see above)) to refer to all instances of an 2344 object ID 2346 resource-id := OMNA (OMA Name Authority) registered resource ID 2347 (0-65535) or "undefined" to refer to all resources within an instance 2349 resource-instance := Resource instance identifier or "undefined" to 2350 refer to single instance of a resource 2352 LWM2M IDs are 16 bit unsigned integers represented in decimal (no 2353 leading zeroes except for the value 0) by URI format strings. For 2354 example, a LWM2M URI might be: 2356 /1/0/1 2358 The base uri is empty, the Object ID is 1, the instance ID is 0, the 2359 resource ID is 1, and the resource instance is "undefined". This 2360 example URI points to internal resource 1, which represents the 2361 registration lifetime configured, in instance 0 of a type 1 object 2362 (LWM2M Server Object). 2364 11.2.2. LWM2M Register Endpoint 2366 LWM2M defines a registration interface based on the REST API, 2367 described in Section 5. The RD registration URI path of the LWM2M 2368 Resource Directory is specified to be "/rd". 2370 LWM2M endpoints register object IDs, for example , to indicate 2371 that a particular object type is supported, and register object 2372 instances, for example , to indicate that a particular instance 2373 of that object type exists. 2375 Resources within the LWM2M object instance are not registered with 2376 the RD, but may be discovered by reading the resource links from the 2377 object instance using GET with a CoAP Content-Format of application/ 2378 link-format. Resources may also be read as a structured object by 2379 performing a GET to the object instance with a Content-Format of 2380 senml+json. 2382 When an LWM2M object or instance is registered, this indicates to the 2383 LWM2M server that the object and its resources are available for 2384 management and service enablement (REST API) operations. 2386 LWM2M endpoints may use the following RD registration parameters as 2387 defined in Table 2 : 2389 ep - Endpoint Name 2390 lt - registration lifetime 2392 Endpoint Name, Lifetime, and LWM2M Version are mandatory parameters 2393 for the register operation, all other registration parameters are 2394 optional. 2396 Additional optional LWM2M registration parameters are defined: 2398 +-----------+-------+-------------------------------+---------------+ 2399 | Name | Query | Validity | Description | 2400 +-----------+-------+-------------------------------+---------------+ 2401 | Binding | b | {"U",UQ","S","SQ","US","UQS"} | Available | 2402 | Mode | | | Protocols | 2403 | | | | | 2404 | LWM2M | ver | 1.0 | Spec Version | 2405 | Version | | | | 2406 | | | | | 2407 | SMS | sms | | MSISDN | 2408 | Number | | | | 2409 +-----------+-------+-------------------------------+---------------+ 2411 Table 5: LWM2M Additional Registration Parameters 2413 The following RD registration parameters are not currently specified 2414 for use in LWM2M: 2416 et - Endpoint Type 2417 base - Registration Base URI 2419 The endpoint registration must include a payload containing links to 2420 all supported objects and existing object instances, optionally 2421 including the appropriate link-format relations. 2423 Here is an example LWM2M registration payload: 2425 ,,, 2427 This link format payload indicates that object ID 1 (LWM2M Server 2428 Object) is supported, with a single instance 0 existing, object ID 3 2429 (LWM2M Device object) is supported, with a single instance 0 2430 existing, and object 5 (LWM2M Firmware Object) is supported, with no 2431 existing instances. 2433 11.2.3. LWM2M Update Endpoint Registration 2435 The LwM2M update is really very similar to the registration update as 2436 described in Appendix A.1, with the only difference that there are 2437 more parameters defined and available. All the parameters listed in 2438 that section are also available with the initial registration but are 2439 all optional: 2441 lt - Registration Lifetime 2442 b - Protocol Binding 2443 sms - MSISDN 2444 link payload - new or modified links 2446 A Registration update is also specified to be used to update the 2447 LWM2M server whenever the endpoint's UDP port or IP address are 2448 changed. 2450 11.2.4. LWM2M De-Register Endpoint 2452 LWM2M allows for de-registration using the delete method on the 2453 returned location from the initial registration operation. LWM2M de- 2454 registration proceeds as described in Appendix A.2. 2456 12. Acknowledgments 2458 Oscar Novo, Srdjan Krco, Szymon Sasin, Kerry Lynn, Esko Dijk, Anders 2459 Brandt, Matthieu Vial, Jim Schaad, Mohit Sethi, Hauke Petersen, 2460 Hannes Tschofenig, Sampo Ukkola, Linyi Tian, and Jan Newmarch have 2461 provided helpful comments, discussions and ideas to improve and shape 2462 this document. Zach would also like to thank his colleagues from the 2463 EU FP7 SENSEI project, where many of the resource directory concepts 2464 were originally developed. 2466 13. Changelog 2468 changes from -15 to -16 2470 o Recommend a common set of resources for members of a group 2472 o Clarified use of multicast group in lighting example 2474 o Add note on concurrent registrations from one EP being possible 2475 but not expected 2477 o Refresh web examples appendix to reflect current use of Modernized 2478 Link Format 2480 o Add examples of URIs where Modernized Link Format matters 2482 o Editorial changes 2484 changes from -14 to -15 2486 o Rewrite of section "Security policies" 2488 o Clarify that the "base" parameter text applies both to relative 2489 references both in anchor and href 2491 o Renamed "Registree-EP" to Registrant-EP" 2493 o Talk of "relative references" and "URIs" rather than "relative" 2494 and "absolute" URIs. (The concept of "absolute URIs" of [RFC3986] 2495 is not needed in RD). 2497 o Fixed examples 2499 o Editorial changes 2501 changes from -13 to -14 2503 o Rename "registration context" to "registration base URI" (and 2504 "con" to "base") and "domain" to "sector" (where the abbreviation 2505 "d" stays for compatibility reasons) 2507 o Introduced resource types core.rd-ep and core.rd-gp 2509 o Registration management moved to appendix A, including endpoint 2510 and group lookup 2512 o Minor editorial changes 2514 * PATCH/iPATCH is clearly deferred to another document 2516 * Recommend against query / fragment identifier in con= 2518 * Interface description lists are described as illustrative 2520 * Rewording of Simple Registration 2522 o Simple registration carries no error information and succeeds 2523 immediately (previously, sequence was unspecified) 2525 o Lookup: href are matched against resolved values (previously, this 2526 was unspecified) 2528 o Lookup: lt are not exposed any more 2530 o con/base: Paths are allowed 2532 o Registration resource locations can not have query or fragment 2533 parts 2535 o Default life time extended to 25 hours 2537 o clarified registration update rules 2539 o lt-value semantics for lookup clarified. 2541 o added template for simple registration 2543 changes from -12 to -13 2545 o Added "all resource directory" nodes MC address 2547 o Clarified observation behavior 2549 o version identification 2551 o example rt= and et= values 2553 o domain from figure 2 2555 o more explanatory text 2557 o endpoints of a groups hosted by different RD 2559 o resolve RFC6690-vs-8288 resolution ambiguities: 2561 * require registered links not to be relative when using anchor 2563 * return absolute URIs in resource lookup 2565 changes from -11 to -12 2567 o added Content Model section, including ER diagram 2569 o removed domain lookup interface; domains are now plain attributes 2570 of groups and endpoints 2572 o updated chapter "Finding a Resource Directory"; now distinguishes 2573 configuration-provided, network-provided and heuristic sources 2575 o improved text on: atomicity, idempotency, lookup with multiple 2576 parameters, endpoint removal, simple registration 2578 o updated LWM2M description 2580 o clarified where relative references are resolved, and how context 2581 and anchor interact 2583 o new appendix on the interaction with RFCs 6690, 5988 and 3986 2585 o lookup interface: group and endpoint lookup return group and 2586 registration resources as link targets 2588 o lookup interface: search parameters work the same across all 2589 entities 2591 o removed all methods that modify links in an existing registration 2592 (POST with payload, PATCH and iPATCH) 2594 o removed plurality definition (was only needed for link 2595 modification) 2597 o enhanced IANA registry text 2599 o state that lookup resources can be observable 2601 o More examples and improved text 2603 changes from -09 to -10 2605 o removed "ins" and "exp" link-format extensions. 2607 o removed all text concerning DNS-SD. 2609 o removed inconsistency in RDAO text. 2611 o suggestions taken over from various sources 2613 o replaced "Function Set" with "REST API", "base URI", "base path" 2615 o moved simple registration to registration section 2617 changes from -08 to -09 2618 o clarified the "example use" of the base RD resource values /rd, 2619 /rd-lookup, and /rd-group. 2621 o changed "ins" ABNF notation. 2623 o various editorial improvements, including in examples 2625 o clarifications for RDAO 2627 changes from -07 to -08 2629 o removed link target value returned from domain and group lookup 2630 types 2632 o Maximum length of domain parameter 63 bytes for consistency with 2633 group 2635 o removed option for simple POST of link data, don't require a 2636 .well-known/core resource to accept POST data and handle it in a 2637 special way; we already have /rd for that 2639 o add IPv6 ND Option for discovery of an RD 2641 o clarify group configuration section 6.1 that endpoints must be 2642 registered before including them in a group 2644 o removed all superfluous client-server diagrams 2646 o simplified lighting example 2648 o introduced Commissioning Tool 2650 o RD-Look-up text is extended. 2652 changes from -06 to -07 2654 o added text in the discovery section to allow content format hints 2655 to be exposed in the discovery link attributes 2657 o editorial updates to section 9 2659 o update author information 2661 o minor text corrections 2663 Changes from -05 to -06 2664 o added note that the PATCH section is contingent on the progress of 2665 the PATCH method 2667 changes from -04 to -05 2669 o added Update Endpoint Links using PATCH 2671 o http access made explicit in interface specification 2673 o Added http examples 2675 Changes from -03 to -04: 2677 o Added http response codes 2679 o Clarified endpoint name usage 2681 o Add application/link-format+cbor content-format 2683 Changes from -02 to -03: 2685 o Added an example for lighting and DNS integration 2687 o Added an example for RD use in OMA LWM2M 2689 o Added Read Links operation for link inspection by endpoints 2691 o Expanded DNS-SD section 2693 o Added draft authors Peter van der Stok and Michael Koster 2695 Changes from -01 to -02: 2697 o Added a catalogue use case. 2699 o Changed the registration update to a POST with optional link 2700 format payload. Removed the endpoint type update from the update. 2702 o Additional examples section added for more complex use cases. 2704 o New DNS-SD mapping section. 2706 o Added text on endpoint identification and authentication. 2708 o Error code 4.04 added to Registration Update and Delete requests. 2710 o Made 63 bytes a SHOULD rather than a MUST for endpoint name and 2711 resource type parameters. 2713 Changes from -00 to -01: 2715 o Removed the ETag validation feature. 2717 o Place holder for the DNS-SD mapping section. 2719 o Explicitly disabled GET or POST on returned Location. 2721 o New registry for RD parameters. 2723 o Added support for the JSON Link Format. 2725 o Added reference to the Groupcomm WG draft. 2727 Changes from -05 to WG Document -00: 2729 o Updated the version and date. 2731 Changes from -04 to -05: 2733 o Restricted Update to parameter updates. 2735 o Added pagination support for the Lookup interface. 2737 o Minor editing, bug fixes and reference updates. 2739 o Added group support. 2741 o Changed rt to et for the registration and update interface. 2743 Changes from -03 to -04: 2745 o Added the ins= parameter back for the DNS-SD mapping. 2747 o Integrated the Simple Directory Discovery from Carsten. 2749 o Editorial improvements. 2751 o Fixed the use of ETags. 2753 o Fixed tickets 383 and 372 2755 Changes from -02 to -03: 2757 o Changed the endpoint name back to a single registration parameter 2758 ep= and removed the h= and ins= parameters. 2760 o Updated REST interface descriptions to use RFC6570 URI Template 2761 format. 2763 o Introduced an improved RD Lookup design as its own function set. 2765 o Improved the security considerations section. 2767 o Made the POST registration interface idempotent by requiring the 2768 ep= parameter to be present. 2770 Changes from -01 to -02: 2772 o Added a terminology section. 2774 o Changed the inclusion of an ETag in registration or update to a 2775 MAY. 2777 o Added the concept of an RD Domain and a registration parameter for 2778 it. 2780 o Recommended the Location returned from a registration to be 2781 stable, allowing for endpoint and Domain information to be changed 2782 during updates. 2784 o Changed the lookup interface to accept endpoint and Domain as 2785 query string parameters to control the scope of a lookup. 2787 14. References 2789 14.1. Normative References 2791 [I-D.ietf-core-links-json] 2792 Li, K., Rahman, A., and C. Bormann, "Representing 2793 Constrained RESTful Environments (CoRE) Link Format in 2794 JSON and CBOR", draft-ietf-core-links-json-10 (work in 2795 progress), February 2018. 2797 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2798 Requirement Levels", BCP 14, RFC 2119, 2799 DOI 10.17487/RFC2119, March 1997, 2800 . 2802 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 2803 Resource Identifier (URI): Generic Syntax", STD 66, 2804 RFC 3986, DOI 10.17487/RFC3986, January 2005, 2805 . 2807 [RFC5988] Nottingham, M., "Web Linking", RFC 5988, 2808 DOI 10.17487/RFC5988, October 2010, 2809 . 2811 [RFC6570] Gregorio, J., Fielding, R., Hadley, M., Nottingham, M., 2812 and D. Orchard, "URI Template", RFC 6570, 2813 DOI 10.17487/RFC6570, March 2012, 2814 . 2816 [RFC6690] Shelby, Z., "Constrained RESTful Environments (CoRE) Link 2817 Format", RFC 6690, DOI 10.17487/RFC6690, August 2012, 2818 . 2820 [RFC6763] Cheshire, S. and M. Krochmal, "DNS-Based Service 2821 Discovery", RFC 6763, DOI 10.17487/RFC6763, February 2013, 2822 . 2824 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 2825 Writing an IANA Considerations Section in RFCs", BCP 26, 2826 RFC 8126, DOI 10.17487/RFC8126, June 2017, 2827 . 2829 14.2. Informative References 2831 [ER] Chen, P., "The entity-relationship model---toward a 2832 unified view of data", ACM Transactions on Database 2833 Systems Vol. 1, pp. 9-36, DOI 10.1145/320434.320440, March 2834 1976. 2836 [I-D.arkko-core-dev-urn] 2837 Arkko, J., Jennings, C., and Z. Shelby, "Uniform Resource 2838 Names for Device Identifiers", draft-arkko-core-dev-urn-05 2839 (work in progress), October 2017. 2841 [I-D.bormann-t2trg-rel-impl] 2842 Bormann, C., "impl-info: A link relation type for 2843 disclosing implementation information", draft-bormann- 2844 t2trg-rel-impl-00 (work in progress), January 2018. 2846 [I-D.ietf-ace-oauth-authz] 2847 Seitz, L., Selander, G., Wahlstroem, E., Erdtman, S., and 2848 H. Tschofenig, "Authentication and Authorization for 2849 Constrained Environments (ACE) using the OAuth 2.0 2850 Framework (ACE-OAuth)", draft-ietf-ace-oauth-authz-16 2851 (work in progress), October 2018. 2853 [I-D.ietf-anima-bootstrapping-keyinfra] 2854 Pritikin, M., Richardson, M., Behringer, M., Bjarnason, 2855 S., and K. Watsen, "Bootstrapping Remote Secure Key 2856 Infrastructures (BRSKI)", draft-ietf-anima-bootstrapping- 2857 keyinfra-16 (work in progress), June 2018. 2859 [I-D.silverajan-core-coap-protocol-negotiation] 2860 Silverajan, B. and M. Ocak, "CoAP Protocol Negotiation", 2861 draft-silverajan-core-coap-protocol-negotiation-09 (work 2862 in progress), July 2018. 2864 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 2865 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 2866 Transfer Protocol -- HTTP/1.1", RFC 2616, 2867 DOI 10.17487/RFC2616, June 1999, 2868 . 2870 [RFC6775] Shelby, Z., Ed., Chakrabarti, S., Nordmark, E., and C. 2871 Bormann, "Neighbor Discovery Optimization for IPv6 over 2872 Low-Power Wireless Personal Area Networks (6LoWPANs)", 2873 RFC 6775, DOI 10.17487/RFC6775, November 2012, 2874 . 2876 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 2877 Protocol (HTTP/1.1): Message Syntax and Routing", 2878 RFC 7230, DOI 10.17487/RFC7230, June 2014, 2879 . 2881 [RFC7252] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained 2882 Application Protocol (CoAP)", RFC 7252, 2883 DOI 10.17487/RFC7252, June 2014, 2884 . 2886 [RFC7390] Rahman, A., Ed. and E. Dijk, Ed., "Group Communication for 2887 the Constrained Application Protocol (CoAP)", RFC 7390, 2888 DOI 10.17487/RFC7390, October 2014, 2889 . 2891 [RFC7641] Hartke, K., "Observing Resources in the Constrained 2892 Application Protocol (CoAP)", RFC 7641, 2893 DOI 10.17487/RFC7641, September 2015, 2894 . 2896 [RFC8132] van der Stok, P., Bormann, C., and A. Sehgal, "PATCH and 2897 FETCH Methods for the Constrained Application Protocol 2898 (CoAP)", RFC 8132, DOI 10.17487/RFC8132, April 2017, 2899 . 2901 [RFC8288] Nottingham, M., "Web Linking", RFC 8288, 2902 DOI 10.17487/RFC8288, October 2017, 2903 . 2905 [RFC8392] Jones, M., Wahlstroem, E., Erdtman, S., and H. Tschofenig, 2906 "CBOR Web Token (CWT)", RFC 8392, DOI 10.17487/RFC8392, 2907 May 2018, . 2909 Appendix A. Registration Management 2911 This section describes how the registering endpoint can maintain the 2912 registries that it created. The registering endpoint can be the 2913 registrant-ep or the CT. An endpoint SHOULD NOT use this interface 2914 for registries that it did not create. The registries are resources 2915 of the RD. 2917 After the initial registration, the registering endpoint retains the 2918 returned location of the Registration Resource for further 2919 operations, including refreshing the registration in order to extend 2920 the lifetime and "keep-alive" the registration. When the lifetime of 2921 the registration has expired, the RD SHOULD NOT respond to discovery 2922 queries concerning this endpoint. The RD SHOULD continue to provide 2923 access to the Registration Resource after a registration time-out 2924 occurs in order to enable the registering endpoint to eventually 2925 refresh the registration. The RD MAY eventually remove the 2926 registration resource for the purpose of garbage collection and 2927 remove it from any group it belongs to. If the Registration Resource 2928 is removed, the corresponding endpoint will need to be re-registered. 2930 The Registration Resource may also be used to inspect the 2931 registration resource using GET, update the registration, cancel the 2932 registration using DELETE, do an endpoint lookup, or a group lookup. 2934 These operations are described below. 2936 A.1. Registration Update 2938 The update interface is used by the registering endpoint to refresh 2939 or update its registration with an RD. To use the interface, the 2940 registering endpoint sends a POST request to the registration 2941 resource returned by the initial registration operation. 2943 An update MAY update the lifetime- or the context- registration 2944 parameters "lt", "base" as in Section 5.3. Parameters that are not 2945 being changed SHOULD NOT be included in an update. Adding parameters 2946 that have not changed increases the size of the message but does not 2947 have any other implications. Parameters MUST be included as query 2948 parameters in an update operation as in Section 5.3. 2950 A registration update resets the timeout of the registration to the 2951 (possibly updated) lifetime of the registration, independent of 2952 whether a "lt" parameter was given. 2954 If the context of the registration is changed in an update, relative 2955 references submitted in the original registration or later updates 2956 are resolved anew against the new context. 2958 The registration update operation only describes the use of POST with 2959 an empty payload. Future standards might describe the semantics of 2960 using content formats and payloads with the POST method to update the 2961 links of a registration (see Appendix A.4). 2963 The update registration request interface is specified as follows: 2965 Interaction: EP -> RD 2967 Method: POST 2969 URI Template: {+location}{?lt,con,extra-attrs*} 2971 URI Template Variables: 2973 location := This is the Location returned by the RD as a result 2974 of a successful earlier registration. 2976 lt := Lifetime (optional). Lifetime of the registration in 2977 seconds. Range of 60-4294967295. If no lifetime is included, 2978 the previous last lifetime set on a previous update or the 2979 original registration (falling back to 90000) SHOULD be used. 2981 base := Base URI (optional). This parameter updates the Base URI 2982 established in the original registration to a new value. If 2983 the parameter is set in an update, it is stored by the RD as 2984 the new Base URI under which to interpret the relative links 2985 present in the payload of the original registration, following 2986 the same restrictions as in the registration. If the parameter 2987 is not set in the request but was set before, the previous Base 2988 URI value is kept unmodified. If the parameter is not set in 2989 the request and was not set before either, the source address 2990 and source port of the update request are stored as the Base 2991 URI. 2993 extra-attrs := Additional registration attributes (optional). As 2994 with the registration, the RD processes them if it knows their 2995 semantics. Otherwise, unknown attributes are stored as 2996 endpoint attributes, overriding any previously stored endpoint 2997 attributes of the same key. 2999 Content-Format: none (no payload) 3001 The following response codes are defined for this interface: 3003 Success: 2.04 "Changed" or 204 "No Content" if the update was 3004 successfully processed. 3006 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 3007 request. 3009 Failure: 4.04 "Not Found" or 404 "Not Found". Registration does not 3010 exist (e.g. may have expired). 3012 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 3013 Service could not perform the operation. 3015 HTTP support: YES 3017 If the registration update fails with a "Service Unavailable" 3018 response and a Max-Age option or Retry-After header, the registering 3019 endpoint SHOULD retry the operation after the time indicated. If the 3020 registration fails in another way, including request timeouts, or if 3021 the time indicated exceeds the remaining lifetime, the registering 3022 endpoint SHOULD attempt registration again. 3024 The following example shows how the registering endpoint updates its 3025 registration resource at an RD using this interface with the example 3026 location value: /rd/4521. 3028 Req: POST /rd/4521 3030 Res: 2.04 Changed 3032 The following example shows the registering endpoint updating its 3033 registration resource at an RD using this interface with the example 3034 location value: /rd/4521. The initial registration by the 3035 registering endpoint set the following values: 3037 o endpoint name (ep)=endpoint1 3039 o lifetime (lt)=500 3041 o Base URI (base)=coap://local-proxy-old.example.com:5683 3043 o payload of Figure 7 3045 The initial state of the Resource Directory is reflected in the 3046 following request: 3048 Req: GET /rd-lookup/res?ep=endpoint1 3050 Res: 2.01 Content 3051 Payload: 3052 ;ct=41; 3053 rt="temperature"; anchor="coap://spurious.example.com:5683", 3054 ;ct=41; 3055 rt="light-lux"; if="sensor"; 3056 anchor="coap://local-proxy-old.example.com:5683" 3058 The following example shows the registering endpoint changing the 3059 Base URI to "coaps://new.example.com:5684": 3061 Req: POST /rd/4521?base=coaps://new.example.com:5684 3063 Res: 2.04 Changed 3065 The consecutive query returns: 3067 Req: GET /rd-lookup/res?ep=endpoint1 3069 Res: 2.01 Content 3070 Payload: 3071 ;ct=41;rt="temperature"; 3072 anchor="coap://spurious.example.com:5683", 3073 ;ct=41;rt="light-lux"; 3074 if="sensor"; anchor="coaps://new.example.com:5684", 3076 A.2. Registration Removal 3078 Although RD entries have soft state and will eventually timeout after 3079 their lifetime, the registering endpoint SHOULD explicitly remove an 3080 entry from the RD if it knows it will no longer be available (for 3081 example on shut-down). This is accomplished using a removal 3082 interface on the RD by performing a DELETE on the endpoint resource. 3084 Removed registrations are implicitly removed from the groups to which 3085 they belong. 3087 The removal request interface is specified as follows: 3089 Interaction: EP -> RD 3091 Method: DELETE 3093 URI Template: {+location} 3095 URI Template Variables: 3097 location := This is the Location returned by the RD as a result 3098 of a successful earlier registration. 3100 The following response codes are defined for this interface: 3102 Success: 2.02 "Deleted" or 204 "No Content" upon successful deletion 3104 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 3105 request. 3107 Failure: 4.04 "Not Found" or 404 "Not Found". Registration does not 3108 exist (e.g. may have expired). 3110 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 3111 Service could not perform the operation. 3113 HTTP support: YES 3115 The following examples shows successful removal of the endpoint from 3116 the RD with example location value /rd/4521. 3118 Req: DELETE /rd/4521 3120 Res: 2.02 Deleted 3122 A.3. Read Endpoint Links 3124 Some registering endpoints may wish to manage their links as a 3125 collection, and may need to read the current set of links stored in 3126 the registration resource, in order to determine link maintenance 3127 operations. 3129 One or more links MAY be selected by using query filtering as 3130 specified in [RFC6690] Section 4.1 3132 If no links are selected, the Resource Directory SHOULD return an 3133 empty payload. 3135 The read request interface is specified as follows: 3137 Interaction: EP -> RD 3139 Method: GET 3141 URI Template: {+location}{?href,rel,rt,if,ct} 3143 URI Template Variables: 3145 location := This is the Location returned by the RD as a result 3146 of a successful earlier registration. 3148 href,rel,rt,if,ct := link relations and attributes specified in 3149 the query in order to select particular links based on their 3150 relations and attributes. "href" denotes the URI target of the 3151 link. See [RFC6690] Sec. 4.1 3153 The following response codes are defined for this interface: 3155 Success: 2.05 "Content" or 200 "OK" upon success with an 3156 "application/link-format", "application/link-format+cbor", or 3157 "application/link-format+json" payload. 3159 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 3160 request. 3162 Failure: 4.04 "Not Found" or 404 "Not Found". Registration does not 3163 exist (e.g. may have expired). 3165 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 3166 Service could not perform the operation. 3168 HTTP support: YES 3170 The following examples show successful read of the endpoint links 3171 from the RD, with example location value /rd/4521 and example 3172 registration payload of Figure 7. 3174 Req: GET /rd/4521 3176 Res: 2.01 Content 3177 Payload: 3178 ;ct=41;rt="temperature-c";if="sensor"; 3179 anchor="coap://spurious.example.com:5683", 3180 ;ct=41;rt="light-lux";if="sensor" 3182 A.4. Update Endpoint Links 3184 An iPATCH (or PATCH) update ([RFC8132]) can add, remove or change the 3185 links of a registration. 3187 Those operations are out of scope of this document, and will require 3188 media types suitable for modifying sets of links. 3190 A.5. Endpoint and group lookup 3192 Endpoint and group lookups result in links to registration resources 3193 and group resources, respectively. Endpoint registration resources 3194 are annotated with their endpoint names (ep), sectors (d, if present) 3195 and registration base URI (base) as well as a constant resource type 3196 (rt="core.rd-ep"); the lifetime (lt) is not reported. Additional 3197 endpoint attributes are added as link attributes to their endpoint 3198 link unless their specification says otherwise. 3200 Group resources are annotated with their group names (gp), sector (d, 3201 if present) and multicast address (base, if present) as well as a 3202 constant resource type (rt="core.rd-gp"). 3204 Serializations derived from Link Format, SHOULD present links to 3205 groups and endpoints in path-absolute form or, if required, as 3206 absolute references. (This approach avoids the RFC6690 ambiguities.) 3208 While Endpoint Lookup does expose the registration resources, the RD 3209 does not need to make them accessible to clients. Clients SHOULD NOT 3210 attempt to dereference or manipulate them. 3212 A Resource Directory can report endpoints or groups in lookup that 3213 are not hosted at the same address. Lookup clients MUST be prepared 3214 to see arbitrary URIs as registration or group resources in the 3215 results and treat them as opaque identifiers; the precise semantics 3216 of such links are left to future specifications. 3218 For groups, a Resource Directory as specified here does not provide a 3219 lookup mechanism for the resources that can be accessed on a group's 3220 multicast address (i.e. no lookup will return links like 3221 ";..." for a group registered 3222 with "base=coap://[ff35...]"). Such an additional lookup interface 3223 could be specified in an extension document. 3225 The following example shows a client performing an endpoint type (et) 3226 lookup with the value oic.d.sensor (which is currently a registered 3227 rt value): 3229 Req: GET /rd-lookup/ep?et=oic.d.sensor 3231 Res: 2.05 Content 3232 ;base="coap://[2001:db8:3::127]:61616";ep="node5"; 3233 et="oic.d.sensor";ct="40", 3234 ;base="coap://[2001:db8:3::129]:61616";ep="node7"; 3235 et="oic.d.sensor";ct="40";d="floor-3" 3236 The following example shows a client performing a group lookup for 3237 all groups: 3239 Req: GET /rd-lookup/gp 3241 Res: 2.05 Content 3242 ;gp="lights1";d="example.com"; 3243 base="coap://[ff35:30:2001:db8::1]", 3244 ;gp="lights2";d="example.com"; 3245 base="coap://[ff35:30:2001:db8::2]" 3247 The following example shows a client performing a lookup for all 3248 groups the endpoint "node1" belongs to: 3250 Req: GET /rd-lookup/gp?ep=node1 3252 Res: 2.05 Content 3253 ;gp="lights1" 3255 Appendix B. Web links and the Resource Directory 3257 Understanding the semantics of a link-format document and its URI 3258 references is a journey through different documents ([RFC3986] 3259 defining URIs, [RFC6690] defining link-format documents based on 3260 [RFC8288] which defines link headers, and [RFC7252] providing the 3261 transport). This appendix summarizes the mechanisms and semantics at 3262 play from an entry in ".well-known/core" to a resource lookup. 3264 This text is primarily aimed at people entering the field of 3265 Constrained Restful Environments from applications that previously 3266 did not use web mechanisms. 3268 At all examples in this section give compatible results for both 3269 Modernized and RFC6690 Link Format; the explanation of the steps 3270 follow Modernized Link Format. 3272 B.1. A simple example 3274 Let's start this example with a very simple host, "2001:db8:f0::1". 3275 A client that follows classical CoAP Discovery ([RFC7252] Section 7), 3276 sends the following multicast request to learn about neighbours 3277 supporting resources with resource-type "temperature". 3279 The client sends a link-local multicast: 3281 GET coap://[ff02::fd]:5683/.well-known/core?rt=temperature 3283 RES 2.05 Content 3284 ;rt=temperature;ct=0 3286 where the response is sent by the server, "[2001:db8:f0::1]:5683". 3288 While the client - on the practical or implementation side - can just 3289 go ahead and create a new request to "[2001:db8:f0::1]:5683" with 3290 Uri-Path: "temp", the full resolution steps for insertion into and 3291 retrieval from the RD without any shortcuts are: 3293 B.1.1. Resolving the URIs 3295 The client parses the single returned record. The link's target 3296 (sometimes called "href") is ""/temp"", which is a relative URI that 3297 needs resolving. The base URI is used to resolve the reference /temp against. 3300 The Base URI of the requested resource can be composed from the 3301 header options of the CoAP GET request by following the steps of 3302 [RFC7252] section 6.5 (with an addition at the end of 8.2) into 3303 ""coap://[2001:db8:f0::1]/.well-known/core"". 3305 Because ""/temp"" starts with a single slash, the record's target is 3306 resolved by replacing the path ""/.well-known/core"" from the Base 3307 URI (section 5.2 [RFC3986]) with the relative target URI ""/temp"" 3308 into ""coap://[2001:db8:f0::1]/temp"". 3310 B.1.2. Interpreting attributes and relations 3312 Some more information but the record's target can be obtained from 3313 the payload: the resource type of the target is "temperature", and 3314 its content type is text/plain (ct=0). 3316 A relation in a web link is a three-part statement that specifies a 3317 named relation between the so-called "context resource" and the 3318 target resource, like "_This page_ has _its table of contents_ at _/ 3319 toc.html_". In [RFC6690] and modernized link-format documents, there 3320 is an implicit "host relation" specified with default parameter: 3321 rel="hosts". 3323 In our example, the context resource of the link is the URI specified 3324 in the GET request "coap:://[2001:db8:f0::1]/.well-known/core". A 3325 full English expression of the "host relation" is: 3327 '"coap://[2001:db8:f0::1]/.well-known/core" is hosting the resource 3328 "coap://[2001:db8:f0::1]/temp", which is of the resource type 3329 "temperature" and can be accessed using the text/plain content 3330 format.' 3332 B.2. A slightly more complex example 3334 Omitting the "rt=temperature" filter, the discovery query would have 3335 given some more records in the payload: 3337 GET coap://[ff02::fd]:5683/.well-known/core 3339 RES 2.05 Content 3340 ;rt=temperature;ct=0, 3341 ;rt=light-lux;ct=0, 3342 ;anchor="/sensors/temp";rel=alternate, 3343 ;anchor="/sensors/temp"; 3344 rel="describedby" 3346 Parsing the third record, the client encounters the "anchor" 3347 parameter. It is a URI relative to the Base URI of the request and 3348 is thus resolved to ""coap://[2001:db8:f0::1]/sensors/temp"". That 3349 is the context resource of the link, so the "rel" statement is not 3350 about the target and the Base URI any more, but about the target and 3351 the resolved URI. Thus, the third record could be read as 3352 ""coap://[2001:db8:f0::1]/sensors/temp" has an alternate 3353 representation at "coap://[2001:db8:f0::1]/t"". 3355 Following the same resolution steps, the fourth record can be read as 3356 ""coap://[2001:db8:f0::1]/sensors/temp" is described by 3357 "http://www.example.com/sensors/t123"". 3359 B.3. Enter the Resource Directory 3361 The resource directory tries to carry the semantics obtainable by 3362 classical CoAP discovery over to the resource lookup interface as 3363 faithfully as possible. 3365 For the following queries, we will assume that the simple host has 3366 used Simple Registration to register at the resource directory that 3367 was announced to it, sending this request from its UDP port 3368 "[2001:db8:f0::1]:6553": 3370 POST coap://[2001:db8:f01::ff]/.well-known/core?ep=simple-host1 3372 The resource directory would have accepted the registration, and 3373 queried the simple host's ".well-known/core" by itself. As a result, 3374 the host is registered as an endpoint in the RD with the name 3375 "simple-host1". The registration is active for 90000 seconds, and 3376 the endpoint registration Base URI is ""coap://[2001:db8:f0::1]"" 3377 following the resolution steps described in Appendix B.1.1. It 3378 should be remarked that the Base URI constructed that way always 3379 yields a URI of the form: scheme://authority without path suffix. 3381 If the client now queries the RD as it would previously have issued a 3382 multicast request, it would go through the RD discovery steps by 3383 fetching "coap://[2001:db8:f0::ff]/.well-known/core?rt=core.rd- 3384 lookup-res", obtain "coap://[2001:db8:f0::ff]/rd-lookup/res" as the 3385 resource lookup endpoint, and issue a request to 3386 "coap://[2001:db8:f0::ff]/rd-lookup/res?rt=temperature" to receive 3387 the following data: 3389 ;rt=temperature;ct=0; 3390 anchor="coap://[2001:db8:f0::1]" 3392 This is not _literally_ the same response that it would have received 3393 from a multicast request, but it contains the equivalent statement: 3395 '"coap://[2001:db8:f0::1]" is hosting the resource 3396 "coap://[2001:db8:f0::1]/temp", which is of the resource type 3397 "temperature" and can be accessed using the text/plain content 3398 format.' 3400 (The difference is whether "/" or "/.well-known/core" hosts the 3401 resources, which is one of the often misunderstood subtleties 3402 Modernized Link Format addresses. Actually, /.well-known/core does 3403 NOT host the resource but stores a URI reference to the resource.) 3405 To complete the examples, the client could also query all resources 3406 hosted at the endpoint with the known endpoint name "simple-host1". 3407 A request to "coap://[2001:db8:f0::ff]/rd-lookup/res?ep=simple-host1" 3408 would return 3410 ;rt=temperature;ct=0; 3411 anchor="coap://[2001:db8:f0::1]", 3412 ;rt=light-lux;ct=0; 3413 anchor="coap://[2001:db8:f0::1]", 3414 ; 3415 anchor="coap://[2001:db8:f0::1]/sensors/temp";rel=alternate, 3416 ; 3417 anchor="coap://[2001:db8:f0::1]/sensors/temp";rel="describedby" 3419 All the target and anchor references are already in absolute form 3420 there, which don't need to be resolved any further. 3422 Had the simple host done an equivalent full registration with a base= 3423 parameter (e.g. "?ep=simple-host1&base=coap+tcp://simple- 3424 host1.example.com"), that context would have been used to resolve the 3425 relative anchor values instead, giving 3427 ;rt=temperature;ct=0; 3428 anchor="coap+tcp://simple-host1.example.com" 3430 and analogous records. 3432 B.4. A note on differences between link-format and Link headers 3434 While link-format and Link headers look very similar and are based on 3435 the same model of typed links, there are some differences between 3436 [RFC6690] and [RFC5988], which are dealt with differently: 3438 o "Resolving the target against the anchor": [RFC6690] Section 2.1 3439 states that the anchor of a link is used as the Base URI against 3440 which the term inside the angle brackets (the target) is resolved, 3441 falling back to the resource's URI with paths stripped off (its 3442 "Origin"). In contrast to that, [RFC8288] Section B.2 describes 3443 that the anchor is immaterial to the resolution of the target 3444 reference. 3446 RFC6690, in the same section, also states that absent anchors set 3447 the context of the link to the target's URI with its path stripped 3448 off, while according to [RFC8288] Section 3.2, the context is the 3449 resource's base URI. 3451 In the context of a Resource Directory, the authors decided to not 3452 let this become an issue by recommending that links in the 3453 Resource Directory be _deserializable_ by either rule set to give 3454 the same results. Note that all examples of [RFC6690], [RFC8288] 3455 and this document comply with that rule. 3457 The Modernized Link Format is introduced in Appendix D to 3458 formalize what it means to apply the ruleset of RFC8288 to Link 3459 Format documents. 3461 o There is no percent encoding in link-format documents. 3463 A link-format document is a UTF-8 encoded string of Unicode 3464 characters and does not have percent encoding, while Link headers 3465 are practically ASCII strings that use percent encoding for non- 3466 ASCII characters, stating the encoding explicitly when required. 3468 For example, while a Link header in a page about a Swedish city 3469 might read 3471 "Link: ;rel="live-environment-data"" 3472 a link-format document from the same source might describe the 3473 link as 3475 ";rel="live-environment-data"" 3477 Parsers and producers of link-format and header data need to be 3478 aware of this difference. 3480 Appendix C. Syntax examples for Protocol Negotiation 3482 [ This appendix should not show up in a published version of this 3483 document. ] 3485 The protocol negotiation that is being worked on in 3486 [I-D.silverajan-core-coap-protocol-negotiation] makes use of the 3487 Resource Directory. 3489 Until that document is update to use the latest resource-directory 3490 specification, here are some examples of protocol negotiation with 3491 the current Resource Directory: 3493 An endpoint could register as follows from its address 3494 [2001:db8:f1::2]:5683: 3496 Req: POST coap://rd.example.com/rd?ep=node1 3497 &at=coap+tcp://[2001:db8:f1::2] 3498 Content-Format: 40 3499 Payload: 3500 ;ct=0;rt="temperature";if="core.s" 3502 Res: 2.01 Created 3503 Location-Path: /rd/1234 3505 An endpoint lookup would just reflect the registered attributes: 3507 Req: GET /rd-lookup/ep 3509 Res: 2.05 Content 3510 ;ep="node1";base="coap://[2001:db8:f1::2]:5683"; 3511 at="coap+tcp://[2001:db8:f1::2]" 3513 A UDP client would then see the following in a resource lookup: 3515 Req: GET /rd-lookup/res?rt=temperature 3517 Res: 2.05 Content 3518 ;ct=0;rt="temperature"; 3519 if="core.s"; anchor="coap://[2001:db8:f1::2]" 3521 while a TCP capable client could say: 3523 Req: GET /rd-lookup/res?rt=temperature&tt=tcp 3525 Res: 2.05 Content 3526 ;ct=0;rt="temperature"; 3527 if="core.s";anchor="coap+tcp://[2001:db8:f1::2]" 3529 Appendix D. Modernized Link Format parsing 3531 The CoRE Link Format as described in [RFC6690] is unsuitable for some 3532 use cases of the Resource Directory, and their resolution scheme is 3533 often misunderstood by developers familiar with [RFC8288]. 3535 For the correct application of base URIs, we describe the 3536 interpretation of a Link Format document as a Modernized Link Format. 3537 In Modernized Link Format, the document is processed as in Link 3538 Format, with the exception of Section 2.1 of [RFC6690]: 3540 o The URI-reference inside angle brackets ("<>") describes the 3541 target URI of the link. 3543 o The context of the link is expressed by the "anchor" parameter. 3544 If the anchor attribute is absent, it defaults to the empty 3545 reference (""). 3547 o Both these references are resolved according to Section 5 of 3548 [RFC3986]. 3550 Content formats derived from [RFC6690] which inherit its resolution 3551 rules, like JSON and CBOR link format of [I-D.ietf-core-links-json], 3552 can be interpreted in analogy to that. 3554 For where the Resource Directory is concerned, all common forms of 3555 links (e.g. all the examples of RFC6690) yield identical results. 3556 When interpreting data read from ".well-known/core", differences in 3557 interpretation only affect links where the absent anchor attribute 3558 means "coap://host/" according to RFC6690 and "coap://host/.well- 3559 known/core" according to Modernized Link format; those typically only 3560 occur in conjunction with the vaguely defined implicit "hosts" 3561 relationship. 3563 D.1. For endpoint developers 3565 When developing endpoints, i.e. when generating documents that will 3566 be submitted to a Resource Directory, the differences between 3567 Modernized Link Format and RFC6690 can be ignored as long as 3569 o all relative references start with a slash, 3571 and any of the following applies: 3573 o There is no anchor attribute, and the context of the link does not 3574 matter to the application. 3576 Example: ";ct=40" 3578 o The anchor is a relative reference. 3580 Example: ";anchor="/sensors/temp";rel="alternate"" 3582 o The target is an absolute reference. 3584 Example: ";anchor="/sensors/ 3585 temp";rel="describedby"" 3587 D.2. Examples of links with differing interpretations 3589 Examples of links with different interpretations from either applying 3590 RFC6690 or Modernized Link Format are shown here. The example is 3591 assumed to be obtained from a document. 3593 o "": The target is "/sensors" in RFC6690 and "/device/ 3594 sensors" in Modernized Link Format (whereas "" would be 3595 unambiguous). 3597 o "": The target is "/?which=these" in RFC6690 and 3598 "/device/index?which=these" in Modernized Link Format. 3600 o ";anchor="http://example.com/calib- 3601 proto/1234";rel="topic"" is about "http://example.com/sensors" in 3602 RFC6690 and about "/device/sensors" in Modernized Link Format. 3604 This link can not be expressed in RFC6690 link format without the 3605 server explicitly expressing most of its own URI (which is 3606 problematic in reverse proxy scenarios or when the Uri-Host option 3607 is not sent). 3609 o ";rel="alternate";anchor=""": According to RFC6690, this 3610 states that the "/" resource has an alternative representation at 3611 "/i", whereas Modernized Link Format says that "/devices/index" 3612 has an alternative representation at "/i". 3614 The "anchor" attribute is usually left out; the link 3615 ";rel="alternate"" is equivalent to the above and results in 3616 the same interpretations. 3618 Authors' Addresses 3620 Zach Shelby 3621 ARM 3622 150 Rose Orchard 3623 San Jose 95134 3624 USA 3626 Phone: +1-408-203-9434 3627 Email: zach.shelby@arm.com 3629 Michael Koster 3630 SmartThings 3631 665 Clyde Avenue 3632 Mountain View 94043 3633 USA 3635 Phone: +1-707-502-5136 3636 Email: Michael.Koster@smartthings.com 3638 Carsten Bormann 3639 Universitaet Bremen TZI 3640 Postfach 330440 3641 Bremen D-28359 3642 Germany 3644 Phone: +49-421-218-63921 3645 Email: cabo@tzi.org 3647 Peter van der Stok 3648 consultant 3650 Phone: +31-492474673 (Netherlands), +33-966015248 (France) 3651 Email: consultancy@vanderstok.org 3652 URI: www.vanderstok.org 3653 Christian Amsuess (editor) 3654 Hollandstr. 12/4 3655 1020 3656 Austria 3658 Phone: +43-664-9790639 3659 Email: christian@amsuess.com