idnits 2.17.1 draft-ietf-core-resource-directory-15.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 414 has weird spacing: '... target o----...' == Line 416 has weird spacing: '...--o rel o...' == Line 467 has weird spacing: '... base o---+...' == Line 481 has weird spacing: '...o href o----...' == Line 485 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 03, 2018) is 2031 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 2794, but no explicit reference was found in the text == Unused Reference: 'I-D.ietf-anima-bootstrapping-keyinfra' is defined on line 2811, but no explicit reference was found in the text == Unused Reference: 'RFC2616' is defined on line 2822, but no explicit reference was found in the text == Unused Reference: 'RFC8392' is defined on line 2863, 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 6, 2019 SmartThings 6 C. Bormann 7 Universitaet Bremen TZI 8 P. van der Stok 9 consultant 10 C. Amsuess, Ed. 11 October 03, 2018 13 CoRE Resource Directory 14 draft-ietf-core-resource-directory-15 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 6, 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 . . . . . . . . . 54 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 . . . . . . . . . . . . . . . . . 62 117 Appendix A. Registration Management . . . . . . . . . . . . . . 64 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 . . . . . . . . . . . . . . . . 70 123 Appendix B. Web links and the Resource Directory . . . . . . . . 72 124 B.1. A simple example . . . . . . . . . . . . . . . . . . . . 72 125 B.1.1. Resolving the URIs . . . . . . . . . . . . . . . . . 72 126 B.1.2. Interpreting attributes and relations . . . . . . . . 73 127 B.2. A slightly more complex example . . . . . . . . . . . . . 73 128 B.3. Enter the Resource Directory . . . . . . . . . . . . . . 74 129 B.4. A note on differences between link-format and Link 130 headers . . . . . . . . . . . . . . . . . . . . . . . . . 75 131 Appendix C. Syntax examples for Protocol Negotiation . . . . . . 76 132 Appendix D. Modernized Link Format parsing . . . . . . . . . . . 77 133 D.1. For endpoint developers . . . . . . . . . . . . . . . . . 78 134 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 78 136 1. Introduction 138 The work on Constrained RESTful Environments (CoRE) aims at realizing 139 the REST architecture in a suitable form for the most constrained 140 nodes (e.g., 8-bit microcontrollers with limited RAM and ROM) and 141 networks (e.g. 6LoWPAN). CoRE is aimed at machine-to-machine (M2M) 142 applications such as smart energy and building automation. 144 The discovery of resources offered by a constrained server is very 145 important in machine-to-machine applications where there are no 146 humans in the loop and static interfaces result in fragility. The 147 discovery of resources provided by an HTTP Web Server is typically 148 called Web Linking [RFC5988]. The use of Web Linking for the 149 description and discovery of resources hosted by constrained web 150 servers is specified by the CoRE Link Format [RFC6690]. However, 151 [RFC6690] only describes how to discover resources from the web 152 server that hosts them by querying "/.well-known/core". In many M2M 153 scenarios, direct discovery of resources is not practical due to 154 sleeping nodes, disperse networks, or networks where multicast 155 traffic is inefficient. These problems can be solved by employing an 156 entity called a Resource Directory (RD), which hosts registrations of 157 resources held on other servers, allowing lookups to be performed for 158 those resources. 160 This document specifies the web interfaces that a Resource Directory 161 supports for web servers to discover the RD and to register, 162 maintain, lookup and remove resource descriptions. Furthermore, new 163 link attributes useful in conjunction with a Resource Directory are 164 defined. Although the examples in this document show the use of 165 these interfaces with CoAP [RFC7252], they can be applied in an 166 equivalent manner to HTTP [RFC7230]. 168 2. Terminology 170 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 171 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 172 "OPTIONAL" in this document are to be interpreted as described in 173 [RFC2119]. The term "byte" is used in its now customary sense as a 174 synonym for "octet". 176 This specification requires readers to be familiar with all the terms 177 and concepts that are discussed in [RFC3986], [RFC5988] and 178 [RFC6690]. Readers should also be familiar with the terms and 179 concepts discussed in [RFC7252]. To describe the REST interfaces 180 defined in this specification, the URI Template format is used 181 [RFC6570]. 183 This specification makes use of the following additional terminology: 185 resolve against 186 The expression "a URI-reference is _resolved against_ a base URI" 187 is used to describe the process of [RFC3986] Section 5.2. 188 Noteworthy corner cases are that if the URI-reference is a (full) 189 URI and resolved against any base URI, that gives the original 190 full URI, and that resolving an empty URI reference gives the base 191 URI without any fragment identifier. 193 Resource Directory 194 A web entity that stores information about web resources and 195 implements the REST interfaces defined in this specification for 196 registration and lookup of those resources. 198 Sector 199 In the context of a Resource Directory, a sector is a logical 200 grouping of endpoints. 202 The abbreviation "d=" is used for the sector in query parameters 203 for compatibility with deployed implementations. 205 Group 206 A group in the Resource Directory specifies a set of endpoints 207 that are enabled with the same multicast address for the purpose 208 of efficient group communications. All groups within a sector 209 have unique names. 211 Endpoint 212 Endpoint (EP) is a term used to describe a web server or client in 213 [RFC7252]. In the context of this specification an endpoint is 214 used to describe a web server that registers resources to the 215 Resource Directory. An endpoint is identified by its endpoint 216 name, which is included during registration, and has a unique name 217 within the associated sector of the registration. 219 Registration Base URI 220 The Base URI of a Registration is a URI that typically gives 221 scheme and authority information about an Endpoint. The 222 Registration Base URI is provided at registration time, and is 223 used by the Resource Directory to resolve relative references of 224 the registration into URIs. 226 Target 227 The target of a link is the destination address (URI) of the link. 228 It is sometimes identified with "href=", or displayed as 229 "". Relative targets need resolving with respect to the 230 Base URI (section 5.2 of [RFC3986]). 232 This use of the term Target is consistent with [RFC8288]'s use of 233 the term. 235 Context 236 The context of a link is the source address (URI) of the link, and 237 describes which resource is linked to the target. A link's 238 context is made explicit in serialized links as the "anchor=" 239 attribute. 241 This use of the term Context is consistent with [RFC8288]'s use of 242 the term. 244 Directory Resource 245 A resource in the Resource Directory (RD) containing registration 246 resources. 248 Group Resource 249 A resource in the RD containing registration resources of the 250 Endpoints that form a group. 252 Registration Resource 253 A resource in the RD that contains information about an Endpoint 254 and its links. 256 Commissioning Tool 257 Commissioning Tool (CT) is a device that assists during the 258 installation of the network by assigning values to parameters, 259 naming endpoints and groups, or adapting the installation to the 260 needs of the applications. 262 Registrant-ep 263 Registrant-ep is the endpoint that is registered into the RD. The 264 registrant-ep can register itself, or a CT registers the 265 registrant-ep. 267 RDAO 268 Resource Directory Address Option. 270 For several operations, interface descriptions are given in list 271 form; those describe the operation participants, request codes, URIs, 272 content formats and outcomes. Those templates contain normative 273 content in their Interaction, Method, URI Template and URI Template 274 Variables sections as well as the details of the Success condition. 275 The additional sections on options like Content-Format and on Failure 276 codes give typical cases that an implementation of the RD should deal 277 with. Those serve to illustrate the typical responses to readers who 278 are not yet familiar with all the details of CoAP based interfaces; 279 they do not limit what a server may respond under atypical 280 circumstances. 282 3. Architecture and Use Cases 284 3.1. Principles 286 The Resource Directory is primarily a tool to make discovery 287 operations more efficient than querying /.well-known/core on all 288 connected devices, or across boundaries that would be limiting those 289 operations. 291 It provides a cache (in the high-level sense, not as defined in 292 [RFC7252]/[RFC2616]) of data that could otherwise only be obtained by 293 directly querying the /.well-known/core resource on the target 294 device, or by accessing those resources with a multicast request. 296 Only information SHOULD be stored in the resource directory that is 297 discoverable from querying the described device's /.well-known/core 298 resource directly. 300 Data in the resource directory can only be provided by the device 301 which hosts those data or a dedicated Commissioning Tool (CT). These 302 CTs are thought to act on behalf of endpoints too constrained, or 303 generally unable, to present that information themselves. No other 304 client can modify data in the resource directory. Changes in the 305 Resource Directory do not propagate automatically back to the web 306 server from where the links originated. 308 3.2. Architecture 310 The resource directory architecture is illustrated in Figure 1. A 311 Resource Directory (RD) is used as a repository for Web Links 312 [RFC5988] describing resources hosted on other web servers, also 313 called endpoints (EP). An endpoint is a web server associated with a 314 scheme, IP address and port. A physical node may host one or more 315 endpoints. The RD implements a set of REST interfaces for endpoints 316 to register and maintain sets of Web Links (called resource directory 317 registration entries), and for endpoints to lookup resources from the 318 RD or maintain groups. An RD can be logically segmented by the use 319 of Sectors. The set of endpoints grouped for group communication can 320 be defined by the RD or configured by a Commissioning Tool. This 321 information hierarchy is shown in Figure 2. 323 A mechanism to discover an RD using CoRE Link Format [RFC6690] is 324 defined. 326 Registration entries in the RD are soft state and need to be 327 periodically refreshed. 329 An endpoint uses specific interfaces to register, update and remove a 330 resource directory registration entry. It is also possible for an RD 331 to fetch Web Links from endpoints and add them as resource directory 332 registration entries. 334 At the first registration of a set of entries, a "registration 335 resource" is created, the location of which is returned to the 336 registering endpoint. The registering endpoint uses this 337 registration resource to manage the contents of registration entries. 339 A lookup interface for discovering any of the Web Links held in the 340 RD is provided using the CoRE Link Format. 342 Registration Lookup, Group 343 Interface Interfaces 344 +----+ | | 345 | EP |---- | | 346 +----+ ---- | | 347 --|- +------+ | 348 +----+ | ----| | | +--------+ 349 | EP | ---------|-----| RD |----|-----| Client | 350 +----+ | ----| | | +--------+ 351 --|- +------+ | 352 +----+ ---- | | 353 | EP |---- | | 354 +----+ 356 Figure 1: The resource directory architecture. 358 +------------+ 359 | Group | <-- Name, Scheme, IP, Port 360 +------------+ 361 | 362 | 363 +------------+ 364 | Endpoint | <-- Name, Scheme, IP, Port 365 +------------+ 366 | 367 | 368 +------------+ 369 | Resource | <-- Target, Parameters 370 +------------+ 372 Figure 2: The resource directory information hierarchy. 374 3.3. RD Content Model 376 The Entity-Relationship (ER) models shown in Figure 3 and Figure 4 377 model the contents of /.well-known/core and the resource directory 378 respectively, with entity-relationship diagrams [ER]. Entities 379 (rectangles) are used for concepts that exist independently. 380 Attributes (ovals) are used for concepts that exist only in 381 connection with a related entity. Relations (diamonds) give a 382 semantic meaning to the relation between entities. Numbers specify 383 the cardinality of the relations. 385 Some of the attribute values are URIs. Those values are always full 386 URIs and never relative references in the information model. They 387 can, however, be expressed as relative references in serializations, 388 and often are. 390 These models provide an abstract view of the information expressed in 391 link-format documents and a Resource Directory. They cover the 392 concepts, but not necessarily all details of an RD's operation; they 393 are meant to give an overview, and not be a template for 394 implementations. 396 +----------------------+ 397 | /.well-known/core | 398 +----------------------+ 399 | 400 | 1 401 ////////\\\\\\\ 402 < contains > 403 \\\\\\\\/////// 404 | 405 | 0+ 406 +--------------------+ 407 | link | 408 +--------------------+ 409 | 410 | 1 oooooooo 411 +-----o target o 412 | oooooooo 413 oooooooooooo 0+ | 414 o target o--------+ 415 o attribute o | 0+ oooooo 416 oooooooooooo +-----o rel o 417 | oooooo 418 | 419 | 1 ooooooooo 420 +-----o context o 421 ooooooooo 423 Figure 3: E-R Model of the content of /.well-known/core 425 The model shown in Figure 3 models the contents of /.well-known/core 426 which contains: 428 o a set of links belonging to the hosting web server 430 The web server is free to choose links it deems appropriate to be 431 exposed in its ".well-known/core". Typically, the links describe 432 resources that are served by the host, but the set can also contain 433 links to resources on other servers (see examples in [RFC6690] page 434 14). The set does not necessarily contain links to all resources 435 served by the host. 437 A link has the following attributes (see [RFC5988]): 439 o Zero or more link relations: They describe relations between the 440 link context and the link target. 442 In link-format serialization, they are expressed as space- 443 separated values in the "rel" attribute, and default to "hosts". 445 o A link context URI: It defines the source of the relation, e.g. 446 _who_ "hosts" something. 448 In link-format serialization, it is expressed in the "anchor" 449 attribute. It defaults to that document's URI. 451 o A link target URI: It defines the destination of the relation 452 (e.g. _what_ is hosted), and is the topic of all target 453 attributes. 455 In link-format serialization, it is expressed between angular 456 brackets, and sometimes called the "href". 458 o Other target attributes (e.g. resource type (rt), interface (if), 459 or content-type (ct)). These provide additional information about 460 the target URI. 462 +----------------------+ 1 ooooooo 463 | resource-directory | +--o href o 464 +----------------------+ | ooooooo 465 | 1 | 466 | oooooooooo 0-1 | 1 oooooo 467 | o base o---+ | +------o gp o 468 | ooooooooooo | | | oooooo 469 | | | | 470 //////\\\\ 0+ +--------+ 0-1 ooooo 471 < contains >----------------| group |------o d o 472 \\\\\///// +--------+ ooooo 473 | | 0+ 474 0+ | | 475 ooooooo 1 +---------------+ 1+ ///////\\\\\\ 476 o base o-------| registration |---------< composed of > 477 ooooooo +---------------+ \\\\\\\////// 478 | | 1 479 | +--------------+ 480 oooooooo 1 | | 481 o href o----+ /////\\\\ 482 oooooooo | < contains > 483 | \\\\\///// 484 oooooooo 1 | | 485 o ep o----+ | 0+ 486 oooooooo | +------------------+ 487 | | link | 488 oooooooo 0-1 | +------------------+ 489 o d o----+ | 490 oooooooo | | 1 oooooooo 491 | +-----o target o 492 oooooooo 1 | | oooooooo 493 o lt o----+ ooooooooooo 0+ | 494 oooooooo | o target o-----+ 495 | o attribute o | 0+ oooooo 496 ooooooooooo 0+ | ooooooooooo +-----o rel o 497 o endpoint o----+ | oooooo 498 o attribute o | 499 ooooooooooo | 1 ooooooooo 500 +----o context o 501 ooooooooo 503 Figure 4: E-R Model of the content of the Resource Directory 505 The model shown in Figure 4 models the contents of the resource 506 directory which contains in addition to /.well-known/core: 508 o 0 to n Registration (entries) of endpoints, 509 o 0 or more Groups 511 A Group has: 513 o a group name ("gp"), 515 o optionally a sector (abbreviated "d" for historical reasons), 517 o a group resource location inside the RD ("href"), 519 o zero or one multicast addresses expressed as a base URI ("base"), 521 o and is composed of zero or more registrations (endpoints). 523 A registration is associated with one endpoint. A registration can 524 be part of 0 or more Groups . A registration defines a set of links 525 as defined for /.well-known/core. A Registration has six types of 526 attributes: 528 o a unique endpoint name ("ep") within a sector 530 o a Registration Base URI ("base", a URI typically describing the 531 scheme://authority part) 533 o a lifetime ("lt"), 535 o a registration resource location inside the RD ("href"), 537 o optionally a sector ("d") 539 o optional additional endpoint attributes (from Section 10.3) 541 The cardinality of "base" is currently 1; future documents are 542 invited to extend the RD specification to support multiple values 543 (e.g. [I-D.silverajan-core-coap-protocol-negotiation]). Its value 544 is used as a Base URI when resolving URIs in the links contained in 545 the endpoint. 547 Links are modelled as they are in Figure 3. 549 3.4. Use Case: Cellular M2M 551 Over the last few years, mobile operators around the world have 552 focused on development of M2M solutions in order to expand the 553 business to the new type of users: machines. The machines are 554 connected directly to a mobile network using an appropriate embedded 555 wireless interface (GSM/GPRS, WCDMA, LTE) or via a gateway providing 556 short and wide range wireless interfaces. From the system design 557 point of view, the ambition is to design horizontal solutions that 558 can enable utilization of machines in different applications 559 depending on their current availability and capabilities as well as 560 application requirements, thus avoiding silo like solutions. One of 561 the crucial enablers of such design is the ability to discover 562 resources (machines -- endpoints) capable of providing required 563 information at a given time or acting on instructions from the end 564 users. 566 Imagine a scenario where endpoints installed on vehicles enable 567 tracking of the position of these vehicles for fleet management 568 purposes and allow monitoring of environment parameters. During the 569 boot-up process endpoints register with a Resource Directory, which 570 is hosted by the mobile operator or somewhere in the cloud. 571 Periodically, these endpoints update their registration and may 572 modify resources they offer. 574 When endpoints are not always connected, for example because they 575 enter a sleep mode, a remote server is usually used to provide proxy 576 access to the endpoints. Mobile apps or web applications for 577 environment monitoring contact the RD, look up the endpoints capable 578 of providing information about the environment using an appropriate 579 set of link parameters, obtain information on how to contact them 580 (URLs of the proxy server), and then initiate interaction to obtain 581 information that is finally processed, displayed on the screen and 582 usually stored in a database. Similarly, fleet management systems 583 provide the appropriate link parameters to the RD to look up for EPs 584 deployed on the vehicles the application is responsible for. 586 3.5. Use Case: Home and Building Automation 588 Home and commercial building automation systems can benefit from the 589 use of M2M web services. The discovery requirements of these 590 applications are demanding. Home automation usually relies on run- 591 time discovery to commission the system, whereas in building 592 automation a combination of professional commissioning and run-time 593 discovery is used. Both home and building automation involve peer- 594 to-peer interactions between endpoints, and involve battery-powered 595 sleeping devices. 597 3.6. Use Case: Link Catalogues 599 Resources may be shared through data brokers that have no knowledge 600 beforehand of who is going to consume the data. Resource Directory 601 can be used to hold links about resources and services hosted 602 anywhere to make them discoverable by a general class of 603 applications. 605 For example, environmental and weather sensors that generate data for 606 public consumption may provide data to an intermediary server, or 607 broker. Sensor data are published to the intermediary upon changes 608 or at regular intervals. Descriptions of the sensors that resolve to 609 links to sensor data may be published to a Resource Directory. 610 Applications wishing to consume the data can use RD Lookup to 611 discover and resolve links to the desired resources and endpoints. 612 The Resource Directory service need not be coupled with the data 613 intermediary service. Mapping of Resource Directories to data 614 intermediaries may be many-to-many. 616 Metadata in web link formats like [RFC6690] which may be internally 617 stored as triples, or relation/attribute pairs providing metadata 618 about resource links, need to be supported by Resource Directories . 619 External catalogues that are represented in other formats may be 620 converted to common web linking formats for storage and access by 621 Resource Directories. Since it is common practice for these to be 622 URN encoded, simple and lossless structural transforms should 623 generally be sufficient to store external metadata in Resource 624 Directories. 626 The additional features of Resource Directory allow sectors to be 627 defined to enable access to a particular set of resources from 628 particular applications. This provides isolation and protection of 629 sensitive data when needed. Groups may be defined to support 630 efficient data transport. 632 4. Finding a Resource Directory 634 A (re-)starting device may want to find one or more resource 635 directories for discovery purposes. 637 The device may be pre-configured to exercise specific mechanisms for 638 finding the resource directory: 640 1. It may be configured with a specific IP address for the RD. That 641 IP address may also be an anycast address, allowing the network 642 to forward RD requests to an RD that is topologically close; each 643 target network environment in which some of these preconfigured 644 nodes are to be brought up is then configured with a route for 645 this anycast address that leads to an appropriate RD. (Instead 646 of using an anycast address, a multicast address can also be 647 preconfigured. The RD servers then need to configure one of 648 their interfaces with this multicast address.) 650 2. It may be configured with a DNS name for the RD and use DNS to 651 return the IP address of the RD; it can find a DNS server to 652 perform the lookup using the usual mechanisms for finding DNS 653 servers. 655 3. It may be configured to use a service discovery mechanism such as 656 DNS-SD [RFC6763]. The present specification suggests configuring 657 the service with name rd._sub._coap._udp, preferably within the 658 domain of the querying nodes. 660 For cases where the device is not specifically configured with a way 661 to find a resource directory, the network may want to provide a 662 suitable default. 664 1. If the address configuration of the network is performed via 665 SLAAC, this is provided by the RDAO option Section 4.1. 667 2. If the address configuration of the network is performed via 668 DHCP, this could be provided via a DHCP option (no such option is 669 defined at the time of writing). 671 Finally, if neither the device nor the network offers any specific 672 configuration, the device may want to employ heuristics to find a 673 suitable resource directory. 675 The present specification does not fully define these heuristics, but 676 suggests a number of candidates: 678 1. In a 6LoWPAN, just assume the Border Router (6LBR) can act as a 679 resource directory (using the ABRO option to find that 680 [RFC6775]). Confirmation can be obtained by sending a Unicast to 681 "coap://[6LBR]/.well-known/core?rt=core.rd*". 683 2. In a network that supports multicast well, discovering the RD 684 using a multicast query for /.well-known/core as specified in 685 CoRE Link Format [RFC6690]: Sending a Multicast GET to 686 "coap://[MCD1]/.well-known/core?rt=core.rd*". RDs within the 687 multicast scope will answer the query. 689 As some of the RD addresses obtained by the methods listed here are 690 just (more or less educated) guesses, endpoints MUST make use of any 691 error messages to very strictly rate-limit requests to candidate IP 692 addresses that don't work out. For example, an ICMP Destination 693 Unreachable message (and, in particular, the port unreachable code 694 for this message) may indicate the lack of a CoAP server on the 695 candidate host, or a CoAP error response code such as 4.05 "Method 696 Not Allowed" may indicate unwillingness of a CoAP server to act as a 697 directory server. 699 If multiple candidate addresses are discovered, the device may pick 700 any of them initially, unless the discovery method indicates a more 701 precise selection scheme. 703 4.1. Resource Directory Address Option (RDAO) 705 The Resource Directory Address Option (RDAO) using IPv6 Neighbor 706 Discovery (ND) carries information about the address of the Resource 707 Directory (RD). This information is needed when endpoints cannot 708 discover the Resource Directory with a link-local or realm-local 709 scope multicast address because the endpoint and the RD are separated 710 by a Border Router (6LBR). In many circumstances the availability of 711 DHCP cannot be guaranteed either during commissioning of the network. 712 The presence and the use of the RD is essential during commissioning. 714 It is possible to send multiple RDAO options in one message, 715 indicating as many resource directory addresses. 717 The RDAO format is: 719 0 1 2 3 720 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 721 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 722 | Type | Length = 3 | Valid Lifetime | 723 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 724 | Reserved | 725 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 726 | | 727 + + 728 | | 729 + RD Address + 730 | | 731 + + 732 | | 733 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 735 Fields: 737 Type: 38 739 Length: 8-bit unsigned integer. The length of 740 the option in units of 8 bytes. 741 Always 3. 743 Valid Lifetime: 16-bit unsigned integer. The length of 744 time in units of 60 seconds (relative to 745 the time the packet is received) that 746 this Resource Directory address is valid. 747 A value of all zero bits (0x0) indicates 748 that this Resource Directory address 749 is not valid anymore. 751 Reserved: This field is unused. It MUST be 752 initialized to zero by the sender and 753 MUST be ignored by the receiver. 755 RD Address: IPv6 address of the RD. 757 Figure 5: Resource Directory Address Option 759 5. Resource Directory 761 This section defines the required set of REST interfaces between a 762 Resource Directory (RD) and endpoints. Although the examples 763 throughout this section assume the use of CoAP [RFC7252], these REST 764 interfaces can also be realized using HTTP [RFC7230]. In all 765 definitions in this section, both CoAP response codes (with dot 766 notation) and HTTP response codes (without dot notation) are shown. 768 An RD implementing this specification MUST support the discovery, 769 registration, update, lookup, and removal interfaces defined in this 770 section. 772 All operations on the contents of the Resource Directory MUST be 773 atomic and idempotent. 775 A resource directory MAY make the information submitted to it 776 available to further directories, if it can ensure that a loop does 777 not form. The protocol used between directories to ensure loop-free 778 operation is outside the scope of this document. 780 5.1. Payload Content Formats 782 Resource Directory implementations using this specification MUST 783 support the application/link-format content format (ct=40). 785 Resource Directories implementing this specification MAY support 786 additional content formats. 788 Any additional content format supported by a Resource Directory 789 implementing this specification MUST have an equivalent serialization 790 in the application/link-format content format. 792 5.2. URI Discovery 794 Before an endpoint can make use of an RD, it must first know the RD's 795 address and port, and the URI path information for its REST APIs. 796 This section defines discovery of the RD and its URIs using the well- 797 known interface of the CoRE Link Format [RFC6690]. A complete set of 798 RD discovery methods is described in Section 4. 800 Discovery of the RD registration URI path is performed by sending 801 either a multicast or unicast GET request to "/.well-known/core" and 802 including a Resource Type (rt) parameter [RFC6690] with the value 803 "core.rd" in the query string. Likewise, a Resource Type parameter 804 value of "core.rd-lookup*" is used to discover the URIs for RD Lookup 805 operations, core.rd* is used to discover all URI paths for RD 806 operations, and "core.rd-group" is used to discover the URI path for 807 RD Group operations. Upon success, the response will contain a 808 payload with a link format entry for each RD function discovered, 809 indicating the URI of the RD function returned and the corresponding 810 Resource Type. When performing multicast discovery, the multicast IP 811 address used will depend on the scope required and the multicast 812 capabilities of the network (see Section 10.5. 814 A Resource Directory MAY provide hints about the content-formats it 815 supports in the links it exposes or registers, using the "ct" link 816 attribute, as shown in the example below. Clients MAY use these 817 hints to select alternate content-formats for interaction with the 818 Resource Directory. 820 HTTP does not support multicast and consequently only unicast 821 discovery can be supported using HTTP. The well-known entry points 822 SHOULD be provided to enable unicast discovery. 824 An implementation of this resource directory specification MUST 825 support query filtering for the rt parameter as defined in [RFC6690]. 827 While the link targets in this discovery step are often expressed in 828 path-absolute form, this is not a requirement. Clients of the RD 829 SHOULD therefore accept URIs of all schemes they support, both as 830 URIs and relative references, and not limit the set of discovered 831 URIs to those hosted at the address used for URI discovery. 833 The URI Discovery operation can yield multiple URIs of a given 834 resource type. The client of the RD can use any of the discovered 835 addresses initially. 837 The discovery request interface is specified as follows (this is 838 exactly the Well-Known Interface of [RFC6690] Section 4, with the 839 additional requirement that the server MUST support query filtering): 841 Interaction: EP and Client -> RD 843 Method: GET 845 URI Template: /.well-known/core{?rt} 847 URI Template Variables: 849 rt := Resource Type. SHOULD contain one of the values "core.rd", 850 "core.rd-lookup*", "core.rd-lookup-res", "core.rd-lookup-ep", 851 "core.rd-lookup-gp", "core.rd-group" or "core.rd*" 853 Content-Format: application/link-format (if any) 855 Content-Format: application/link-format+json (if any) 857 Content-Format: application/link-format+cbor (if any) 859 The following response codes are defined for this interface: 861 Success: 2.05 "Content" or 200 "OK" with an application/link-format, 862 application/link-format+json, or application/link-format+cbor 863 payload containing one or more matching entries for the RD 864 resource. 866 Failure: 4.00 "Bad Request" or 400 "Bad Request" is returned in case 867 of a malformed request for a unicast request. 869 Failure: No error response to a multicast request. 871 HTTP support : YES (Unicast only) 873 The following example shows an endpoint discovering an RD using this 874 interface, thus learning that the directory resource location, in 875 this example, is /rd, and that the content-format delivered by the 876 server hosting the resource is application/link-format (ct=40). Note 877 that it is up to the RD to choose its RD locations. 879 Req: GET coap://[MCD1]/.well-known/core?rt=core.rd* 881 Res: 2.05 Content 882 ;rt="core.rd";ct=40, 883 ;rt="core.rd-lookup-ep";ct=40, 884 ;rt="core.rd-lookup-res";ct=40, 885 ;rt="core.rd-lookup-gp";ct=40, 886 ;rt="core.rd-group";ct=40 888 Figure 6: Example discovery exchange 890 The following example shows the way of indicating that a client may 891 request alternate content-formats. The Content-Format code attribute 892 "ct" MAY include a space-separated sequence of Content-Format codes 893 as specified in Section 7.2.1 of [RFC7252], indicating that multiple 894 content-formats are available. The example below shows the required 895 Content-Format 40 (application/link-format) indicated as well as the 896 CBOR and JSON representation of link format. The RD resource 897 locations /rd, /rd-lookup, and /rd-group are example values. The 898 server in this example also indicates that it is capable of providing 899 observation on resource lookups. 901 [ The RFC editor is asked to replace these and later occurrences of 902 MCD1, TBD64 and TBD504 with the numeric ID values assigned by IANA to 903 application/link-format+cbor and application/link-format+json, 904 respectively, as they are defined in I-D.ietf-core-links-json. ] 905 Req: GET coap://[MCD1]/.well-known/core?rt=core.rd* 907 Res: 2.05 Content 908 ;rt="core.rd";ct="40 65225", 909 ;rt="core.rd-lookup-res";ct="40 TBD64 TBD504";obs, 910 ;rt="core.rd-lookup-ep";ct="40 TBD64 TBD504", 911 ;rt="core.rd-lookup-gp";ct=40 TBD64 TBD504", 912 ;rt="core.rd-group";ct="40 TBD64 TBD504" 914 From a management and maintenance perspective, it is necessary to 915 identify the components that constitute the RD server. The 916 identification refers to information about for example client-server 917 incompatibilities, supported features, required updates and other 918 aspects. The URI discovery address, a described in section 4 of 919 [RFC6690] can be used to find the identification. 921 It would typically be stored in an implementation information link 922 (as described in [I-D.bormann-t2trg-rel-impl]): 924 Req: GET /.well-known/core?rel=impl-info 926 Res: 2.05 Content 927 ; 928 rel="impl-info" 930 Note that depending on the particular server's architecture, such a 931 link could be anchored at the RD server's root, at the discovery site 932 (as in this example) or at individual RD components. The latter is 933 to be expected when different applications are run on the same 934 server. 936 5.3. Registration 938 After discovering the location of an RD, a registrant-ep or CT MAY 939 register the resources of the registrant-ep using the registration 940 interface. This interface accepts a POST from an endpoint containing 941 the list of resources to be added to the directory as the message 942 payload in the CoRE Link Format [RFC6690], JSON CoRE Link Format 943 (application/link-format+json), or CBOR CoRE Link Format 944 (application/link-format+cbor) [I-D.ietf-core-links-json], along with 945 query parameters indicating the name of the endpoint, and optionally 946 the sector, lifetime and base URI of the registration. It is 947 expected that other specifications will define further parameters 948 (see Section 10.3). The RD then creates a new registration resource 949 in the RD and returns its location. The receiving endpoint MUST use 950 that location when refreshing registrations using this interface. 951 Registration resources in the RD are kept active for the period 952 indicated by the lifetime parameter. The creating endpoint is 953 responsible for refreshing the registration resource within this 954 period using either the registration or update interface. The 955 registration interface MUST be implemented to be idempotent, so that 956 registering twice with the same endpoint parameters ep and d (sector) 957 does not create multiple registration resources. 959 The following rules apply for an update identified by a given (ep, d) 960 value pair: 962 o when the parameter values of the Update generate the same 963 attribute values as already present, the location of the already 964 existing registration is returned. 966 o when for a given (ep, d) value pair the update generates attribute 967 values which are different from the existing one, the existing 968 registration is removed and a new registration with a new location 969 is created. 971 o when the (ep, d) value pair of the update is different from any 972 existing registration, a new registration is generated. 974 The posted link-format document can (and typically does) contain 975 relative references both in its link targets and in its anchors, or 976 contain empty anchors. The RD server needs to resolve these 977 references in order to faithfully represent them in lookups. They 978 are resolved against the base URI of the registration, which is 979 provided either explicitly in the "base" parameter or constructed 980 implicitly from the requester's URI as constructed from its network 981 address and scheme. 983 Link format documents submitted to the resource directory are 984 interpreted as Modernized Link Format (see Appendix D) by the RD. A 985 registrant-ep SHOULD NOT submit documents whose interpretations 986 according to [RFC6690] and Appendix D differ to avoid the ambiguities 987 described in Appendix B.4. 989 In practice, most links (precisely listed in Appendix D.1) can be 990 submitted without consideration for those details. 992 The registration request interface is specified as follows: 994 Interaction: EP -> RD 996 Method: POST 998 URI Template: {+rd}{?ep,d,lt,base,extra-attrs*} 1000 URI Template Variables: 1002 rd := RD registration URI (mandatory). This is the location of 1003 the RD, as obtained from discovery. 1005 ep := Endpoint name (mostly mandatory). The endpoint name is an 1006 identifier that MUST be unique within a sector. The maximum 1007 length of this parameter is 63 bytes. If the RD is configured 1008 to recognize the endpoint (e.g. based on its security context), 1009 the endpoint sets no endpoint name, and the RD assigns one 1010 based on a set of configuration parameter values. 1012 d := Sector (optional). The sector to which this endpoint 1013 belongs. The maximum length of this parameter is 63 bytes. 1014 When this parameter is not present, the RD MAY associate the 1015 endpoint with a configured default sector or leave it empty. 1016 The endpoint name and sector name are not set when one or both 1017 are set in an accompanying authorization token. 1019 lt := Lifetime (optional). Lifetime of the registration in 1020 seconds. Range of 60-4294967295. If no lifetime is included 1021 in the initial registration, a default value of 90000 (25 1022 hours) SHOULD be assumed. 1024 base := Base URI (optional). This parameter sets the base URI of 1025 the registration, under which the relative links in the payload 1026 are to be interpreted. The specified URI typically does not 1027 have a path component of its own, and MUST be suitable as a 1028 base URI to resolve any relative references given in the 1029 registration. The parameter is therefore usually of the shape 1030 "scheme://authority" for HTTP and CoAP URIs. The URI SHOULD 1031 NOT have a query or fragment component as any non-empty 1032 relative part in a reference would remove those parts from the 1033 resulting URI. 1035 In the absence of this parameter the scheme of the protocol, 1036 source address and source port of the registration request are 1037 assumed. That Base URI is constructed by concatenating the 1038 used protcol's scheme with the characters "://", the 1039 requester's source address as an address literal and ":" 1040 followed by its port (if it was not the protocol's default one) 1041 in analogy to [RFC7252] Section 6.5. 1043 This parameter is mandatory when the directory is filled by a 1044 third party such as an commissioning tool. 1046 If the registrant-ep uses an ephemeral port to register with, 1047 it MUST include the base parameter in the registration to 1048 provide a valid network path. 1050 If the registrant-ep, located behind a NAT gateway, is 1051 registering with a Resource Directory which is on the network 1052 service side of the NAT gateway, the endpoint MUST use a 1053 persistent port for the outgoing registration in order to 1054 provide the NAT gateway with a valid network address for 1055 replies and incoming requests. 1057 Endpoints that register with a base that contains a path 1058 component can not meaningfully use [RFC6690] Link Format due to 1059 its prevalence of the Origin concept in relative reference 1060 resolution; they can submit payloads for interpretation as 1061 Modernized Link Format. Typically, links submitted by such an 1062 endpoint are of the "path-noscheme" (starts with a path not 1063 preceded by a slash, precisely defined in [RFC3986] 1064 Section 3.3) form. 1066 extra-attrs := Additional registration attributes (optional). 1067 The endpoint can pass any parameter registered at Section 10.3 1068 to the directory. If the RD is aware of the parameter's 1069 specified semantics, it processes it accordingly. Otherwise, 1070 it MUST store the unknown key and its value(s) as an endpoint 1071 attribute for further lookup. 1073 Content-Format: application/link-format 1075 Content-Format: application/link-format+json 1077 Content-Format: application/link-format+cbor 1079 The following response codes are defined for this interface: 1081 Success: 2.01 "Created" or 201 "Created". The Location-Path option 1082 or Location header MUST be included in the response. This 1083 location MUST be a stable identifier generated by the RD as it is 1084 used for all subsequent operations on this registration resource. 1085 The registration resource location thus returned is for the 1086 purpose of updating the lifetime of the registration and for 1087 maintaining the content of the registered links, including 1088 updating and deleting links. 1090 A registration with an already registered ep and d value pair 1091 responds with the same success code and location as the original 1092 registration; the set of links registered with the endpoint is 1093 replaced with the links from the payload. 1095 The location MUST NOT have a query or fragment component, as that 1096 could conflict with query parameters during the Registration 1097 Update operation. Therefore, the Location-Query option MUST NOT 1098 be present in a successful response. 1100 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 1101 request. 1103 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 1104 Service could not perform the operation. 1106 HTTP support: YES 1108 If the registration fails with a Service Unavailable response and a 1109 Max-Age option or Retry-After header, the registering endpoint SHOULD 1110 retry the operation after the time indicated. If the registration 1111 fails in another way, including request timeouts, or if the Service 1112 Unavailable error persists after several retries, or indicates a 1113 longer time than the endpoint is willing to wait, it SHOULD pick 1114 another registration URI from the "URI Discovery" step and if there 1115 is only one or the list is exhausted, pick other choices from the 1116 "Finding a Resource Directory" step. Care has to be taken to 1117 consider the freshness of results obtained earlier, e.g. of the 1118 result of a "/.well-known/core" response, the lifetime of an RDAO 1119 option and of DNS responses. Any rate limits and persistent errors 1120 from the "Finding a Resource Directory" step must be considered for 1121 the whole registration time, not only for a single operation. 1123 The following example shows a registrant-ep with the name "node1" 1124 registering two resources to an RD using this interface. The 1125 location "/rd" is an example RD location discovered in a request 1126 similar to Figure 6. 1128 Req: POST coap://rd.example.com/rd?ep=node1 1129 Content-Format: 40 1130 Payload: 1131 ;ct=41;rt="temperature-c";if="sensor"; 1132 anchor="coap://spurious.example.com:5683", 1133 ;ct=41;rt="light-lux";if="sensor" 1135 Res: 2.01 Created 1136 Location-Path: /rd/4521 1138 Figure 7: Example registration payload 1140 A Resource Directory may optionally support HTTP. Here is an example 1141 of almost the same registration operation above, when done using HTTP 1142 and the JSON Link Format. 1144 Req: POST /rd?ep=node1&base=http://[2001:db8:1::1] HTTP/1.1 1145 Host: example.com 1146 Content-Type: application/link-format+json 1147 Payload: 1148 [ 1149 {"href": "/sensors/temp", "ct": "41", "rt": "temperature-c", 1150 "if": "sensor", "anchor": "coap://spurious.example.com:5683"}, 1151 {"href": "/sensors/light", "ct": "41", "rt": "light-lux", 1152 "if": "sensor"} 1153 ] 1155 Res: 201 Created 1156 Location: /rd/4521 1158 5.3.1. Simple Registration 1160 Not all endpoints hosting resources are expected to know how to 1161 upload links to an RD as described in Section 5.3. Instead, simple 1162 endpoints can implement the Simple Registration approach described in 1163 this section. An RD implementing this specification MUST implement 1164 Simple Registration. However, there may be security reasons why this 1165 form of directory discovery would be disabled. 1167 This approach requires that the registrant-ep makes available the 1168 hosted resources that it wants to be discovered, as links on its 1169 "/.well-known/core" interface as specified in [RFC6690]. The links 1170 in that document are subject to the same limitations as the payload 1171 of a registration (with respect to Appendix D). 1173 The registrant-ep finds one or more addresses of the directory server 1174 as described in Section 4. 1176 The registrant-ep asks the selected directory server to probe its 1177 /.well-known/core and publish the links as follows: 1179 The registrant-ep sends (and regularly refreshes with) a POST request 1180 to the "/.well-known/core" URI of the directory server of choice. 1181 The body of the POST request is empty, and triggers the resource 1182 directory server to perform GET requests at the requesting 1183 registrant-ep's /.well-known/core to obtain the link-format payload 1184 to register. 1186 The registrant-ep includes the same registration parameters in the 1187 POST request as it would per Section 5.3. The registration base URI 1188 of the registration is taken from the requesting server's URI. 1190 The Resource Directory MUST NOT query the registrant-ep's data before 1191 sending the response; this is to accommodate very limited endpoints. 1193 The success condition only indicates that the request was valid (i.e. 1194 the passed parameters are valid per se), not that the link data could 1195 be obtained or parsed or was successfully registered into the RD. 1197 The simple registration request interface is specified as follows: 1199 Interaction: EP -> RD 1201 Method: POST 1203 URI Template: /.well-known/core{?ep,d,lt,extra-attrs*} 1205 URI Template Variables are as they are for registration in 1206 Section 5.3. The base attribute is not accepted to keep the 1207 registration interface simple; that rules out registration over CoAP- 1208 over-TCP or HTTP that would need to specify one. 1210 The following response codes are defined for this interface: 1212 Success: 2.04 "Changed". 1214 Failure: 4.00 "Bad Request". Malformed request. 1216 Failure: 5.03 "Service Unavailable". Service could not perform the 1217 operation. 1219 HTTP support: NO 1221 For the second interaction triggered by the above, the registrant-ep 1222 takes the role of server and the RD the role of client. (Note that 1223 this is exactly the Well-Known Interface of [RFC6690] Section 4): 1225 Interaction: RD -> EP 1227 Method: GET 1229 URI Template: /.well-known/core 1231 The following response codes are defined for this interface: 1233 Success: 2.05 "Content". 1235 Failure: 4.00 "Bad Request". Malformed request. 1237 Failure: 4.04 "Not Found". /.well-known/core does not exist or is 1238 empty. 1240 Failure: 5.03 "Service Unavailable". Service could not perform the 1241 operation. 1243 HTTP support: NO 1245 The registration resources MUST be deleted after the expiration of 1246 their lifetime. Additional operations on the registration resource 1247 cannot be executed because no registration location is returned. 1249 The following example shows a registrant-ep using Simple 1250 Registration, by simply sending an empty POST to a resource 1251 directory. 1253 Req:(to RD server from [2001:db8:2::1]) 1254 POST /.well-known/core?lt=6000&ep=node1 1255 No payload 1257 Res: 2.04 Changed 1259 (later) 1261 Req: (from RD server to [2001:db8:2::1]) 1262 GET /.well-known/core 1263 Accept: 40 1265 Res: 2.05 Content 1266 Content-Format: 40 1267 Payload: 1268 1270 5.3.2. Third-party registration 1272 For some applications, even Simple Registration may be too taxing for 1273 some very constrained devices, in particular if the security 1274 requirements become too onerous. 1276 In a controlled environment (e.g. building control), the Resource 1277 Directory can be filled by a third party device, called a 1278 Commissioning Tool (CT). The commissioning tool can fill the 1279 Resource Directory from a database or other means. For that purpose 1280 scheme, IP address and port of the URI of the registered device is 1281 the value of the "base" parameter of the registration described in 1282 Section 5.3. 1284 It should be noted that the value of the "base" parameter applies to 1285 all the links of the registration and has consequences for the anchor 1286 value of the individual links as exemplified in Appendix B. An 1287 eventual (currently non-existing) "base" attribute of the link is not 1288 affected by the value of "base" parameter in the registration. 1290 6. RD Groups 1292 This section defines the REST API for the creation, management, and 1293 lookup of endpoints for group operations. Similar to endpoint 1294 registration entries in the RD, groups may be created or removed. 1295 However unlike an endpoint entry, a group entry consists of a list of 1296 endpoints and does not have a lifetime associated with it. In order 1297 to make use of multicast requests with CoAP, a group MAY have a 1298 multicast address associated with it. 1300 6.1. Register a Group 1302 In order to create a group, a commissioning tool (CT) used to 1303 configure groups, makes a request to the RD indicating the name of 1304 the group to create (or update), optionally the sector the group 1305 belongs to, and optionally the multicast address of the group. This 1306 specification does not require that the endpoints belong to the same 1307 sector as the group, but a Resource Directory implementation can 1308 impose requirements on the sectors of groups and endpoints depending 1309 on its configuration. 1311 The registration message is a list of links to registration resources 1312 of the endpoints that belong to that group. The CT can use any URI 1313 reference discovered using endpoint lookup from the same server or 1314 obtained by registering an endpoint using third party registration 1315 and enter it into a group. 1317 The commissioning tool SHOULD not send any target attributes with the 1318 links to the registration resources, and the resource directory 1319 SHOULD reject registrations that contain links with unprocessable 1320 attributes. 1322 Configuration of the endpoints themselves is out of scope of this 1323 specification. Such an interface for managing the group membership 1324 of an endpoint has been defined in [RFC7390]. 1326 The registration request interface is specified as follows: 1328 Interaction: CT -> RD 1330 Method: POST 1332 URI Template: {+rd-group}{?gp,d,base} 1334 URI Template Variables: 1336 rd-group := RD Group URI (mandatory). This is the location of 1337 the RD Group REST API. 1339 gp := Group Name (mandatory). The name of the group to be 1340 created or replaced, unique within that sector. The maximum 1341 length of this parameter is 63 bytes. 1343 d := Sector (optional). The sector to which this group belongs. 1344 The maximum length of this parameter is 63 bytes. When this 1345 parameter is not present, the RD MAY associate the group with a 1346 configured default sector or leave it empty. 1348 base := Group Base URI (optional). This parameter sets the 1349 scheme, address and port of the multicast address associated 1350 with the group. When base is used, scheme and host are 1351 mandatory and port parameter is optional. 1353 Content-Format: application/link-format 1355 Content-Format: application/link-format+json 1357 Content-Format: application/link-format+cbor 1359 The following response codes are defined for this interface: 1361 Success: 2.01 "Created" or 201 "Created". The Location header or 1362 Location-Path option MUST be returned in response to a successful 1363 group CREATE operation. This location MUST be a stable identifier 1364 generated by the RD as it is used for delete operations of the 1365 group resource. 1367 As with the Registration operation, the location MUST NOT have a 1368 query or fragment component. 1370 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 1371 request. 1373 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 1374 Service could not perform the operation. 1376 HTTP support: YES 1378 The following example shows an EP registering a group with the name 1379 "lights" which has two endpoints. The RD group path /rd-group is an 1380 example RD location discovered in a request similar to Figure 6. 1382 Req: POST coap://rd.example.com/rd-group?gp=lights 1383 &base=coap://[ff35:30:2001:db8::1] 1384 Content-Format: 40 1385 Payload: 1386 , 1387 1389 Res: 2.01 Created 1390 Location-Path: /rd-group/12 1392 A relative href value denotes the path to the registration resource 1393 of the Endpoint. When pointing to a registration resource on a 1394 different RD, the href value is a URI. 1396 6.2. Group Removal 1398 A group can be removed simply by sending a removal message to the 1399 location of the group registration resource which was returned when 1400 initially registering the group. Removing a group MUST NOT remove 1401 the endpoints of the group from the RD. 1403 The removal request interface is specified as follows: 1405 Interaction: CT -> RD 1407 Method: DELETE 1409 URI Template: {+location} 1411 URI Template Variables: 1413 location := This is the path of the group resource returned by 1414 the RD as a result of a successful group registration. 1416 The following responses codes are defined for this interface: 1418 Success: 2.02 "Deleted" or 204 "No Content" upon successful deletion 1420 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 1421 request. 1423 Failure: 4.04 "Not Found" or 404 "Not Found". Group does not exist. 1425 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 1426 Service could not perform the operation. 1428 HTTP support: YES 1429 The following examples shows successful removal of the group from the 1430 RD with the example location value /rd-group/12. 1432 Req: DELETE /rd-group/12 1434 Res: 2.02 Deleted 1436 7. RD Lookup 1438 To discover the resources registered with the RD, a lookup interface 1439 must be provided. This lookup interface is defined as a default, and 1440 it is assumed that RDs may also support lookups to return resource 1441 descriptions in alternative formats (e.g. Atom or HTML Link) or 1442 using more advanced interfaces (e.g. supporting context or semantic 1443 based lookup). 1445 RD Lookup allows lookups for groups, endpoints and resources using 1446 attributes defined in this document and for use with the CoRE Link 1447 Format. The result of a lookup request is the list of links (if any) 1448 corresponding to the type of lookup. Thus, a group lookup MUST 1449 return a list of groups, an endpoint lookup MUST return a list of 1450 endpoints and a resource lookup MUST return a list of links to 1451 resources. 1453 The lookup type is selected by a URI endpoint, which is indicated by 1454 a Resource Type as per Table 1 below: 1456 +-------------+--------------------+-----------+ 1457 | Lookup Type | Resource Type | Mandatory | 1458 +-------------+--------------------+-----------+ 1459 | Resource | core.rd-lookup-res | Mandatory | 1460 | Endpoint | core.rd-lookup-ep | Mandatory | 1461 | Group | core.rd-lookup-gp | Optional | 1462 +-------------+--------------------+-----------+ 1464 Table 1: Lookup Types 1466 7.1. Resource lookup 1468 Resource lookup results in links that are semantically equivalent to 1469 the links submitted to the RD. The links and link parameters 1470 returned by the lookup are equal to the submitted ones, except that 1471 the target and anchor references are fully resolved. 1473 Links that did not have an anchor attribute are therefore returned 1474 with the base URI of the registration as the anchor. Links of which 1475 href or anchor was submitted as a (full) URI are returned with these 1476 attributes unmodified. 1478 Above rules allow the client to interpret the response as links 1479 without any further knowledge of the storage conventions of the RD. 1480 The Resource Directory MAY replace the registration base URIs with a 1481 configured intermediate proxy, e.g. in the case of an HTTP lookup 1482 interface for CoAP endpoints. 1484 7.2. Lookup filtering 1486 Using the Accept Option, the requester can control whether the 1487 returned list is returned in CoRE Link Format ("application/link- 1488 format", default) or its alternate content-formats ("application/ 1489 link-format+json" or "application/link-format+cbor"). 1491 The page and count parameters are used to obtain lookup results in 1492 specified increments using pagination, where count specifies how many 1493 links to return and page specifies which subset of links organized in 1494 sequential pages, each containing 'count' links, starting with link 1495 zero and page zero. Thus, specifying count of 10 and page of 0 will 1496 return the first 10 links in the result set (links 0-9). Count = 10 1497 and page = 1 will return the next 'page' containing links 10-19, and 1498 so on. 1500 Multiple search criteria MAY be included in a lookup. All included 1501 criteria MUST match for a link to be returned. The Resource 1502 Directory MUST support matching with multiple search criteria. 1504 A link matches a search criterion if it has an attribute of the same 1505 name and the same value, allowing for a trailing "*" wildcard 1506 operator as in Section 4.1 of [RFC6690]. Attributes that are defined 1507 as "link-type" match if the search value matches any of their values 1508 (see Section 4.1 of [RFC6690]; e.g. "?if=core.s" matches ";if="abc 1509 core.s";"). A link also matches a search criterion if the link that 1510 would be produced for any of its containing entities would match the 1511 criterion, or an entity contained in it would: A search criterion 1512 matches an endpoint if it matches the endpoint itself, any of the 1513 groups it is contained in or any resource it contains. A search 1514 criterion matches a resource if it matches the resource itself, the 1515 resource's endpoint, or any of the endpoint's groups. 1517 Note that "href" is a valid search criterion and matches target 1518 references. Like all search criteria, on a resource lookup it can 1519 match the target reference of the resource link itself, but also the 1520 registration resource of the endpoint that registered it, or any 1521 group resource that endpoint is contained in. Queries for resource 1522 link targets MUST be in URI form (i.e. not relative references) and 1523 are matched against a resolved link target. Queries for groups and 1524 endpoints SHOULD be expressed in path-absolute form if possible and 1525 MUST be expressed in URI form otherwise; the RD SHOULD recognize 1526 either. 1528 Endpoints that are interested in a lookup result repeatedly or 1529 continuously can use mechanisms like ETag caching, resource 1530 observation ([RFC7641]), or any future mechanism that might allow 1531 more efficient observations of collections. These are advertised, 1532 detected and used according to their own specifications and can be 1533 used with the lookup interface as with any other resource. 1535 When resource observation is used, every time the set of matching 1536 links changes, or the content of a matching link changes, the RD 1537 sends a notification with the matching link set. The notification 1538 contains the successful current response to the given request, 1539 especially with respect to representing zero matching links (see 1540 "Success" item below). 1542 The lookup interface is specified as follows: 1544 Interaction: Client -> RD 1546 Method: GET 1548 URI Template: {+type-lookup-location}{?page,count,search*} 1550 URI Template Variables: 1552 type-lookup-location := RD Lookup URI for a given lookup type 1553 (mandatory). The address is discovered as described in 1554 Section 5.2. 1556 search := Search criteria for limiting the number of results 1557 (optional). 1559 page := Page (optional). Parameter cannot be used without the 1560 count parameter. Results are returned from result set in pages 1561 that contain 'count' links starting from index (page * count). 1562 Page numbering starts with zero. 1564 count := Count (optional). Number of results is limited to this 1565 parameter value. If the page parameter is also present, the 1566 response MUST only include 'count' links starting with the 1567 (page * count) link in the result set from the query. If the 1568 count parameter is not present, then the response MUST return 1569 all matching links in the result set. Link numbering starts 1570 with zero. 1572 Content-Format: application/link-format (optional) 1573 Content-Format: application/link-format+json (optional) 1575 Content-Format: application/link-format+cbor (optional) 1577 The following responses codes are defined for this interface: 1579 Success: 2.05 "Content" or 200 "OK" with an "application/link- 1580 format", "application/link-format+cbor", or "application/link- 1581 format+json" payload containing matching entries for the lookup. 1582 The payload can contain zero links (which is an empty payload, 1583 "80" (hex) or "[]" in the respective content format), indicating 1584 that no entities matched the request. 1586 Failure: No error response to a multicast request. 1588 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 1589 request. 1591 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 1592 Service could not perform the operation. 1594 HTTP support: YES 1596 The group and endpoint lookup return registration resources which can 1597 only be manipulated by the registering endpoint. Examples of group 1598 and endpoint lookup belong to the management aspects of the RD and 1599 are shown in Appendix A.5. The resource lookup examples are shown in 1600 this section. 1602 7.3. Resource lookup examples 1604 The examples in this section assume the existence of CoAP hosts with 1605 a default CoAP port 61616. HTTP hosts are possible and do not change 1606 the nature of the examples. 1608 The following example shows a client performing a resource lookup 1609 with the example resource look-up locations discovered in Figure 6: 1611 Req: GET /rd-lookup/res?rt=temperature 1613 Res: 2.05 Content 1614 ;rt="temperature"; 1615 anchor="coap://[2001:db8:3::123]:61616" 1617 The same lookup using the CBOR Link Format media type: 1619 Req: GET /rd-lookup/res?rt=temperature 1620 Accept: TBD64 1622 Res: 2.05 Content 1623 Content-Format: TBD64 1624 Payload in Hex notation: 1625 81A3017823636F61703A2F2F5B323030313A6462383A333A3A3132335D3A363136313 1626 62F74656D7003781E636F61703A2F2F5B323030313A6462383A333A3A3132335D3A36 1627 31363136096B74656D7065726174757265 1628 Decoded payload: 1629 [{1: "coap://[2001:db8:3::123]:61616/temp", 9: "temperature", 1630 3: "coap://[2001:db8:3::123]:61616"}] 1632 A client that wants to be notified of new resources as they show up 1633 can use observation: 1635 Req: GET /rd-lookup/res?rt=light 1636 Observe: 0 1638 Res: 2.05 Content 1639 Observe: 23 1640 Payload: empty 1642 (at a later point in time) 1644 Res: 2.05 Content 1645 Observe: 24 1646 Payload: 1647 ;rt="light"; 1648 anchor="coap://[2001:db8:3::124]", 1649 ;rt="light"; 1650 anchor="coap://[2001:db8:3::124]", 1651 ;rt="light"; 1652 anchor="coap://[2001:db8:3::124]" 1654 The following example shows a client performing a paginated resource 1655 lookup 1656 Req: GET /rd-lookup/res?page=0&count=5 1658 Res: 2.05 Content 1659 ;rt=sensor;ct=60; 1660 anchor="coap://[2001:db8:3::123]:61616", 1661 ;rt=sensor;ct=60; 1662 anchor="coap://[2001:db8:3::123]:61616", 1663 ;rt=sensor;ct=60; 1664 anchor="coap://[2001:db8:3::123]:61616", 1665 ;rt=sensor;ct=60; 1666 anchor="coap://[2001:db8:3::123]:61616", 1667 ;rt=sensor;ct=60; 1668 anchor="coap://[2001:db8:3::123]:61616" 1670 Req: GET /rd-lookup/res?page=1&count=5 1672 Res: 2.05 Content 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", 1679 ;rt=sensor;ct=60; 1680 anchor="coap://[2001:db8:3::123]:61616", 1681 ;rt=sensor;ct=60; 1682 anchor="coap://[2001:db8:3::123]:61616" 1684 The following example shows a client performing a lookup of all 1685 resources from endpoints of all endpoints of a given endpoint type. 1686 It assumes that two endpoints (with endpoint names "sensor1" and 1687 "sensor2") have previously registered with their respective addresses 1688 "coap://sensor1.example.com" and "coap://sensor2.example.com", and 1689 posted the very payload of the 6th request of section 5 of [RFC6690]. 1691 It demonstrates how absolute link targets stay unmodified, while 1692 relative ones are resolved: 1694 Req: GET /rd-lookup/res?et=oic.d.sensor 1696 ;ct=40;title="Sensor Index"; 1697 anchor="coap://sensor1.example.com", 1698 ;rt="temperature-c"; 1699 if="sensor"; anchor="coap://sensor1.example.com", 1700 ;rt="light-lux"; 1701 if="sensor"; anchor="coap://sensor1.example.com", 1702 ;rel="describedby"; 1703 anchor="coap://sensor1.example.com/sensors/temp", 1704 ;rel="alternate"; 1705 anchor="coap://sensor1.example.com/sensors/temp", 1706 ;ct=40;title="Sensor Index"; 1707 anchor="coap://sensor2.example.com", 1708 ;rt="temperature-c"; 1709 if="sensor"; anchor="coap://sensor2.example.com", 1710 ;rt="light-lux"; 1711 if="sensor"; anchor="coap://sensor2.example.com", 1712 ;rel="describedby"; 1713 anchor="coap://sensor2.example.com/sensors/temp", 1714 ;rel="alternate"; 1715 anchor="coap://sensor2.example.com/sensors/temp" 1717 8. Security policies 1719 The Resource Directory (RD) provides assistance to applications 1720 situated on a selection of nodes to discover endpoints on connected 1721 nodes. This section discusses different security aspects of 1722 accessing the RD. 1724 The contents of the RD are inserted in two ways: 1726 1. The node hosting the discoverable endpoint fills the RD with the 1727 contents of /.well-known/core by: 1729 * Storing the contents directly into RD (see Section 5.3) 1731 * Requesting the RD to load the contents from /.well-known/core 1732 see (section {{simple}) 1734 2. A Commissioning Tool (CT) fills the RD with endpoint information 1735 for a set of discoverable nodes. (see Section 5.3 with 1736 base=authority parameter value) 1738 In both cases, the nodes filling the RD should be authenticated and 1739 authorized to change the contents of the RD. An Authorization Server 1740 (AS) is responsible to assign a token to the registering node to 1741 authorize the node to discover or register endpoints in a given RD 1742 [I-D.ietf-ace-oauth-authz]. 1744 It can be imagined that an installation is divided in a set of 1745 security regions, each one with its own RD(s) to discover the 1746 endpoints that are part of a given security region. An endpoint that 1747 wants to discover an RD, responsible for a given region, needs to be 1748 authorized to learn the contents of a given RD. Within a region, for 1749 a given RD, a more fine-grained security division is possible based 1750 on the values of the endpoint registration parameters. Authorization 1751 to discover endpoints with a given set of filter values is 1752 recommended for those cases. 1754 When a node registers its endpoints, criteria are needed to authorize 1755 the node to enter them. An important aspect is the uniqueness of the 1756 (endpoint name, and optional sector) pair within the RD. Consider 1757 the two cases separately: (1) CT registers endpoints, and (2) the 1758 registering node registers its own endpoint(s). * A CT needs 1759 authorization to register a set of endpoints. This authorization can 1760 be based on the region, i.e. a given CT is authorized to register any 1761 endpoint (endpoint name, sector) into a given RD, or to register an 1762 endpoint with (endpoint name, sector) value pairs assigned by the AS, 1763 or can be more fine-grained, including a subset of registration 1764 parameter values. * A given endpoint that registers itself, needs to 1765 proof its possession of its unique (endpoint name, sector) value 1766 pair. Alternatively, the AS can authorize the endpoint to register 1767 with an (endpoint name, sector) value pair assigned by the AS. * A 1768 separate document needs to specify these aspects to ensure 1769 interoperability between registering nodes and RD. The subsections 1770 below give some hints how to handle a subset of the different 1771 aspects. 1773 8.1. Secure RD discovery 1775 The Resource Server (RS) discussed in [I-D.ietf-ace-oauth-authz] is 1776 equated to the RD. The client (C) needs to discover the RD as 1777 discussed in Section 4. C can discover the related AS by sending a 1778 request to the RD. The RD denies the request by sending the address 1779 of the related AS, as discussed in section 5.1 of 1780 [I-D.ietf-ace-oauth-authz]. The client MUST send an authorization 1781 request to the AS. When appropriate, the AS returns a token that 1782 specifies the authorization permission which needs to be specified in 1783 a separate document. 1785 8.2. Secure RD filtering 1787 The authorized parameter values for the queries by a given endpoint 1788 must be registered by the AS. The AS communicates the parameter 1789 values in the token. A separate document needs to specify the 1790 parameter value combinations and their storage in the token. The RD 1791 decodes the token and checks the validity of the queries of the 1792 client. 1794 8.3. Secure endpoint Name assignment 1796 This section only considers the assignment of a name to the endpoint 1797 based on an automatic mechanism without use of AS. More elaborate 1798 protocols are out of scope. The registering endpoint is authorized 1799 by the AS to discover the RD and add registrations. A token is 1800 provided by the AS and communicated from registering endpoint to RD. 1801 It is assumed that DTLS is used to secure the channel between 1802 registering endpoint and RD, where the registering endpoint is the 1803 DTLS client. Assuming that the client is provided by a certificate 1804 at manufacturing time, the certificate is uniquely identified by the 1805 CN field and the serial number. The RD can assign a unique endpoint 1806 name by using the certificate identifier as endpoint name. Proof of 1807 possession of the endpoint name by the registering endpoint is 1808 checked by encrypting the certificate identifier with the private key 1809 of the registering endpoint, which the RD can decrypt with the public 1810 key stored in the certificate. Even simpler, the authorized 1811 registering endpoint can generate a random number (or string) that 1812 identifies the endpoint. The RD can check for the improbable 1813 replication of the random value. The RD MUST check that registering 1814 endpoint uses only one random value for each authorized endpoint. 1816 9. Security Considerations 1818 The security considerations as described in Section 7 of [RFC5988] 1819 and Section 6 of [RFC6690] apply. The "/.well-known/core" resource 1820 may be protected e.g. using DTLS when hosted on a CoAP server as 1821 described in [RFC7252]. DTLS or TLS based security SHOULD be used on 1822 all resource directory interfaces defined in this document. 1824 9.1. Endpoint Identification and Authentication 1826 An Endpoint (name, sector) pair is unique within the et of endpoints 1827 regsitered by the RD. An Endpoint MUST NOT be identified by its 1828 protocol, port or IP address as these may change over the lifetime of 1829 an Endpoint. 1831 Every operation performed by an Endpoint on a resource directory 1832 SHOULD be mutually authenticated using Pre-Shared Key, Raw Public Key 1833 or Certificate based security. 1835 Consider the following threat: two devices A and B are registered at 1836 a single server. Both devices have unique, per-device credentials 1837 for use with DTLS to make sure that only parties with authorization 1838 to access A or B can do so. 1840 Now, imagine that a malicious device A wants to sabotage the device 1841 B. It uses its credentials during the DTLS exchange. Then, it 1842 specifies the endpoint name of device B as the name of its own 1843 endpoint in device A. If the server does not check whether the 1844 identifier provided in the DTLS handshake matches the identifier used 1845 at the CoAP layer then it may be inclined to use the endpoint name 1846 for looking up what information to provision to the malicious device. 1848 Section 8.3 specifies an example that removes this threat for 1849 endpoints that have a certificate installed. 1851 9.2. Access Control 1853 Access control SHOULD be performed separately for the RD 1854 registration, Lookup, and group API paths, as different endpoints may 1855 be authorized to register with an RD from those authorized to lookup 1856 endpoints from the RD. Such access control SHOULD be performed in as 1857 fine-grained a level as possible. For example access control for 1858 lookups could be performed either at the sector, endpoint or resource 1859 level. 1861 9.3. Denial of Service Attacks 1863 Services that run over UDP unprotected are vulnerable to unknowingly 1864 become part of a DDoS attack as UDP does not require return 1865 routability check. Therefore, an attacker can easily spoof the 1866 source IP of the target entity and send requests to such a service 1867 which would then respond to the target entity. This can be used for 1868 large-scale DDoS attacks on the target. Especially, if the service 1869 returns a response that is order of magnitudes larger than the 1870 request, the situation becomes even worse as now the attack can be 1871 amplified. DNS servers have been widely used for DDoS amplification 1872 attacks. There is also a danger that NTP Servers could become 1873 implicated in denial-of-service (DoS) attacks since they run on 1874 unprotected UDP, there is no return routability check, and they can 1875 have a large amplification factor. The responses from the NTP server 1876 were found to be 19 times larger than the request. A Resource 1877 Directory (RD) which responds to wild-card lookups is potentially 1878 vulnerable if run with CoAP over UDP. Since there is no return 1879 routability check and the responses can be significantly larger than 1880 requests, RDs can unknowingly become part of a DDoS amplification 1881 attack. 1883 10. IANA Considerations 1885 10.1. Resource Types 1887 IANA is asked to enter the following values into the Resource Type 1888 (rt=) Link Target Attribute Values sub-registry of the Constrained 1889 Restful Environments (CoRE) Parameters registry defined in [RFC6690]: 1891 +--------------------+----------------------------+-----------------+ 1892 | Value | Description | Reference | 1893 +--------------------+----------------------------+-----------------+ 1894 | core.rd | Directory resource of an | RFCTHIS Section | 1895 | | RD | 5.2 | 1896 | core.rd-group | Group directory resource | RFCTHIS Section | 1897 | | of an RD | 5.2 | 1898 | core.rd-lookup-res | Resource lookup of an RD | RFCTHIS Section | 1899 | | | 5.2 | 1900 | core.rd-lookup-ep | Endpoint lookup of an RD | RFCTHIS Section | 1901 | | | 5.2 | 1902 | core.rd-lookup-gp | Group lookup of an RD | RFCTHIS Section | 1903 | | | 5.2 | 1904 | core.rd-ep | Endpoint resource of an RD | RFCTHIS Section | 1905 | | | 7 | 1906 | core.rd-gp | Group resource of an RD | RFCTHIS Section | 1907 | | | 7 | 1908 +--------------------+----------------------------+-----------------+ 1910 10.2. IPv6 ND Resource Directory Address Option 1912 This document registers one new ND option type under the sub-registry 1913 "IPv6 Neighbor Discovery Option Formats": 1915 o Resource Directory address Option (38) 1917 10.3. RD Parameter Registry 1919 This specification defines a new sub-registry for registration and 1920 lookup parameters called "RD Parameters" under "CoRE Parameters". 1921 Although this specification defines a basic set of parameters, it is 1922 expected that other standards that make use of this interface will 1923 define new ones. 1925 Each entry in the registry must include 1926 o the human readable name of the parameter, 1928 o the short name as used in query parameters or link attributes, 1930 o indication of whether it can be passed as a query parameter at 1931 registration of endpoints or groups, as a query parameter in 1932 lookups, or be expressed as a link attribute, 1934 o validity requirements if any, and 1936 o a description. 1938 The query parameter MUST be both a valid URI query key [RFC3986] and 1939 a parmname as used in [RFC5988]. 1941 The description must give details on which registrations they apply 1942 to (Endpoint, group registrations or both? Can they be updated?), 1943 and how they are to be processed in lookups. 1945 The mechanisms around new RD parameters should be designed in such a 1946 way that they tolerate RD implementations that are unaware of the 1947 parameter and expose any parameter passed at registration or updates 1948 on in endpoint lookups. (For example, if a parameter used at 1949 registration were to be confidential, the registering endpoint should 1950 be instructed to only set that parameter if the RD advertises support 1951 for keeping it confidential at the discovery step.) 1953 Initial entries in this sub-registry are as follows: 1955 +--------------+-------+---------------+-----+----------------------+ 1956 | Full name | Short | Validity | Use | Description | 1957 +--------------+-------+---------------+-----+----------------------+ 1958 | Endpoint | ep | | RLA | Name of the | 1959 | Name | | | | endpoint, max 63 | 1960 | | | | | bytes | 1961 | Lifetime | lt | 60-4294967295 | R | Lifetime of the | 1962 | | | | | registration in | 1963 | | | | | seconds | 1964 | Sector | d | | RLA | Sector to which this | 1965 | | | | | endpoint belongs | 1966 | Registration | base | URI | RLA | The scheme, address | 1967 | Base URI | | | | and port and path at | 1968 | | | | | which this server is | 1969 | | | | | available | 1970 | Group Name | gp | | RLA | Name of a group in | 1971 | | | | | the RD | 1972 | Page | page | Integer | L | Used for pagination | 1973 | Count | count | Integer | L | Used for pagination | 1974 | Endpoint | et | | RLA | Semantic name of the | 1975 | Type | | | | endpoint (see | 1976 | | | | | Section 10.4) | 1977 +--------------+-------+---------------+-----+----------------------+ 1979 Table 2: RD Parameters 1981 (Short: Short name used in query parameters or link attributes. Use: 1982 R = used at registration, L = used at lookup, A = expressed in link 1983 attribute 1985 The descriptions for the options defined in this document are only 1986 summarized here. To which registrations they apply and when they are 1987 to be shown is described in the respective sections of this document. 1989 The IANA policy for future additions to the sub-registry is "Expert 1990 Review" as described in [RFC8126]. The evaluation should consider 1991 formal criteria, duplication of functionality (Is the new entry 1992 redundant with an existing one?), topical suitability (E.g. is the 1993 described property actually a property of the endpoint and not a 1994 property of a particular resource, in which case it should go into 1995 the payload of the registration and need not be registered?), and the 1996 potential for conflict with commonly used link attributes (For 1997 example, "if" could be used as a parameter for conditional 1998 registration if it were not to be used in lookup or attributes, but 1999 would make a bad parameter for lookup, because a resource lookup with 2000 an "if" query parameter could ambiguously filter by the registered 2001 endpoint property or the [RFC6690] link attribute). It is expected 2002 that the registry will receive between 5 and 50 registrations in 2003 total over the next years. 2005 10.3.1. Full description of the "Endpoint Type" Registration Parameter 2007 An endpoint registering at an RD can describe itself with endpoint 2008 types, similar to how resources are described with Resource Types in 2009 [RFC6690]. An endpoint type is expressed as a string, which can be 2010 either a URI or one of the values defined in the Endpoint Type sub- 2011 registry. Endpoint types can be passed in the "et" query parameter 2012 as part of extra-attrs at the Registration step, are shown on 2013 endpoint lookups using the "et" target attribute, and can be filtered 2014 for using "et" as a search criterion in resource and endpoint lookup. 2015 Multiple endpoint types are given as separate query parameters or 2016 link attributes. 2018 Note that Endpoint Type differs from Resource Type in that it uses 2019 multiple attributes rather than space separated values. As a result, 2020 Resource Directory implementations automatically support correct 2021 filtering in the lookup interfaces from the rules for unknown 2022 endpoint attributes. 2024 10.4. "Endpoint Type" (et=) RD Parameter values 2026 This specification establishes a new sub-registry under "CoRE 2027 Parameters" called '"Endpoint Type" (et=) RD Parameter values'. The 2028 registry properties (required policy, requirements, template) are 2029 identical to those of the Resource Type parameters in [RFC6690], in 2030 short: 2032 The review policy is IETF Review for values starting with "core", and 2033 Specification Required for others. 2035 The requirements to be enforced are: 2037 o The values MUST be related to the purpose described in 2038 Section 10.3.1. 2040 o The registered values MUST conform to the ABNF reg-rel-type 2041 definition of [RFC6690] and MUST NOT be a URI. 2043 o It is recommended to use the period "." character for 2044 segmentation. 2046 The registry is initially empty. 2048 10.5. Multicast Address Registration 2050 IANA has assigned the following multicast addresses for use by CoAP 2051 nodes: 2053 IPv4 - "all CoRE resource directories" address, from the "IPv4 2054 Multicast Address Space Registry" equal to "All CoAP Nodes", 2055 224.0.1.187. As the address is used for discovery that may span 2056 beyond a single network, it has come from the Internetwork Control 2057 Block (224.0.1.x, RFC 5771). 2059 IPv6 - "all CoRE resource directories" address MCD1 (suggestions 2060 FF0X::FE), from the "IPv6 Multicast Address Space Registry", in the 2061 "Variable Scope Multicast Addresses" space (RFC 3307). Note that 2062 there is a distinct multicast address for each scope that interested 2063 CoAP nodes should listen to; CoAP needs the Link-Local and Site-Local 2064 scopes only. 2066 11. Examples 2068 Two examples are presented: a Lighting Installation example in 2069 Section 11.1 and a LWM2M example in Section 11.2. 2071 11.1. Lighting Installation 2073 This example shows a simplified lighting installation which makes use 2074 of the Resource Directory (RD) with a CoAP interface to facilitate 2075 the installation and start up of the application code in the lights 2076 and sensors. In particular, the example leads to the definition of a 2077 group and the enabling of the corresponding multicast address. No 2078 conclusions must be drawn on the realization of actual installation 2079 or naming procedures, because the example only "emphasizes" some of 2080 the issues that may influence the use of the RD and does not pretend 2081 to be normative. 2083 11.1.1. Installation Characteristics 2085 The example assumes that the installation is managed. That means 2086 that a Commissioning Tool (CT) is used to authorize the addition of 2087 nodes, name them, and name their services. The CT can be connected 2088 to the installation in many ways: the CT can be part of the 2089 installation network, connected by WiFi to the installation network, 2090 or connected via GPRS link, or other method. 2092 It is assumed that there are two naming authorities for the 2093 installation: (1) the network manager that is responsible for the 2094 correct operation of the network and the connected interfaces, and 2095 (2) the lighting manager that is responsible for the correct 2096 functioning of networked lights and sensors. The result is the 2097 existence of two naming schemes coming from the two managing 2098 entities. 2100 The example installation consists of one presence sensor, and two 2101 luminaries, luminary1 and luminary2, each with their own wireless 2102 interface. Each luminary contains three lamps: left, right and 2103 middle. Each luminary is accessible through one endpoint. For each 2104 lamp a resource exists to modify the settings of a lamp in a 2105 luminary. The purpose of the installation is that the presence 2106 sensor notifies the presence of persons to a group of lamps. The 2107 group of lamps consists of: middle and left lamps of luminary1 and 2108 right lamp of luminary2. 2110 Before commissioning by the lighting manager, the network is 2111 installed and access to the interfaces is proven to work by the 2112 network manager. 2114 At the moment of installation, the network under installation is not 2115 necessarily connected to the DNS infra structure. Therefore, SLAAC 2116 IPv6 addresses are assigned to CT, RD, luminaries and sensor shown in 2117 Table 3 below: 2119 +--------------------+----------------+ 2120 | Name | IPv6 address | 2121 +--------------------+----------------+ 2122 | luminary1 | 2001:db8:4::1 | 2123 | luminary2 | 2001:db8:4::2 | 2124 | Presence sensor | 2001:db8:4::3 | 2125 | Resource directory | 2001:db8:4::ff | 2126 +--------------------+----------------+ 2128 Table 3: interface SLAAC addresses 2130 In Section 11.1.2 the use of resource directory during installation 2131 is presented. 2133 11.1.2. RD entries 2135 It is assumed that access to the DNS infrastructure is not always 2136 possible during installation. Therefore, the SLAAC addresses are 2137 used in this section. 2139 For discovery, the resource types (rt) of the devices are important. 2140 The lamps in the luminaries have rt: light, and the presence sensor 2141 has rt: p-sensor. The endpoints have names which are relevant to the 2142 light installation manager. In this case luminary1, luminary2, and 2143 the presence sensor are located in room 2-4-015, where luminary1 is 2144 located at the window and luminary2 and the presence sensor are 2145 located at the door. The endpoint names reflect this physical 2146 location. The middle, left and right lamps are accessed via path 2147 /light/middle, /light/left, and /light/right respectively. The 2148 identifiers relevant to the Resource Directory are shown in Table 4 2149 below: 2151 +----------------+------------------+---------------+---------------+ 2152 | Name | endpoint | resource path | resource type | 2153 +----------------+------------------+---------------+---------------+ 2154 | luminary1 | lm_R2-4-015_wndw | /light/left | light | 2155 | luminary1 | lm_R2-4-015_wndw | /light/middle | light | 2156 | luminary1 | lm_R2-4-015_wndw | /light/right | light | 2157 | luminary2 | lm_R2-4-015_door | /light/left | light | 2158 | luminary2 | lm_R2-4-015_door | /light/middle | light | 2159 | luminary2 | lm_R2-4-015_door | /light/right | light | 2160 | Presence | ps_R2-4-015_door | /ps | p-sensor | 2161 | sensor | | | | 2162 +----------------+------------------+---------------+---------------+ 2164 Table 4: Resource Directory identifiers 2166 It is assumed that the CT knows the RD's address, and has performed 2167 URI discovery on it that returned a response like the one in the 2168 Section 5.2 example. 2170 The CT inserts the endpoints of the luminaries and the sensor in the 2171 RD using the registration base URI parameter (base) to specify the 2172 interface address: 2174 Req: POST coap://[2001:db8:4::ff]/rd 2175 ?ep=lm_R2-4-015_wndw&base=coap://[2001:db8:4::1]&d=R2-4-015 2176 Payload: 2177 ;rt="light", 2178 ;rt="light", 2179 ;rt="light" 2181 Res: 2.01 Created 2182 Location-Path: /rd/4521 2183 Req: POST coap://[2001:db8:4::ff]/rd 2184 ?ep=lm_R2-4-015_door&base=coap://[2001:db8:4::2]&d=R2-4-015 2185 Payload: 2186 ;rt="light", 2187 ;rt="light", 2188 ;rt="light" 2190 Res: 2.01 Created 2191 Location-Path: /rd/4522 2193 Req: POST coap://[2001:db8:4::ff]/rd 2194 ?ep=ps_R2-4-015_door&base=coap://[2001:db8:4::3]d&d=R2-4-015 2195 Payload: 2196 ;rt="p-sensor" 2198 Res: 2.01 Created 2199 Location-Path: /rd/4523 2201 The sector name d=R2-4-015 has been added for an efficient lookup 2202 because filtering on "ep" name is more awkward. The same sector name 2203 is communicated to the two luminaries and the presence sensor by the 2204 CT. 2206 The group is specified in the RD. The base parameter is set to the 2207 site-local multicast address allocated to the group. In the POST in 2208 the example below, these two endpoints and the endpoint of the 2209 presence sensor are registered as members of the group. 2211 Req: POST coap://[2001:db8:4::ff]/rd-group 2212 ?gp=grp_R2-4-015&base=coap://[ff05::1] 2213 Payload: 2214 , 2215 , 2216 2218 Res: 2.01 Created 2219 Location-Path: /rd-group/501 2221 After the filling of the RD by the CT, the application in the 2222 luminaries can learn to which groups they belong, and enable their 2223 interface for the multicast address. 2225 The luminary, knowing its sector and own IPv6 address, looks up the 2226 groups containing light resources it is assigned to: 2228 Req: GET coap://[2001:db8:4::ff]/rd-lookup/gp 2229 ?d=R2-4-015&base=coap://[2001:db8:4::1]&rt=light 2231 Res: 2.05 Content 2232 ;gp="grp_R2-4-015";base="coap://[ff05::1]" 2234 From the returned base parameter value, the luminary learns the 2235 multicast address of the multicast group. 2237 Alternatively, the CT can communicate the multicast address directly 2238 to the luminaries by using the "coap-group" resource specified in 2239 [RFC7390]. 2241 Req: POST coap://[2001:db8:4::1]/coap-group 2242 Content-Format: application/coap-group+json 2243 Payload: 2244 { "a": "[ff05::1]", "n": "grp_R2-4-015"} 2246 Res: 2.01 Created 2247 Location-Path: /coap-group/1 2249 Dependent on the situation, only the address, "a", or the name, "n", 2250 is specified in the coap-group resource. 2252 11.2. OMA Lightweight M2M (LWM2M) Example 2254 This example shows how the OMA LWM2M specification makes use of 2255 Resource Directory (RD). 2257 OMA LWM2M is a profile for device services based on CoAP(OMA Name 2258 Authority). LWM2M defines a simple object model and a number of 2259 abstract interfaces and operations for device management and device 2260 service enablement. 2262 An LWM2M server is an instance of an LWM2M middleware service layer, 2263 containing a Resource Directory along with other LWM2M interfaces 2264 defined by the LWM2M specification. 2266 CoRE Resource Directory (RD) is used to provide the LWM2M 2267 Registration interface. 2269 LWM2M does not provide for registration sectors and does not 2270 currently use the rd-group or rd-lookup interfaces. 2272 The LWM2M specification describes a set of interfaces and a resource 2273 model used between a LWM2M device and an LWM2M server. Other 2274 interfaces, proxies, and applications are currently out of scope for 2275 LWM2M. 2277 The location of the LWM2M Server and RD URI path is provided by the 2278 LWM2M Bootstrap process, so no dynamic discovery of the RD is used. 2279 LWM2M Servers and endpoints are not required to implement the /.well- 2280 known/core resource. 2282 11.2.1. The LWM2M Object Model 2284 The OMA LWM2M object model is based on a simple 2 level class 2285 hierarchy consisting of Objects and Resources. 2287 An LWM2M Resource is a REST endpoint, allowed to be a single value or 2288 an array of values of the same data type. 2290 An LWM2M Object is a resource template and container type that 2291 encapsulates a set of related resources. An LWM2M Object represents 2292 a specific type of information source; for example, there is a LWM2M 2293 Device Management object that represents a network connection, 2294 containing resources that represent individual properties like radio 2295 signal strength. 2297 Since there may potentially be more than one of a given type object, 2298 for example more than one network connection, LWM2M defines instances 2299 of objects that contain the resources that represent a specific 2300 physical thing. 2302 The URI template for LWM2M consists of a base URI followed by Object, 2303 Instance, and Resource IDs: 2305 {/base-uri}{/object-id}{/object-instance}{/resource-id}{/resource- 2306 instance} 2308 The five variables given here are strings. base-uri can also have 2309 the special value "undefined" (sometimes called "null" in RFC 6570). 2310 Each of the variables object-instance, resource-id, and resource- 2311 instance can be the special value "undefined" only if the values 2312 behind it in this sequence also are "undefined". As a special case, 2313 object-instance can be "empty" (which is different from "undefined") 2314 if resource-id is not "undefined". 2316 base-uri := Base URI for LWM2M resources or "undefined" for default 2317 (empty) base URI 2319 object-id := OMNA (OMA Name Authority) registered object ID (0-65535) 2321 object-instance := Object instance identifier (0-65535) or 2322 "undefined"/"empty" (see above)) to refer to all instances of an 2323 object ID 2324 resource-id := OMNA (OMA Name Authority) registered resource ID 2325 (0-65535) or "undefined" to refer to all resources within an instance 2327 resource-instance := Resource instance identifier or "undefined" to 2328 refer to single instance of a resource 2330 LWM2M IDs are 16 bit unsigned integers represented in decimal (no 2331 leading zeroes except for the value 0) by URI format strings. For 2332 example, a LWM2M URI might be: 2334 /1/0/1 2336 The base uri is empty, the Object ID is 1, the instance ID is 0, the 2337 resource ID is 1, and the resource instance is "undefined". This 2338 example URI points to internal resource 1, which represents the 2339 registration lifetime configured, in instance 0 of a type 1 object 2340 (LWM2M Server Object). 2342 11.2.2. LWM2M Register Endpoint 2344 LWM2M defines a registration interface based on the REST API, 2345 described in Section 5. The RD registration URI path of the LWM2M 2346 Resource Directory is specified to be "/rd". 2348 LWM2M endpoints register object IDs, for example , to indicate 2349 that a particular object type is supported, and register object 2350 instances, for example , to indicate that a particular instance 2351 of that object type exists. 2353 Resources within the LWM2M object instance are not registered with 2354 the RD, but may be discovered by reading the resource links from the 2355 object instance using GET with a CoAP Content-Format of application/ 2356 link-format. Resources may also be read as a structured object by 2357 performing a GET to the object instance with a Content-Format of 2358 senml+json. 2360 When an LWM2M object or instance is registered, this indicates to the 2361 LWM2M server that the object and its resources are available for 2362 management and service enablement (REST API) operations. 2364 LWM2M endpoints may use the following RD registration parameters as 2365 defined in Table 2 : 2367 ep - Endpoint Name 2368 lt - registration lifetime 2369 Endpoint Name, Lifetime, and LWM2M Version are mandatory parameters 2370 for the register operation, all other registration parameters are 2371 optional. 2373 Additional optional LWM2M registration parameters are defined: 2375 +-----------+-------+-------------------------------+---------------+ 2376 | Name | Query | Validity | Description | 2377 +-----------+-------+-------------------------------+---------------+ 2378 | Binding | b | {"U",UQ","S","SQ","US","UQS"} | Available | 2379 | Mode | | | Protocols | 2380 | | | | | 2381 | LWM2M | ver | 1.0 | Spec Version | 2382 | Version | | | | 2383 | | | | | 2384 | SMS | sms | | MSISDN | 2385 | Number | | | | 2386 +-----------+-------+-------------------------------+---------------+ 2388 Table 5: LWM2M Additional Registration Parameters 2390 The following RD registration parameters are not currently specified 2391 for use in LWM2M: 2393 et - Endpoint Type 2394 base - Registration Base URI 2396 The endpoint registration must include a payload containing links to 2397 all supported objects and existing object instances, optionally 2398 including the appropriate link-format relations. 2400 Here is an example LWM2M registration payload: 2402 ,,, 2404 This link format payload indicates that object ID 1 (LWM2M Server 2405 Object) is supported, with a single instance 0 existing, object ID 3 2406 (LWM2M Device object) is supported, with a single instance 0 2407 existing, and object 5 (LWM2M Firmware Object) is supported, with no 2408 existing instances. 2410 11.2.3. LWM2M Update Endpoint Registration 2412 The LwM2M update is really very similar to the registration update as 2413 described in Appendix A.1, with the only difference that there are 2414 more parameters defined and available. All the parameters listed in 2415 that section are also available with the initial registration but are 2416 all optional: 2418 lt - Registration Lifetime 2419 b - Protocol Binding 2420 sms - MSISDN 2421 link payload - new or modified links 2423 A Registration update is also specified to be used to update the 2424 LWM2M server whenever the endpoint's UDP port or IP address are 2425 changed. 2427 11.2.4. LWM2M De-Register Endpoint 2429 LWM2M allows for de-registration using the delete method on the 2430 returned location from the initial registration operation. LWM2M de- 2431 registration proceeds as described in Appendix A.2. 2433 12. Acknowledgments 2435 Oscar Novo, Srdjan Krco, Szymon Sasin, Kerry Lynn, Esko Dijk, Anders 2436 Brandt, Matthieu Vial, Jim Schaad, Mohit Sethi, Hauke Petersen, 2437 Hannes Tschofenig, Sampo Ukkola, Linyi Tian, and Jan Newmarch have 2438 provided helpful comments, discussions and ideas to improve and shape 2439 this document. Zach would also like to thank his colleagues from the 2440 EU FP7 SENSEI project, where many of the resource directory concepts 2441 were originally developed. 2443 13. Changelog 2445 changes from -14 to -15 2447 o Rewrite of section "Security policies" 2449 o Clarify that the "base" parameter text applies both to relative 2450 references both in anchor and href 2452 o Renamed "Registree-EP" to Registrant-EP" 2454 o Talk of "relative references" and "URIs" rather than "relative" 2455 and "absolute" URIs. (The concept of "absolute URIs" of [RFC3986] 2456 is not needed in RD). 2458 o Fixed examples 2460 o Editorial changes 2462 changes from -13 to -14 2463 o Rename "registration context" to "registration base URI" (and 2464 "con" to "base") and "domain" to "sector" (where the abbreviation 2465 "d" stays for compatibility reasons) 2467 o Introduced resource types core.rd-ep and core.rd-gp 2469 o Registration management moved to appendix A, including endpoint 2470 and group lookup 2472 o Minor editorial changes 2474 * PATCH/iPATCH is clearly deferred to another document 2476 * Recommend against query / fragment identifier in con= 2478 * Interface description lists are described as illustrative 2480 * Rewording of Simple Registration 2482 o Simple registration carries no error information and succeeds 2483 immediately (previously, sequence was unspecified) 2485 o Lookup: href are matched against resolved values (previously, this 2486 was unspecified) 2488 o Lookup: lt are not exposed any more 2490 o con/base: Paths are allowed 2492 o Registration resource locations can not have query or fragment 2493 parts 2495 o Default life time extended to 25 hours 2497 o clarified registration update rules 2499 o lt-value semantics for lookup clarified. 2501 o added template for simple registration 2503 changes from -12 to -13 2505 o Added "all resource directory" nodes MC address 2507 o Clarified observation behavior 2509 o version identification 2510 o example rt= and et= values 2512 o domain from figure 2 2514 o more explanatory text 2516 o endpoints of a groups hosted by different RD 2518 o resolve RFC6690-vs-8288 resolution ambiguities: 2520 * require registered links not to be relative when using anchor 2522 * return absolute URIs in resource lookup 2524 changes from -11 to -12 2526 o added Content Model section, including ER diagram 2528 o removed domain lookup interface; domains are now plain attributes 2529 of groups and endpoints 2531 o updated chapter "Finding a Resource Directory"; now distinguishes 2532 configuration-provided, network-provided and heuristic sources 2534 o improved text on: atomicity, idempotency, lookup with multiple 2535 parameters, endpoint removal, simple registration 2537 o updated LWM2M description 2539 o clarified where relative references are resolved, and how context 2540 and anchor interact 2542 o new appendix on the interaction with RFCs 6690, 5988 and 3986 2544 o lookup interface: group and endpoint lookup return group and 2545 registration resources as link targets 2547 o lookup interface: search parameters work the same across all 2548 entities 2550 o removed all methods that modify links in an existing registration 2551 (POST with payload, PATCH and iPATCH) 2553 o removed plurality definition (was only needed for link 2554 modification) 2556 o enhanced IANA registry text 2557 o state that lookup resources can be observable 2559 o More examples and improved text 2561 changes from -09 to -10 2563 o removed "ins" and "exp" link-format extensions. 2565 o removed all text concerning DNS-SD. 2567 o removed inconsistency in RDAO text. 2569 o suggestions taken over from various sources 2571 o replaced "Function Set" with "REST API", "base URI", "base path" 2573 o moved simple registration to registration section 2575 changes from -08 to -09 2577 o clarified the "example use" of the base RD resource values /rd, 2578 /rd-lookup, and /rd-group. 2580 o changed "ins" ABNF notation. 2582 o various editorial improvements, including in examples 2584 o clarifications for RDAO 2586 changes from -07 to -08 2588 o removed link target value returned from domain and group lookup 2589 types 2591 o Maximum length of domain parameter 63 bytes for consistency with 2592 group 2594 o removed option for simple POST of link data, don't require a 2595 .well-known/core resource to accept POST data and handle it in a 2596 special way; we already have /rd for that 2598 o add IPv6 ND Option for discovery of an RD 2600 o clarify group configuration section 6.1 that endpoints must be 2601 registered before including them in a group 2603 o removed all superfluous client-server diagrams 2604 o simplified lighting example 2606 o introduced Commissioning Tool 2608 o RD-Look-up text is extended. 2610 changes from -06 to -07 2612 o added text in the discovery section to allow content format hints 2613 to be exposed in the discovery link attributes 2615 o editorial updates to section 9 2617 o update author information 2619 o minor text corrections 2621 Changes from -05 to -06 2623 o added note that the PATCH section is contingent on the progress of 2624 the PATCH method 2626 changes from -04 to -05 2628 o added Update Endpoint Links using PATCH 2630 o http access made explicit in interface specification 2632 o Added http examples 2634 Changes from -03 to -04: 2636 o Added http response codes 2638 o Clarified endpoint name usage 2640 o Add application/link-format+cbor content-format 2642 Changes from -02 to -03: 2644 o Added an example for lighting and DNS integration 2646 o Added an example for RD use in OMA LWM2M 2648 o Added Read Links operation for link inspection by endpoints 2650 o Expanded DNS-SD section 2651 o Added draft authors Peter van der Stok and Michael Koster 2653 Changes from -01 to -02: 2655 o Added a catalogue use case. 2657 o Changed the registration update to a POST with optional link 2658 format payload. Removed the endpoint type update from the update. 2660 o Additional examples section added for more complex use cases. 2662 o New DNS-SD mapping section. 2664 o Added text on endpoint identification and authentication. 2666 o Error code 4.04 added to Registration Update and Delete requests. 2668 o Made 63 bytes a SHOULD rather than a MUST for endpoint name and 2669 resource type parameters. 2671 Changes from -00 to -01: 2673 o Removed the ETag validation feature. 2675 o Place holder for the DNS-SD mapping section. 2677 o Explicitly disabled GET or POST on returned Location. 2679 o New registry for RD parameters. 2681 o Added support for the JSON Link Format. 2683 o Added reference to the Groupcomm WG draft. 2685 Changes from -05 to WG Document -00: 2687 o Updated the version and date. 2689 Changes from -04 to -05: 2691 o Restricted Update to parameter updates. 2693 o Added pagination support for the Lookup interface. 2695 o Minor editing, bug fixes and reference updates. 2697 o Added group support. 2699 o Changed rt to et for the registration and update interface. 2701 Changes from -03 to -04: 2703 o Added the ins= parameter back for the DNS-SD mapping. 2705 o Integrated the Simple Directory Discovery from Carsten. 2707 o Editorial improvements. 2709 o Fixed the use of ETags. 2711 o Fixed tickets 383 and 372 2713 Changes from -02 to -03: 2715 o Changed the endpoint name back to a single registration parameter 2716 ep= and removed the h= and ins= parameters. 2718 o Updated REST interface descriptions to use RFC6570 URI Template 2719 format. 2721 o Introduced an improved RD Lookup design as its own function set. 2723 o Improved the security considerations section. 2725 o Made the POST registration interface idempotent by requiring the 2726 ep= parameter to be present. 2728 Changes from -01 to -02: 2730 o Added a terminology section. 2732 o Changed the inclusion of an ETag in registration or update to a 2733 MAY. 2735 o Added the concept of an RD Domain and a registration parameter for 2736 it. 2738 o Recommended the Location returned from a registration to be 2739 stable, allowing for endpoint and Domain information to be changed 2740 during updates. 2742 o Changed the lookup interface to accept endpoint and Domain as 2743 query string parameters to control the scope of a lookup. 2745 14. References 2747 14.1. Normative References 2749 [I-D.ietf-core-links-json] 2750 Li, K., Rahman, A., and C. Bormann, "Representing 2751 Constrained RESTful Environments (CoRE) Link Format in 2752 JSON and CBOR", draft-ietf-core-links-json-10 (work in 2753 progress), February 2018. 2755 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2756 Requirement Levels", BCP 14, RFC 2119, 2757 DOI 10.17487/RFC2119, March 1997, 2758 . 2760 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 2761 Resource Identifier (URI): Generic Syntax", STD 66, 2762 RFC 3986, DOI 10.17487/RFC3986, January 2005, 2763 . 2765 [RFC5988] Nottingham, M., "Web Linking", RFC 5988, 2766 DOI 10.17487/RFC5988, October 2010, 2767 . 2769 [RFC6570] Gregorio, J., Fielding, R., Hadley, M., Nottingham, M., 2770 and D. Orchard, "URI Template", RFC 6570, 2771 DOI 10.17487/RFC6570, March 2012, 2772 . 2774 [RFC6690] Shelby, Z., "Constrained RESTful Environments (CoRE) Link 2775 Format", RFC 6690, DOI 10.17487/RFC6690, August 2012, 2776 . 2778 [RFC6763] Cheshire, S. and M. Krochmal, "DNS-Based Service 2779 Discovery", RFC 6763, DOI 10.17487/RFC6763, February 2013, 2780 . 2782 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 2783 Writing an IANA Considerations Section in RFCs", BCP 26, 2784 RFC 8126, DOI 10.17487/RFC8126, June 2017, 2785 . 2787 14.2. Informative References 2789 [ER] Chen, P., "The entity-relationship model---toward a 2790 unified view of data", ACM Transactions on Database 2791 Systems Vol. 1, pp. 9-36, DOI 10.1145/320434.320440, March 2792 1976. 2794 [I-D.arkko-core-dev-urn] 2795 Arkko, J., Jennings, C., and Z. Shelby, "Uniform Resource 2796 Names for Device Identifiers", draft-arkko-core-dev-urn-05 2797 (work in progress), October 2017. 2799 [I-D.bormann-t2trg-rel-impl] 2800 Bormann, C., "impl-info: A link relation type for 2801 disclosing implementation information", draft-bormann- 2802 t2trg-rel-impl-00 (work in progress), January 2018. 2804 [I-D.ietf-ace-oauth-authz] 2805 Seitz, L., Selander, G., Wahlstroem, E., Erdtman, S., and 2806 H. Tschofenig, "Authentication and Authorization for 2807 Constrained Environments (ACE) using the OAuth 2.0 2808 Framework (ACE-OAuth)", draft-ietf-ace-oauth-authz-16 2809 (work in progress), October 2018. 2811 [I-D.ietf-anima-bootstrapping-keyinfra] 2812 Pritikin, M., Richardson, M., Behringer, M., Bjarnason, 2813 S., and K. Watsen, "Bootstrapping Remote Secure Key 2814 Infrastructures (BRSKI)", draft-ietf-anima-bootstrapping- 2815 keyinfra-16 (work in progress), June 2018. 2817 [I-D.silverajan-core-coap-protocol-negotiation] 2818 Silverajan, B. and M. Ocak, "CoAP Protocol Negotiation", 2819 draft-silverajan-core-coap-protocol-negotiation-09 (work 2820 in progress), July 2018. 2822 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 2823 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 2824 Transfer Protocol -- HTTP/1.1", RFC 2616, 2825 DOI 10.17487/RFC2616, June 1999, 2826 . 2828 [RFC6775] Shelby, Z., Ed., Chakrabarti, S., Nordmark, E., and C. 2829 Bormann, "Neighbor Discovery Optimization for IPv6 over 2830 Low-Power Wireless Personal Area Networks (6LoWPANs)", 2831 RFC 6775, DOI 10.17487/RFC6775, November 2012, 2832 . 2834 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 2835 Protocol (HTTP/1.1): Message Syntax and Routing", 2836 RFC 7230, DOI 10.17487/RFC7230, June 2014, 2837 . 2839 [RFC7252] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained 2840 Application Protocol (CoAP)", RFC 7252, 2841 DOI 10.17487/RFC7252, June 2014, 2842 . 2844 [RFC7390] Rahman, A., Ed. and E. Dijk, Ed., "Group Communication for 2845 the Constrained Application Protocol (CoAP)", RFC 7390, 2846 DOI 10.17487/RFC7390, October 2014, 2847 . 2849 [RFC7641] Hartke, K., "Observing Resources in the Constrained 2850 Application Protocol (CoAP)", RFC 7641, 2851 DOI 10.17487/RFC7641, September 2015, 2852 . 2854 [RFC8132] van der Stok, P., Bormann, C., and A. Sehgal, "PATCH and 2855 FETCH Methods for the Constrained Application Protocol 2856 (CoAP)", RFC 8132, DOI 10.17487/RFC8132, April 2017, 2857 . 2859 [RFC8288] Nottingham, M., "Web Linking", RFC 8288, 2860 DOI 10.17487/RFC8288, October 2017, 2861 . 2863 [RFC8392] Jones, M., Wahlstroem, E., Erdtman, S., and H. Tschofenig, 2864 "CBOR Web Token (CWT)", RFC 8392, DOI 10.17487/RFC8392, 2865 May 2018, . 2867 Appendix A. Registration Management 2869 This section describes how the registering endpoint can maintain the 2870 registries that it created. The registering endpoint can be the 2871 registrant-ep or the CT. An endpoint SHOULD NOT use this interface 2872 for registries that it did not create. The registries are resources 2873 of the RD. 2875 After the initial registration, the registering endpoint retains the 2876 returned location of the Registration Resource for further 2877 operations, including refreshing the registration in order to extend 2878 the lifetime and "keep-alive" the registration. When the lifetime of 2879 the registration has expired, the RD SHOULD NOT respond to discovery 2880 queries concerning this endpoint. The RD SHOULD continue to provide 2881 access to the Registration Resource after a registration time-out 2882 occurs in order to enable the registering endpoint to eventually 2883 refresh the registration. The RD MAY eventually remove the 2884 registration resource for the purpose of garbage collection and 2885 remove it from any group it belongs to. If the Registration Resource 2886 is removed, the corresponding endpoint will need to be re-registered. 2888 The Registration Resource may also be used to inspect the 2889 registration resource using GET, update the registration, cancel the 2890 registration using DELETE, do an endpoint lookup, or a group lookup. 2892 These operations are described below. 2894 A.1. Registration Update 2896 The update interface is used by the registering endpoint to refresh 2897 or update its registration with an RD. To use the interface, the 2898 registering endpoint sends a POST request to the registration 2899 resource returned by the initial registration operation. 2901 An update MAY update the lifetime- or the context- registration 2902 parameters "lt", "base" as in Section 5.3. Parameters that are not 2903 being changed SHOULD NOT be included in an update. Adding parameters 2904 that have not changed increases the size of the message but does not 2905 have any other implications. Parameters MUST be included as query 2906 parameters in an update operation as in Section 5.3. 2908 A registration update resets the timeout of the registration to the 2909 (possibly updated) lifetime of the registration, independent of 2910 whether a "lt" parameter was given. 2912 If the context of the registration is changed in an update, relative 2913 references submitted in the original registration or later updates 2914 are resolved anew against the new context. 2916 The registration update operation only describes the use of POST with 2917 an empty payload. Future standards might describe the semantics of 2918 using content formats and payloads with the POST method to update the 2919 links of a registration (see Appendix A.4). 2921 The update registration request interface is specified as follows: 2923 Interaction: EP -> RD 2925 Method: POST 2927 URI Template: {+location}{?lt,con,extra-attrs*} 2929 URI Template Variables: 2931 location := This is the Location returned by the RD as a result 2932 of a successful earlier registration. 2934 lt := Lifetime (optional). Lifetime of the registration in 2935 seconds. Range of 60-4294967295. If no lifetime is included, 2936 the previous last lifetime set on a previous update or the 2937 original registration (falling back to 90000) SHOULD be used. 2939 base := Base URI (optional). This parameter updates the Base URI 2940 established in the original registration to a new value. If 2941 the parameter is set in an update, it is stored by the RD as 2942 the new Base URI under which to interpret the relative links 2943 present in the payload of the original registration, following 2944 the same restrictions as in the registration. If the parameter 2945 is not set in the request but was set before, the previous Base 2946 URI value is kept unmodified. If the parameter is not set in 2947 the request and was not set before either, the source address 2948 and source port of the update request are stored as the Base 2949 URI. 2951 extra-attrs := Additional registration attributes (optional). As 2952 with the registration, the RD processes them if it knows their 2953 semantics. Otherwise, unknown attributes are stored as 2954 endpoint attributes, overriding any previously stored endpoint 2955 attributes of the same key. 2957 Content-Format: none (no payload) 2959 The following response codes are defined for this interface: 2961 Success: 2.04 "Changed" or 204 "No Content" if the update was 2962 successfully processed. 2964 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 2965 request. 2967 Failure: 4.04 "Not Found" or 404 "Not Found". Registration does not 2968 exist (e.g. may have expired). 2970 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 2971 Service could not perform the operation. 2973 HTTP support: YES 2975 If the registration update fails with a "Service Unavailable" 2976 response and a Max-Age option or Retry-After header, the registering 2977 endpoint SHOULD retry the operation after the time indicated. If the 2978 registration fails in another way, including request timeouts, or if 2979 the time indicated exceeds the remaining lifetime, the registering 2980 endpoint SHOULD attempt registration again. 2982 The following example shows how the registering endpoint updates its 2983 registration resource at an RD using this interface with the example 2984 location value: /rd/4521. 2986 Req: POST /rd/4521 2988 Res: 2.04 Changed 2990 The following example shows the registering endpoint updating its 2991 registration resource at an RD using this interface with the example 2992 location value: /rd/4521. The initial registration by the 2993 registering endpoint set the following values: 2995 o endpoint name (ep)=endpoint1 2997 o lifetime (lt)=500 2999 o Base URI (base)=coap://local-proxy-old.example.com:5683 3001 o payload of Figure 7 3003 The initial state of the Resource Directory is reflected in the 3004 following request: 3006 Req: GET /rd-lookup/res?ep=endpoint1 3008 Res: 2.01 Content 3009 Payload: 3010 ;ct=41; 3011 rt="temperature"; anchor="coap://spurious.example.com:5683", 3012 ;ct=41; 3013 rt="light-lux"; if="sensor"; 3014 anchor="coap://local-proxy-old.example.com:5683" 3016 The following example shows the registering endpoint changing the 3017 Base URI to "coaps://new.example.com:5684": 3019 Req: POST /rd/4521?base=coaps://new.example.com:5684 3021 Res: 2.04 Changed 3023 The consecutive query returns: 3025 Req: GET /rd-lookup/res?ep=endpoint1 3027 Res: 2.01 Content 3028 Payload: 3029 ;ct=41;rt="temperature"; 3030 anchor="coap://spurious.example.com:5683", 3031 ;ct=41;rt="light-lux"; 3032 if="sensor"; anchor="coaps://new.example.com:5684", 3034 A.2. Registration Removal 3036 Although RD entries have soft state and will eventually timeout after 3037 their lifetime, the registering endpoint SHOULD explicitly remove an 3038 entry from the RD if it knows it will no longer be available (for 3039 example on shut-down). This is accomplished using a removal 3040 interface on the RD by performing a DELETE on the endpoint resource. 3042 Removed registrations are implicitly removed from the groups to which 3043 they belong. 3045 The removal request interface is specified as follows: 3047 Interaction: EP -> RD 3049 Method: DELETE 3051 URI Template: {+location} 3053 URI Template Variables: 3055 location := This is the Location returned by the RD as a result 3056 of a successful earlier registration. 3058 The following response codes are defined for this interface: 3060 Success: 2.02 "Deleted" or 204 "No Content" upon successful deletion 3062 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 3063 request. 3065 Failure: 4.04 "Not Found" or 404 "Not Found". Registration does not 3066 exist (e.g. may have expired). 3068 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 3069 Service could not perform the operation. 3071 HTTP support: YES 3072 The following examples shows successful removal of the endpoint from 3073 the RD with example location value /rd/4521. 3075 Req: DELETE /rd/4521 3077 Res: 2.02 Deleted 3079 A.3. Read Endpoint Links 3081 Some registering endpoints may wish to manage their links as a 3082 collection, and may need to read the current set of links stored in 3083 the registration resource, in order to determine link maintenance 3084 operations. 3086 One or more links MAY be selected by using query filtering as 3087 specified in [RFC6690] Section 4.1 3089 If no links are selected, the Resource Directory SHOULD return an 3090 empty payload. 3092 The read request interface is specified as follows: 3094 Interaction: EP -> RD 3096 Method: GET 3098 URI Template: {+location}{?href,rel,rt,if,ct} 3100 URI Template Variables: 3102 location := This is the Location returned by the RD as a result 3103 of a successful earlier registration. 3105 href,rel,rt,if,ct := link relations and attributes specified in 3106 the query in order to select particular links based on their 3107 relations and attributes. "href" denotes the URI target of the 3108 link. See [RFC6690] Sec. 4.1 3110 The following response codes are defined for this interface: 3112 Success: 2.05 "Content" or 200 "OK" upon success with an 3113 "application/link-format", "application/link-format+cbor", or 3114 "application/link-format+json" payload. 3116 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 3117 request. 3119 Failure: 4.04 "Not Found" or 404 "Not Found". Registration does not 3120 exist (e.g. may have expired). 3122 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 3123 Service could not perform the operation. 3125 HTTP support: YES 3127 The following examples show successful read of the endpoint links 3128 from the RD, with example location value /rd/4521 and example 3129 registration payload of Figure 7. 3131 Req: GET /rd/4521 3133 Res: 2.01 Content 3134 Payload: 3135 ;ct=41;rt="temperature-c";if="sensor"; 3136 anchor="coap://spurious.example.com:5683", 3137 ;ct=41;rt="light-lux";if="sensor" 3139 A.4. Update Endpoint Links 3141 An iPATCH (or PATCH) update ([RFC8132]) can add, remove or change the 3142 links of a registration. 3144 Those operations are out of scope of this document, and will require 3145 media types suitable for modifying sets of links. 3147 A.5. Endpoint and group lookup 3149 Endpoint and group lookups result in links to registration resources 3150 and group resources, respectively. Endpoint registration resources 3151 are annotated with their endpoint names (ep), sectors (d, if present) 3152 and registration base URI (base) as well as a constant resource type 3153 (rt="core.rd-ep"); the lifetime (lt) is not reported. Additional 3154 endpoint attributes are added as link attributes to their endpoint 3155 link unless their specification says otherwise. 3157 Group resources are annotated with their group names (gp), sector (d, 3158 if present) and multicast address (base, if present) as well as a 3159 constant resource type (rt="core.rd-gp"). 3161 Serializations derived from Link Format, SHOULD present links to 3162 groups and endpoints in path-absolute form or, if required, as 3163 absolute references. (This approach avoids the RFC6690 ambiguities.) 3164 While Endpoint Lookup does expose the registration resources, the RD 3165 does not need to make them accessible to clients. Clients SHOULD NOT 3166 attempt to dereference or manipulate them. 3168 A Resource Directory can report endpoints or groups in lookup that 3169 are not hosted at the same address. Lookup clients MUST be prepared 3170 to see arbitrary URIs as registration or group resources in the 3171 results and treat them as opaque identifiers; the precise semantics 3172 of such links are left to future specifications. 3174 For groups, a Resource Directory as specified here does not provide a 3175 lookup mechanism for the resources that can be accessed on a group's 3176 multicast address (i.e. no lookup will return links like 3177 ";..." for a group registered 3178 with "base=coap://[ff35...]"). Such an additional lookup interface 3179 could be specified in an extension document. 3181 The following example shows a client performing an endpoint type (et) 3182 lookup with the value oic.d.sensor (which is currently a registered 3183 rt value): 3185 Req: GET /rd-lookup/ep?et=oic.d.sensor 3187 Res: 2.05 Content 3188 ;base="coap://[2001:db8:3::127]:61616";ep="node5"; 3189 et="oic.d.sensor";ct="40", 3190 ;base="coap://[2001:db8:3::129]:61616";ep="node7"; 3191 et="oic.d.sensor";ct="40";d="floor-3" 3193 The following example shows a client performing a group lookup for 3194 all groups: 3196 Req: GET /rd-lookup/gp 3198 Res: 2.05 Content 3199 ;gp="lights1";d="example.com"; 3200 base="coap://[ff35:30:2001:db8::1]", 3201 ;gp="lights2";d="example.com"; 3202 base="coap://[ff35:30:2001:db8::2]" 3204 The following example shows a client performing a lookup for all 3205 groups the endpoint "node1" belongs to: 3207 Req: GET /rd-lookup/gp?ep=node1 3209 Res: 2.05 Content 3210 ;gp="lights1" 3212 Appendix B. Web links and the Resource Directory 3214 Understanding the semantics of a link-format document and its URI 3215 references is a journey through different documents ([RFC3986] 3216 defining URIs, [RFC6690] defining link-format documents based on 3217 [RFC8288] which defines link headers, and [RFC7252] providing the 3218 transport). This appendix summarizes the mechanisms and semantics at 3219 play from an entry in ".well-known/core" to a resource lookup. 3221 This text is primarily aimed at people entering the field of 3222 Constrained Restful Environments from applications that previously 3223 did not use web mechanisms. 3225 B.1. A simple example 3227 Let's start this example with a very simple host, "2001:db8:f0::1". 3228 A client that follows classical CoAP Discovery ([RFC7252] Section 7), 3229 sends the following multicast request to learn about neighbours 3230 supporting resources with resource-type "temperature". 3232 The client sends a link-local multicast: 3234 GET coap://[ff02::fd]:5683/.well-known/core?rt=temperature 3236 RES 2.05 Content 3237 ;rt=temperature;ct=0 3239 where the response is sent by the server, "[2001:db8:f0::1]:5683". 3241 While the client - on the practical or implementation side - can just 3242 go ahead and create a new request to "[2001:db8:f0::1]:5683" with 3243 Uri-Path: "temp", the full resolution steps for insertion into and 3244 retrieval from the RD without any shortcuts are: 3246 B.1.1. Resolving the URIs 3248 The client parses the single returned record. The link's target 3249 (sometimes called "href") is ""/temp"", which is a relative URI that 3250 needs resolving. As long as all involved links follow the 3251 restrictions set forth for this document (see Appendix B.4), the base 3252 URI is used to resolve the 3253 reference /temp against. 3255 The Base URI of the requested resource can be composed from the 3256 header options of the CoAP GET request by following the steps of 3257 [RFC7252] section 6.5 (with an addition at the end of 8.2) into 3258 ""coap://[2001:db8:f0::1]/.well-known/core"". 3260 The record's target is resolved by replacing the path ""/.well-known/ 3261 core"" from the Base URI (section 5.2 [RFC3986]) with the relative 3262 target URI ""/temp"" into ""coap://[2001:db8:f0::1]/temp"". 3264 B.1.2. Interpreting attributes and relations 3266 Some more information but the record's target can be obtained from 3267 the payload: the resource type of the target is "temperature", and 3268 its content type is text/plain (ct=0). 3270 A relation in a web link is a three-part statement that specifies a 3271 named relation between the so-called "context resource" and the 3272 target resource, like "_This page_ has _its table of contents_ at _/ 3273 toc.html_". In [RFC6690] link-format documents, there is an implicit 3274 "host relation" specified with default parameter: rel="hosts". 3276 In our example, the context resource of the link is the URI specified 3277 in the GET request "coap:://[2001:db8:f0::1]/.well-known/core". A 3278 full English expression of the "host relation" is: 3280 '"coap://[2001:db8:f0::1]/.well-known/core" is hosting the resource 3281 "coap://[2001:db8:f0::1]/temp", which is of the resource type 3282 "temperature" and can be accessed using the text/plain content 3283 format.' 3285 B.2. A slightly more complex example 3287 Omitting the "rt=temperature" filter, the discovery query would have 3288 given some more records in the payload: 3290 GET coap://[ff02::fd]:5683/.well-known/core 3292 RES 2.05 Content 3293 ;rt=temperature;ct=0, 3294 ;rt=light-lux;ct=0, 3295 ;anchor="/sensors/temp";rel=alternate, 3296 ;anchor="/sensors/temp"; 3297 rel="describedby" 3299 Parsing the third record, the client encounters the "anchor" 3300 parameter. It is a URI relative to the Base URI of the request and 3301 is thus resolved to ""coap://[2001:db8:f0::1]/sensors/temp"". That 3302 is the context resource of the link, so the "rel" statement is not 3303 about the target and the Base URI any more, but about the target and 3304 the resolved URI. Thus, the third record could be read as 3305 ""coap://[2001:db8:f0::1]/sensors/temp" has an alternate 3306 representation at "coap://[2001:db8:f0::1]/t"". 3308 Following the same resolution steps, the fourth record can be read as 3309 ""coap://[2001:db8:f0::1]/sensors/temp" is described by 3310 "http://www.example.com/sensors/t123"". 3312 B.3. Enter the Resource Directory 3314 The resource directory tries to carry the semantics obtainable by 3315 classical CoAP discovery over to the resource lookup interface as 3316 faithfully as possible. 3318 For the following queries, we will assume that the simple host has 3319 used Simple Registration to register at the resource directory that 3320 was announced to it, sending this request from its UDP port 3321 "[2001:db8:f0::1]:6553": 3323 POST coap://[2001:db8:f01::ff]/.well-known/core?ep=simple-host1 3325 The resource directory would have accepted the registration, and 3326 queried the simple host's ".well-known/core" by itself. As a result, 3327 the host is registered as an endpoint in the RD with the name 3328 "simple-host1". The registration is active for 90000 seconds, and 3329 the endpoint registration Base URI is ""coap://[2001:db8:f0::1]/"" 3330 following the resolution steps described in Appendix B.1.1. It 3331 should be remarked that the Base URI constructed that way always 3332 yields a URI of the form: scheme://authority without path suffix. 3334 If the client now queries the RD as it would previously have issued a 3335 multicast request, it would go through the RD discovery steps by 3336 fetching "coap://[2001:db8:f0::ff]/.well-known/core?rt=core.rd- 3337 lookup-res", obtain "coap://[2001:db8:f0::ff]/rd-lookup/res" as the 3338 resource lookup endpoint, and issue a request to 3339 "coap://[2001:db8:f0::ff]/rd-lookup/res?rt=temperature" to receive 3340 the following data: 3342 ;rt=temperature;ct=0; 3343 anchor="coap://[2001:db8:f0::1]" 3345 This is not _literally_ the same response that it would have received 3346 from a multicast request, but it contains the equivalent statement: 3348 '"coap://[2001:db8:f0::1]" is hosting the resource 3349 "coap://[2001:db8:f0::1]/temp", which is of the resource type 3350 "temperature" and can be accessed using the text/plain content 3351 format.' 3353 (The difference is whether "/" or "/.well-known/core" hosts the 3354 resources, which is subject of ongoing discussion about RFC6690). 3356 Actually, /.well-known/core does NOT host the resource but stores a 3357 URI reference to the resource. 3359 To complete the examples, the client could also query all resources 3360 hosted at the endpoint with the known endpoint name "simple-host1". 3361 A request to "coap://[2001:db8:f0::ff]/rd-lookup/res?ep=simple-host1" 3362 would return 3364 ;rt=temperature;ct=0; 3365 anchor="coap://[2001:db8:f0::1]", 3366 ;rt=light-lux;ct=0; 3367 anchor="coap://[2001:db8:f0::1]", 3368 ; 3369 anchor="coap://[2001:db8:f0::1]/sensors/temp";rel=alternate, 3370 ; 3371 anchor="coap://[2001:db8:f0::1]/sensors/temp";rel="describedby" 3373 All the target and anchor references are already in absolute form 3374 there, which don't need to be resolved any further. 3376 Had the simple host registered with a base= parameter (e.g. 3377 "?ep=simple-host1&base=coap+tcp://simple-host1.example.com"), that 3378 context would have been used to resolve the relative anchor values 3379 instead, giving 3381 ;rt=temperature;ct=0; 3382 anchor="coap+tcp://simple-host1.example.com" 3384 and analogous records. 3386 B.4. A note on differences between link-format and Link headers 3388 While link-format and Link headers look very similar and are based on 3389 the same model of typed links, there are some differences between 3390 [RFC6690] and [RFC5988], which are dealt with differently: 3392 o "Resolving the target against the anchor": [RFC6690] Section 2.1 3393 states that the anchor of a link is used as the Base URI against 3394 which the term inside the angle brackets (the target) is resolved, 3395 falling back to the resource's URI with paths stripped off (its 3396 "Origin"). In contrast to that, [RFC8288] Section B.2 describes 3397 that the anchor is immaterial to the resolution of the target 3398 reference. 3400 RFC6690, in the same section, also states that absent anchors set 3401 the context of the link to the target's URI with its path stripped 3402 off, while according to [RFC8288] Section 3.2, the context is the 3403 resource's base URI. 3405 In the context of a Resource Directory, the authors decided to not 3406 let this become an issue by recommending that links in the 3407 Resource Directory be _deserializable_ by either rule set to give 3408 the same results. Note that all examples of [RFC6690], [RFC8288] 3409 and this document comply with that rule. 3411 The Modernized Link Format is introduced in Appendix D to 3412 formalize what it means to apply the ruleset of RFC8288 to Link 3413 Format documents. 3415 o There is no percent encoding in link-format documents. 3417 A link-format document is a UTF-8 encoded string of Unicode 3418 characters and does not have percent encoding, while Link headers 3419 are practically ASCII strings that use percent encoding for non- 3420 ASCII characters, stating the encoding explicitly when required. 3422 For example, while a Link header in a page about a Swedish city 3423 might read 3425 "Link: ;rel="live-environment-data"" 3427 a link-format document from the same source might describe the 3428 link as 3430 ";rel="live-environment-data"" 3432 Parsers and producers of link-format and header data need to be 3433 aware of this difference. 3435 Appendix C. Syntax examples for Protocol Negotiation 3437 [ This appendix should not show up in a published version of this 3438 document. ] 3440 The protocol negotiation that is being worked on in 3441 [I-D.silverajan-core-coap-protocol-negotiation] makes use of the 3442 Resource Directory. 3444 Until that document is update to use the latest resource-directory 3445 specification, here are some examples of protocol negotiation with 3446 the current Resource Directory: 3448 An endpoint could register as follows from its address 3449 [2001:db8:f1::2]:5683: 3451 Req: POST coap://rd.example.com/rd?ep=node1 3452 &at=coap+tcp://[2001:db8:f1::2] 3453 Content-Format: 40 3454 Payload: 3455 ;ct=0;rt="temperature";if="core.s" 3457 Res: 2.01 Created 3458 Location-Path: /rd/1234 3460 An endpoint lookup would just reflect the registered attributes: 3462 Req: GET /rd-lookup/ep 3464 Res: 2.05 Content 3465 ;ep="node1";base="coap://[2001:db8:f1::2]:5683"; 3466 at="coap+tcp://[2001:db8:f1::2]" 3468 A UDP client would then see the following in a resource lookup: 3470 Req: GET /rd-lookup/res?rt=temperature 3472 Res: 2.05 Content 3473 ;ct=0;rt="temperature"; 3474 if="core.s"; anchor="coap://[2001:db8:f1::2]" 3476 while a TCP capable client could say: 3478 Req: GET /rd-lookup/res?rt=temperature&tt=tcp 3480 Res: 2.05 Content 3481 ;ct=0;rt="temperature"; 3482 if="core.s";anchor="coap+tcp://[2001:db8:f1::2]" 3484 Appendix D. Modernized Link Format parsing 3486 The CoRE Link Format as described in [RFC6690] is unsuitable for some 3487 use cases of the Resource Directory, and their resolution scheme is 3488 often misunderstood by developers familiar with [RFC8288]. 3490 For the correct application of base URIs, we describe the 3491 interpretation of a Link Format document as a Modernized Link Format. 3492 In Modernized Link Format, the document is processed as in Link 3493 Format, with the exception of Section 2.1 of [RFC6690]: 3495 o The URI-reference inside angle brackets ("<>") describes the 3496 target URI of the link. 3498 o The context of the link is expressed by the "anchor" parameter. 3499 If the anchor attribute is absent, it defaults to the empty 3500 reference (""). 3502 o Both these references are resolved according to Section 5 of 3503 [RFC3986]. 3505 Content formats derived from [RFC6690] which inherit its resolution 3506 rules, like JSON and CBOR link format of [I-D.ietf-core-links-json], 3507 can be interpreted in analogy to that. 3509 For where the Resource Directory is concerned, all common forms of 3510 links (e.g. all the examples of RFC6690) yield identical results. 3511 When interpreting data read from ".well-known/core", differences in 3512 interpretation only affect links where the absent anchor attribute 3513 means "coap://host/" according to RFC6690 and "coap://host/.well- 3514 known/core" according to Modernized Link format; those typically only 3515 occur in conjunction with the vaguely defined implicit "hosts" 3516 relationship. 3518 D.1. For endpoint developers 3520 When developing endpoints, i.e. when generating documents that will 3521 be submitted to a Resource Directory, the differences between 3522 Modernized Link Format and RFC6690 can be ignored as long as all 3523 relative references start with a slash, and any of the following 3524 applies: 3526 o There is no anchor attribute, and the context of the link does not 3527 matter to the application. 3529 Example: ";ct=40" 3531 o The anchor is a relative reference. 3533 Example: ";anchor="/sensors/temp";rel="alternate" 3535 o The target is an absolute reference. 3537 Example: ";anchor="/sensors/ 3538 temp";rel="describedby"" 3540 Authors' Addresses 3541 Zach Shelby 3542 ARM 3543 150 Rose Orchard 3544 San Jose 95134 3545 USA 3547 Phone: +1-408-203-9434 3548 Email: zach.shelby@arm.com 3550 Michael Koster 3551 SmartThings 3552 665 Clyde Avenue 3553 Mountain View 94043 3554 USA 3556 Phone: +1-707-502-5136 3557 Email: Michael.Koster@smartthings.com 3559 Carsten Bormann 3560 Universitaet Bremen TZI 3561 Postfach 330440 3562 Bremen D-28359 3563 Germany 3565 Phone: +49-421-218-63921 3566 Email: cabo@tzi.org 3568 Peter van der Stok 3569 consultant 3571 Phone: +31-492474673 (Netherlands), +33-966015248 (France) 3572 Email: consultancy@vanderstok.org 3573 URI: www.vanderstok.org 3575 Christian Amsuess (editor) 3576 Hollandstr. 12/4 3577 1020 3578 Austria 3580 Phone: +43-664-9790639 3581 Email: christian@amsuess.com