idnits 2.17.1 draft-ietf-core-resource-directory-17.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 403 has weird spacing: '... target o----...' == Line 405 has weird spacing: '...--o rel o...' == Line 469 has weird spacing: '...o href o----...' == Line 473 has weird spacing: '... o ep o---...' == Line 481 has weird spacing: '... o lt o---...' == (2 more instances...) -- The document date (October 23, 2018) is 2011 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 2694, but no explicit reference was found in the text == Unused Reference: 'I-D.ietf-anima-bootstrapping-keyinfra' is defined on line 2711, but no explicit reference was found in the text == Unused Reference: 'RFC2616' is defined on line 2722, but no explicit reference was found in the text == Unused Reference: 'RFC8392' is defined on line 2763, 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 (~~), 16 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 CoRE Z. Shelby 3 Internet-Draft ARM 4 Intended status: Standards Track M. Koster 5 Expires: April 26, 2019 SmartThings 6 C. Bormann 7 Universitaet Bremen TZI 8 P. van der Stok 9 consultant 10 C. Amsuess, Ed. 11 October 23, 2018 13 CoRE Resource Directory 14 draft-ietf-core-resource-directory-17 16 Abstract 18 In many M2M applications, direct discovery of resources is not 19 practical due to sleeping nodes, disperse networks, or networks where 20 multicast traffic is inefficient. These problems can be solved by 21 employing an entity called a Resource Directory (RD), which hosts 22 registrations of resources held on other servers, allowing lookups to 23 be performed for those resources. This document specifies the web 24 interfaces that a Resource Directory supports for web servers to 25 discover the RD and to register, maintain, lookup and remove resource 26 descriptions. Furthermore, new link attributes useful in conjunction 27 with an RD are defined. 29 Status of This Memo 31 This Internet-Draft is submitted in full conformance with the 32 provisions of BCP 78 and BCP 79. 34 Internet-Drafts are working documents of the Internet Engineering 35 Task Force (IETF). Note that other groups may also distribute 36 working documents as Internet-Drafts. The list of current Internet- 37 Drafts is at https://datatracker.ietf.org/drafts/current/. 39 Internet-Drafts are draft documents valid for a maximum of six months 40 and may be updated, replaced, or obsoleted by other documents at any 41 time. It is inappropriate to use Internet-Drafts as reference 42 material or to cite them other than as "work in progress." 44 This Internet-Draft will expire on April 26, 2019. 46 Copyright Notice 48 Copyright (c) 2018 IETF Trust and the persons identified as the 49 document authors. All rights reserved. 51 This document is subject to BCP 78 and the IETF Trust's Legal 52 Provisions Relating to IETF Documents 53 (https://trustee.ietf.org/license-info) in effect on the date of 54 publication of this document. Please review these documents 55 carefully, as they describe your rights and restrictions with respect 56 to this document. Code Components extracted from this document must 57 include Simplified BSD License text as described in Section 4.e of 58 the Trust Legal Provisions and are provided without warranty as 59 described in the Simplified BSD License. 61 Table of Contents 63 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 64 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 4 65 3. Architecture and Use Cases . . . . . . . . . . . . . . . . . 6 66 3.1. Principles . . . . . . . . . . . . . . . . . . . . . . . 6 67 3.2. Architecture . . . . . . . . . . . . . . . . . . . . . . 7 68 3.3. RD Content Model . . . . . . . . . . . . . . . . . . . . 8 69 3.4. Use Case: Cellular M2M . . . . . . . . . . . . . . . . . 12 70 3.5. Use Case: Home and Building Automation . . . . . . . . . 13 71 3.6. Use Case: Link Catalogues . . . . . . . . . . . . . . . . 13 72 4. Finding a Resource Directory . . . . . . . . . . . . . . . . 14 73 4.1. Resource Directory Address Option (RDAO) . . . . . . . . 15 74 5. Resource Directory . . . . . . . . . . . . . . . . . . . . . 17 75 5.1. Payload Content Formats . . . . . . . . . . . . . . . . . 17 76 5.2. URI Discovery . . . . . . . . . . . . . . . . . . . . . . 17 77 5.3. Registration . . . . . . . . . . . . . . . . . . . . . . 20 78 5.3.1. Simple Registration . . . . . . . . . . . . . . . . . 25 79 5.3.2. Third-party registration . . . . . . . . . . . . . . 27 80 5.3.3. RD-Groups . . . . . . . . . . . . . . . . . . . . . . 28 81 6. RD Lookup . . . . . . . . . . . . . . . . . . . . . . . . . . 29 82 6.1. Resource lookup . . . . . . . . . . . . . . . . . . . . . 29 83 6.2. Lookup filtering . . . . . . . . . . . . . . . . . . . . 30 84 6.3. Resource lookup examples . . . . . . . . . . . . . . . . 32 85 7. Security policies . . . . . . . . . . . . . . . . . . . . . . 35 86 7.1. Secure RD discovery . . . . . . . . . . . . . . . . . . . 36 87 7.2. Secure RD filtering . . . . . . . . . . . . . . . . . . . 37 88 7.3. Secure endpoint Name assignment . . . . . . . . . . . . . 37 89 8. Security Considerations . . . . . . . . . . . . . . . . . . . 37 90 8.1. Endpoint Identification and Authentication . . . . . . . 38 91 8.2. Access Control . . . . . . . . . . . . . . . . . . . . . 38 92 8.3. Denial of Service Attacks . . . . . . . . . . . . . . . . 38 93 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 39 94 9.1. Resource Types . . . . . . . . . . . . . . . . . . . . . 39 95 9.2. IPv6 ND Resource Directory Address Option . . . . . . . . 39 96 9.3. RD Parameter Registry . . . . . . . . . . . . . . . . . . 39 97 9.3.1. Full description of the "Endpoint Type" Registration 98 Parameter . . . . . . . . . . . . . . . . . . . . . . 42 99 9.4. "Endpoint Type" (et=) RD Parameter values . . . . . . . . 42 100 9.5. Multicast Address Registration . . . . . . . . . . . . . 43 101 10. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 43 102 10.1. Lighting Installation . . . . . . . . . . . . . . . . . 43 103 10.1.1. Installation Characteristics . . . . . . . . . . . . 43 104 10.1.2. RD entries . . . . . . . . . . . . . . . . . . . . . 44 105 10.2. OMA Lightweight M2M (LWM2M) Example . . . . . . . . . . 47 106 10.2.1. The LWM2M Object Model . . . . . . . . . . . . . . . 48 107 10.2.2. LWM2M Register Endpoint . . . . . . . . . . . . . . 49 108 10.2.3. LWM2M Update Endpoint Registration . . . . . . . . . 51 109 10.2.4. LWM2M De-Register Endpoint . . . . . . . . . . . . . 51 110 11. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 51 111 12. Changelog . . . . . . . . . . . . . . . . . . . . . . . . . . 51 112 13. References . . . . . . . . . . . . . . . . . . . . . . . . . 58 113 13.1. Normative References . . . . . . . . . . . . . . . . . . 58 114 13.2. Informative References . . . . . . . . . . . . . . . . . 59 115 Appendix A. Registration Management . . . . . . . . . . . . . . 61 116 A.1. Registration Update . . . . . . . . . . . . . . . . . . . 62 117 A.2. Registration Removal . . . . . . . . . . . . . . . . . . 65 118 A.3. Read Endpoint Links . . . . . . . . . . . . . . . . . . . 66 119 A.4. Update Endpoint Links . . . . . . . . . . . . . . . . . . 67 120 A.5. Endpoint lookup . . . . . . . . . . . . . . . . . . . . . 67 121 Appendix B. Web links and the Resource Directory . . . . . . . . 68 122 B.1. A simple example . . . . . . . . . . . . . . . . . . . . 68 123 B.1.1. Resolving the URIs . . . . . . . . . . . . . . . . . 69 124 B.1.2. Interpreting attributes and relations . . . . . . . . 69 125 B.2. A slightly more complex example . . . . . . . . . . . . . 69 126 B.3. Enter the Resource Directory . . . . . . . . . . . . . . 70 127 B.4. A note on differences between link-format and Link 128 headers . . . . . . . . . . . . . . . . . . . . . . . . . 72 129 Appendix C. Syntax examples for Protocol Negotiation . . . . . . 73 130 Appendix D. Modernized Link Format parsing . . . . . . . . . . . 74 131 D.1. For endpoint developers . . . . . . . . . . . . . . . . . 74 132 D.2. Examples of links with differing interpretations . . . . 75 133 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 75 135 1. Introduction 137 The work on Constrained RESTful Environments (CoRE) aims at realizing 138 the REST architecture in a suitable form for the most constrained 139 nodes (e.g., 8-bit microcontrollers with limited RAM and ROM) and 140 networks (e.g. 6LoWPAN). CoRE is aimed at machine-to-machine (M2M) 141 applications such as smart energy and building automation. 143 The discovery of resources offered by a constrained server is very 144 important in machine-to-machine applications where there are no 145 humans in the loop and static interfaces result in fragility. The 146 discovery of resources provided by an HTTP Web Server is typically 147 called Web Linking [RFC5988]. The use of Web Linking for the 148 description and discovery of resources hosted by constrained web 149 servers is specified by the CoRE Link Format [RFC6690]. However, 150 [RFC6690] only describes how to discover resources from the web 151 server that hosts them by querying "/.well-known/core". In many M2M 152 scenarios, direct discovery of resources is not practical due to 153 sleeping nodes, disperse networks, or networks where multicast 154 traffic is inefficient. These problems can be solved by employing an 155 entity called a Resource Directory (RD), which hosts registrations of 156 resources held on other servers, allowing lookups to be performed for 157 those resources. 159 This document specifies the web interfaces that a Resource Directory 160 supports for web servers to discover the RD and to register, 161 maintain, lookup and remove resource descriptions. Furthermore, new 162 link attributes useful in conjunction with a Resource Directory are 163 defined. Although the examples in this document show the use of 164 these interfaces with CoAP [RFC7252], they can be applied in an 165 equivalent manner to HTTP [RFC7230]. 167 2. Terminology 169 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 170 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 171 "OPTIONAL" in this document are to be interpreted as described in 172 [RFC2119]. The term "byte" is used in its now customary sense as a 173 synonym for "octet". 175 This specification requires readers to be familiar with all the terms 176 and concepts that are discussed in [RFC3986], [RFC5988] and 177 [RFC6690]. Readers should also be familiar with the terms and 178 concepts discussed in [RFC7252]. To describe the REST interfaces 179 defined in this specification, the URI Template format is used 180 [RFC6570]. 182 This specification makes use of the following additional terminology: 184 resolve against 185 The expression "a URI-reference is _resolved against_ a base URI" 186 is used to describe the process of [RFC3986] Section 5.2. 187 Noteworthy corner cases are that if the URI-reference is a (full) 188 URI and resolved against any base URI, that gives the original 189 full URI, and that resolving an empty URI reference gives the base 190 URI without any fragment identifier. 192 Resource Directory 193 A web entity that stores information about web resources and 194 implements the REST interfaces defined in this specification for 195 registration and lookup of those resources. 197 Sector 198 In the context of a Resource Directory, a sector is a logical 199 grouping of endpoints. 201 The abbreviation "d=" is used for the sector in query parameters 202 for compatibility with deployed implementations. 204 Endpoint 205 Endpoint (EP) is a term used to describe a web server or client in 206 [RFC7252]. In the context of this specification an endpoint is 207 used to describe a web server that registers resources to the 208 Resource Directory. An endpoint is identified by its endpoint 209 name, which is included during registration, and has a unique name 210 within the associated sector of the registration. 212 Registration Base URI 213 The Base URI of a Registration is a URI that typically gives 214 scheme and authority information about an Endpoint. The 215 Registration Base URI is provided at registration time, and is 216 used by the Resource Directory to resolve relative references of 217 the registration into URIs. 219 Target 220 The target of a link is the destination address (URI) of the link. 221 It is sometimes identified with "href=", or displayed as 222 "". Relative targets need resolving with respect to the 223 Base URI (section 5.2 of [RFC3986]). 225 This use of the term Target is consistent with [RFC8288]'s use of 226 the term. 228 Context 229 The context of a link is the source address (URI) of the link, and 230 describes which resource is linked to the target. A link's 231 context is made explicit in serialized links as the "anchor=" 232 attribute. 234 This use of the term Context is consistent with [RFC8288]'s use of 235 the term. 237 Directory Resource 238 A resource in the Resource Directory (RD) containing registration 239 resources. 241 Registration Resource 242 A resource in the RD that contains information about an Endpoint 243 and its links. 245 Commissioning Tool 246 Commissioning Tool (CT) is a device that assists during the 247 installation of the network by assigning values to parameters, 248 naming endpoints and groups, or adapting the installation to the 249 needs of the applications. 251 Registrant-ep 252 Registrant-ep is the endpoint that is registered into the RD. The 253 registrant-ep can register itself, or a CT registers the 254 registrant-ep. 256 RDAO 257 Resource Directory Address Option. 259 For several operations, interface descriptions are given in list 260 form; those describe the operation participants, request codes, URIs, 261 content formats and outcomes. Those templates contain normative 262 content in their Interaction, Method, URI Template and URI Template 263 Variables sections as well as the details of the Success condition. 264 The additional sections on options like Content-Format and on Failure 265 codes give typical cases that an implementation of the RD should deal 266 with. Those serve to illustrate the typical responses to readers who 267 are not yet familiar with all the details of CoAP based interfaces; 268 they do not limit what a server may respond under atypical 269 circumstances. 271 3. Architecture and Use Cases 273 3.1. Principles 275 The Resource Directory is primarily a tool to make discovery 276 operations more efficient than querying /.well-known/core on all 277 connected devices, or across boundaries that would be limiting those 278 operations. 280 It provides a cache (in the high-level sense, not as defined in 281 [RFC7252]/[RFC2616]) of data that could otherwise only be obtained by 282 directly querying the /.well-known/core resource on the target 283 device, or by accessing those resources with a multicast request. 285 Only information SHOULD be stored in the resource directory that is 286 discoverable from querying the described device's /.well-known/core 287 resource directly. 289 Data in the resource directory can only be provided by the device 290 which hosts those data or a dedicated Commissioning Tool (CT). These 291 CTs are thought to act on behalf of endpoints too constrained, or 292 generally unable, to present that information themselves. No other 293 client can modify data in the resource directory. Changes in the 294 Resource Directory do not propagate automatically back to the web 295 server from where the links originated. 297 3.2. Architecture 299 The resource directory architecture is illustrated in Figure 1. A 300 Resource Directory (RD) is used as a repository for Web Links 301 [RFC5988] describing resources hosted on other web servers, also 302 called endpoints (EP). An endpoint is a web server associated with a 303 scheme, IP address and port. A physical node may host one or more 304 endpoints. The RD implements a set of REST interfaces for endpoints 305 to register and maintain sets of Web Links (called resource directory 306 registration entries), and for endpoints to lookup resources from the 307 RD. An RD can be logically segmented by the use of Sectors. This 308 information hierarchy is shown in Figure 2. 310 A mechanism to discover an RD using CoRE Link Format [RFC6690] is 311 defined. 313 Registration entries in the RD are soft state and need to be 314 periodically refreshed. 316 An endpoint uses specific interfaces to register, update and remove a 317 resource directory registration entry. It is also possible for an RD 318 to fetch Web Links from endpoints and add them as resource directory 319 registration entries. 321 At the first registration of a set of entries, a "registration 322 resource" is created, the location of which is returned to the 323 registering endpoint. The registering endpoint uses this 324 registration resource to manage the contents of registration entries. 326 A lookup interface for discovering any of the Web Links held in the 327 RD is provided using the CoRE Link Format. 329 Registration Lookup 330 Interface Interface 331 +----+ | | 332 | EP |---- | | 333 +----+ ---- | | 334 --|- +------+ | 335 +----+ | ----| | | +--------+ 336 | EP | ---------|-----| RD |----|-----| Client | 337 +----+ | ----| | | +--------+ 338 --|- +------+ | 339 +----+ ---- | | 340 | EP |---- | | 341 +----+ 343 Figure 1: The resource directory architecture. 345 +------------+ 346 | Endpoint | <-- Name, Scheme, IP, Port 347 +------------+ 348 | 349 | 350 +------------+ 351 | Resource | <-- Target, Parameters 352 +------------+ 354 Figure 2: The resource directory information hierarchy. 356 A Registrant-EP MAY keep concurrent registrations to more than one RD 357 at the same time if explicitly configured to do so, but that is not 358 expected to be supported by typical EP implementations. Any such 359 registrations are independent of each other. The usual expectation 360 when multiple discovery mechanisms or addresses are configured is 361 that they constitute a fallback path for a single registration. 363 3.3. RD Content Model 365 The Entity-Relationship (ER) models shown in Figure 3 and Figure 4 366 model the contents of /.well-known/core and the resource directory 367 respectively, with entity-relationship diagrams [ER]. Entities 368 (rectangles) are used for concepts that exist independently. 369 Attributes (ovals) are used for concepts that exist only in 370 connection with a related entity. Relations (diamonds) give a 371 semantic meaning to the relation between entities. Numbers specify 372 the cardinality of the relations. 374 Some of the attribute values are URIs. Those values are always full 375 URIs and never relative references in the information model. They 376 can, however, be expressed as relative references in serializations, 377 and often are. 379 These models provide an abstract view of the information expressed in 380 link-format documents and a Resource Directory. They cover the 381 concepts, but not necessarily all details of an RD's operation; they 382 are meant to give an overview, and not be a template for 383 implementations. 385 +----------------------+ 386 | /.well-known/core | 387 +----------------------+ 388 | 389 | 1 390 ////////\\\\\\\ 391 < contains > 392 \\\\\\\\/////// 393 | 394 | 0+ 395 +--------------------+ 396 | link | 397 +--------------------+ 398 | 399 | 1 oooooooo 400 +-----o target o 401 | oooooooo 402 oooooooooooo 0+ | 403 o target o--------+ 404 o attribute o | 0+ oooooo 405 oooooooooooo +-----o rel o 406 | oooooo 407 | 408 | 1 ooooooooo 409 +-----o context o 410 ooooooooo 412 Figure 3: E-R Model of the content of /.well-known/core 414 The model shown in Figure 3 models the contents of /.well-known/core 415 which contains: 417 o a set of links belonging to the hosting web server 418 The web server is free to choose links it deems appropriate to be 419 exposed in its ".well-known/core". Typically, the links describe 420 resources that are served by the host, but the set can also contain 421 links to resources on other servers (see examples in [RFC6690] page 422 14). The set does not necessarily contain links to all resources 423 served by the host. 425 A link has the following attributes (see [RFC5988]): 427 o Zero or more link relations: They describe relations between the 428 link context and the link target. 430 In link-format serialization, they are expressed as space- 431 separated values in the "rel" attribute, and default to "hosts". 433 o A link context URI: It defines the source of the relation, e.g. 434 _who_ "hosts" something. 436 In link-format serialization, it is expressed in the "anchor" 437 attribute. It defaults to that document's URI. 439 o A link target URI: It defines the destination of the relation 440 (e.g. _what_ is hosted), and is the topic of all target 441 attributes. 443 In link-format serialization, it is expressed between angular 444 brackets, and sometimes called the "href". 446 o Other target attributes (e.g. resource type (rt), interface (if), 447 or content-type (ct)). These provide additional information about 448 the target URI. 450 +----------------------+ 451 | resource-directory | 452 +----------------------+ 453 | 1 454 | 455 | 456 | 457 | 458 //////\\\\ 459 < contains > 460 \\\\\///// 461 | 462 0+ | 463 ooooooo 1 +---------------+ 464 o base o-------| registration | 465 ooooooo +---------------+ 466 | | 1 467 | +--------------+ 468 oooooooo 1 | | 469 o href o----+ /////\\\\ 470 oooooooo | < contains > 471 | \\\\\///// 472 oooooooo 1 | | 473 o ep o----+ | 0+ 474 oooooooo | +------------------+ 475 | | link | 476 oooooooo 0-1 | +------------------+ 477 o d o----+ | 478 oooooooo | | 1 oooooooo 479 | +-----o target o 480 oooooooo 1 | | oooooooo 481 o lt o----+ ooooooooooo 0+ | 482 oooooooo | o target o-----+ 483 | o attribute o | 0+ oooooo 484 ooooooooooo 0+ | ooooooooooo +-----o rel o 485 o endpoint o----+ | oooooo 486 o attribute o | 487 ooooooooooo | 1 ooooooooo 488 +----o context o 489 ooooooooo 491 Figure 4: E-R Model of the content of the Resource Directory 493 The model shown in Figure 4 models the contents of the resource 494 directory which contains in addition to /.well-known/core: 496 o 0 to n Registration (entries) of endpoints, 497 A registration is associated with one endpoint. A registration 498 defines a set of links as defined for /.well-known/core. A 499 Registration has six types of attributes: 501 o a unique endpoint name ("ep") within a sector 503 o a Registration Base URI ("base", a URI typically describing the 504 scheme://authority part) 506 o a lifetime ("lt"), 508 o a registration resource location inside the RD ("href"), 510 o optionally a sector ("d") 512 o optional additional endpoint attributes (from Section 9.3) 514 The cardinality of "base" is currently 1; future documents are 515 invited to extend the RD specification to support multiple values 516 (e.g. [I-D.silverajan-core-coap-protocol-negotiation]). Its value 517 is used as a Base URI when resolving URIs in the links contained in 518 the endpoint. 520 Links are modelled as they are in Figure 3. 522 3.4. Use Case: Cellular M2M 524 Over the last few years, mobile operators around the world have 525 focused on development of M2M solutions in order to expand the 526 business to the new type of users: machines. The machines are 527 connected directly to a mobile network using an appropriate embedded 528 wireless interface (GSM/GPRS, WCDMA, LTE) or via a gateway providing 529 short and wide range wireless interfaces. From the system design 530 point of view, the ambition is to design horizontal solutions that 531 can enable utilization of machines in different applications 532 depending on their current availability and capabilities as well as 533 application requirements, thus avoiding silo like solutions. One of 534 the crucial enablers of such design is the ability to discover 535 resources (machines -- endpoints) capable of providing required 536 information at a given time or acting on instructions from the end 537 users. 539 Imagine a scenario where endpoints installed on vehicles enable 540 tracking of the position of these vehicles for fleet management 541 purposes and allow monitoring of environment parameters. During the 542 boot-up process endpoints register with a Resource Directory, which 543 is hosted by the mobile operator or somewhere in the cloud. 545 Periodically, these endpoints update their registration and may 546 modify resources they offer. 548 When endpoints are not always connected, for example because they 549 enter a sleep mode, a remote server is usually used to provide proxy 550 access to the endpoints. Mobile apps or web applications for 551 environment monitoring contact the RD, look up the endpoints capable 552 of providing information about the environment using an appropriate 553 set of link parameters, obtain information on how to contact them 554 (URLs of the proxy server), and then initiate interaction to obtain 555 information that is finally processed, displayed on the screen and 556 usually stored in a database. Similarly, fleet management systems 557 provide the appropriate link parameters to the RD to look up for EPs 558 deployed on the vehicles the application is responsible for. 560 3.5. Use Case: Home and Building Automation 562 Home and commercial building automation systems can benefit from the 563 use of M2M web services. The discovery requirements of these 564 applications are demanding. Home automation usually relies on run- 565 time discovery to commission the system, whereas in building 566 automation a combination of professional commissioning and run-time 567 discovery is used. Both home and building automation involve peer- 568 to-peer interactions between endpoints, and involve battery-powered 569 sleeping devices. 571 3.6. Use Case: Link Catalogues 573 Resources may be shared through data brokers that have no knowledge 574 beforehand of who is going to consume the data. Resource Directory 575 can be used to hold links about resources and services hosted 576 anywhere to make them discoverable by a general class of 577 applications. 579 For example, environmental and weather sensors that generate data for 580 public consumption may provide data to an intermediary server, or 581 broker. Sensor data are published to the intermediary upon changes 582 or at regular intervals. Descriptions of the sensors that resolve to 583 links to sensor data may be published to a Resource Directory. 584 Applications wishing to consume the data can use RD Lookup to 585 discover and resolve links to the desired resources and endpoints. 586 The Resource Directory service need not be coupled with the data 587 intermediary service. Mapping of Resource Directories to data 588 intermediaries may be many-to-many. 590 Metadata in web link formats like [RFC6690] which may be internally 591 stored as triples, or relation/attribute pairs providing metadata 592 about resource links, need to be supported by Resource Directories . 594 External catalogues that are represented in other formats may be 595 converted to common web linking formats for storage and access by 596 Resource Directories. Since it is common practice for these to be 597 URN encoded, simple and lossless structural transforms should 598 generally be sufficient to store external metadata in Resource 599 Directories. 601 The additional features of Resource Directory allow sectors to be 602 defined to enable access to a particular set of resources from 603 particular applications. This provides isolation and protection of 604 sensitive data when needed. Application groups with multicast 605 addresses may be defined to support efficient data transport. 607 4. Finding a Resource Directory 609 A (re-)starting device may want to find one or more resource 610 directories for discovery purposes. 612 The device may be pre-configured to exercise specific mechanisms for 613 finding the resource directory: 615 1. It may be configured with a specific IP address for the RD. That 616 IP address may also be an anycast address, allowing the network 617 to forward RD requests to an RD that is topologically close; each 618 target network environment in which some of these preconfigured 619 nodes are to be brought up is then configured with a route for 620 this anycast address that leads to an appropriate RD. (Instead 621 of using an anycast address, a multicast address can also be 622 preconfigured. The RD servers then need to configure one of 623 their interfaces with this multicast address.) 625 2. It may be configured with a DNS name for the RD and use DNS to 626 return the IP address of the RD; it can find a DNS server to 627 perform the lookup using the usual mechanisms for finding DNS 628 servers. 630 3. It may be configured to use a service discovery mechanism such as 631 DNS-SD [RFC6763]. The present specification suggests configuring 632 the service with name rd._sub._coap._udp, preferably within the 633 domain of the querying nodes. 635 For cases where the device is not specifically configured with a way 636 to find a resource directory, the network may want to provide a 637 suitable default. 639 1. If the address configuration of the network is performed via 640 SLAAC, this is provided by the RDAO option Section 4.1. 642 2. If the address configuration of the network is performed via 643 DHCP, this could be provided via a DHCP option (no such option is 644 defined at the time of writing). 646 Finally, if neither the device nor the network offers any specific 647 configuration, the device may want to employ heuristics to find a 648 suitable resource directory. 650 The present specification does not fully define these heuristics, but 651 suggests a number of candidates: 653 1. In a 6LoWPAN, just assume the Border Router (6LBR) can act as a 654 resource directory (using the ABRO option to find that 655 [RFC6775]). Confirmation can be obtained by sending a Unicast to 656 "coap://[6LBR]/.well-known/core?rt=core.rd*". 658 2. In a network that supports multicast well, discovering the RD 659 using a multicast query for /.well-known/core as specified in 660 CoRE Link Format [RFC6690]: Sending a Multicast GET to 661 "coap://[MCD1]/.well-known/core?rt=core.rd*". RDs within the 662 multicast scope will answer the query. 664 As some of the RD addresses obtained by the methods listed here are 665 just (more or less educated) guesses, endpoints MUST make use of any 666 error messages to very strictly rate-limit requests to candidate IP 667 addresses that don't work out. For example, an ICMP Destination 668 Unreachable message (and, in particular, the port unreachable code 669 for this message) may indicate the lack of a CoAP server on the 670 candidate host, or a CoAP error response code such as 4.05 "Method 671 Not Allowed" may indicate unwillingness of a CoAP server to act as a 672 directory server. 674 If multiple candidate addresses are discovered, the device may pick 675 any of them initially, unless the discovery method indicates a more 676 precise selection scheme. 678 4.1. Resource Directory Address Option (RDAO) 680 The Resource Directory Address Option (RDAO) using IPv6 Neighbor 681 Discovery (ND) carries information about the address of the Resource 682 Directory (RD). This information is needed when endpoints cannot 683 discover the Resource Directory with a link-local or realm-local 684 scope multicast address because the endpoint and the RD are separated 685 by a Border Router (6LBR). In many circumstances the availability of 686 DHCP cannot be guaranteed either during commissioning of the network. 687 The presence and the use of the RD is essential during commissioning. 689 It is possible to send multiple RDAO options in one message, 690 indicating as many resource directory addresses. 692 The RDAO format is: 694 0 1 2 3 695 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 696 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 697 | Type | Length = 3 | Valid Lifetime | 698 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 699 | Reserved | 700 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 701 | | 702 + + 703 | | 704 + RD Address + 705 | | 706 + + 707 | | 708 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 710 Fields: 712 Type: 38 714 Length: 8-bit unsigned integer. The length of 715 the option in units of 8 bytes. 716 Always 3. 718 Valid Lifetime: 16-bit unsigned integer. The length of 719 time in units of 60 seconds (relative to 720 the time the packet is received) that 721 this Resource Directory address is valid. 722 A value of all zero bits (0x0) indicates 723 that this Resource Directory address 724 is not valid anymore. 726 Reserved: This field is unused. It MUST be 727 initialized to zero by the sender and 728 MUST be ignored by the receiver. 730 RD Address: IPv6 address of the RD. 732 Figure 5: Resource Directory Address Option 734 5. Resource Directory 736 This section defines the required set of REST interfaces between a 737 Resource Directory (RD) and endpoints. Although the examples 738 throughout this section assume the use of CoAP [RFC7252], these REST 739 interfaces can also be realized using HTTP [RFC7230]. In all 740 definitions in this section, both CoAP response codes (with dot 741 notation) and HTTP response codes (without dot notation) are shown. 742 An RD implementing this specification MUST support the discovery, 743 registration, update, lookup, and removal interfaces defined in this 744 section. 746 All operations on the contents of the Resource Directory MUST be 747 atomic and idempotent. 749 A resource directory MAY make the information submitted to it 750 available to further directories, if it can ensure that a loop does 751 not form. The protocol used between directories to ensure loop-free 752 operation is outside the scope of this document. 754 5.1. Payload Content Formats 756 Resource Directory implementations using this specification MUST 757 support the application/link-format content format (ct=40). 759 Resource Directories implementing this specification MAY support 760 additional content formats. 762 Any additional content format supported by a Resource Directory 763 implementing this specification MUST have an equivalent serialization 764 in the application/link-format content format. 766 5.2. URI Discovery 768 Before an endpoint can make use of an RD, it must first know the RD's 769 address and port, and the URI path information for its REST APIs. 770 This section defines discovery of the RD and its URIs using the well- 771 known interface of the CoRE Link Format [RFC6690]. A complete set of 772 RD discovery methods is described in Section 4. 774 Discovery of the RD registration URI path is performed by sending 775 either a multicast or unicast GET request to "/.well-known/core" and 776 including a Resource Type (rt) parameter [RFC6690] with the value 777 "core.rd" in the query string. Likewise, a Resource Type parameter 778 value of "core.rd-lookup*" is used to discover the URIs for RD Lookup 779 operations, core.rd* is used to discover all URI paths for RD 780 operations. Upon success, the response will contain a payload with a 781 link format entry for each RD function discovered, indicating the URI 782 of the RD function returned and the corresponding Resource Type. 783 When performing multicast discovery, the multicast IP address used 784 will depend on the scope required and the multicast capabilities of 785 the network (see Section 9.5. 787 A Resource Directory MAY provide hints about the content-formats it 788 supports in the links it exposes or registers, using the "ct" link 789 attribute, as shown in the example below. Clients MAY use these 790 hints to select alternate content-formats for interaction with the 791 Resource Directory. 793 HTTP does not support multicast and consequently only unicast 794 discovery can be supported using HTTP. The well-known entry points 795 SHOULD be provided to enable unicast discovery. 797 An implementation of this resource directory specification MUST 798 support query filtering for the rt parameter as defined in [RFC6690]. 800 While the link targets in this discovery step are often expressed in 801 path-absolute form, this is not a requirement. Clients of the RD 802 SHOULD therefore accept URIs of all schemes they support, both as 803 URIs and relative references, and not limit the set of discovered 804 URIs to those hosted at the address used for URI discovery. 806 The URI Discovery operation can yield multiple URIs of a given 807 resource type. The client of the RD can use any of the discovered 808 addresses initially. 810 The discovery request interface is specified as follows (this is 811 exactly the Well-Known Interface of [RFC6690] Section 4, with the 812 additional requirement that the server MUST support query filtering): 814 Interaction: EP and Client -> RD 816 Method: GET 818 URI Template: /.well-known/core{?rt} 820 URI Template Variables: 822 rt := Resource Type. SHOULD contain one of the values "core.rd", 823 "core.rd-lookup*", "core.rd-lookup-res", "core.rd-lookup-ep", 824 or "core.rd*" 826 Content-Format: application/link-format (if any) 828 Content-Format: application/link-format+json (if any) 829 Content-Format: application/link-format+cbor (if any) 831 The following response codes are defined for this interface: 833 Success: 2.05 "Content" or 200 "OK" with an application/link-format, 834 application/link-format+json, or application/link-format+cbor 835 payload containing one or more matching entries for the RD 836 resource. 838 Failure: 4.00 "Bad Request" or 400 "Bad Request" is returned in case 839 of a malformed request for a unicast request. 841 Failure: No error response to a multicast request. 843 HTTP support : YES (Unicast only) 845 The following example shows an endpoint discovering an RD using this 846 interface, thus learning that the directory resource location, in 847 this example, is /rd, and that the content-format delivered by the 848 server hosting the resource is application/link-format (ct=40). Note 849 that it is up to the RD to choose its RD locations. 851 Req: GET coap://[MCD1]/.well-known/core?rt=core.rd* 853 Res: 2.05 Content 854 ;rt="core.rd";ct=40, 855 ;rt="core.rd-lookup-ep";ct=40, 856 ;rt="core.rd-lookup-res";ct=40, 858 Figure 6: Example discovery exchange 860 The following example shows the way of indicating that a client may 861 request alternate content-formats. The Content-Format code attribute 862 "ct" MAY include a space-separated sequence of Content-Format codes 863 as specified in Section 7.2.1 of [RFC7252], indicating that multiple 864 content-formats are available. The example below shows the required 865 Content-Format 40 (application/link-format) indicated as well as the 866 CBOR and JSON representation of link format. The RD resource 867 locations /rd, and /rd-lookup are example values. The server in this 868 example also indicates that it is capable of providing observation on 869 resource lookups. 871 [ The RFC editor is asked to replace these and later occurrences of 872 MCD1, TBD64 and TBD504 with the assigned IPv6 site-local address for 873 "all CoRE Resource Directories" and the numeric ID values assigned by 874 IANA to application/link-format+cbor and application/link- 875 format+json, respectively, as they are defined in I-D.ietf-core- 876 links-json. ] 877 Req: GET coap://[MCD1]/.well-known/core?rt=core.rd* 879 Res: 2.05 Content 880 ;rt="core.rd";ct="40 65225", 881 ;rt="core.rd-lookup-res";ct="40 TBD64 TBD504";obs, 882 ;rt="core.rd-lookup-ep";ct="40 TBD64 TBD504", 884 From a management and maintenance perspective, it is necessary to 885 identify the components that constitute the RD server. The 886 identification refers to information about for example client-server 887 incompatibilities, supported features, required updates and other 888 aspects. The URI discovery address, a described in section 4 of 889 [RFC6690] can be used to find the identification. 891 It would typically be stored in an implementation information link 892 (as described in [I-D.bormann-t2trg-rel-impl]): 894 Req: GET /.well-known/core?rel=impl-info 896 Res: 2.05 Content 897 ; 898 rel="impl-info" 900 Note that depending on the particular server's architecture, such a 901 link could be anchored at the RD server's root, at the discovery site 902 (as in this example) or at individual RD components. The latter is 903 to be expected when different applications are run on the same 904 server. 906 5.3. Registration 908 After discovering the location of an RD, a registrant-ep or CT MAY 909 register the resources of the registrant-ep using the registration 910 interface. This interface accepts a POST from an endpoint containing 911 the list of resources to be added to the directory as the message 912 payload in the CoRE Link Format [RFC6690], JSON CoRE Link Format 913 (application/link-format+json), or CBOR CoRE Link Format 914 (application/link-format+cbor) [I-D.ietf-core-links-json], along with 915 query parameters indicating the name of the endpoint, and optionally 916 the sector, lifetime and base URI of the registration. It is 917 expected that other specifications will define further parameters 918 (see Section 9.3). The RD then creates a new registration resource 919 in the RD and returns its location. The receiving endpoint MUST use 920 that location when refreshing registrations using this interface. 921 Registration resources in the RD are kept active for the period 922 indicated by the lifetime parameter. The creating endpoint is 923 responsible for refreshing the registration resource within this 924 period using either the registration or update interface. The 925 registration interface MUST be implemented to be idempotent, so that 926 registering twice with the same endpoint parameters ep and d (sector) 927 does not create multiple registration resources. 929 The following rules apply for an update identified by a given (ep, d) 930 value pair: 932 o when the parameter values of the Update generate the same 933 attribute values as already present, the location of the already 934 existing registration is returned. 936 o when for a given (ep, d) value pair the update generates attribute 937 values which are different from the existing one, the existing 938 registration is removed and a new registration with a new location 939 is created. 941 o when the (ep, d) value pair of the update is different from any 942 existing registration, a new registration is generated. 944 The posted link-format document can (and typically does) contain 945 relative references both in its link targets and in its anchors, or 946 contain empty anchors. The RD server needs to resolve these 947 references in order to faithfully represent them in lookups. They 948 are resolved against the base URI of the registration, which is 949 provided either explicitly in the "base" parameter or constructed 950 implicitly from the requester's URI as constructed from its network 951 address and scheme. 953 Link format documents submitted to the resource directory are 954 interpreted as Modernized Link Format (see Appendix D) by the RD. A 955 registrant-ep SHOULD NOT submit documents whose interpretations 956 according to [RFC6690] and Appendix D differ to avoid the ambiguities 957 described in Appendix B.4. 959 In practice, most links (precisely listed in Appendix D.1) can be 960 submitted without consideration for those details. 962 The registration request interface is specified as follows: 964 Interaction: EP -> RD 966 Method: POST 968 URI Template: {+rd}{?ep,d,lt,base,extra-attrs*} 970 URI Template Variables: 972 rd := RD registration URI (mandatory). This is the location of 973 the RD, as obtained from discovery. 975 ep := Endpoint name (mostly mandatory). The endpoint name is an 976 identifier that MUST be unique within a sector. The maximum 977 length of this parameter is 63 bytes. If the RD is configured 978 to recognize the endpoint (e.g. based on its security context), 979 the endpoint sets no endpoint name, and the RD assigns one 980 based on a set of configuration parameter values. 982 d := Sector (optional). The sector to which this endpoint 983 belongs. The maximum length of this parameter is 63 bytes. 984 When this parameter is not present, the RD MAY associate the 985 endpoint with a configured default sector or leave it empty. 986 The endpoint name and sector name are not set when one or both 987 are set in an accompanying authorization token. 989 lt := Lifetime (optional). Lifetime of the registration in 990 seconds. Range of 60-4294967295. If no lifetime is included 991 in the initial registration, a default value of 90000 (25 992 hours) SHOULD be assumed. 994 base := Base URI (optional). This parameter sets the base URI of 995 the registration, under which the relative links in the payload 996 are to be interpreted. The specified URI typically does not 997 have a path component of its own, and MUST be suitable as a 998 base URI to resolve any relative references given in the 999 registration. The parameter is therefore usually of the shape 1000 "scheme://authority" for HTTP and CoAP URIs. The URI SHOULD 1001 NOT have a query or fragment component as any non-empty 1002 relative part in a reference would remove those parts from the 1003 resulting URI. 1005 In the absence of this parameter the scheme of the protocol, 1006 source address and source port of the registration request are 1007 assumed. That Base URI is constructed by concatenating the 1008 used protcol's scheme with the characters "://", the 1009 requester's source address as an address literal and ":" 1010 followed by its port (if it was not the protocol's default one) 1011 in analogy to [RFC7252] Section 6.5. 1013 This parameter is mandatory when the directory is filled by a 1014 third party such as an commissioning tool. 1016 If the registrant-ep uses an ephemeral port to register with, 1017 it MUST include the base parameter in the registration to 1018 provide a valid network path. 1020 If the registrant-ep, located behind a NAT gateway, is 1021 registering with a Resource Directory which is on the network 1022 service side of the NAT gateway, the endpoint MUST use a 1023 persistent port for the outgoing registration in order to 1024 provide the NAT gateway with a valid network address for 1025 replies and incoming requests. 1027 Endpoints that register with a base that contains a path 1028 component can not meaningfully use [RFC6690] Link Format due to 1029 its prevalence of the Origin concept in relative reference 1030 resolution; they can submit payloads for interpretation as 1031 Modernized Link Format. Typically, links submitted by such an 1032 endpoint are of the "path-noscheme" (starts with a path not 1033 preceded by a slash, precisely defined in [RFC3986] 1034 Section 3.3) form. 1036 extra-attrs := Additional registration attributes (optional). 1037 The endpoint can pass any parameter registered at Section 9.3 1038 to the directory. If the RD is aware of the parameter's 1039 specified semantics, it processes it accordingly. Otherwise, 1040 it MUST store the unknown key and its value(s) as an endpoint 1041 attribute for further lookup. 1043 Content-Format: application/link-format 1045 Content-Format: application/link-format+json 1047 Content-Format: application/link-format+cbor 1049 The following response codes are defined for this interface: 1051 Success: 2.01 "Created" or 201 "Created". The Location-Path option 1052 or Location header MUST be included in the response. This 1053 location MUST be a stable identifier generated by the RD as it is 1054 used for all subsequent operations on this registration resource. 1055 The registration resource location thus returned is for the 1056 purpose of updating the lifetime of the registration and for 1057 maintaining the content of the registered links, including 1058 updating and deleting links. 1060 A registration with an already registered ep and d value pair 1061 responds with the same success code and location as the original 1062 registration; the set of links registered with the endpoint is 1063 replaced with the links from the payload. 1065 The location MUST NOT have a query or fragment component, as that 1066 could conflict with query parameters during the Registration 1067 Update operation. Therefore, the Location-Query option MUST NOT 1068 be present in a successful response. 1070 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 1071 request. 1073 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 1074 Service could not perform the operation. 1076 HTTP support: YES 1078 If the registration fails with a Service Unavailable response and a 1079 Max-Age option or Retry-After header, the registering endpoint SHOULD 1080 retry the operation after the time indicated. If the registration 1081 fails in another way, including request timeouts, or if the Service 1082 Unavailable error persists after several retries, or indicates a 1083 longer time than the endpoint is willing to wait, it SHOULD pick 1084 another registration URI from the "URI Discovery" step and if there 1085 is only one or the list is exhausted, pick other choices from the 1086 "Finding a Resource Directory" step. Care has to be taken to 1087 consider the freshness of results obtained earlier, e.g. of the 1088 result of a "/.well-known/core" response, the lifetime of an RDAO 1089 option and of DNS responses. Any rate limits and persistent errors 1090 from the "Finding a Resource Directory" step must be considered for 1091 the whole registration time, not only for a single operation. 1093 The following example shows a registrant-ep with the name "node1" 1094 registering two resources to an RD using this interface. The 1095 location "/rd" is an example RD location discovered in a request 1096 similar to Figure 6. 1098 Req: POST coap://rd.example.com/rd?ep=node1 1099 Content-Format: 40 1100 Payload: 1101 ;ct=41;rt="temperature-c";if="sensor"; 1102 anchor="coap://spurious.example.com:5683", 1103 ;ct=41;rt="light-lux";if="sensor" 1105 Res: 2.01 Created 1106 Location-Path: /rd/4521 1108 Figure 7: Example registration payload 1110 A Resource Directory may optionally support HTTP. Here is an example 1111 of almost the same registration operation above, when done using HTTP 1112 and the JSON Link Format. 1114 Req: POST /rd?ep=node1&base=http://[2001:db8:1::1] HTTP/1.1 1115 Host: example.com 1116 Content-Type: application/link-format+json 1117 Payload: 1118 [ 1119 {"href": "/sensors/temp", "ct": "41", "rt": "temperature-c", 1120 "if": "sensor", "anchor": "coap://spurious.example.com:5683"}, 1121 {"href": "/sensors/light", "ct": "41", "rt": "light-lux", 1122 "if": "sensor"} 1123 ] 1125 Res: 201 Created 1126 Location: /rd/4521 1128 5.3.1. Simple Registration 1130 Not all endpoints hosting resources are expected to know how to 1131 upload links to an RD as described in Section 5.3. Instead, simple 1132 endpoints can implement the Simple Registration approach described in 1133 this section. An RD implementing this specification MUST implement 1134 Simple Registration. However, there may be security reasons why this 1135 form of directory discovery would be disabled. 1137 This approach requires that the registrant-ep makes available the 1138 hosted resources that it wants to be discovered, as links on its 1139 "/.well-known/core" interface as specified in [RFC6690]. The links 1140 in that document are subject to the same limitations as the payload 1141 of a registration (with respect to Appendix D). 1143 The registrant-ep finds one or more addresses of the directory server 1144 as described in Section 4. 1146 The registrant-ep asks the selected directory server to probe its 1147 /.well-known/core and publish the links as follows: 1149 The registrant-ep sends (and regularly refreshes with) a POST request 1150 to the "/.well-known/core" URI of the directory server of choice. 1151 The body of the POST request is empty, and triggers the resource 1152 directory server to perform GET requests at the requesting 1153 registrant-ep's /.well-known/core to obtain the link-format payload 1154 to register. 1156 The registrant-ep includes the same registration parameters in the 1157 POST request as it would per Section 5.3. The registration base URI 1158 of the registration is taken from the requesting server's URI. 1160 The Resource Directory MUST NOT query the registrant-ep's data before 1161 sending the response; this is to accommodate very limited endpoints. 1163 The success condition only indicates that the request was valid (i.e. 1164 the passed parameters are valid per se), not that the link data could 1165 be obtained or parsed or was successfully registered into the RD. 1167 The simple registration request interface is specified as follows: 1169 Interaction: EP -> RD 1171 Method: POST 1173 URI Template: /.well-known/core{?ep,d,lt,extra-attrs*} 1175 URI Template Variables are as they are for registration in 1176 Section 5.3. The base attribute is not accepted to keep the 1177 registration interface simple; that rules out registration over CoAP- 1178 over-TCP or HTTP that would need to specify one. 1180 The following response codes are defined for this interface: 1182 Success: 2.04 "Changed". 1184 Failure: 4.00 "Bad Request". Malformed request. 1186 Failure: 5.03 "Service Unavailable". Service could not perform the 1187 operation. 1189 HTTP support: NO 1191 For the second interaction triggered by the above, the registrant-ep 1192 takes the role of server and the RD the role of client. (Note that 1193 this is exactly the Well-Known Interface of [RFC6690] Section 4): 1195 Interaction: RD -> EP 1197 Method: GET 1199 URI Template: /.well-known/core 1201 The following response codes are defined for this interface: 1203 Success: 2.05 "Content". 1205 Failure: 4.00 "Bad Request". Malformed request. 1207 Failure: 4.04 "Not Found". /.well-known/core does not exist or is 1208 empty. 1210 Failure: 5.03 "Service Unavailable". Service could not perform the 1211 operation. 1213 HTTP support: NO 1215 The registration resources MUST be deleted after the expiration of 1216 their lifetime. Additional operations on the registration resource 1217 cannot be executed because no registration location is returned. 1219 The following example shows a registrant-ep using Simple 1220 Registration, by simply sending an empty POST to a resource 1221 directory. 1223 Req:(to RD server from [2001:db8:2::1]) 1224 POST /.well-known/core?lt=6000&ep=node1 1225 No payload 1227 Res: 2.04 Changed 1229 (later) 1231 Req: (from RD server to [2001:db8:2::1]) 1232 GET /.well-known/core 1233 Accept: 40 1235 Res: 2.05 Content 1236 Content-Format: 40 1237 Payload: 1238 1240 5.3.2. Third-party registration 1242 For some applications, even Simple Registration may be too taxing for 1243 some very constrained devices, in particular if the security 1244 requirements become too onerous. 1246 In a controlled environment (e.g. building control), the Resource 1247 Directory can be filled by a third party device, called a 1248 Commissioning Tool (CT). The commissioning tool can fill the 1249 Resource Directory from a database or other means. For that purpose 1250 scheme, IP address and port of the URI of the registered device is 1251 the value of the "base" parameter of the registration described in 1252 Section 5.3. 1254 It should be noted that the value of the "base" parameter applies to 1255 all the links of the registration and has consequences for the anchor 1256 value of the individual links as exemplified in Appendix B. An 1257 eventual (currently non-existing) "base" attribute of the link is not 1258 affected by the value of "base" parameter in the registration. 1260 5.3.3. RD-Groups 1262 The RD-Groups usage pattern allows announcing application groups 1263 inside a Resource Directory. 1265 Groups are represented by endpoint registrations. Their base address 1266 is a multicast address, and they SHOULD be entered with the endpoint 1267 type "core.rd-group". The endpoint name can also be referred to as a 1268 group name in this context. 1270 The registration is inserted into the RD by a Commissioning Tool, 1271 which might also be known as a group manager here. It performs third 1272 party registration and registration updates. 1274 The links it registers SHOULD be available on all members that join 1275 the group. Depending on the application, members that lack some 1276 resource MAY be permissible if requests to them fail gracefully. 1278 The following example shows a CT registering a group with the name 1279 "lights" which provides two resources. The directory resource path 1280 /rd is an example RD location discovered in a request similar to 1281 Figure 6. 1283 Req: POST coap://rd.example.com/rd?ep=lights&et=core.rd-group 1284 &base=coap://[ff35:30:2001:db8::1] 1285 Content-Format: 40 1286 Payload: 1287 ;rt="light";if="core.a", 1288 ;if="core.p";u="K" 1290 Res: 2.01 Created 1291 Location-Path: /rd/12 1293 In this example, the group manager can easily permit devices that 1294 have no writable color-temperature to join, as they would still 1295 respond to brightness changing commands. Had the group instead 1296 contained a single resource that sets brightness and color 1297 temperature atomically, endpoints would need to support both 1298 properties. 1300 The resources of a group can be looked up like any other resource, 1301 and the group registrations (along with any additional registration 1302 parameters) can be looked up using the endpoint lookup interface. 1304 6. RD Lookup 1306 To discover the resources registered with the RD, a lookup interface 1307 must be provided. This lookup interface is defined as a default, and 1308 it is assumed that RDs may also support lookups to return resource 1309 descriptions in alternative formats (e.g. Atom or HTML Link) or 1310 using more advanced interfaces (e.g. supporting context or semantic 1311 based lookup). 1313 RD Lookup allows lookups for endpoints and resources using attributes 1314 defined in this document and for use with the CoRE Link Format. The 1315 result of a lookup request is the list of links (if any) 1316 corresponding to the type of lookup. Thus, an endpoint lookup MUST 1317 return a list of endpoints and a resource lookup MUST return a list 1318 of links to resources. 1320 The lookup type is selected by a URI endpoint, which is indicated by 1321 a Resource Type as per Table 1 below: 1323 +-------------+--------------------+-----------+ 1324 | Lookup Type | Resource Type | Mandatory | 1325 +-------------+--------------------+-----------+ 1326 | Resource | core.rd-lookup-res | Mandatory | 1327 | Endpoint | core.rd-lookup-ep | Mandatory | 1328 +-------------+--------------------+-----------+ 1330 Table 1: Lookup Types 1332 6.1. Resource lookup 1334 Resource lookup results in links that are semantically equivalent to 1335 the links submitted to the RD. The links and link parameters 1336 returned by the lookup are equal to the submitted ones, except that 1337 the target and anchor references are fully resolved. 1339 Links that did not have an anchor attribute are therefore returned 1340 with the base URI of the registration as the anchor. Links of which 1341 href or anchor was submitted as a (full) URI are returned with these 1342 attributes unmodified. 1344 Above rules allow the client to interpret the response as links 1345 without any further knowledge of the storage conventions of the RD. 1346 The Resource Directory MAY replace the registration base URIs with a 1347 configured intermediate proxy, e.g. in the case of an HTTP lookup 1348 interface for CoAP endpoints. 1350 6.2. Lookup filtering 1352 Using the Accept Option, the requester can control whether the 1353 returned list is returned in CoRE Link Format ("application/link- 1354 format", default) or its alternate content-formats ("application/ 1355 link-format+json" or "application/link-format+cbor"). 1357 The page and count parameters are used to obtain lookup results in 1358 specified increments using pagination, where count specifies how many 1359 links to return and page specifies which subset of links organized in 1360 sequential pages, each containing 'count' links, starting with link 1361 zero and page zero. Thus, specifying count of 10 and page of 0 will 1362 return the first 10 links in the result set (links 0-9). Count = 10 1363 and page = 1 will return the next 'page' containing links 10-19, and 1364 so on. 1366 Multiple search criteria MAY be included in a lookup. All included 1367 criteria MUST match for a link to be returned. The Resource 1368 Directory MUST support matching with multiple search criteria. 1370 A link matches a search criterion if it has an attribute of the same 1371 name and the same value, allowing for a trailing "*" wildcard 1372 operator as in Section 4.1 of [RFC6690]. Attributes that are defined 1373 as "link-type" match if the search value matches any of their values 1374 (see Section 4.1 of [RFC6690]; e.g. "?if=core.s" matches ";if="abc 1375 core.s";"). A resource link also matches a search criterion if its 1376 endpoint would match the criterion, and vice versa, an endpoint link 1377 matches a search criterion if any of its resource links matches it. 1379 Note that "href" is a valid search criterion and matches target 1380 references. Like all search criteria, on a resource lookup it can 1381 match the target reference of the resource link itself, but also the 1382 registration resource of the endpoint that registered it. Queries 1383 for resource link targets MUST be in URI form (i.e. not relative 1384 references) and are matched against a resolved link target. Queries 1385 for endpoints SHOULD be expressed in path-absolute form if possible 1386 and MUST be expressed in URI form otherwise; the RD SHOULD recognize 1387 either. 1389 Endpoints that are interested in a lookup result repeatedly or 1390 continuously can use mechanisms like ETag caching, resource 1391 observation ([RFC7641]), or any future mechanism that might allow 1392 more efficient observations of collections. These are advertised, 1393 detected and used according to their own specifications and can be 1394 used with the lookup interface as with any other resource. 1396 When resource observation is used, every time the set of matching 1397 links changes, or the content of a matching link changes, the RD 1398 sends a notification with the matching link set. The notification 1399 contains the successful current response to the given request, 1400 especially with respect to representing zero matching links (see 1401 "Success" item below). 1403 The lookup interface is specified as follows: 1405 Interaction: Client -> RD 1407 Method: GET 1409 URI Template: {+type-lookup-location}{?page,count,search*} 1411 URI Template Variables: 1413 type-lookup-location := RD Lookup URI for a given lookup type 1414 (mandatory). The address is discovered as described in 1415 Section 5.2. 1417 search := Search criteria for limiting the number of results 1418 (optional). 1420 page := Page (optional). Parameter cannot be used without the 1421 count parameter. Results are returned from result set in pages 1422 that contain 'count' links starting from index (page * count). 1423 Page numbering starts with zero. 1425 count := Count (optional). Number of results is limited to this 1426 parameter value. If the page parameter is also present, the 1427 response MUST only include 'count' links starting with the 1428 (page * count) link in the result set from the query. If the 1429 count parameter is not present, then the response MUST return 1430 all matching links in the result set. Link numbering starts 1431 with zero. 1433 Content-Format: application/link-format (optional) 1435 Content-Format: application/link-format+json (optional) 1437 Content-Format: application/link-format+cbor (optional) 1439 The following responses codes are defined for this interface: 1441 Success: 2.05 "Content" or 200 "OK" with an "application/link- 1442 format", "application/link-format+cbor", or "application/link- 1443 format+json" payload containing matching entries for the lookup. 1444 The payload can contain zero links (which is an empty payload, 1445 "80" (hex) or "[]" in the respective content format), indicating 1446 that no entities matched the request. 1448 Failure: No error response to a multicast request. 1450 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 1451 request. 1453 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 1454 Service could not perform the operation. 1456 HTTP support: YES 1458 The endpoint lookup returns registration resources which can only be 1459 manipulated by the registering endpoint. Examples of endpoint lookup 1460 belong to the management aspects of the RD and are shown in 1461 Appendix A.5. The resource lookup examples are shown in this 1462 section. 1464 6.3. Resource lookup examples 1466 The examples in this section assume the existence of CoAP hosts with 1467 a default CoAP port 61616. HTTP hosts are possible and do not change 1468 the nature of the examples. 1470 The following example shows a client performing a resource lookup 1471 with the example resource look-up locations discovered in Figure 6: 1473 Req: GET /rd-lookup/res?rt=temperature 1475 Res: 2.05 Content 1476 ;rt="temperature"; 1477 anchor="coap://[2001:db8:3::123]:61616" 1479 The same lookup using the CBOR Link Format media type: 1481 Req: GET /rd-lookup/res?rt=temperature 1482 Accept: TBD64 1484 Res: 2.05 Content 1485 Content-Format: TBD64 1486 Payload in Hex notation: 1487 81A3017823636F61703A2F2F5B323030313A6462383A333A3A3132335D3A363136313 1488 62F74656D7003781E636F61703A2F2F5B323030313A6462383A333A3A3132335D3A36 1489 31363136096B74656D7065726174757265 1490 Decoded payload: 1491 [{1: "coap://[2001:db8:3::123]:61616/temp", 9: "temperature", 1492 3: "coap://[2001:db8:3::123]:61616"}] 1493 A client that wants to be notified of new resources as they show up 1494 can use observation: 1496 Req: GET /rd-lookup/res?rt=light 1497 Observe: 0 1499 Res: 2.05 Content 1500 Observe: 23 1501 Payload: empty 1503 (at a later point in time) 1505 Res: 2.05 Content 1506 Observe: 24 1507 Payload: 1508 ;rt="light"; 1509 anchor="coap://[2001:db8:3::124]", 1510 ;rt="light"; 1511 anchor="coap://[2001:db8:3::124]", 1512 ;rt="light"; 1513 anchor="coap://[2001:db8:3::124]" 1515 The following example shows a client performing a paginated resource 1516 lookup 1517 Req: GET /rd-lookup/res?page=0&count=5 1519 Res: 2.05 Content 1520 ;rt=sensor;ct=60; 1521 anchor="coap://[2001:db8:3::123]:61616", 1522 ;rt=sensor;ct=60; 1523 anchor="coap://[2001:db8:3::123]:61616", 1524 ;rt=sensor;ct=60; 1525 anchor="coap://[2001:db8:3::123]:61616", 1526 ;rt=sensor;ct=60; 1527 anchor="coap://[2001:db8:3::123]:61616", 1528 ;rt=sensor;ct=60; 1529 anchor="coap://[2001:db8:3::123]:61616" 1531 Req: GET /rd-lookup/res?page=1&count=5 1533 Res: 2.05 Content 1534 ;rt=sensor;ct=60; 1535 anchor="coap://[2001:db8:3::123]:61616", 1536 ;rt=sensor;ct=60; 1537 anchor="coap://[2001:db8:3::123]:61616", 1538 ;rt=sensor;ct=60; 1539 anchor="coap://[2001:db8:3::123]:61616", 1540 ;rt=sensor;ct=60; 1541 anchor="coap://[2001:db8:3::123]:61616", 1542 ;rt=sensor;ct=60; 1543 anchor="coap://[2001:db8:3::123]:61616" 1545 The following example shows a client performing a lookup of all 1546 resources from endpoints of all endpoints of a given endpoint type. 1547 It assumes that two endpoints (with endpoint names "sensor1" and 1548 "sensor2") have previously registered with their respective addresses 1549 "coap://sensor1.example.com" and "coap://sensor2.example.com", and 1550 posted the very payload of the 6th request of section 5 of [RFC6690]. 1552 It demonstrates how absolute link targets stay unmodified, while 1553 relative ones are resolved: 1555 Req: GET /rd-lookup/res?et=oic.d.sensor 1557 ;ct=40;title="Sensor Index"; 1558 anchor="coap://sensor1.example.com", 1559 ;rt="temperature-c"; 1560 if="sensor"; anchor="coap://sensor1.example.com", 1561 ;rt="light-lux"; 1562 if="sensor"; anchor="coap://sensor1.example.com", 1563 ;rel="describedby"; 1564 anchor="coap://sensor1.example.com/sensors/temp", 1565 ;rel="alternate"; 1566 anchor="coap://sensor1.example.com/sensors/temp", 1567 ;ct=40;title="Sensor Index"; 1568 anchor="coap://sensor2.example.com", 1569 ;rt="temperature-c"; 1570 if="sensor"; anchor="coap://sensor2.example.com", 1571 ;rt="light-lux"; 1572 if="sensor"; anchor="coap://sensor2.example.com", 1573 ;rel="describedby"; 1574 anchor="coap://sensor2.example.com/sensors/temp", 1575 ;rel="alternate"; 1576 anchor="coap://sensor2.example.com/sensors/temp" 1578 The following example shows a client performing a lookup of all 1579 resources of all endpoints (groups) with et=core.rd-group. 1581 Req: GET /rd-lookup/res?et=core.rd-group 1583 ;rt="light";if="core.a"; 1584 et="core.rd-group";anchor="coap://[ff35:30:2001:db8::1]", 1585 ;if="core.p";u="K"; 1586 et="core.rd-group"; 1587 anchor="coap://[ff35:30:2001:db8::1]" 1589 7. Security policies 1591 The Resource Directory (RD) provides assistance to applications 1592 situated on a selection of nodes to discover endpoints on connected 1593 nodes. This section discusses different security aspects of 1594 accessing the RD. 1596 The contents of the RD are inserted in two ways: 1598 1. The node hosting the discoverable endpoint fills the RD with the 1599 contents of /.well-known/core by: 1601 * Storing the contents directly into RD (see Section 5.3) 1602 * Requesting the RD to load the contents from /.well-known/core 1603 (see Section 5.3.1) 1605 2. A Commissioning Tool (CT) fills the RD with endpoint information 1606 for a set of discoverable nodes. (see Section 5.3 with 1607 base=authority parameter value) 1609 In both cases, the nodes filling the RD should be authenticated and 1610 authorized to change the contents of the RD. An Authorization Server 1611 (AS) is responsible to assign a token to the registering node to 1612 authorize the node to discover or register endpoints in a given RD 1613 [I-D.ietf-ace-oauth-authz]. 1615 It can be imagined that an installation is divided in a set of 1616 security regions, each one with its own RD(s) to discover the 1617 endpoints that are part of a given security region. An endpoint that 1618 wants to discover an RD, responsible for a given region, needs to be 1619 authorized to learn the contents of a given RD. Within a region, for 1620 a given RD, a more fine-grained security division is possible based 1621 on the values of the endpoint registration parameters. Authorization 1622 to discover endpoints with a given set of filter values is 1623 recommended for those cases. 1625 When a node registers its endpoints, criteria are needed to authorize 1626 the node to enter them. An important aspect is the uniqueness of the 1627 (endpoint name, and optional sector) pair within the RD. Consider 1628 the two cases separately: (1) CT registers endpoints, and (2) the 1629 registering node registers its own endpoint(s). * A CT needs 1630 authorization to register a set of endpoints. This authorization can 1631 be based on the region, i.e. a given CT is authorized to register any 1632 endpoint (endpoint name, sector) into a given RD, or to register an 1633 endpoint with (endpoint name, sector) value pairs assigned by the AS, 1634 or can be more fine-grained, including a subset of registration 1635 parameter values. * A given endpoint that registers itself, needs to 1636 proof its possession of its unique (endpoint name, sector) value 1637 pair. Alternatively, the AS can authorize the endpoint to register 1638 with an (endpoint name, sector) value pair assigned by the AS. * A 1639 separate document needs to specify these aspects to ensure 1640 interoperability between registering nodes and RD. The subsections 1641 below give some hints how to handle a subset of the different 1642 aspects. 1644 7.1. Secure RD discovery 1646 The Resource Server (RS) discussed in [I-D.ietf-ace-oauth-authz] is 1647 equated to the RD. The client (C) needs to discover the RD as 1648 discussed in Section 4. C can discover the related AS by sending a 1649 request to the RD. The RD denies the request by sending the address 1650 of the related AS, as discussed in section 5.1 of 1651 [I-D.ietf-ace-oauth-authz]. The client MUST send an authorization 1652 request to the AS. When appropriate, the AS returns a token that 1653 specifies the authorization permission which needs to be specified in 1654 a separate document. 1656 7.2. Secure RD filtering 1658 The authorized parameter values for the queries by a given endpoint 1659 must be registered by the AS. The AS communicates the parameter 1660 values in the token. A separate document needs to specify the 1661 parameter value combinations and their storage in the token. The RD 1662 decodes the token and checks the validity of the queries of the 1663 client. 1665 7.3. Secure endpoint Name assignment 1667 This section only considers the assignment of a name to the endpoint 1668 based on an automatic mechanism without use of AS. More elaborate 1669 protocols are out of scope. The registering endpoint is authorized 1670 by the AS to discover the RD and add registrations. A token is 1671 provided by the AS and communicated from registering endpoint to RD. 1672 It is assumed that DTLS is used to secure the channel between 1673 registering endpoint and RD, where the registering endpoint is the 1674 DTLS client. Assuming that the client is provided by a certificate 1675 at manufacturing time, the certificate is uniquely identified by the 1676 CN field and the serial number. The RD can assign a unique endpoint 1677 name by using the certificate identifier as endpoint name. Proof of 1678 possession of the endpoint name by the registering endpoint is 1679 checked by encrypting the certificate identifier with the private key 1680 of the registering endpoint, which the RD can decrypt with the public 1681 key stored in the certificate. Even simpler, the authorized 1682 registering endpoint can generate a random number (or string) that 1683 identifies the endpoint. The RD can check for the improbable 1684 replication of the random value. The RD MUST check that registering 1685 endpoint uses only one random value for each authorized endpoint. 1687 8. Security Considerations 1689 The security considerations as described in Section 7 of [RFC5988] 1690 and Section 6 of [RFC6690] apply. The "/.well-known/core" resource 1691 may be protected e.g. using DTLS when hosted on a CoAP server as 1692 described in [RFC7252]. DTLS or TLS based security SHOULD be used on 1693 all resource directory interfaces defined in this document. 1695 8.1. Endpoint Identification and Authentication 1697 An Endpoint (name, sector) pair is unique within the et of endpoints 1698 regsitered by the RD. An Endpoint MUST NOT be identified by its 1699 protocol, port or IP address as these may change over the lifetime of 1700 an Endpoint. 1702 Every operation performed by an Endpoint on a resource directory 1703 SHOULD be mutually authenticated using Pre-Shared Key, Raw Public Key 1704 or Certificate based security. 1706 Consider the following threat: two devices A and B are registered at 1707 a single server. Both devices have unique, per-device credentials 1708 for use with DTLS to make sure that only parties with authorization 1709 to access A or B can do so. 1711 Now, imagine that a malicious device A wants to sabotage the device 1712 B. It uses its credentials during the DTLS exchange. Then, it 1713 specifies the endpoint name of device B as the name of its own 1714 endpoint in device A. If the server does not check whether the 1715 identifier provided in the DTLS handshake matches the identifier used 1716 at the CoAP layer then it may be inclined to use the endpoint name 1717 for looking up what information to provision to the malicious device. 1719 Section 7.3 specifies an example that removes this threat for 1720 endpoints that have a certificate installed. 1722 8.2. Access Control 1724 Access control SHOULD be performed separately for the RD registration 1725 and Lookup API paths, as different endpoints may be authorized to 1726 register with an RD from those authorized to lookup endpoints from 1727 the RD. Such access control SHOULD be performed in as fine-grained a 1728 level as possible. For example access control for lookups could be 1729 performed either at the sector, endpoint or resource level. 1731 8.3. Denial of Service Attacks 1733 Services that run over UDP unprotected are vulnerable to unknowingly 1734 become part of a DDoS attack as UDP does not require return 1735 routability check. Therefore, an attacker can easily spoof the 1736 source IP of the target entity and send requests to such a service 1737 which would then respond to the target entity. This can be used for 1738 large-scale DDoS attacks on the target. Especially, if the service 1739 returns a response that is order of magnitudes larger than the 1740 request, the situation becomes even worse as now the attack can be 1741 amplified. DNS servers have been widely used for DDoS amplification 1742 attacks. There is also a danger that NTP Servers could become 1743 implicated in denial-of-service (DoS) attacks since they run on 1744 unprotected UDP, there is no return routability check, and they can 1745 have a large amplification factor. The responses from the NTP server 1746 were found to be 19 times larger than the request. A Resource 1747 Directory (RD) which responds to wild-card lookups is potentially 1748 vulnerable if run with CoAP over UDP. Since there is no return 1749 routability check and the responses can be significantly larger than 1750 requests, RDs can unknowingly become part of a DDoS amplification 1751 attack. 1753 9. IANA Considerations 1755 9.1. Resource Types 1757 IANA is asked to enter the following values into the Resource Type 1758 (rt=) Link Target Attribute Values sub-registry of the Constrained 1759 Restful Environments (CoRE) Parameters registry defined in [RFC6690]: 1761 +--------------------+--------------------------+-------------------+ 1762 | Value | Description | Reference | 1763 +--------------------+--------------------------+-------------------+ 1764 | core.rd | Directory resource of an | RFCTHIS Section | 1765 | | RD | 5.2 | 1766 | core.rd-lookup-res | Resource lookup of an RD | RFCTHIS Section | 1767 | | | 5.2 | 1768 | core.rd-lookup-ep | Endpoint lookup of an RD | RFCTHIS Section | 1769 | | | 5.2 | 1770 | core.rd-ep | Endpoint resource of an | RFCTHIS Section 6 | 1771 | | RD | | 1772 +--------------------+--------------------------+-------------------+ 1774 9.2. IPv6 ND Resource Directory Address Option 1776 This document registers one new ND option type under the sub-registry 1777 "IPv6 Neighbor Discovery Option Formats": 1779 o Resource Directory address Option (38) 1781 9.3. RD Parameter Registry 1783 This specification defines a new sub-registry for registration and 1784 lookup parameters called "RD Parameters" under "CoRE Parameters". 1785 Although this specification defines a basic set of parameters, it is 1786 expected that other standards that make use of this interface will 1787 define new ones. 1789 Each entry in the registry must include 1790 o the human readable name of the parameter, 1792 o the short name as used in query parameters or link attributes, 1794 o indication of whether it can be passed as a query parameter at 1795 registration of endpoints, as a query parameter in lookups, or be 1796 expressed as a link attribute, 1798 o validity requirements if any, and 1800 o a description. 1802 The query parameter MUST be both a valid URI query key [RFC3986] and 1803 a parmname as used in [RFC5988]. 1805 The description must give details on whether the parameter can be 1806 updated, and how it is to be processed in lookups. 1808 The mechanisms around new RD parameters should be designed in such a 1809 way that they tolerate RD implementations that are unaware of the 1810 parameter and expose any parameter passed at registration or updates 1811 on in endpoint lookups. (For example, if a parameter used at 1812 registration were to be confidential, the registering endpoint should 1813 be instructed to only set that parameter if the RD advertises support 1814 for keeping it confidential at the discovery step.) 1816 Initial entries in this sub-registry are as follows: 1818 +--------------+-------+---------------+-----+----------------------+ 1819 | Full name | Short | Validity | Use | Description | 1820 +--------------+-------+---------------+-----+----------------------+ 1821 | Endpoint | ep | | RLA | Name of the | 1822 | Name | | | | endpoint, max 63 | 1823 | | | | | bytes | 1824 | Lifetime | lt | 60-4294967295 | R | Lifetime of the | 1825 | | | | | registration in | 1826 | | | | | seconds | 1827 | Sector | d | | RLA | Sector to which this | 1828 | | | | | endpoint belongs | 1829 | Registration | base | URI | RLA | The scheme, address | 1830 | Base URI | | | | and port and path at | 1831 | | | | | which this server is | 1832 | | | | | available | 1833 | Page | page | Integer | L | Used for pagination | 1834 | Count | count | Integer | L | Used for pagination | 1835 | Endpoint | et | | RLA | Semantic name of the | 1836 | Type | | | | endpoint (see | 1837 | | | | | Section 9.4) | 1838 +--------------+-------+---------------+-----+----------------------+ 1840 Table 2: RD Parameters 1842 (Short: Short name used in query parameters or link attributes. Use: 1843 R = used at registration, L = used at lookup, A = expressed in link 1844 attribute 1846 The descriptions for the options defined in this document are only 1847 summarized here. To which registrations they apply and when they are 1848 to be shown is described in the respective sections of this document. 1850 The IANA policy for future additions to the sub-registry is "Expert 1851 Review" as described in [RFC8126]. The evaluation should consider 1852 formal criteria, duplication of functionality (Is the new entry 1853 redundant with an existing one?), topical suitability (E.g. is the 1854 described property actually a property of the endpoint and not a 1855 property of a particular resource, in which case it should go into 1856 the payload of the registration and need not be registered?), and the 1857 potential for conflict with commonly used link attributes (For 1858 example, "if" could be used as a parameter for conditional 1859 registration if it were not to be used in lookup or attributes, but 1860 would make a bad parameter for lookup, because a resource lookup with 1861 an "if" query parameter could ambiguously filter by the registered 1862 endpoint property or the [RFC6690] link attribute). It is expected 1863 that the registry will receive between 5 and 50 registrations in 1864 total over the next years. 1866 9.3.1. Full description of the "Endpoint Type" Registration Parameter 1868 An endpoint registering at an RD can describe itself with endpoint 1869 types, similar to how resources are described with Resource Types in 1870 [RFC6690]. An endpoint type is expressed as a string, which can be 1871 either a URI or one of the values defined in the Endpoint Type sub- 1872 registry. Endpoint types can be passed in the "et" query parameter 1873 as part of extra-attrs at the Registration step, are shown on 1874 endpoint lookups using the "et" target attribute, and can be filtered 1875 for using "et" as a search criterion in resource and endpoint lookup. 1876 Multiple endpoint types are given as separate query parameters or 1877 link attributes. 1879 Note that Endpoint Type differs from Resource Type in that it uses 1880 multiple attributes rather than space separated values. As a result, 1881 Resource Directory implementations automatically support correct 1882 filtering in the lookup interfaces from the rules for unknown 1883 endpoint attributes. 1885 9.4. "Endpoint Type" (et=) RD Parameter values 1887 This specification establishes a new sub-registry under "CoRE 1888 Parameters" called '"Endpoint Type" (et=) RD Parameter values'. The 1889 registry properties (required policy, requirements, template) are 1890 identical to those of the Resource Type parameters in [RFC6690], in 1891 short: 1893 The review policy is IETF Review for values starting with "core", and 1894 Specification Required for others. 1896 The requirements to be enforced are: 1898 o The values MUST be related to the purpose described in 1899 Section 9.3.1. 1901 o The registered values MUST conform to the ABNF reg-rel-type 1902 definition of [RFC6690] and MUST NOT be a URI. 1904 o It is recommended to use the period "." character for 1905 segmentation. 1907 The registry initially contains one value: 1909 o "core.rd-group": An application group as described in 1910 Section 5.3.3. 1912 9.5. Multicast Address Registration 1914 IANA has assigned the following multicast addresses for use by CoAP 1915 nodes: 1917 IPv4 - "all CoRE resource directories" address, from the "IPv4 1918 Multicast Address Space Registry" equal to "All CoAP Nodes", 1919 224.0.1.187. As the address is used for discovery that may span 1920 beyond a single network, it has come from the Internetwork Control 1921 Block (224.0.1.x, RFC 5771). 1923 IPv6 - "all CoRE resource directories" address MCD1 (suggestions 1924 FF0X::FE), from the "IPv6 Multicast Address Space Registry", in the 1925 "Variable Scope Multicast Addresses" space (RFC 3307). Note that 1926 there is a distinct multicast address for each scope that interested 1927 CoAP nodes should listen to; CoAP needs the Link-Local and Site-Local 1928 scopes only. 1930 10. Examples 1932 Two examples are presented: a Lighting Installation example in 1933 Section 10.1 and a LWM2M example in Section 10.2. 1935 10.1. Lighting Installation 1937 This example shows a simplified lighting installation which makes use 1938 of the Resource Directory (RD) with a CoAP interface to facilitate 1939 the installation and start up of the application code in the lights 1940 and sensors. In particular, the example leads to the definition of a 1941 group and the enabling of the corresponding multicast address as 1942 described in Section 5.3.3. No conclusions must be drawn on the 1943 realization of actual installation or naming procedures, because the 1944 example only "emphasizes" some of the issues that may influence the 1945 use of the RD and does not pretend to be normative. 1947 10.1.1. Installation Characteristics 1949 The example assumes that the installation is managed. That means 1950 that a Commissioning Tool (CT) is used to authorize the addition of 1951 nodes, name them, and name their services. The CT can be connected 1952 to the installation in many ways: the CT can be part of the 1953 installation network, connected by WiFi to the installation network, 1954 or connected via GPRS link, or other method. 1956 It is assumed that there are two naming authorities for the 1957 installation: (1) the network manager that is responsible for the 1958 correct operation of the network and the connected interfaces, and 1959 (2) the lighting manager that is responsible for the correct 1960 functioning of networked lights and sensors. The result is the 1961 existence of two naming schemes coming from the two managing 1962 entities. 1964 The example installation consists of one presence sensor, and two 1965 luminaries, luminary1 and luminary2, each with their own wireless 1966 interface. Each luminary contains three lamps: left, right and 1967 middle. Each luminary is accessible through one endpoint. For each 1968 lamp a resource exists to modify the settings of a lamp in a 1969 luminary. The purpose of the installation is that the presence 1970 sensor notifies the presence of persons to a group of lamps. The 1971 group of lamps consists of: middle and left lamps of luminary1 and 1972 right lamp of luminary2. 1974 Before commissioning by the lighting manager, the network is 1975 installed and access to the interfaces is proven to work by the 1976 network manager. 1978 At the moment of installation, the network under installation is not 1979 necessarily connected to the DNS infra structure. Therefore, SLAAC 1980 IPv6 addresses are assigned to CT, RD, luminaries and sensor shown in 1981 Table 3 below: 1983 +--------------------+----------------+ 1984 | Name | IPv6 address | 1985 +--------------------+----------------+ 1986 | luminary1 | 2001:db8:4::1 | 1987 | luminary2 | 2001:db8:4::2 | 1988 | Presence sensor | 2001:db8:4::3 | 1989 | Resource directory | 2001:db8:4::ff | 1990 +--------------------+----------------+ 1992 Table 3: interface SLAAC addresses 1994 In Section 10.1.2 the use of resource directory during installation 1995 is presented. 1997 10.1.2. RD entries 1999 It is assumed that access to the DNS infrastructure is not always 2000 possible during installation. Therefore, the SLAAC addresses are 2001 used in this section. 2003 For discovery, the resource types (rt) of the devices are important. 2004 The lamps in the luminaries have rt: light, and the presence sensor 2005 has rt: p-sensor. The endpoints have names which are relevant to the 2006 light installation manager. In this case luminary1, luminary2, and 2007 the presence sensor are located in room 2-4-015, where luminary1 is 2008 located at the window and luminary2 and the presence sensor are 2009 located at the door. The endpoint names reflect this physical 2010 location. The middle, left and right lamps are accessed via path 2011 /light/middle, /light/left, and /light/right respectively. The 2012 identifiers relevant to the Resource Directory are shown in Table 4 2013 below: 2015 +----------------+------------------+---------------+---------------+ 2016 | Name | endpoint | resource path | resource type | 2017 +----------------+------------------+---------------+---------------+ 2018 | luminary1 | lm_R2-4-015_wndw | /light/left | light | 2019 | luminary1 | lm_R2-4-015_wndw | /light/middle | light | 2020 | luminary1 | lm_R2-4-015_wndw | /light/right | light | 2021 | luminary2 | lm_R2-4-015_door | /light/left | light | 2022 | luminary2 | lm_R2-4-015_door | /light/middle | light | 2023 | luminary2 | lm_R2-4-015_door | /light/right | light | 2024 | Presence | ps_R2-4-015_door | /ps | p-sensor | 2025 | sensor | | | | 2026 +----------------+------------------+---------------+---------------+ 2028 Table 4: Resource Directory identifiers 2030 It is assumed that the CT knows the RD's address, and has performed 2031 URI discovery on it that returned a response like the one in the 2032 Section 5.2 example. 2034 The CT inserts the endpoints of the luminaries and the sensor in the 2035 RD using the registration base URI parameter (base) to specify the 2036 interface address: 2038 Req: POST coap://[2001:db8:4::ff]/rd 2039 ?ep=lm_R2-4-015_wndw&base=coap://[2001:db8:4::1]&d=R2-4-015 2040 Payload: 2041 ;rt="light", 2042 ;rt="light", 2043 ;rt="light" 2045 Res: 2.01 Created 2046 Location-Path: /rd/4521 2047 Req: POST coap://[2001:db8:4::ff]/rd 2048 ?ep=lm_R2-4-015_door&base=coap://[2001:db8:4::2]&d=R2-4-015 2049 Payload: 2050 ;rt="light", 2051 ;rt="light", 2052 ;rt="light" 2054 Res: 2.01 Created 2055 Location-Path: /rd/4522 2057 Req: POST coap://[2001:db8:4::ff]/rd 2058 ?ep=ps_R2-4-015_door&base=coap://[2001:db8:4::3]d&d=R2-4-015 2059 Payload: 2060 ;rt="p-sensor" 2062 Res: 2.01 Created 2063 Location-Path: /rd/4523 2065 The sector name d=R2-4-015 has been added for an efficient lookup 2066 because filtering on "ep" name is more awkward. The same sector name 2067 is communicated to the two luminaries and the presence sensor by the 2068 CT. 2070 The group is specified in the RD. The base parameter is set to the 2071 site-local multicast address allocated to the group. In the POST in 2072 the example below, the resources supported by all group members are 2073 published. 2075 Req: POST coap://[2001:db8:4::ff]/rd 2076 ?ep=grp_R2-4-015&et=core.rd-group&base=coap://[ff05::1] 2077 Payload: 2078 ;rt="light", 2079 ;rt="light", 2080 ;rt="light" 2082 Res: 2.01 Created 2083 Location-Path: /rd/501 2085 After the filling of the RD by the CT, the application in the 2086 luminaries can learn to which groups they belong, and enable their 2087 interface for the multicast address. 2089 The luminary, knowing its sector and being configured to join any 2090 group containing lights, searches for candidate groups and joins 2091 them: 2093 Req: GET coap://[2001:db8:4::ff]/rd-lookup/ep 2094 ?d=R2-4-015&et=core.rd-group&rt=light 2096 Res: 2.05 Content 2097 ;ep="grp_R2-4-015";et="core.rd-group"; 2098 base="coap://[ff05::1]" 2100 From the returned base parameter value, the luminary learns the 2101 multicast address of the multicast group. 2103 Alternatively, the CT can communicate the multicast address directly 2104 to the luminaries by using the "coap-group" resource specified in 2105 [RFC7390]. 2107 Req: POST coap://[2001:db8:4::1]/coap-group 2108 Content-Format: application/coap-group+json 2109 Payload: 2110 { "a": "[ff05::1]", "n": "grp_R2-4-015"} 2112 Res: 2.01 Created 2113 Location-Path: /coap-group/1 2115 Dependent on the situation, only the address, "a", or the name, "n", 2116 is specified in the coap-group resource. 2118 The presence sensor can learn the presence of groups that support 2119 resources with rt=light in its own sector by sending the same 2120 request, as used by the luminary. The presence sensor learns the 2121 multicast address to use for sending messages to the luminaries. 2123 10.2. OMA Lightweight M2M (LWM2M) Example 2125 This example shows how the OMA LWM2M specification makes use of 2126 Resource Directory (RD). 2128 OMA LWM2M is a profile for device services based on CoAP(OMA Name 2129 Authority). LWM2M defines a simple object model and a number of 2130 abstract interfaces and operations for device management and device 2131 service enablement. 2133 An LWM2M server is an instance of an LWM2M middleware service layer, 2134 containing a Resource Directory along with other LWM2M interfaces 2135 defined by the LWM2M specification. 2137 CoRE Resource Directory (RD) is used to provide the LWM2M 2138 Registration interface. 2140 LWM2M does not provide for registration sectors and does not 2141 currently use the rd-lookup interface. 2143 The LWM2M specification describes a set of interfaces and a resource 2144 model used between a LWM2M device and an LWM2M server. Other 2145 interfaces, proxies, and applications are currently out of scope for 2146 LWM2M. 2148 The location of the LWM2M Server and RD URI path is provided by the 2149 LWM2M Bootstrap process, so no dynamic discovery of the RD is used. 2150 LWM2M Servers and endpoints are not required to implement the /.well- 2151 known/core resource. 2153 10.2.1. The LWM2M Object Model 2155 The OMA LWM2M object model is based on a simple 2 level class 2156 hierarchy consisting of Objects and Resources. 2158 An LWM2M Resource is a REST endpoint, allowed to be a single value or 2159 an array of values of the same data type. 2161 An LWM2M Object is a resource template and container type that 2162 encapsulates a set of related resources. An LWM2M Object represents 2163 a specific type of information source; for example, there is a LWM2M 2164 Device Management object that represents a network connection, 2165 containing resources that represent individual properties like radio 2166 signal strength. 2168 Since there may potentially be more than one of a given type object, 2169 for example more than one network connection, LWM2M defines instances 2170 of objects that contain the resources that represent a specific 2171 physical thing. 2173 The URI template for LWM2M consists of a base URI followed by Object, 2174 Instance, and Resource IDs: 2176 {/base-uri}{/object-id}{/object-instance}{/resource-id}{/resource- 2177 instance} 2179 The five variables given here are strings. base-uri can also have 2180 the special value "undefined" (sometimes called "null" in RFC 6570). 2181 Each of the variables object-instance, resource-id, and resource- 2182 instance can be the special value "undefined" only if the values 2183 behind it in this sequence also are "undefined". As a special case, 2184 object-instance can be "empty" (which is different from "undefined") 2185 if resource-id is not "undefined". 2187 base-uri := Base URI for LWM2M resources or "undefined" for default 2188 (empty) base URI 2190 object-id := OMNA (OMA Name Authority) registered object ID (0-65535) 2192 object-instance := Object instance identifier (0-65535) or 2193 "undefined"/"empty" (see above)) to refer to all instances of an 2194 object ID 2196 resource-id := OMNA (OMA Name Authority) registered resource ID 2197 (0-65535) or "undefined" to refer to all resources within an instance 2199 resource-instance := Resource instance identifier or "undefined" to 2200 refer to single instance of a resource 2202 LWM2M IDs are 16 bit unsigned integers represented in decimal (no 2203 leading zeroes except for the value 0) by URI format strings. For 2204 example, a LWM2M URI might be: 2206 /1/0/1 2208 The base uri is empty, the Object ID is 1, the instance ID is 0, the 2209 resource ID is 1, and the resource instance is "undefined". This 2210 example URI points to internal resource 1, which represents the 2211 registration lifetime configured, in instance 0 of a type 1 object 2212 (LWM2M Server Object). 2214 10.2.2. LWM2M Register Endpoint 2216 LWM2M defines a registration interface based on the REST API, 2217 described in Section 5. The RD registration URI path of the LWM2M 2218 Resource Directory is specified to be "/rd". 2220 LWM2M endpoints register object IDs, for example , to indicate 2221 that a particular object type is supported, and register object 2222 instances, for example , to indicate that a particular instance 2223 of that object type exists. 2225 Resources within the LWM2M object instance are not registered with 2226 the RD, but may be discovered by reading the resource links from the 2227 object instance using GET with a CoAP Content-Format of application/ 2228 link-format. Resources may also be read as a structured object by 2229 performing a GET to the object instance with a Content-Format of 2230 senml+json. 2232 When an LWM2M object or instance is registered, this indicates to the 2233 LWM2M server that the object and its resources are available for 2234 management and service enablement (REST API) operations. 2236 LWM2M endpoints may use the following RD registration parameters as 2237 defined in Table 2 : 2239 ep - Endpoint Name 2240 lt - registration lifetime 2242 Endpoint Name, Lifetime, and LWM2M Version are mandatory parameters 2243 for the register operation, all other registration parameters are 2244 optional. 2246 Additional optional LWM2M registration parameters are defined: 2248 +-----------+-------+-------------------------------+---------------+ 2249 | Name | Query | Validity | Description | 2250 +-----------+-------+-------------------------------+---------------+ 2251 | Binding | b | {"U",UQ","S","SQ","US","UQS"} | Available | 2252 | Mode | | | Protocols | 2253 | | | | | 2254 | LWM2M | ver | 1.0 | Spec Version | 2255 | Version | | | | 2256 | | | | | 2257 | SMS | sms | | MSISDN | 2258 | Number | | | | 2259 +-----------+-------+-------------------------------+---------------+ 2261 Table 5: LWM2M Additional Registration Parameters 2263 The following RD registration parameters are not currently specified 2264 for use in LWM2M: 2266 et - Endpoint Type 2267 base - Registration Base URI 2269 The endpoint registration must include a payload containing links to 2270 all supported objects and existing object instances, optionally 2271 including the appropriate link-format relations. 2273 Here is an example LWM2M registration payload: 2275 ,,, 2277 This link format payload indicates that object ID 1 (LWM2M Server 2278 Object) is supported, with a single instance 0 existing, object ID 3 2279 (LWM2M Device object) is supported, with a single instance 0 2280 existing, and object 5 (LWM2M Firmware Object) is supported, with no 2281 existing instances. 2283 10.2.3. LWM2M Update Endpoint Registration 2285 The LwM2M update is really very similar to the registration update as 2286 described in Appendix A.1, with the only difference that there are 2287 more parameters defined and available. All the parameters listed in 2288 that section are also available with the initial registration but are 2289 all optional: 2291 lt - Registration Lifetime 2292 b - Protocol Binding 2293 sms - MSISDN 2294 link payload - new or modified links 2296 A Registration update is also specified to be used to update the 2297 LWM2M server whenever the endpoint's UDP port or IP address are 2298 changed. 2300 10.2.4. LWM2M De-Register Endpoint 2302 LWM2M allows for de-registration using the delete method on the 2303 returned location from the initial registration operation. LWM2M de- 2304 registration proceeds as described in Appendix A.2. 2306 11. Acknowledgments 2308 Oscar Novo, Srdjan Krco, Szymon Sasin, Kerry Lynn, Esko Dijk, Anders 2309 Brandt, Matthieu Vial, Jim Schaad, Mohit Sethi, Hauke Petersen, 2310 Hannes Tschofenig, Sampo Ukkola, Linyi Tian, and Jan Newmarch have 2311 provided helpful comments, discussions and ideas to improve and shape 2312 this document. Zach would also like to thank his colleagues from the 2313 EU FP7 SENSEI project, where many of the resource directory concepts 2314 were originally developed. 2316 12. Changelog 2318 changes from -16 to -17 2320 (Note that -17 is published as a direct follow-up to -16, containing 2321 a single change to be discussed at IETF103) 2323 o Removed groups that are enumerations of registrations and have 2324 dedicated mechanism 2326 o Add groups that are enumerations of shared resources and are a 2327 special case of endpoint registrations 2329 changes from -15 to -16 2330 o Recommend a common set of resources for members of a group 2332 o Clarified use of multicast group in lighting example 2334 o Add note on concurrent registrations from one EP being possible 2335 but not expected 2337 o Refresh web examples appendix to reflect current use of Modernized 2338 Link Format 2340 o Add examples of URIs where Modernized Link Format matters 2342 o Editorial changes 2344 changes from -14 to -15 2346 o Rewrite of section "Security policies" 2348 o Clarify that the "base" parameter text applies both to relative 2349 references both in anchor and href 2351 o Renamed "Registree-EP" to Registrant-EP" 2353 o Talk of "relative references" and "URIs" rather than "relative" 2354 and "absolute" URIs. (The concept of "absolute URIs" of [RFC3986] 2355 is not needed in RD). 2357 o Fixed examples 2359 o Editorial changes 2361 changes from -13 to -14 2363 o Rename "registration context" to "registration base URI" (and 2364 "con" to "base") and "domain" to "sector" (where the abbreviation 2365 "d" stays for compatibility reasons) 2367 o Introduced resource types core.rd-ep and core.rd-gp 2369 o Registration management moved to appendix A, including endpoint 2370 and group lookup 2372 o Minor editorial changes 2374 * PATCH/iPATCH is clearly deferred to another document 2376 * Recommend against query / fragment identifier in con= 2377 * Interface description lists are described as illustrative 2379 * Rewording of Simple Registration 2381 o Simple registration carries no error information and succeeds 2382 immediately (previously, sequence was unspecified) 2384 o Lookup: href are matched against resolved values (previously, this 2385 was unspecified) 2387 o Lookup: lt are not exposed any more 2389 o con/base: Paths are allowed 2391 o Registration resource locations can not have query or fragment 2392 parts 2394 o Default life time extended to 25 hours 2396 o clarified registration update rules 2398 o lt-value semantics for lookup clarified. 2400 o added template for simple registration 2402 changes from -12 to -13 2404 o Added "all resource directory" nodes MC address 2406 o Clarified observation behavior 2408 o version identification 2410 o example rt= and et= values 2412 o domain from figure 2 2414 o more explanatory text 2416 o endpoints of a groups hosted by different RD 2418 o resolve RFC6690-vs-8288 resolution ambiguities: 2420 * require registered links not to be relative when using anchor 2422 * return absolute URIs in resource lookup 2424 changes from -11 to -12 2425 o added Content Model section, including ER diagram 2427 o removed domain lookup interface; domains are now plain attributes 2428 of groups and endpoints 2430 o updated chapter "Finding a Resource Directory"; now distinguishes 2431 configuration-provided, network-provided and heuristic sources 2433 o improved text on: atomicity, idempotency, lookup with multiple 2434 parameters, endpoint removal, simple registration 2436 o updated LWM2M description 2438 o clarified where relative references are resolved, and how context 2439 and anchor interact 2441 o new appendix on the interaction with RFCs 6690, 5988 and 3986 2443 o lookup interface: group and endpoint lookup return group and 2444 registration resources as link targets 2446 o lookup interface: search parameters work the same across all 2447 entities 2449 o removed all methods that modify links in an existing registration 2450 (POST with payload, PATCH and iPATCH) 2452 o removed plurality definition (was only needed for link 2453 modification) 2455 o enhanced IANA registry text 2457 o state that lookup resources can be observable 2459 o More examples and improved text 2461 changes from -09 to -10 2463 o removed "ins" and "exp" link-format extensions. 2465 o removed all text concerning DNS-SD. 2467 o removed inconsistency in RDAO text. 2469 o suggestions taken over from various sources 2471 o replaced "Function Set" with "REST API", "base URI", "base path" 2472 o moved simple registration to registration section 2474 changes from -08 to -09 2476 o clarified the "example use" of the base RD resource values /rd, 2477 /rd-lookup, and /rd-group. 2479 o changed "ins" ABNF notation. 2481 o various editorial improvements, including in examples 2483 o clarifications for RDAO 2485 changes from -07 to -08 2487 o removed link target value returned from domain and group lookup 2488 types 2490 o Maximum length of domain parameter 63 bytes for consistency with 2491 group 2493 o removed option for simple POST of link data, don't require a 2494 .well-known/core resource to accept POST data and handle it in a 2495 special way; we already have /rd for that 2497 o add IPv6 ND Option for discovery of an RD 2499 o clarify group configuration section 6.1 that endpoints must be 2500 registered before including them in a group 2502 o removed all superfluous client-server diagrams 2504 o simplified lighting example 2506 o introduced Commissioning Tool 2508 o RD-Look-up text is extended. 2510 changes from -06 to -07 2512 o added text in the discovery section to allow content format hints 2513 to be exposed in the discovery link attributes 2515 o editorial updates to section 9 2517 o update author information 2519 o minor text corrections 2520 Changes from -05 to -06 2522 o added note that the PATCH section is contingent on the progress of 2523 the PATCH method 2525 changes from -04 to -05 2527 o added Update Endpoint Links using PATCH 2529 o http access made explicit in interface specification 2531 o Added http examples 2533 Changes from -03 to -04: 2535 o Added http response codes 2537 o Clarified endpoint name usage 2539 o Add application/link-format+cbor content-format 2541 Changes from -02 to -03: 2543 o Added an example for lighting and DNS integration 2545 o Added an example for RD use in OMA LWM2M 2547 o Added Read Links operation for link inspection by endpoints 2549 o Expanded DNS-SD section 2551 o Added draft authors Peter van der Stok and Michael Koster 2553 Changes from -01 to -02: 2555 o Added a catalogue use case. 2557 o Changed the registration update to a POST with optional link 2558 format payload. Removed the endpoint type update from the update. 2560 o Additional examples section added for more complex use cases. 2562 o New DNS-SD mapping section. 2564 o Added text on endpoint identification and authentication. 2566 o Error code 4.04 added to Registration Update and Delete requests. 2568 o Made 63 bytes a SHOULD rather than a MUST for endpoint name and 2569 resource type parameters. 2571 Changes from -00 to -01: 2573 o Removed the ETag validation feature. 2575 o Place holder for the DNS-SD mapping section. 2577 o Explicitly disabled GET or POST on returned Location. 2579 o New registry for RD parameters. 2581 o Added support for the JSON Link Format. 2583 o Added reference to the Groupcomm WG draft. 2585 Changes from -05 to WG Document -00: 2587 o Updated the version and date. 2589 Changes from -04 to -05: 2591 o Restricted Update to parameter updates. 2593 o Added pagination support for the Lookup interface. 2595 o Minor editing, bug fixes and reference updates. 2597 o Added group support. 2599 o Changed rt to et for the registration and update interface. 2601 Changes from -03 to -04: 2603 o Added the ins= parameter back for the DNS-SD mapping. 2605 o Integrated the Simple Directory Discovery from Carsten. 2607 o Editorial improvements. 2609 o Fixed the use of ETags. 2611 o Fixed tickets 383 and 372 2613 Changes from -02 to -03: 2615 o Changed the endpoint name back to a single registration parameter 2616 ep= and removed the h= and ins= parameters. 2618 o Updated REST interface descriptions to use RFC6570 URI Template 2619 format. 2621 o Introduced an improved RD Lookup design as its own function set. 2623 o Improved the security considerations section. 2625 o Made the POST registration interface idempotent by requiring the 2626 ep= parameter to be present. 2628 Changes from -01 to -02: 2630 o Added a terminology section. 2632 o Changed the inclusion of an ETag in registration or update to a 2633 MAY. 2635 o Added the concept of an RD Domain and a registration parameter for 2636 it. 2638 o Recommended the Location returned from a registration to be 2639 stable, allowing for endpoint and Domain information to be changed 2640 during updates. 2642 o Changed the lookup interface to accept endpoint and Domain as 2643 query string parameters to control the scope of a lookup. 2645 13. References 2647 13.1. Normative References 2649 [I-D.ietf-core-links-json] 2650 Li, K., Rahman, A., and C. Bormann, "Representing 2651 Constrained RESTful Environments (CoRE) Link Format in 2652 JSON and CBOR", draft-ietf-core-links-json-10 (work in 2653 progress), February 2018. 2655 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2656 Requirement Levels", BCP 14, RFC 2119, 2657 DOI 10.17487/RFC2119, March 1997, 2658 . 2660 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 2661 Resource Identifier (URI): Generic Syntax", STD 66, 2662 RFC 3986, DOI 10.17487/RFC3986, January 2005, 2663 . 2665 [RFC5988] Nottingham, M., "Web Linking", RFC 5988, 2666 DOI 10.17487/RFC5988, October 2010, 2667 . 2669 [RFC6570] Gregorio, J., Fielding, R., Hadley, M., Nottingham, M., 2670 and D. Orchard, "URI Template", RFC 6570, 2671 DOI 10.17487/RFC6570, March 2012, 2672 . 2674 [RFC6690] Shelby, Z., "Constrained RESTful Environments (CoRE) Link 2675 Format", RFC 6690, DOI 10.17487/RFC6690, August 2012, 2676 . 2678 [RFC6763] Cheshire, S. and M. Krochmal, "DNS-Based Service 2679 Discovery", RFC 6763, DOI 10.17487/RFC6763, February 2013, 2680 . 2682 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 2683 Writing an IANA Considerations Section in RFCs", BCP 26, 2684 RFC 8126, DOI 10.17487/RFC8126, June 2017, 2685 . 2687 13.2. Informative References 2689 [ER] Chen, P., "The entity-relationship model---toward a 2690 unified view of data", ACM Transactions on Database 2691 Systems Vol. 1, pp. 9-36, DOI 10.1145/320434.320440, March 2692 1976. 2694 [I-D.arkko-core-dev-urn] 2695 Arkko, J., Jennings, C., and Z. Shelby, "Uniform Resource 2696 Names for Device Identifiers", draft-arkko-core-dev-urn-05 2697 (work in progress), October 2017. 2699 [I-D.bormann-t2trg-rel-impl] 2700 Bormann, C., "impl-info: A link relation type for 2701 disclosing implementation information", draft-bormann- 2702 t2trg-rel-impl-00 (work in progress), January 2018. 2704 [I-D.ietf-ace-oauth-authz] 2705 Seitz, L., Selander, G., Wahlstroem, E., Erdtman, S., and 2706 H. Tschofenig, "Authentication and Authorization for 2707 Constrained Environments (ACE) using the OAuth 2.0 2708 Framework (ACE-OAuth)", draft-ietf-ace-oauth-authz-16 2709 (work in progress), October 2018. 2711 [I-D.ietf-anima-bootstrapping-keyinfra] 2712 Pritikin, M., Richardson, M., Behringer, M., Bjarnason, 2713 S., and K. Watsen, "Bootstrapping Remote Secure Key 2714 Infrastructures (BRSKI)", draft-ietf-anima-bootstrapping- 2715 keyinfra-16 (work in progress), June 2018. 2717 [I-D.silverajan-core-coap-protocol-negotiation] 2718 Silverajan, B. and M. Ocak, "CoAP Protocol Negotiation", 2719 draft-silverajan-core-coap-protocol-negotiation-09 (work 2720 in progress), July 2018. 2722 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 2723 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 2724 Transfer Protocol -- HTTP/1.1", RFC 2616, 2725 DOI 10.17487/RFC2616, June 1999, 2726 . 2728 [RFC6775] Shelby, Z., Ed., Chakrabarti, S., Nordmark, E., and C. 2729 Bormann, "Neighbor Discovery Optimization for IPv6 over 2730 Low-Power Wireless Personal Area Networks (6LoWPANs)", 2731 RFC 6775, DOI 10.17487/RFC6775, November 2012, 2732 . 2734 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 2735 Protocol (HTTP/1.1): Message Syntax and Routing", 2736 RFC 7230, DOI 10.17487/RFC7230, June 2014, 2737 . 2739 [RFC7252] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained 2740 Application Protocol (CoAP)", RFC 7252, 2741 DOI 10.17487/RFC7252, June 2014, 2742 . 2744 [RFC7390] Rahman, A., Ed. and E. Dijk, Ed., "Group Communication for 2745 the Constrained Application Protocol (CoAP)", RFC 7390, 2746 DOI 10.17487/RFC7390, October 2014, 2747 . 2749 [RFC7641] Hartke, K., "Observing Resources in the Constrained 2750 Application Protocol (CoAP)", RFC 7641, 2751 DOI 10.17487/RFC7641, September 2015, 2752 . 2754 [RFC8132] van der Stok, P., Bormann, C., and A. Sehgal, "PATCH and 2755 FETCH Methods for the Constrained Application Protocol 2756 (CoAP)", RFC 8132, DOI 10.17487/RFC8132, April 2017, 2757 . 2759 [RFC8288] Nottingham, M., "Web Linking", RFC 8288, 2760 DOI 10.17487/RFC8288, October 2017, 2761 . 2763 [RFC8392] Jones, M., Wahlstroem, E., Erdtman, S., and H. Tschofenig, 2764 "CBOR Web Token (CWT)", RFC 8392, DOI 10.17487/RFC8392, 2765 May 2018, . 2767 Appendix A. Registration Management 2769 This section describes how the registering endpoint can maintain the 2770 registries that it created. The registering endpoint can be the 2771 registrant-ep or the CT. An endpoint SHOULD NOT use this interface 2772 for registries that it did not create. The registries are resources 2773 of the RD. 2775 After the initial registration, the registering endpoint retains the 2776 returned location of the Registration Resource for further 2777 operations, including refreshing the registration in order to extend 2778 the lifetime and "keep-alive" the registration. When the lifetime of 2779 the registration has expired, the RD SHOULD NOT respond to discovery 2780 queries concerning this endpoint. The RD SHOULD continue to provide 2781 access to the Registration Resource after a registration time-out 2782 occurs in order to enable the registering endpoint to eventually 2783 refresh the registration. The RD MAY eventually remove the 2784 registration resource for the purpose of garbage collection. If the 2785 Registration Resource is removed, the corresponding endpoint will 2786 need to be re-registered. 2788 The Registration Resource may also be used to inspect the 2789 registration resource using GET, update the registration, cancel the 2790 registration using DELETE, or do an endpoint lookup. 2792 These operations are described below. 2794 A.1. Registration Update 2796 The update interface is used by the registering endpoint to refresh 2797 or update its registration with an RD. To use the interface, the 2798 registering endpoint sends a POST request to the registration 2799 resource returned by the initial registration operation. 2801 An update MAY update the lifetime- or the context- registration 2802 parameters "lt", "base" as in Section 5.3. Parameters that are not 2803 being changed SHOULD NOT be included in an update. Adding parameters 2804 that have not changed increases the size of the message but does not 2805 have any other implications. Parameters MUST be included as query 2806 parameters in an update operation as in Section 5.3. 2808 A registration update resets the timeout of the registration to the 2809 (possibly updated) lifetime of the registration, independent of 2810 whether a "lt" parameter was given. 2812 If the context of the registration is changed in an update, relative 2813 references submitted in the original registration or later updates 2814 are resolved anew against the new context. 2816 The registration update operation only describes the use of POST with 2817 an empty payload. Future standards might describe the semantics of 2818 using content formats and payloads with the POST method to update the 2819 links of a registration (see Appendix A.4). 2821 The update registration request interface is specified as follows: 2823 Interaction: EP -> RD 2825 Method: POST 2827 URI Template: {+location}{?lt,con,extra-attrs*} 2829 URI Template Variables: 2831 location := This is the Location returned by the RD as a result 2832 of a successful earlier registration. 2834 lt := Lifetime (optional). Lifetime of the registration in 2835 seconds. Range of 60-4294967295. If no lifetime is included, 2836 the previous last lifetime set on a previous update or the 2837 original registration (falling back to 90000) SHOULD be used. 2839 base := Base URI (optional). This parameter updates the Base URI 2840 established in the original registration to a new value. If 2841 the parameter is set in an update, it is stored by the RD as 2842 the new Base URI under which to interpret the relative links 2843 present in the payload of the original registration, following 2844 the same restrictions as in the registration. If the parameter 2845 is not set in the request but was set before, the previous Base 2846 URI value is kept unmodified. If the parameter is not set in 2847 the request and was not set before either, the source address 2848 and source port of the update request are stored as the Base 2849 URI. 2851 extra-attrs := Additional registration attributes (optional). As 2852 with the registration, the RD processes them if it knows their 2853 semantics. Otherwise, unknown attributes are stored as 2854 endpoint attributes, overriding any previously stored endpoint 2855 attributes of the same key. 2857 Content-Format: none (no payload) 2859 The following response codes are defined for this interface: 2861 Success: 2.04 "Changed" or 204 "No Content" if the update was 2862 successfully processed. 2864 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 2865 request. 2867 Failure: 4.04 "Not Found" or 404 "Not Found". Registration does not 2868 exist (e.g. may have expired). 2870 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 2871 Service could not perform the operation. 2873 HTTP support: YES 2875 If the registration update fails with a "Service Unavailable" 2876 response and a Max-Age option or Retry-After header, the registering 2877 endpoint SHOULD retry the operation after the time indicated. If the 2878 registration fails in another way, including request timeouts, or if 2879 the time indicated exceeds the remaining lifetime, the registering 2880 endpoint SHOULD attempt registration again. 2882 The following example shows how the registering endpoint updates its 2883 registration resource at an RD using this interface with the example 2884 location value: /rd/4521. 2886 Req: POST /rd/4521 2888 Res: 2.04 Changed 2889 The following example shows the registering endpoint updating its 2890 registration resource at an RD using this interface with the example 2891 location value: /rd/4521. The initial registration by the 2892 registering endpoint set the following values: 2894 o endpoint name (ep)=endpoint1 2896 o lifetime (lt)=500 2898 o Base URI (base)=coap://local-proxy-old.example.com:5683 2900 o payload of Figure 7 2902 The initial state of the Resource Directory is reflected in the 2903 following request: 2905 Req: GET /rd-lookup/res?ep=endpoint1 2907 Res: 2.01 Content 2908 Payload: 2909 ;ct=41; 2910 rt="temperature"; anchor="coap://spurious.example.com:5683", 2911 ;ct=41; 2912 rt="light-lux"; if="sensor"; 2913 anchor="coap://local-proxy-old.example.com:5683" 2915 The following example shows the registering endpoint changing the 2916 Base URI to "coaps://new.example.com:5684": 2918 Req: POST /rd/4521?base=coaps://new.example.com:5684 2920 Res: 2.04 Changed 2922 The consecutive query returns: 2924 Req: GET /rd-lookup/res?ep=endpoint1 2926 Res: 2.01 Content 2927 Payload: 2928 ;ct=41;rt="temperature"; 2929 anchor="coap://spurious.example.com:5683", 2930 ;ct=41;rt="light-lux"; 2931 if="sensor"; anchor="coaps://new.example.com:5684", 2933 The following example shows a client performing and enpoint lookup 2934 for all groups. 2936 Req: GET /rd-lookup/ep?et=core.rd-group 2938 Res: 2.01 Content 2939 Payload: 2940 ;ep="GRP_R2-4-015";et="core.rd-group"; 2941 base="coap://[ff05:;1]", 2942 ;ep=lights&et=core.rd-group; 2943 base="coap://[ff35:30:2001:db8::1]" 2945 A.2. Registration Removal 2947 Although RD entries have soft state and will eventually timeout after 2948 their lifetime, the registering endpoint SHOULD explicitly remove an 2949 entry from the RD if it knows it will no longer be available (for 2950 example on shut-down). This is accomplished using a removal 2951 interface on the RD by performing a DELETE on the endpoint resource. 2953 The removal request interface is specified as follows: 2955 Interaction: EP -> RD 2957 Method: DELETE 2959 URI Template: {+location} 2961 URI Template Variables: 2963 location := This is the Location returned by the RD as a result 2964 of a successful earlier registration. 2966 The following response codes are defined for this interface: 2968 Success: 2.02 "Deleted" or 204 "No Content" upon successful deletion 2970 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 2971 request. 2973 Failure: 4.04 "Not Found" or 404 "Not Found". Registration does not 2974 exist (e.g. may have expired). 2976 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 2977 Service could not perform the operation. 2979 HTTP support: YES 2981 The following examples shows successful removal of the endpoint from 2982 the RD with example location value /rd/4521. 2984 Req: DELETE /rd/4521 2986 Res: 2.02 Deleted 2988 A.3. Read Endpoint Links 2990 Some registering endpoints may wish to manage their links as a 2991 collection, and may need to read the current set of links stored in 2992 the registration resource, in order to determine link maintenance 2993 operations. 2995 One or more links MAY be selected by using query filtering as 2996 specified in [RFC6690] Section 4.1 2998 If no links are selected, the Resource Directory SHOULD return an 2999 empty payload. 3001 The read request interface is specified as follows: 3003 Interaction: EP -> RD 3005 Method: GET 3007 URI Template: {+location}{?href,rel,rt,if,ct} 3009 URI Template Variables: 3011 location := This is the Location returned by the RD as a result 3012 of a successful earlier registration. 3014 href,rel,rt,if,ct := link relations and attributes specified in 3015 the query in order to select particular links based on their 3016 relations and attributes. "href" denotes the URI target of the 3017 link. See [RFC6690] Sec. 4.1 3019 The following response codes are defined for this interface: 3021 Success: 2.05 "Content" or 200 "OK" upon success with an 3022 "application/link-format", "application/link-format+cbor", or 3023 "application/link-format+json" payload. 3025 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 3026 request. 3028 Failure: 4.04 "Not Found" or 404 "Not Found". Registration does not 3029 exist (e.g. may have expired). 3031 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 3032 Service could not perform the operation. 3034 HTTP support: YES 3036 The following examples show successful read of the endpoint links 3037 from the RD, with example location value /rd/4521 and example 3038 registration payload of Figure 7. 3040 Req: GET /rd/4521 3042 Res: 2.01 Content 3043 Payload: 3044 ;ct=41;rt="temperature-c";if="sensor"; 3045 anchor="coap://spurious.example.com:5683", 3046 ;ct=41;rt="light-lux";if="sensor" 3048 A.4. Update Endpoint Links 3050 An iPATCH (or PATCH) update ([RFC8132]) can add, remove or change the 3051 links of a registration. 3053 Those operations are out of scope of this document, and will require 3054 media types suitable for modifying sets of links. 3056 A.5. Endpoint lookup 3058 Endpoint lookups result in links to registration resources. Endpoint 3059 registration resources are annotated with their endpoint names (ep), 3060 sectors (d, if present) and registration base URI (base) as well as a 3061 constant resource type (rt="core.rd-ep"); the lifetime (lt) is not 3062 reported. Additional endpoint attributes are added as link 3063 attributes to their endpoint link unless their specification says 3064 otherwise. 3066 Serializations derived from Link Format, SHOULD present links to 3067 endpoints in path-absolute form or, if required, as absolute 3068 references. (This approach avoids the RFC6690 ambiguities.) 3070 While Endpoint Lookup does expose the registration resources, the RD 3071 does not need to make them accessible to clients. Clients SHOULD NOT 3072 attempt to dereference or manipulate them. 3074 A Resource Directory can report endpoints in lookup that are not 3075 hosted at the same address. Lookup clients MUST be prepared to see 3076 arbitrary URIs as registration resources in the results and treat 3077 them as opaque identifiers; the precise semantics of such links are 3078 left to future specifications. 3080 The following example shows a client performing an endpoint type (et) 3081 lookup with the value oic.d.sensor (which is currently a registered 3082 rt value): 3084 Req: GET /rd-lookup/ep?et=oic.d.sensor 3086 Res: 2.05 Content 3087 ;base="coap://[2001:db8:3::127]:61616";ep="node5"; 3088 et="oic.d.sensor";ct="40", 3089 ;base="coap://[2001:db8:3::129]:61616";ep="node7"; 3090 et="oic.d.sensor";ct="40";d="floor-3" 3092 Appendix B. Web links and the Resource Directory 3094 Understanding the semantics of a link-format document and its URI 3095 references is a journey through different documents ([RFC3986] 3096 defining URIs, [RFC6690] defining link-format documents based on 3097 [RFC8288] which defines link headers, and [RFC7252] providing the 3098 transport). This appendix summarizes the mechanisms and semantics at 3099 play from an entry in ".well-known/core" to a resource lookup. 3101 This text is primarily aimed at people entering the field of 3102 Constrained Restful Environments from applications that previously 3103 did not use web mechanisms. 3105 At all examples in this section give compatible results for both 3106 Modernized and RFC6690 Link Format; the explanation of the steps 3107 follow Modernized Link Format. 3109 B.1. A simple example 3111 Let's start this example with a very simple host, "2001:db8:f0::1". 3112 A client that follows classical CoAP Discovery ([RFC7252] Section 7), 3113 sends the following multicast request to learn about neighbours 3114 supporting resources with resource-type "temperature". 3116 The client sends a link-local multicast: 3118 GET coap://[ff02::fd]:5683/.well-known/core?rt=temperature 3120 RES 2.05 Content 3121 ;rt=temperature;ct=0 3123 where the response is sent by the server, "[2001:db8:f0::1]:5683". 3125 While the client - on the practical or implementation side - can just 3126 go ahead and create a new request to "[2001:db8:f0::1]:5683" with 3127 Uri-Path: "temp", the full resolution steps for insertion into and 3128 retrieval from the RD without any shortcuts are: 3130 B.1.1. Resolving the URIs 3132 The client parses the single returned record. The link's target 3133 (sometimes called "href") is ""/temp"", which is a relative URI that 3134 needs resolving. The base URI is used to resolve the reference /temp against. 3137 The Base URI of the requested resource can be composed from the 3138 header options of the CoAP GET request by following the steps of 3139 [RFC7252] section 6.5 (with an addition at the end of 8.2) into 3140 ""coap://[2001:db8:f0::1]/.well-known/core"". 3142 Because ""/temp"" starts with a single slash, the record's target is 3143 resolved by replacing the path ""/.well-known/core"" from the Base 3144 URI (section 5.2 [RFC3986]) with the relative target URI ""/temp"" 3145 into ""coap://[2001:db8:f0::1]/temp"". 3147 B.1.2. Interpreting attributes and relations 3149 Some more information but the record's target can be obtained from 3150 the payload: the resource type of the target is "temperature", and 3151 its content type is text/plain (ct=0). 3153 A relation in a web link is a three-part statement that specifies a 3154 named relation between the so-called "context resource" and the 3155 target resource, like "_This page_ has _its table of contents_ at _/ 3156 toc.html_". In [RFC6690] and modernized link-format documents, there 3157 is an implicit "host relation" specified with default parameter: 3158 rel="hosts". 3160 In our example, the context resource of the link is the URI specified 3161 in the GET request "coap:://[2001:db8:f0::1]/.well-known/core". A 3162 full English expression of the "host relation" is: 3164 '"coap://[2001:db8:f0::1]/.well-known/core" is hosting the resource 3165 "coap://[2001:db8:f0::1]/temp", which is of the resource type 3166 "temperature" and can be accessed using the text/plain content 3167 format.' 3169 B.2. A slightly more complex example 3171 Omitting the "rt=temperature" filter, the discovery query would have 3172 given some more records in the payload: 3174 GET coap://[ff02::fd]:5683/.well-known/core 3176 RES 2.05 Content 3177 ;rt=temperature;ct=0, 3178 ;rt=light-lux;ct=0, 3179 ;anchor="/sensors/temp";rel=alternate, 3180 ;anchor="/sensors/temp"; 3181 rel="describedby" 3183 Parsing the third record, the client encounters the "anchor" 3184 parameter. It is a URI relative to the Base URI of the request and 3185 is thus resolved to ""coap://[2001:db8:f0::1]/sensors/temp"". That 3186 is the context resource of the link, so the "rel" statement is not 3187 about the target and the Base URI any more, but about the target and 3188 the resolved URI. Thus, the third record could be read as 3189 ""coap://[2001:db8:f0::1]/sensors/temp" has an alternate 3190 representation at "coap://[2001:db8:f0::1]/t"". 3192 Following the same resolution steps, the fourth record can be read as 3193 ""coap://[2001:db8:f0::1]/sensors/temp" is described by 3194 "http://www.example.com/sensors/t123"". 3196 B.3. Enter the Resource Directory 3198 The resource directory tries to carry the semantics obtainable by 3199 classical CoAP discovery over to the resource lookup interface as 3200 faithfully as possible. 3202 For the following queries, we will assume that the simple host has 3203 used Simple Registration to register at the resource directory that 3204 was announced to it, sending this request from its UDP port 3205 "[2001:db8:f0::1]:6553": 3207 POST coap://[2001:db8:f01::ff]/.well-known/core?ep=simple-host1 3209 The resource directory would have accepted the registration, and 3210 queried the simple host's ".well-known/core" by itself. As a result, 3211 the host is registered as an endpoint in the RD with the name 3212 "simple-host1". The registration is active for 90000 seconds, and 3213 the endpoint registration Base URI is ""coap://[2001:db8:f0::1]"" 3214 following the resolution steps described in Appendix B.1.1. It 3215 should be remarked that the Base URI constructed that way always 3216 yields a URI of the form: scheme://authority without path suffix. 3218 If the client now queries the RD as it would previously have issued a 3219 multicast request, it would go through the RD discovery steps by 3220 fetching "coap://[2001:db8:f0::ff]/.well-known/core?rt=core.rd- 3221 lookup-res", obtain "coap://[2001:db8:f0::ff]/rd-lookup/res" as the 3222 resource lookup endpoint, and issue a request to 3223 "coap://[2001:db8:f0::ff]/rd-lookup/res?rt=temperature" to receive 3224 the following data: 3226 ;rt=temperature;ct=0; 3227 anchor="coap://[2001:db8:f0::1]" 3229 This is not _literally_ the same response that it would have received 3230 from a multicast request, but it contains the equivalent statement: 3232 '"coap://[2001:db8:f0::1]" is hosting the resource 3233 "coap://[2001:db8:f0::1]/temp", which is of the resource type 3234 "temperature" and can be accessed using the text/plain content 3235 format.' 3237 (The difference is whether "/" or "/.well-known/core" hosts the 3238 resources, which is one of the often misunderstood subtleties 3239 Modernized Link Format addresses. Actually, /.well-known/core does 3240 NOT host the resource but stores a URI reference to the resource.) 3242 To complete the examples, the client could also query all resources 3243 hosted at the endpoint with the known endpoint name "simple-host1". 3244 A request to "coap://[2001:db8:f0::ff]/rd-lookup/res?ep=simple-host1" 3245 would return 3247 ;rt=temperature;ct=0; 3248 anchor="coap://[2001:db8:f0::1]", 3249 ;rt=light-lux;ct=0; 3250 anchor="coap://[2001:db8:f0::1]", 3251 ; 3252 anchor="coap://[2001:db8:f0::1]/sensors/temp";rel=alternate, 3253 ; 3254 anchor="coap://[2001:db8:f0::1]/sensors/temp";rel="describedby" 3256 All the target and anchor references are already in absolute form 3257 there, which don't need to be resolved any further. 3259 Had the simple host done an equivalent full registration with a base= 3260 parameter (e.g. "?ep=simple-host1&base=coap+tcp://simple- 3261 host1.example.com"), that context would have been used to resolve the 3262 relative anchor values instead, giving 3264 ;rt=temperature;ct=0; 3265 anchor="coap+tcp://simple-host1.example.com" 3267 and analogous records. 3269 B.4. A note on differences between link-format and Link headers 3271 While link-format and Link headers look very similar and are based on 3272 the same model of typed links, there are some differences between 3273 [RFC6690] and [RFC5988], which are dealt with differently: 3275 o "Resolving the target against the anchor": [RFC6690] Section 2.1 3276 states that the anchor of a link is used as the Base URI against 3277 which the term inside the angle brackets (the target) is resolved, 3278 falling back to the resource's URI with paths stripped off (its 3279 "Origin"). In contrast to that, [RFC8288] Section B.2 describes 3280 that the anchor is immaterial to the resolution of the target 3281 reference. 3283 RFC6690, in the same section, also states that absent anchors set 3284 the context of the link to the target's URI with its path stripped 3285 off, while according to [RFC8288] Section 3.2, the context is the 3286 resource's base URI. 3288 In the context of a Resource Directory, the authors decided to not 3289 let this become an issue by recommending that links in the 3290 Resource Directory be _deserializable_ by either rule set to give 3291 the same results. Note that all examples of [RFC6690], [RFC8288] 3292 and this document comply with that rule. 3294 The Modernized Link Format is introduced in Appendix D to 3295 formalize what it means to apply the ruleset of RFC8288 to Link 3296 Format documents. 3298 o There is no percent encoding in link-format documents. 3300 A link-format document is a UTF-8 encoded string of Unicode 3301 characters and does not have percent encoding, while Link headers 3302 are practically ASCII strings that use percent encoding for non- 3303 ASCII characters, stating the encoding explicitly when required. 3305 For example, while a Link header in a page about a Swedish city 3306 might read 3308 "Link: ;rel="live-environment-data"" 3310 a link-format document from the same source might describe the 3311 link as 3313 ";rel="live-environment-data"" 3315 Parsers and producers of link-format and header data need to be 3316 aware of this difference. 3318 Appendix C. Syntax examples for Protocol Negotiation 3320 [ This appendix should not show up in a published version of this 3321 document. ] 3323 The protocol negotiation that is being worked on in 3324 [I-D.silverajan-core-coap-protocol-negotiation] makes use of the 3325 Resource Directory. 3327 Until that document is update to use the latest resource-directory 3328 specification, here are some examples of protocol negotiation with 3329 the current Resource Directory: 3331 An endpoint could register as follows from its address 3332 [2001:db8:f1::2]:5683: 3334 Req: POST coap://rd.example.com/rd?ep=node1 3335 &at=coap+tcp://[2001:db8:f1::2] 3336 Content-Format: 40 3337 Payload: 3338 ;ct=0;rt="temperature";if="core.s" 3340 Res: 2.01 Created 3341 Location-Path: /rd/1234 3343 An endpoint lookup would just reflect the registered attributes: 3345 Req: GET /rd-lookup/ep 3347 Res: 2.05 Content 3348 ;ep="node1";base="coap://[2001:db8:f1::2]:5683"; 3349 at="coap+tcp://[2001:db8:f1::2]" 3351 A UDP client would then see the following in a resource lookup: 3353 Req: GET /rd-lookup/res?rt=temperature 3355 Res: 2.05 Content 3356 ;ct=0;rt="temperature"; 3357 if="core.s"; anchor="coap://[2001:db8:f1::2]" 3359 while a TCP capable client could say: 3361 Req: GET /rd-lookup/res?rt=temperature&tt=tcp 3363 Res: 2.05 Content 3364 ;ct=0;rt="temperature"; 3365 if="core.s";anchor="coap+tcp://[2001:db8:f1::2]" 3367 Appendix D. Modernized Link Format parsing 3369 The CoRE Link Format as described in [RFC6690] is unsuitable for some 3370 use cases of the Resource Directory, and their resolution scheme is 3371 often misunderstood by developers familiar with [RFC8288]. 3373 For the correct application of base URIs, we describe the 3374 interpretation of a Link Format document as a Modernized Link Format. 3375 In Modernized Link Format, the document is processed as in Link 3376 Format, with the exception of Section 2.1 of [RFC6690]: 3378 o The URI-reference inside angle brackets ("<>") describes the 3379 target URI of the link. 3381 o The context of the link is expressed by the "anchor" parameter. 3382 If the anchor attribute is absent, it defaults to the empty 3383 reference (""). 3385 o Both these references are resolved according to Section 5 of 3386 [RFC3986]. 3388 Content formats derived from [RFC6690] which inherit its resolution 3389 rules, like JSON and CBOR link format of [I-D.ietf-core-links-json], 3390 can be interpreted in analogy to that. 3392 For where the Resource Directory is concerned, all common forms of 3393 links (e.g. all the examples of RFC6690) yield identical results. 3394 When interpreting data read from ".well-known/core", differences in 3395 interpretation only affect links where the absent anchor attribute 3396 means "coap://host/" according to RFC6690 and "coap://host/.well- 3397 known/core" according to Modernized Link format; those typically only 3398 occur in conjunction with the vaguely defined implicit "hosts" 3399 relationship. 3401 D.1. For endpoint developers 3403 When developing endpoints, i.e. when generating documents that will 3404 be submitted to a Resource Directory, the differences between 3405 Modernized Link Format and RFC6690 can be ignored as long as 3407 o all relative references start with a slash, 3409 and any of the following applies: 3411 o There is no anchor attribute, and the context of the link does not 3412 matter to the application. 3414 Example: ";ct=40" 3416 o The anchor is a relative reference. 3418 Example: ";anchor="/sensors/temp";rel="alternate"" 3420 o The target is an absolute reference. 3422 Example: ";anchor="/sensors/ 3423 temp";rel="describedby"" 3425 D.2. Examples of links with differing interpretations 3427 Examples of links with different interpretations from either applying 3428 RFC6690 or Modernized Link Format are shown here. The example is 3429 assumed to be obtained from a document. 3431 o "": The target is "/sensors" in RFC6690 and "/device/ 3432 sensors" in Modernized Link Format (whereas "" would be 3433 unambiguous). 3435 o "": The target is "/?which=these" in RFC6690 and 3436 "/device/index?which=these" in Modernized Link Format. 3438 o ";anchor="http://example.com/calib- 3439 proto/1234";rel="topic"" is about "http://example.com/sensors" in 3440 RFC6690 and about "/device/sensors" in Modernized Link Format. 3442 This link can not be expressed in RFC6690 link format without the 3443 server explicitly expressing most of its own URI (which is 3444 problematic in reverse proxy scenarios or when the Uri-Host option 3445 is not sent). 3447 o ";rel="alternate";anchor=""": According to RFC6690, this 3448 states that the "/" resource has an alternative representation at 3449 "/i", whereas Modernized Link Format says that "/devices/index" 3450 has an alternative representation at "/i". 3452 The "anchor" attribute is usually left out; the link 3453 ";rel="alternate"" is equivalent to the above and results in 3454 the same interpretations. 3456 Authors' Addresses 3457 Zach Shelby 3458 ARM 3459 150 Rose Orchard 3460 San Jose 95134 3461 USA 3463 Phone: +1-408-203-9434 3464 Email: zach.shelby@arm.com 3466 Michael Koster 3467 SmartThings 3468 665 Clyde Avenue 3469 Mountain View 94043 3470 USA 3472 Phone: +1-707-502-5136 3473 Email: Michael.Koster@smartthings.com 3475 Carsten Bormann 3476 Universitaet Bremen TZI 3477 Postfach 330440 3478 Bremen D-28359 3479 Germany 3481 Phone: +49-421-218-63921 3482 Email: cabo@tzi.org 3484 Peter van der Stok 3485 consultant 3487 Phone: +31-492474673 (Netherlands), +33-966015248 (France) 3488 Email: consultancy@vanderstok.org 3489 URI: www.vanderstok.org 3491 Christian Amsuess (editor) 3492 Hollandstr. 12/4 3493 1020 3494 Austria 3496 Phone: +43-664-9790639 3497 Email: christian@amsuess.com