idnits 2.17.1 draft-ietf-core-resource-directory-18.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 390 has weird spacing: '... target o----...' == Line 392 has weird spacing: '...--o rel o...' == Line 457 has weird spacing: '...o href o----...' == Line 461 has weird spacing: '... o ep o---...' == Line 469 has weird spacing: '... o lt o---...' == (2 more instances...) -- The document date (December 20, 2018) is 1953 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 2922, but no explicit reference was found in the text == Unused Reference: 'I-D.ietf-anima-bootstrapping-keyinfra' is defined on line 2944, but no explicit reference was found in the text == Unused Reference: 'RFC8392' is defined on line 3001, but no explicit reference was found in the text == Outdated reference: A later version (-02) exists of draft-bormann-t2trg-rel-impl-00 == Outdated reference: A later version (-09) exists of draft-hartke-t2trg-coral-06 == Outdated reference: A later version (-46) exists of draft-ietf-ace-oauth-authz-17 == Outdated reference: A later version (-45) exists of draft-ietf-anima-bootstrapping-keyinfra-17 -- Obsolete informational reference (is this intentional?): RFC 7230 (Obsoleted by RFC 9110, RFC 9112) Summary: 0 errors (**), 0 flaws (~~), 16 warnings (==), 2 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: June 23, 2019 SmartThings 6 C. Bormann 7 Universitaet Bremen TZI 8 P. van der Stok 9 consultant 10 C. Amsuess, Ed. 11 December 20, 2018 13 CoRE Resource Directory 14 draft-ietf-core-resource-directory-18 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 contains 22 information about resources held on other servers, allowing lookups 23 to be performed for those resources. The input to an RD is composed 24 of links and the output is composed of links constructed from the 25 information stored in the RD. This document specifies the web 26 interfaces that a Resource Directory supports for web servers to 27 discover the RD and to register, maintain, lookup and remove 28 information on resources. Furthermore, new target attributes useful 29 in conjunction with an RD are defined. 31 Status of This Memo 33 This Internet-Draft is submitted in full conformance with the 34 provisions of BCP 78 and BCP 79. 36 Internet-Drafts are working documents of the Internet Engineering 37 Task Force (IETF). Note that other groups may also distribute 38 working documents as Internet-Drafts. The list of current Internet- 39 Drafts is at https://datatracker.ietf.org/drafts/current/. 41 Internet-Drafts are draft documents valid for a maximum of six months 42 and may be updated, replaced, or obsoleted by other documents at any 43 time. It is inappropriate to use Internet-Drafts as reference 44 material or to cite them other than as "work in progress." 46 This Internet-Draft will expire on June 23, 2019. 48 Copyright Notice 50 Copyright (c) 2018 IETF Trust and the persons identified as the 51 document authors. All rights reserved. 53 This document is subject to BCP 78 and the IETF Trust's Legal 54 Provisions Relating to IETF Documents 55 (https://trustee.ietf.org/license-info) in effect on the date of 56 publication of this document. Please review these documents 57 carefully, as they describe your rights and restrictions with respect 58 to this document. Code Components extracted from this document must 59 include Simplified BSD License text as described in Section 4.e of 60 the Trust Legal Provisions and are provided without warranty as 61 described in the Simplified BSD License. 63 Table of Contents 65 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 66 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 4 67 3. Architecture and Use Cases . . . . . . . . . . . . . . . . . 6 68 3.1. Principles . . . . . . . . . . . . . . . . . . . . . . . 6 69 3.2. Architecture . . . . . . . . . . . . . . . . . . . . . . 7 70 3.3. RD Content Model . . . . . . . . . . . . . . . . . . . . 8 71 3.4. Link-local addresses . . . . . . . . . . . . . . . . . . 12 72 3.5. Use Case: Cellular M2M . . . . . . . . . . . . . . . . . 12 73 3.6. Use Case: Home and Building Automation . . . . . . . . . 13 74 3.7. Use Case: Link Catalogues . . . . . . . . . . . . . . . . 13 75 4. Finding a Resource Directory . . . . . . . . . . . . . . . . 14 76 4.1. Resource Directory Address Option (RDAO) . . . . . . . . 16 77 5. Resource Directory . . . . . . . . . . . . . . . . . . . . . 17 78 5.1. Payload Content Formats . . . . . . . . . . . . . . . . . 18 79 5.2. URI Discovery . . . . . . . . . . . . . . . . . . . . . . 18 80 5.3. Registration . . . . . . . . . . . . . . . . . . . . . . 21 81 5.3.1. Simple Registration . . . . . . . . . . . . . . . . . 25 82 5.3.2. Third-party registration . . . . . . . . . . . . . . 28 83 5.4. Operations on the Registration Resource . . . . . . . . . 28 84 5.4.1. Registration Update . . . . . . . . . . . . . . . . . 29 85 5.4.2. Registration Removal . . . . . . . . . . . . . . . . 32 86 5.4.3. Further operations . . . . . . . . . . . . . . . . . 33 87 6. RD Lookup . . . . . . . . . . . . . . . . . . . . . . . . . . 33 88 6.1. Resource lookup . . . . . . . . . . . . . . . . . . . . . 34 89 6.2. Lookup filtering . . . . . . . . . . . . . . . . . . . . 34 90 6.3. Resource lookup examples . . . . . . . . . . . . . . . . 36 91 6.4. Endpoint lookup . . . . . . . . . . . . . . . . . . . . . 39 92 7. Security policies . . . . . . . . . . . . . . . . . . . . . . 40 93 7.1. Secure RD discovery . . . . . . . . . . . . . . . . . . . 41 94 7.2. Secure RD filtering . . . . . . . . . . . . . . . . . . . 41 95 7.3. Secure endpoint Name assignment . . . . . . . . . . . . . 42 97 8. Security Considerations . . . . . . . . . . . . . . . . . . . 42 98 8.1. Endpoint Identification and Authentication . . . . . . . 42 99 8.2. Access Control . . . . . . . . . . . . . . . . . . . . . 43 100 8.3. Denial of Service Attacks . . . . . . . . . . . . . . . . 43 101 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 43 102 9.1. Resource Types . . . . . . . . . . . . . . . . . . . . . 43 103 9.2. IPv6 ND Resource Directory Address Option . . . . . . . . 44 104 9.3. RD Parameter Registry . . . . . . . . . . . . . . . . . . 44 105 9.3.1. Full description of the "Endpoint Type" Registration 106 Parameter . . . . . . . . . . . . . . . . . . . . . . 46 107 9.4. "Endpoint Type" (et=) RD Parameter values . . . . . . . . 46 108 9.5. Multicast Address Registration . . . . . . . . . . . . . 47 109 10. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 47 110 10.1. Lighting Installation . . . . . . . . . . . . . . . . . 47 111 10.1.1. Installation Characteristics . . . . . . . . . . . . 47 112 10.1.2. RD entries . . . . . . . . . . . . . . . . . . . . . 49 113 10.2. OMA Lightweight M2M (LWM2M) Example . . . . . . . . . . 51 114 10.2.1. The LWM2M Object Model . . . . . . . . . . . . . . . 52 115 10.2.2. LWM2M Register Endpoint . . . . . . . . . . . . . . 53 116 10.2.3. LWM2M Update Endpoint Registration . . . . . . . . . 55 117 10.2.4. LWM2M De-Register Endpoint . . . . . . . . . . . . . 55 118 11. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 55 119 12. Changelog . . . . . . . . . . . . . . . . . . . . . . . . . . 55 120 13. References . . . . . . . . . . . . . . . . . . . . . . . . . 63 121 13.1. Normative References . . . . . . . . . . . . . . . . . . 63 122 13.2. Informative References . . . . . . . . . . . . . . . . . 64 123 Appendix A. Groups Registration and Lookup . . . . . . . . . . . 66 124 Appendix B. Web links and the Resource Directory . . . . . . . . 68 125 B.1. A simple example . . . . . . . . . . . . . . . . . . . . 68 126 B.1.1. Resolving the URIs . . . . . . . . . . . . . . . . . 68 127 B.1.2. Interpreting attributes and relations . . . . . . . . 69 128 B.2. A slightly more complex example . . . . . . . . . . . . . 69 129 B.3. Enter the Resource Directory . . . . . . . . . . . . . . 70 130 B.4. A note on differences between link-format and Link 131 headers . . . . . . . . . . . . . . . . . . . . . . . . . 71 132 Appendix C. Limited Link Format . . . . . . . . . . . . . . . . 72 133 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 73 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 [RFC8288]. 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 contains information 156 about resources held on other servers, allowing lookups to be 157 performed for 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 information on resources. Furthermore, 162 new target attributes useful in conjunction with a Resource Directory 163 are 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], [RFC8288] 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 templates are given in list form; 260 those describe the operation participants, request codes, URIs, 261 content formats and outcomes. Sections of those templates contain 262 normative content about Interaction, Method, URI Template and URI 263 Template Variables 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 information about resources hosted by other devices that 281 could otherwise only be obtained by directly querying the /.well- 282 known/core resource on these other devices, either by a unicast 283 request or a multicast request. 285 Only information SHOULD be stored in the resource directory that can 286 be obtained by 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 to the 294 information in the Resource Directory do not propagate automatically 295 back to the web servers from where the information 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 of registrations 301 describing resources hosted on other web servers, also called 302 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 resource directory registrations, and for 306 endpoints to lookup resources from the RD. An RD can be logically 307 segmented by the use of Sectors. 309 A mechanism to discover an RD using CoRE Link Format [RFC6690] is 310 defined. 312 Registrations in the RD are soft state and need to be periodically 313 refreshed. 315 An endpoint uses specific interfaces to register, update and remove a 316 registration. It is also possible for an RD to fetch Web Links from 317 endpoints and add their contents to resource directory registrations. 319 At the first registration of an endpoint, a "registration resource" 320 is created, the location of which is returned to the registering 321 endpoint. The registering endpoint uses this registration resource 322 to manage the contents of registrations. 324 A lookup interface for discovering any of the Web Links stored in the 325 RD is provided using the CoRE Link Format. 327 Registration Lookup 328 Interface Interface 329 +----+ | | 330 | EP |---- | | 331 +----+ ---- | | 332 --|- +------+ | 333 +----+ | ----| | | +--------+ 334 | EP | ---------|-----| RD |----|-----| Client | 335 +----+ | ----| | | +--------+ 336 --|- +------+ | 337 +----+ ---- | | 338 | EP |---- | | 339 +----+ 341 Figure 1: The resource directory architecture. 343 A Registrant-EP MAY keep concurrent registrations to more than one RD 344 at the same time if explicitly configured to do so, but that is not 345 expected to be supported by typical EP implementations. Any such 346 registrations are independent of each other. The usual expectation 347 when multiple discovery mechanisms or addresses are configured is 348 that they constitute a fall-back path for a single registration. 350 3.3. RD Content Model 352 The Entity-Relationship (ER) models shown in Figure 2 and Figure 3 353 model the contents of /.well-known/core and the resource directory 354 respectively, with entity-relationship diagrams [ER]. Entities 355 (rectangles) are used for concepts that exist independently. 356 Attributes (ovals) are used for concepts that exist only in 357 connection with a related entity. Relations (diamonds) give a 358 semantic meaning to the relation between entities. Numbers specify 359 the cardinality of the relations. 361 Some of the attribute values are URIs. Those values are always full 362 URIs and never relative references in the information model. They 363 can, however, be expressed as relative references in serializations, 364 and often are. 366 These models provide an abstract view of the information expressed in 367 link-format documents and a Resource Directory. They cover the 368 concepts, but not necessarily all details of an RD's operation; they 369 are meant to give an overview, and not be a template for 370 implementations. 372 +----------------------+ 373 | /.well-known/core | 374 +----------------------+ 375 | 376 | 1 377 ////////\\\\\\\ 378 < contains > 379 \\\\\\\\/////// 380 | 381 | 0+ 382 +--------------------+ 383 | link | 384 +--------------------+ 385 | 386 | 1 oooooooo 387 +-----o target o 388 | oooooooo 389 oooooooooooo 0+ | 390 o target o--------+ 391 o attribute o | 0+ oooooo 392 oooooooooooo +-----o rel o 393 | oooooo 394 | 395 | 1 ooooooooo 396 +-----o context o 397 ooooooooo 399 Figure 2: E-R Model of the content of /.well-known/core 401 The model shown in Figure 2 models the contents of /.well-known/core 402 which contains: 404 o a set of links belonging to the hosting web server 406 The web server is free to choose links it deems appropriate to be 407 exposed in its ".well-known/core". Typically, the links describe 408 resources that are served by the host, but the set can also contain 409 links to resources on other servers (see examples in [RFC6690] page 410 14). The set does not necessarily contain links to all resources 411 served by the host. 413 A link has the following attributes (see [RFC8288]): 415 o Zero or more link relations: They describe relations between the 416 link context and the link target. 418 In link-format serialization, they are expressed as space- 419 separated values in the "rel" attribute, and default to "hosts". 421 o A link context URI: It defines the source of the relation, e.g. 422 _who_ "hosts" something. 424 In link-format serialization, it is expressed in the "anchor" 425 attribute. It defaults to that document's URI. 427 o A link target URI: It defines the destination of the relation 428 (e.g. _what_ is hosted), and is the topic of all target 429 attributes. 431 In link-format serialization, it is expressed between angular 432 brackets, and sometimes called the "href". 434 o Other target attributes (e.g. resource type (rt), interface (if), 435 or content-type (ct)). These provide additional information about 436 the target URI. 438 +----------------------+ 439 | resource-directory | 440 +----------------------+ 441 | 1 442 | 443 | 444 | 445 | 446 //////\\\\ 447 < contains > 448 \\\\\///// 449 | 450 0+ | 451 ooooooo 1 +---------------+ 452 o base o-------| registration | 453 ooooooo +---------------+ 454 | | 1 455 | +--------------+ 456 oooooooo 1 | | 457 o href o----+ /////\\\\ 458 oooooooo | < contains > 459 | \\\\\///// 460 oooooooo 1 | | 461 o ep o----+ | 0+ 462 oooooooo | +------------------+ 463 | | link | 464 oooooooo 0-1 | +------------------+ 465 o d o----+ | 466 oooooooo | | 1 oooooooo 467 | +-----o target o 468 oooooooo 1 | | oooooooo 469 o lt o----+ ooooooooooo 0+ | 470 oooooooo | o target o-----+ 471 | o attribute o | 0+ oooooo 472 ooooooooooo 0+ | ooooooooooo +-----o rel o 473 o endpoint o----+ | oooooo 474 o attribute o | 475 ooooooooooo | 1 ooooooooo 476 +----o context o 477 ooooooooo 479 Figure 3: E-R Model of the content of the Resource Directory 481 The model shown in Figure 3 models the contents of the resource 482 directory which contains in addition to /.well-known/core: 484 o 0 to n Registrations of endpoints, 485 A registration is associated with one endpoint. A registration 486 defines a set of links as defined for /.well-known/core. A 487 Registration has six types of attributes: 489 o a unique endpoint name ("ep") within a sector 491 o a Registration Base URI ("base", a URI typically describing the 492 scheme://authority part) 494 o a lifetime ("lt"), 496 o a registration resource location inside the RD ("href"), 498 o optionally a sector ("d") 500 o optional additional endpoint attributes (from Section 9.3) 502 The cardinality of "base" is currently 1; future documents are 503 invited to extend the RD specification to support multiple values 504 (e.g. [I-D.silverajan-core-coap-protocol-negotiation]). Its value 505 is used as a Base URI when resolving URIs in the links contained in 506 the endpoint. 508 Links are modelled as they are in Figure 2. 510 3.4. Link-local addresses 512 Registration requests to the RD may arrive from link-local IP 513 addresses. When building a Registration Base URI from that source IP 514 address (which would become part of the resolved URIs in resource 515 lookup), its link-local IP literal typically contains a zone 516 identifier of the RD, and is not usable across hosts (see [RFC6874] 517 Section 1). 519 Therefore, RD servers SHOULD reject registrations which use of URIs 520 containing link-local IP addresses. 522 3.5. 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. 544 Periodically, these endpoints update their registration and may 545 modify resources they offer. 547 When endpoints are not always connected, for example because they 548 enter a sleep mode, a remote server is usually used to provide proxy 549 access to the endpoints. Mobile apps or web applications for 550 environment monitoring contact the RD, look up the endpoints capable 551 of providing information about the environment using an appropriate 552 set of link parameters, obtain information on how to contact them 553 (URLs of the proxy server), and then initiate interaction to obtain 554 information that is finally processed, displayed on the screen and 555 usually stored in a database. Similarly, fleet management systems 556 provide the appropriate link parameters to the RD to look up for EPs 557 deployed on the vehicles the application is responsible for. 559 3.6. Use Case: Home and Building Automation 561 Home and commercial building automation systems can benefit from the 562 use of M2M web services. The discovery requirements of these 563 applications are demanding. Home automation usually relies on run- 564 time discovery to commission the system, whereas in building 565 automation a combination of professional commissioning and run-time 566 discovery is used. Both home and building automation involve peer- 567 to-peer interactions between endpoints, and involve battery-powered 568 sleeping devices. 570 3.7. Use Case: Link Catalogues 572 Resources may be shared through data brokers that have no knowledge 573 beforehand of who is going to consume the data. Resource Directory 574 can be used to hold links about resources and services hosted 575 anywhere to make them discoverable by a general class of 576 applications. 578 For example, environmental and weather sensors that generate data for 579 public consumption may provide data to an intermediary server, or 580 broker. Sensor data are published to the intermediary upon changes 581 or at regular intervals. Descriptions of the sensors that resolve to 582 links to sensor data may be published to a Resource Directory. 583 Applications wishing to consume the data can use RD Lookup to 584 discover and resolve links to the desired resources and endpoints. 585 The Resource Directory service need not be coupled with the data 586 intermediary service. Mapping of Resource Directories to data 587 intermediaries may be many-to-many. 589 Metadata in web link formats like [RFC6690] which may be internally 590 stored as triples, or relation/attribute pairs providing metadata 591 about resource links, need to be supported by Resource Directories . 592 External catalogues that are represented in other formats may be 593 converted to common web linking formats for storage and access by 594 Resource Directories. Since it is common practice for these to be 595 URN encoded, simple and lossless structural transforms should 596 generally be sufficient to store external metadata in Resource 597 Directories. 599 The additional features of Resource Directory allow sectors to be 600 defined to enable access to a particular set of resources from 601 particular applications. This provides isolation and protection of 602 sensitive data when needed. Application groups with multicast 603 addresses may be defined to support efficient data transport. 605 4. Finding a Resource Directory 607 A (re-)starting device may want to find one or more resource 608 directories for discovery purposes. 610 The device may be pre-configured to exercise specific mechanisms for 611 finding the resource directory: 613 1. It may be configured with a specific IP address for the RD. That 614 IP address may also be an anycast address, allowing the network 615 to forward RD requests to an RD that is topologically close; each 616 target network environment in which some of these preconfigured 617 nodes are to be brought up is then configured with a route for 618 this anycast address that leads to an appropriate RD. (Instead 619 of using an anycast address, a multicast address can also be 620 preconfigured. The RD servers then need to configure one of 621 their interfaces with this multicast address.) 623 2. It may be configured with a DNS name for the RD and use DNS to 624 return the IP address of the RD; it can find a DNS server to 625 perform the lookup using the usual mechanisms for finding DNS 626 servers. 628 3. It may be configured to use a service discovery mechanism such as 629 DNS-SD [RFC6763]. The present specification suggests configuring 630 the service with name rd._sub._coap._udp, preferably within the 631 domain of the querying nodes. 633 For cases where the device is not specifically configured with a way 634 to find a resource directory, the network may want to provide a 635 suitable default. 637 1. If the address configuration of the network is performed via 638 SLAAC, this is provided by the RDAO option Section 4.1. 640 2. If the address configuration of the network is performed via 641 DHCP, this could be provided via a DHCP option (no such option is 642 defined at the time of writing). 644 Finally, if neither the device nor the network offers any specific 645 configuration, the device may want to employ heuristics to find a 646 suitable resource directory. 648 The present specification does not fully define these heuristics, but 649 suggests a number of candidates: 651 1. In a 6LoWPAN, just assume the Border Router (6LBR) can act as a 652 resource directory (using the ABRO option to find that 653 [RFC6775]). Confirmation can be obtained by sending a Unicast to 654 "coap://[6LBR]/.well-known/core?rt=core.rd*". 656 2. In a network that supports multicast well, discovering the RD 657 using a multicast query for /.well-known/core as specified in 658 CoRE Link Format [RFC6690]: Sending a Multicast GET to 659 "coap://[MCD1]/.well-known/core?rt=core.rd*". RDs within the 660 multicast scope will answer the query. 662 When answering a link-local multicast request, the RD SHOULD NOT 663 respond with their link-local addresses but use a routable one; 664 otherwise the registrant-ep would later need to pick an explicit base 665 address to avoid the issue of Section 3.4. 667 As some of the RD addresses obtained by the methods listed here are 668 just (more or less educated) guesses, endpoints MUST make use of any 669 error messages to very strictly rate-limit requests to candidate IP 670 addresses that don't work out. For example, an ICMP Destination 671 Unreachable message (and, in particular, the port unreachable code 672 for this message) may indicate the lack of a CoAP server on the 673 candidate host, or a CoAP error response code such as 4.05 "Method 674 Not Allowed" may indicate unwillingness of a CoAP server to act as a 675 directory server. 677 If multiple candidate addresses are discovered, the device may pick 678 any of them initially, unless the discovery method indicates a more 679 precise selection scheme. 681 4.1. Resource Directory Address Option (RDAO) 683 The Resource Directory Address Option (RDAO) using IPv6 Neighbor 684 Discovery (ND) carries information about the address of the Resource 685 Directory (RD). This information is needed when endpoints cannot 686 discover the Resource Directory with a link-local or realm-local 687 scope multicast address because the endpoint and the RD are separated 688 by a Border Router (6LBR). In many circumstances the availability of 689 DHCP cannot be guaranteed either during commissioning of the network. 690 The presence and the use of the RD is essential during commissioning. 692 It is possible to send multiple RDAO options in one message, 693 indicating as many resource directory addresses. 695 The RDAO format is: 697 0 1 2 3 698 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 699 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 700 | Type | Length = 3 | Valid Lifetime | 701 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 702 | Reserved | 703 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 704 | | 705 + + 706 | | 707 + RD Address + 708 | | 709 + + 710 | | 711 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 713 Fields: 715 Type: 38 717 Length: 8-bit unsigned integer. The length of 718 the option in units of 8 bytes. 719 Always 3. 721 Valid Lifetime: 16-bit unsigned integer. The length of 722 time in units of 60 seconds (relative to 723 the time the packet is received) that 724 this Resource Directory address is valid. 725 A value of all zero bits (0x0) indicates 726 that this Resource Directory address 727 is not valid anymore. 729 Reserved: This field is unused. It MUST be 730 initialized to zero by the sender and 731 MUST be ignored by the receiver. 733 RD Address: IPv6 address of the RD. 735 Figure 4: Resource Directory Address Option 737 5. Resource Directory 739 This section defines the required set of REST interfaces between a 740 Resource Directory (RD) and endpoints. Although the examples 741 throughout this section assume the use of CoAP [RFC7252], these REST 742 interfaces can also be realized using HTTP [RFC7230]. In all 743 definitions in this section, both CoAP response codes (with dot 744 notation) and HTTP response codes (without dot notation) are shown. 746 An RD implementing this specification MUST support the discovery, 747 registration, update, lookup, and removal interfaces defined in this 748 section. 750 All operations on the contents of the Resource Directory MUST be 751 atomic and idempotent. 753 A resource directory MAY make the information submitted to it 754 available to further directories, if it can ensure that a loop does 755 not form. The protocol used between directories to ensure loop-free 756 operation is outside the scope of this document. 758 5.1. Payload Content Formats 760 Resource Directory implementations using this specification MUST 761 support the application/link-format content format (ct=40). 763 Resource Directories implementing this specification MAY support 764 additional content formats. 766 Any additional content format supported by a Resource Directory 767 implementing this specification SHOULD be able to express all the 768 information expressible in link-format. It MAY be able to express 769 information that is inexpressible in link-format, but those 770 expressions SHOULD be avoided where possible. 772 5.2. URI Discovery 774 Before an endpoint can make use of an RD, it must first know the RD's 775 address and port, and the URI path information for its REST APIs. 776 This section defines discovery of the RD and its URIs using the well- 777 known interface of the CoRE Link Format [RFC6690]. A complete set of 778 RD discovery methods is described in Section 4. 780 Discovery of the RD registration URI path is performed by sending 781 either a multicast or unicast GET request to "/.well-known/core" and 782 including a Resource Type (rt) parameter [RFC6690] with the value 783 "core.rd" in the query string. Likewise, a Resource Type parameter 784 value of "core.rd-lookup*" is used to discover the URIs for RD Lookup 785 operations, core.rd* is used to discover all URI paths for RD 786 operations. Upon success, the response will contain a payload with a 787 link format entry for each RD function discovered, indicating the URI 788 of the RD function returned and the corresponding Resource Type. 789 When performing multicast discovery, the multicast IP address used 790 will depend on the scope required and the multicast capabilities of 791 the network (see Section 9.5). 793 A Resource Directory MAY provide hints about the content-formats it 794 supports in the links it exposes or registers, using the "ct" target 795 attribute, as shown in the example below. Clients MAY use these 796 hints to select alternate content-formats for interaction with the 797 Resource Directory. 799 HTTP does not support multicast and consequently only unicast 800 discovery can be supported using HTTP. The well-known entry points 801 SHOULD be provided to enable unicast discovery. 803 An implementation of this resource directory specification MUST 804 support query filtering for the rt parameter as defined in [RFC6690]. 806 While the link targets in this discovery step are often expressed in 807 path-absolute form, this is not a requirement. Clients of the RD 808 SHOULD therefore accept URIs of all schemes they support, both as 809 URIs and relative references, and not limit the set of discovered 810 URIs to those hosted at the address used for URI discovery. 812 The URI Discovery operation can yield multiple URIs of a given 813 resource type. The client of the RD can use any of the discovered 814 addresses initially. 816 The discovery request interface is specified as follows (this is 817 exactly the Well-Known Interface of [RFC6690] Section 4, with the 818 additional requirement that the server MUST support query filtering): 820 Interaction: EP and Client -> RD 822 Method: GET 824 URI Template: /.well-known/core{?rt} 826 URI Template Variables: 828 rt := Resource Type. SHOULD contain one of the values "core.rd", 829 "core.rd-lookup*", "core.rd-lookup-res", "core.rd-lookup-ep", 830 or "core.rd*" 832 Accept: absent, application/link-format or any other media type 833 representing web links 835 The following response codes are defined for this interface: 837 Success: 2.05 "Content" or 200 "OK" with an application/link-format 838 or other web link payload containing one or more matching entries 839 for the RD resource. 841 Failure: 4.00 "Bad Request" or 400 "Bad Request" is returned in case 842 of a malformed request for a unicast request. 844 Failure: No error response to a multicast request. 846 HTTP support : YES (Unicast only) 848 The following example shows an endpoint discovering an RD using this 849 interface, thus learning that the directory resource location, in 850 this example, is /rd, and that the content-format delivered by the 851 server hosting the resource is application/link-format (ct=40). Note 852 that it is up to the RD to choose its RD locations. 854 Req: GET coap://[MCD1]/.well-known/core?rt=core.rd* 856 Res: 2.05 Content 857 ;rt="core.rd";ct=40, 858 ;rt="core.rd-lookup-ep";ct=40, 859 ;rt="core.rd-lookup-res";ct=40, 861 Figure 5: Example discovery exchange 863 The following example shows the way of indicating that a client may 864 request alternate content-formats. The Content-Format code attribute 865 "ct" MAY include a space-separated sequence of Content-Format codes 866 as specified in Section 7.2.1 of [RFC7252], indicating that multiple 867 content-formats are available. The example below shows the required 868 Content-Format 40 (application/link-format) indicated as well as a 869 CBOR and JSON representation from [I-D.ietf-core-links-json] (which 870 have no numeric values assigned yet, so they are shown as TBD64 and 871 TBD504 as in that draft). The RD resource locations /rd, and /rd- 872 lookup are example values. The server in this example also indicates 873 that it is capable of providing observation on resource lookups. 875 [ The RFC editor is asked to replace this and later occurrences of 876 MCD1 with the assigned IPv6 site-local address for "all CoRE Resource 877 Directories". ] 879 Req: GET coap://[MCD1]/.well-known/core?rt=core.rd* 881 Res: 2.05 Content 882 ;rt="core.rd";ct="40 65225", 883 ;rt="core.rd-lookup-res";ct="40 TBD64 TBD504";obs, 884 ;rt="core.rd-lookup-ep";ct="40 TBD64 TBD504", 886 From a management and maintenance perspective, it is necessary to 887 identify the components that constitute the RD server. The 888 identification refers to information about for example client-server 889 incompatibilities, supported features, required updates and other 890 aspects. The URI discovery address, a described in section 4 of 891 [RFC6690] can be used to find the identification. 893 It would typically be stored in an implementation information link 894 (as described in [I-D.bormann-t2trg-rel-impl]): 896 Req: GET /.well-known/core?rel=impl-info 898 Res: 2.05 Content 899 ; 900 rel="impl-info" 902 Note that depending on the particular server's architecture, such a 903 link could be anchored at the RD server's root, at the discovery site 904 (as in this example) or at individual RD components. The latter is 905 to be expected when different applications are run on the same 906 server. 908 5.3. Registration 910 After discovering the location of an RD, a registrant-ep or CT MAY 911 register the resources of the registrant-ep using the registration 912 interface. This interface accepts a POST from an endpoint containing 913 the list of resources to be added to the directory as the message 914 payload in the CoRE Link Format [RFC6690] or other representations of 915 web links, along with query parameters indicating the name of the 916 endpoint, and optionally the sector, lifetime and base URI of the 917 registration. It is expected that other specifications will define 918 further parameters (see Section 9.3). The RD then creates a new 919 registration resource in the RD and returns its location. The 920 receiving endpoint MUST use that location when refreshing 921 registrations using this interface. Registration resources in the RD 922 are kept active for the period indicated by the lifetime parameter. 923 The creating endpoint is responsible for refreshing the registration 924 resource within this period using either the registration or update 925 interface. The registration interface MUST be implemented to be 926 idempotent, so that registering twice with the same endpoint 927 parameters ep and d (sector) does not create multiple registration 928 resources. 930 The following rules apply for a registration request targeting a 931 given (ep, d) value pair: 933 o When the (ep, d) value pair of the registration-request is 934 different from any existing registration, a new registration is 935 generated. 937 o When the (ep, d) value pair of the registration-request is equal 938 to an existing registration, the content and parameters of the 939 existing registration are replaced with the content of the 940 registration request. 942 The posted link-format document can (and typically does) contain 943 relative references both in its link targets and in its anchors, or 944 contain empty anchors. The RD server needs to resolve these 945 references in order to faithfully represent them in lookups. They 946 are resolved against the base URI of the registration, which is 947 provided either explicitly in the "base" parameter or constructed 948 implicitly from the requester's URI as constructed from its network 949 address and scheme. 951 For media types to which Appendix C applies (i.e. documents in 952 application/link-format), the RD only needs to accept representations 953 in Limited Link Format as described there. Its behavior with 954 representations outside that subset is implementation defined. 956 The registration request interface is specified as follows: 958 Interaction: EP -> RD 960 Method: POST 962 URI Template: {+rd}{?ep,d,lt,base,extra-attrs*} 964 URI Template Variables: 966 rd := RD registration URI (mandatory). This is the location of 967 the RD, as obtained from discovery. 969 ep := Endpoint name (mostly mandatory). The endpoint name is an 970 identifier that MUST be unique within a sector. The maximum 971 length of this parameter is 63 bytes. If the RD is configured 972 to recognize the endpoint (e.g. based on its security context), 973 the RD assigns an endpoint name based on a set of configuration 974 parameter values. 976 d := Sector (optional). The sector to which this endpoint 977 belongs. The maximum length of this parameter is 63 bytes. 978 When this parameter is not present, the RD MAY associate the 979 endpoint with a configured default sector or leave it empty. 980 The endpoint name and sector name are not set when one or both 981 are set in an accompanying authorization token. 983 lt := Lifetime (optional). Lifetime of the registration in 984 seconds. Range of 60-4294967295. If no lifetime is included 985 in the initial registration, a default value of 90000 (25 986 hours) SHOULD be assumed. 988 base := Base URI (optional). This parameter sets the base URI of 989 the registration, under which the relative links in the payload 990 are to be interpreted. The specified URI typically does not 991 have a path component of its own, and MUST be suitable as a 992 base URI to resolve any relative references given in the 993 registration. The parameter is therefore usually of the shape 994 "scheme://authority" for HTTP and CoAP URIs. The URI SHOULD 995 NOT have a query or fragment component as any non-empty 996 relative part in a reference would remove those parts from the 997 resulting URI. 999 In the absence of this parameter the scheme of the protocol, 1000 source address and source port of the registration request are 1001 assumed. The Base URI is consecutively constructed by 1002 concatenating the used protocol's scheme with the characters 1003 "://", the requester's source address as an address literal and 1004 ":" followed by its port (if it was not the protocol's default 1005 one) in analogy to [RFC7252] Section 6.5. 1007 This parameter is mandatory when the directory is filled by a 1008 third party such as an commissioning tool. 1010 If the registrant-ep uses an ephemeral port to register with, 1011 it MUST include the base parameter in the registration to 1012 provide a valid network path. 1014 If the registrant-ep, located behind a NAT gateway, is 1015 registering with a Resource Directory which is on the network 1016 service side of the NAT gateway, the endpoint MUST use a 1017 persistent port for the outgoing registration in order to 1018 provide the NAT gateway with a valid network address for 1019 replies and incoming requests. 1021 If the registrant-ep uses a link-local address to register, it 1022 MUST give an explicit routable base address unless configured 1023 otherwise as per Section 3.4 (or just register from that 1024 address in the first place). 1026 Endpoints that register with a base that contains a path 1027 component can not meaningfully use [RFC6690] Link Format due to 1028 its prevalence of the Origin concept in relative reference 1029 resolution. Those applications should use different 1030 representations of links to which Appendix C is not applicable 1031 (e.g. [I-D.hartke-t2trg-coral]). 1033 extra-attrs := Additional registration attributes (optional). 1034 The endpoint can pass any parameter registered at Section 9.3 1035 to the directory. If the RD is aware of the parameter's 1036 specified semantics, it processes it accordingly. Otherwise, 1037 it MUST store the unknown key and its value(s) as an endpoint 1038 attribute for further lookup. 1040 Content-Format: application/link-format or any other indicated media 1041 type representing web links 1043 The following response codes are defined for this interface: 1045 Success: 2.01 "Created" or 201 "Created". The Location-Path option 1046 or Location header MUST be included in the response. This 1047 location MUST be a stable identifier generated by the RD as it is 1048 used for all subsequent operations on this registration resource. 1049 The registration resource location thus returned is for the 1050 purpose of updating the lifetime of the registration and for 1051 maintaining the content of the registered links, including 1052 updating and deleting links. 1054 A registration with an already registered ep and d value pair 1055 responds with the same success code and location as the original 1056 registration; the set of links registered with the endpoint is 1057 replaced with the links from the payload. 1059 The location MUST NOT have a query or fragment component, as that 1060 could conflict with query parameters during the Registration 1061 Update operation. Therefore, the Location-Query option MUST NOT 1062 be present in a successful response. 1064 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 1065 request. 1067 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 1068 Service could not perform the operation. 1070 HTTP support: YES 1072 If the registration fails with a Service Unavailable response and a 1073 Max-Age option or Retry-After header, the registering endpoint SHOULD 1074 retry the operation after the time indicated. If the registration 1075 fails in another way, including request timeouts, or if the Service 1076 Unavailable error persists after several retries, or indicates a 1077 longer time than the endpoint is willing to wait, it SHOULD pick 1078 another registration URI from the "URI Discovery" step and if there 1079 is only one or the list is exhausted, pick other choices from the 1080 "Finding a Resource Directory" step. Care has to be taken to 1081 consider the freshness of results obtained earlier, e.g. of the 1082 result of a "/.well-known/core" response, the lifetime of an RDAO 1083 option and of DNS responses. Any rate limits and persistent errors 1084 from the "Finding a Resource Directory" step must be considered for 1085 the whole registration time, not only for a single operation. 1087 The following example shows a registrant-ep with the name "node1" 1088 registering two resources to an RD using this interface. The 1089 location "/rd" is an example RD location discovered in a request 1090 similar to Figure 5. 1092 Req: POST coap://rd.example.com/rd?ep=node1 1093 Content-Format: 40 1094 Payload: 1095 ;ct=41;rt="temperature-c";if="sensor"; 1096 anchor="coap://spurious.example.com:5683", 1097 ;ct=41;rt="light-lux";if="sensor" 1099 Res: 2.01 Created 1100 Location-Path: /rd/4521 1102 Figure 6: Example registration payload 1104 A Resource Directory may optionally support HTTP. Here is an example 1105 of almost the same registration operation above, when done using 1106 HTTP. 1108 Req: POST /rd?ep=node1&base=http://[2001:db8:1::1] HTTP/1.1 1109 Host: example.com 1110 Content-Type: application/link-format 1111 Payload: 1112 ;ct=41;rt="temperature-c";if="sensor"; 1113 anchor="coap://spurious.example.com:5683", 1114 ;ct=41;rt="light-lux";if="sensor" 1116 Res: 201 Created 1117 Location: /rd/4521 1119 5.3.1. Simple Registration 1121 Not all endpoints hosting resources are expected to know how to 1122 upload links to an RD as described in Section 5.3. Instead, simple 1123 endpoints can implement the Simple Registration approach described in 1124 this section. An RD implementing this specification MUST implement 1125 Simple Registration. However, there may be security reasons why this 1126 form of directory discovery would be disabled. 1128 This approach requires that the registrant-ep makes available the 1129 hosted resources that it wants to be discovered, as links on its 1130 "/.well-known/core" interface as specified in [RFC6690]. The links 1131 in that document are subject to the same limitations as the payload 1132 of a registration (with respect to Appendix C). 1134 The registrant-ep finds one or more addresses of the directory server 1135 as described in Section 4. 1137 The registrant-ep asks the selected directory server to probe its 1138 /.well-known/core and publish the links as follows: 1140 The registrant-ep sends (and regularly refreshes with) a POST request 1141 to the "/.well-known/core" URI of the directory server of choice. 1142 The body of the POST request is empty, and triggers the resource 1143 directory server to perform GET requests at the requesting 1144 registrant-ep's /.well-known/core to obtain the link-format payload 1145 to register. 1147 The registrant-ep includes the same registration parameters in the 1148 POST request as it would per Section 5.3. The registration base URI 1149 of the registration is taken from the registrant-ep's network address 1150 (as is default with regular registrations). 1152 The Resource Directory needs to query the registrant-ep's discovery 1153 resource to determine the success of the operation. It SHOULD keep a 1154 cache of the discovery resource and not query it again as long as it 1155 is fresh. 1157 (This is to accomodate constrained registrant devices that can not 1158 process an incoming and outgoing request at the same time. 1159 Registrants MUST be able to serve a GET request to "/.well-known/ 1160 core" after having requested registration. Constrained devices MAY 1161 regard the initial request as temporarily failed when they need RAM 1162 occupied by their own request to serve the RD's GET, and retry later 1163 when the RD already has a cached representation of their discovery 1164 resources. Then, the RD can reply immediately and the registrant can 1165 receive the response.) 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*} 1174 URI Template Variables are as they are for registration in 1175 Section 5.3. The base attribute is not accepted to keep the 1176 registration interface simple; that rules out registration over CoAP- 1177 over-TCP or HTTP that would need to specify one. 1179 The following response codes are defined for this interface: 1181 Success: 2.04 "Changed". 1183 Failure: 4.00 "Bad Request". Malformed request. 1185 Failure: 5.03 "Service Unavailable". Service could not perform the 1186 operation. 1188 HTTP support: NO 1190 For the second interaction triggered by the above, the registrant-ep 1191 takes the role of server and the RD the role of client. (Note that 1192 this is exactly the Well-Known Interface of [RFC6690] Section 4): 1194 Interaction: RD -> EP 1196 Method: GET 1198 URI Template: /.well-known/core 1200 The following response codes are defined for this interface: 1202 Success: 2.05 "Content". 1204 Failure: 4.00 "Bad Request". Malformed request. 1206 Failure: 4.04 "Not Found". /.well-known/core does not exist. 1208 Failure: 5.03 "Service Unavailable". Service could not perform the 1209 operation. 1211 HTTP support: NO 1213 The registration resources MUST be deleted after the expiration of 1214 their lifetime. Additional operations on the registration resource 1215 cannot be executed because no registration location is returned. 1217 The following example shows a registrant-ep using Simple 1218 Registration, by simply sending an empty POST to a resource 1219 directory. 1221 Req: (to RD server from [2001:db8:2::1]) 1222 POST /.well-known/core?lt=6000&ep=node1 1223 No payload 1225 Req: (from RD server to [2001:db8:2::1]) 1226 GET /.well-known/core 1227 Accept: 40 1229 Res: (to the RD from [2001:db8:2::1] ) 2.05 Content 1230 Content-Format: 40 1231 Payload: 1232 1234 Res: (from the RD to [2001:db8:2::1]) 2.04 Changed 1236 5.3.2. Third-party registration 1238 For some applications, even Simple Registration may be too taxing for 1239 some very constrained devices, in particular if the security 1240 requirements become too onerous. 1242 In a controlled environment (e.g. building control), the Resource 1243 Directory can be filled by a third party device, called a 1244 Commissioning Tool (CT). The commissioning tool can fill the 1245 Resource Directory from a database or other means. For that purpose 1246 scheme, IP address and port of the URI of the registered device is 1247 the value of the "base" parameter of the registration described in 1248 Section 5.3. 1250 It should be noted that the value of the "base" parameter applies to 1251 all the links of the registration and has consequences for the anchor 1252 value of the individual links as exemplified in Appendix B. An 1253 eventual (currently non-existing) "base" attribute of the link is not 1254 affected by the value of "base" parameter in the registration. 1256 5.4. Operations on the Registration Resource 1258 This section describes how the registering endpoint can maintain the 1259 registrations that it created. The registering endpoint can be the 1260 registrant-ep or the CT. An endpoint SHOULD NOT use this interface 1261 for registrations that it did not create. The registrations are 1262 resources of the RD. 1264 After the initial registration, the registering endpoint retains the 1265 returned location of the Registration Resource for further 1266 operations, including refreshing the registration in order to extend 1267 the lifetime and "keep-alive" the registration. When the lifetime of 1268 the registration has expired, the RD SHOULD NOT respond to discovery 1269 queries concerning this endpoint. The RD SHOULD continue to provide 1270 access to the Registration Resource after a registration time-out 1271 occurs in order to enable the registering endpoint to eventually 1272 refresh the registration. The RD MAY eventually remove the 1273 registration resource for the purpose of garbage collection. If the 1274 Registration Resource is removed, the corresponding endpoint will 1275 need to be re-registered. 1277 The Registration Resource may also be used cancel the registration 1278 using DELETE, and to perform further operations beyond the scope of 1279 this specification. 1281 These operations are described below. 1283 5.4.1. Registration Update 1285 The update interface is used by the registering endpoint to refresh 1286 or update its registration with an RD. To use the interface, the 1287 registering endpoint sends a POST request to the registration 1288 resource returned by the initial registration operation. 1290 An update MAY update the lifetime- or the context- registration 1291 parameters "lt", "base" as in Section 5.3. Parameters that are not 1292 being changed SHOULD NOT be included in an update. Adding parameters 1293 that have not changed increases the size of the message but does not 1294 have any other implications. Parameters MUST be included as query 1295 parameters in an update operation as in Section 5.3. 1297 A registration update resets the timeout of the registration to the 1298 (possibly updated) lifetime of the registration, independent of 1299 whether a "lt" parameter was given. 1301 If the context of the registration is changed in an update, relative 1302 references submitted in the original registration or later updates 1303 are resolved anew against the new context. 1305 The registration update operation only describes the use of POST with 1306 an empty payload. Future standards might describe the semantics of 1307 using content formats and payloads with the POST method to update the 1308 links of a registration (see Section 5.4.3). 1310 The update registration request interface is specified as follows: 1312 Interaction: EP -> RD 1314 Method: POST 1316 URI Template: {+location}{?lt,base,extra-attrs*} 1317 URI Template Variables: 1319 location := This is the Location returned by the RD as a result 1320 of a successful earlier registration. 1322 lt := Lifetime (optional). Lifetime of the registration in 1323 seconds. Range of 60-4294967295. If no lifetime is included, 1324 the previous last lifetime set on a previous update or the 1325 original registration (falling back to 90000) SHOULD be used. 1327 base := Base URI (optional). This parameter updates the Base URI 1328 established in the original registration to a new value. If 1329 the parameter is set in an update, it is stored by the RD as 1330 the new Base URI under which to interpret the relative links 1331 present in the payload of the original registration, following 1332 the same restrictions as in the registration. If the parameter 1333 is not set in the request but was set before, the previous Base 1334 URI value is kept unmodified. If the parameter is not set in 1335 the request and was not set before either, the source address 1336 and source port of the update request are stored as the Base 1337 URI. 1339 extra-attrs := Additional registration attributes (optional). As 1340 with the registration, the RD processes them if it knows their 1341 semantics. Otherwise, unknown attributes are stored as 1342 endpoint attributes, overriding any previously stored endpoint 1343 attributes of the same key. 1345 Content-Format: none (no payload) 1347 The following response codes are defined for this interface: 1349 Success: 2.04 "Changed" or 204 "No Content" if the update was 1350 successfully processed. 1352 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 1353 request. 1355 Failure: 4.04 "Not Found" or 404 "Not Found". Registration does not 1356 exist (e.g. may have been removed). 1358 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 1359 Service could not perform the operation. 1361 HTTP support: YES 1363 If the registration update fails with a "Service Unavailable" 1364 response and a Max-Age option or Retry-After header, the registering 1365 endpoint SHOULD retry the operation after the time indicated. If the 1366 registration fails in another way, including request timeouts, or if 1367 the time indicated exceeds the remaining lifetime, the registering 1368 endpoint SHOULD attempt registration again. 1370 The following example shows how the registering endpoint updates its 1371 registration resource at an RD using this interface with the example 1372 location value: /rd/4521. 1374 Req: POST /rd/4521 1376 Res: 2.04 Changed 1378 The following example shows the registering endpoint updating its 1379 registration resource at an RD using this interface with the example 1380 location value: /rd/4521. The initial registration by the 1381 registering endpoint set the following values: 1383 o endpoint name (ep)=endpoint1 1385 o lifetime (lt)=500 1387 o Base URI (base)=coap://local-proxy-old.example.com:5683 1389 o payload of Figure 6 1391 The initial state of the Resource Directory is reflected in the 1392 following request: 1394 Req: GET /rd-lookup/res?ep=endpoint1 1396 Res: 2.01 Content 1397 Payload: 1398 ;ct=41; 1399 rt="temperature"; anchor="coap://spurious.example.com:5683", 1400 ;ct=41; 1401 rt="light-lux"; if="sensor"; 1402 anchor="coap://local-proxy-old.example.com:5683" 1404 The following example shows the registering endpoint changing the 1405 Base URI to "coaps://new.example.com:5684": 1407 Req: POST /rd/4521?base=coaps://new.example.com:5684 1409 Res: 2.04 Changed 1411 The consecutive query returns: 1413 Req: GET /rd-lookup/res?ep=endpoint1 1415 Res: 2.01 Content 1416 Payload: 1417 ;ct=41;rt="temperature"; 1418 anchor="coap://spurious.example.com:5683", 1419 ;ct=41;rt="light-lux"; 1420 if="sensor"; anchor="coaps://new.example.com:5684", 1422 5.4.2. Registration Removal 1424 Although RD registrations have soft state and will eventually timeout 1425 after their lifetime, the registering endpoint SHOULD explicitly 1426 remove an entry from the RD if it knows it will no longer be 1427 available (for example on shut-down). This is accomplished using a 1428 removal interface on the RD by performing a DELETE on the endpoint 1429 resource. 1431 The removal request interface is specified as follows: 1433 Interaction: EP -> RD 1435 Method: DELETE 1437 URI Template: {+location} 1439 URI Template Variables: 1441 location := This is the Location returned by the RD as a result 1442 of a successful earlier registration. 1444 The following response codes are defined for this interface: 1446 Success: 2.02 "Deleted" or 204 "No Content" upon successful deletion 1448 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 1449 request. 1451 Failure: 4.04 "Not Found" or 404 "Not Found". Registration does not 1452 exist (e.g. may already have been removed). 1454 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 1455 Service could not perform the operation. 1457 HTTP support: YES 1459 The following examples shows successful removal of the endpoint from 1460 the RD with example location value /rd/4521. 1462 Req: DELETE /rd/4521 1464 Res: 2.02 Deleted 1466 5.4.3. Further operations 1468 Additional operations on the registration can be specified in future 1469 documents, for example: 1471 o Send iPATCH (or PATCH) updates ([RFC8132]) to add, remove or 1472 change the links of a registration. 1474 o Use GET to read the currently stored set of links in a 1475 registration resource. 1477 Those operations are out of scope of this document, and will require 1478 media types suitable for modifying sets of links. 1480 6. RD Lookup 1482 To discover the resources registered with the RD, a lookup interface 1483 must be provided. This lookup interface is defined as a default, and 1484 it is assumed that RDs may also support lookups to return resource 1485 descriptions in alternative formats (e.g. JSON or CBOR link format 1486 [I-D.ietf-core-links-json]) or using more advanced interfaces (e.g. 1487 supporting context or semantic based lookup) on different resources 1488 that are discovered independently. 1490 RD Lookup allows lookups for endpoints and resources using attributes 1491 defined in this document and for use with the CoRE Link Format. The 1492 result of a lookup request is the list of links (if any) 1493 corresponding to the type of lookup. Thus, an endpoint lookup MUST 1494 return a list of endpoints and a resource lookup MUST return a list 1495 of links to resources. 1497 The lookup type is selected by a URI endpoint, which is indicated by 1498 a Resource Type as per Table 1 below: 1500 +-------------+--------------------+-----------+ 1501 | Lookup Type | Resource Type | Mandatory | 1502 +-------------+--------------------+-----------+ 1503 | Resource | core.rd-lookup-res | Mandatory | 1504 | Endpoint | core.rd-lookup-ep | Mandatory | 1505 +-------------+--------------------+-----------+ 1507 Table 1: Lookup Types 1509 6.1. Resource lookup 1511 Resource lookup results in links that are semantically equivalent to 1512 the links submitted to the RD. The links and link parameters 1513 returned by the lookup are equal to the submitted ones, except that 1514 the target and anchor references are fully resolved. 1516 Links that did not have an anchor attribute are therefore returned 1517 with the base URI of the registration as the anchor. Links of which 1518 href or anchor was submitted as a (full) URI are returned with these 1519 attributes unmodified. 1521 Above rules allow the client to interpret the response as links 1522 without any further knowledge of the storage conventions of the RD. 1523 The Resource Directory MAY replace the registration base URIs with a 1524 configured intermediate proxy, e.g. in the case of an HTTP lookup 1525 interface for CoAP endpoints. 1527 6.2. Lookup filtering 1529 Using the Accept Option, the requester can control whether the 1530 returned list is returned in CoRE Link Format ("application/link- 1531 format", default) or in alternate content-formats (e.g. from 1532 [I-D.ietf-core-links-json]). 1534 The page and count parameters are used to obtain lookup results in 1535 specified increments using pagination, where count specifies how many 1536 links to return and page specifies which subset of links organized in 1537 sequential pages, each containing 'count' links, starting with link 1538 zero and page zero. Thus, specifying count of 10 and page of 0 will 1539 return the first 10 links in the result set (links 0-9). Count = 10 1540 and page = 1 will return the next 'page' containing links 10-19, and 1541 so on. 1543 Multiple search criteria MAY be included in a lookup. All included 1544 criteria MUST match for a link to be returned. The Resource 1545 Directory MUST support matching with multiple search criteria. 1547 A link matches a search criterion if it has an attribute of the same 1548 name and the same value, allowing for a trailing "*" wildcard 1549 operator as in Section 4.1 of [RFC6690]. Attributes that are defined 1550 as "link-type" match if the search value matches any of their values 1551 (see Section 4.1 of [RFC6690]; e.g. "?if=core.s" matches ";if="abc 1552 core.s";"). A resource link also matches a search criterion if its 1553 endpoint would match the criterion, and vice versa, an endpoint link 1554 matches a search criterion if any of its resource links matches it. 1556 Note that "href" is a valid search criterion and matches target 1557 references. Like all search criteria, on a resource lookup it can 1558 match the target reference of the resource link itself, but also the 1559 registration resource of the endpoint that registered it. Queries 1560 for resource link targets MUST be in URI form (i.e. not relative 1561 references) and are matched against a resolved link target. Queries 1562 for endpoints SHOULD be expressed in path-absolute form if possible 1563 and MUST be expressed in URI form otherwise; the RD SHOULD recognize 1564 either. 1566 Endpoints that are interested in a lookup result repeatedly or 1567 continuously can use mechanisms like ETag caching, resource 1568 observation ([RFC7641]), or any future mechanism that might allow 1569 more efficient observations of collections. These are advertised, 1570 detected and used according to their own specifications and can be 1571 used with the lookup interface as with any other resource. 1573 When resource observation is used, every time the set of matching 1574 links changes, or the content of a matching link changes, the RD 1575 sends a notification with the matching link set. The notification 1576 contains the successful current response to the given request, 1577 especially with respect to representing zero matching links (see 1578 "Success" item below). 1580 The lookup interface is specified as follows: 1582 Interaction: Client -> RD 1584 Method: GET 1586 URI Template: {+type-lookup-location}{?page,count,search*} 1588 URI Template Variables: 1590 type-lookup-location := RD Lookup URI for a given lookup type 1591 (mandatory). The address is discovered as described in 1592 Section 5.2. 1594 search := Search criteria for limiting the number of results 1595 (optional). 1597 page := Page (optional). Parameter cannot be used without the 1598 count parameter. Results are returned from result set in pages 1599 that contain 'count' links starting from index (page * count). 1600 Page numbering starts with zero. 1602 count := Count (optional). Number of results is limited to this 1603 parameter value. If the page parameter is also present, the 1604 response MUST only include 'count' links starting with the 1605 (page * count) link in the result set from the query. If the 1606 count parameter is not present, then the response MUST return 1607 all matching links in the result set. Link numbering starts 1608 with zero. 1610 Accept: absent, application/link-format or any other indicated 1611 media type representing web links 1613 The following responses codes are defined for this interface: 1615 Success: 2.05 "Content" or 200 "OK" with an "application/link- 1616 format" or other web link payload containing matching entries for 1617 the lookup. The payload can contain zero links (which is an empty 1618 payload in [RFC6690] link format, but could also be "[]" in JSON 1619 based formats), indicating that no entities matched the request. 1621 Failure: No error response to a multicast request. 1623 Failure: 4.00 "Bad Request" or 400 "Bad Request". Malformed 1624 request. 1626 Failure: 5.03 "Service Unavailable" or 503 "Service Unavailable". 1627 Service could not perform the operation. 1629 HTTP support: YES 1631 6.3. Resource lookup examples 1633 The examples in this section assume the existence of CoAP hosts with 1634 a default CoAP port 61616. HTTP hosts are possible and do not change 1635 the nature of the examples. 1637 The following example shows a client performing a resource lookup 1638 with the example resource look-up locations discovered in Figure 5: 1640 Req: GET /rd-lookup/res?rt=temperature 1642 Res: 2.05 Content 1643 ;rt="temperature"; 1644 anchor="coap://[2001:db8:3::123]:61616" 1646 A client that wants to be notified of new resources as they show up 1647 can use observation: 1649 Req: GET /rd-lookup/res?rt=light 1650 Observe: 0 1652 Res: 2.05 Content 1653 Observe: 23 1654 Payload: empty 1656 (at a later point in time) 1658 Res: 2.05 Content 1659 Observe: 24 1660 Payload: 1661 ;rt="light"; 1662 anchor="coap://[2001:db8:3::124]", 1663 ;rt="light"; 1664 anchor="coap://[2001:db8:3::124]", 1665 ;rt="light"; 1666 anchor="coap://[2001:db8:3::124]" 1668 The following example shows a client performing a paginated resource 1669 lookup 1670 Req: GET /rd-lookup/res?page=0&count=5 1672 Res: 2.05 Content 1673 ;rt=sensor;ct=60; 1674 anchor="coap://[2001:db8:3::123]:61616", 1675 ;rt=sensor;ct=60; 1676 anchor="coap://[2001:db8:3::123]:61616", 1677 ;rt=sensor;ct=60; 1678 anchor="coap://[2001:db8:3::123]:61616", 1679 ;rt=sensor;ct=60; 1680 anchor="coap://[2001:db8:3::123]:61616", 1681 ;rt=sensor;ct=60; 1682 anchor="coap://[2001:db8:3::123]:61616" 1684 Req: GET /rd-lookup/res?page=1&count=5 1686 Res: 2.05 Content 1687 ;rt=sensor;ct=60; 1688 anchor="coap://[2001:db8:3::123]:61616", 1689 ;rt=sensor;ct=60; 1690 anchor="coap://[2001:db8:3::123]:61616", 1691 ;rt=sensor;ct=60; 1692 anchor="coap://[2001:db8:3::123]:61616", 1693 ;rt=sensor;ct=60; 1694 anchor="coap://[2001:db8:3::123]:61616", 1695 ;rt=sensor;ct=60; 1696 anchor="coap://[2001:db8:3::123]:61616" 1698 The following example shows a client performing a lookup of all 1699 resources from endpoints of all endpoints of a given endpoint type. 1700 It assumes that two endpoints (with endpoint names "sensor1" and 1701 "sensor2") have previously registered with their respective addresses 1702 "coap://sensor1.example.com" and "coap://sensor2.example.com", and 1703 posted the very payload of the 6th request of section 5 of [RFC6690]. 1705 It demonstrates how absolute link targets stay unmodified, while 1706 relative ones are resolved: 1708 Req: GET /rd-lookup/res?et=oic.d.sensor 1710 ;ct=40;title="Sensor Index"; 1711 anchor="coap://sensor1.example.com", 1712 ;rt="temperature-c"; 1713 if="sensor"; anchor="coap://sensor1.example.com", 1714 ;rt="light-lux"; 1715 if="sensor"; anchor="coap://sensor1.example.com", 1716 ;rel="describedby"; 1717 anchor="coap://sensor1.example.com/sensors/temp", 1718 ;rel="alternate"; 1719 anchor="coap://sensor1.example.com/sensors/temp", 1720 ;ct=40;title="Sensor Index"; 1721 anchor="coap://sensor2.example.com", 1722 ;rt="temperature-c"; 1723 if="sensor"; anchor="coap://sensor2.example.com", 1724 ;rt="light-lux"; 1725 if="sensor"; anchor="coap://sensor2.example.com", 1726 ;rel="describedby"; 1727 anchor="coap://sensor2.example.com/sensors/temp", 1728 ;rel="alternate"; 1729 anchor="coap://sensor2.example.com/sensors/temp" 1731 6.4. Endpoint lookup 1733 The endpoint lookup returns registration resources which can only be 1734 manipulated by the registering endpoint. 1736 Endpoint registration resources are annotated with their endpoint 1737 names (ep), sectors (d, if present) and registration base URI (base; 1738 reports the registrant-ep's address if no explicit base was given) as 1739 well as a constant resource type (rt="core.rd-ep"); the lifetime (lt) 1740 is not reported. Additional endpoint attributes are added as target 1741 attributes to their endpoint link unless their specification says 1742 otherwise. 1744 Links to endpoints SHOULD be presented in path-absolute form or, if 1745 required, as absolute references. (This avoids the RFC6690 1746 ambiguities.) 1748 While Endpoint Lookup does expose the registration resources, the RD 1749 does not need to make them accessible to clients. Clients SHOULD NOT 1750 attempt to dereference or manipulate them. 1752 A Resource Directory can report endpoints in lookup that are not 1753 hosted at the same address. Lookup clients MUST be prepared to see 1754 arbitrary URIs as registration resources in the results and treat 1755 them as opaque identifiers; the precise semantics of such links are 1756 left to future specifications. 1758 The following example shows a client performing an endpoint type (et) 1759 lookup with the value oic.d.sensor (which is currently a registered 1760 rt value): 1762 Req: GET /rd-lookup/ep?et=oic.d.sensor 1764 Res: 2.05 Content 1765 ;base="coap://[2001:db8:3::127]:61616";ep="node5"; 1766 et="oic.d.sensor";ct="40";rt="core.rd-ep", 1767 ;base="coap://[2001:db8:3::129]:61616";ep="node7"; 1768 et="oic.d.sensor";ct="40";d="floor-3";rt="core.rd-ep" 1770 7. Security policies 1772 The Resource Directory (RD) provides assistance to applications 1773 situated on a selection of nodes to discover endpoints on connected 1774 nodes. This section discusses different security aspects of 1775 accessing the RD. 1777 The contents of the RD are inserted in two ways: 1779 1. The node hosting the discoverable endpoint fills the RD with the 1780 contents of /.well-known/core by: 1782 * Storing the contents directly into RD (see Section 5.3) 1784 * Requesting the RD to load the contents from /.well-known/core 1785 (see Section 5.3.1) 1787 2. A Commissioning Tool (CT) fills the RD with endpoint information 1788 for a set of discoverable nodes. (see Section 5.3 with 1789 base=authority parameter value) 1791 In both cases, the nodes filling the RD should be authenticated and 1792 authorized to change the contents of the RD. An Authorization Server 1793 (AS) is responsible to assign a token to the registering node to 1794 authorize the node to discover or register endpoints in a given RD 1795 [I-D.ietf-ace-oauth-authz]. 1797 It can be imagined that an installation is divided in a set of 1798 security regions, each one with its own RD(s) to discover the 1799 endpoints that are part of a given security region. An endpoint that 1800 wants to discover an RD, responsible for a given region, needs to be 1801 authorized to learn the contents of a given RD. Within a region, for 1802 a given RD, a more fine-grained security division is possible based 1803 on the values of the endpoint registration parameters. Authorization 1804 to discover endpoints with a given set of filter values is 1805 recommended for those cases. 1807 When a node registers its endpoints, criteria are needed to authorize 1808 the node to enter them. An important aspect is the uniqueness of the 1809 (endpoint name, and optional sector) pair within the RD. Consider 1810 the two cases separately: (1) CT registers endpoints, and (2) the 1811 registering node registers its own endpoint(s). 1813 o A CT needs authorization to register a set of endpoints. This 1814 authorization can be based on the region, i.e. a given CT is 1815 authorized to register any endpoint (endpoint name, sector) into a 1816 given RD, or to register an endpoint with (endpoint name, sector) 1817 value pairs assigned by the AS, or can be more fine-grained, 1818 including a subset of registration parameter values. 1820 o A given endpoint that registers itself, needs to proof its 1821 possession of its unique (endpoint name, sector) value pair. 1822 Alternatively, the AS can authorize the endpoint to register with 1823 an (endpoint name, sector) value pair assigned by the AS. 1825 A separate document needs to specify these aspects to ensure 1826 interoperability between registering nodes and RD. The subsections 1827 below give some hints how to handle a subset of the different 1828 aspects. 1830 7.1. Secure RD discovery 1832 The Resource Server (RS) discussed in [I-D.ietf-ace-oauth-authz] is 1833 equated to the RD. The client (C) needs to discover the RD as 1834 discussed in Section 4. C can discover the related AS by sending a 1835 request to the RD. The RD denies the request by sending the address 1836 of the related AS, as discussed in section 5.1 of 1837 [I-D.ietf-ace-oauth-authz]. The client MUST send an authorization 1838 request to the AS. When appropriate, the AS returns a token that 1839 specifies the authorization permission which needs to be specified in 1840 a separate document. 1842 7.2. Secure RD filtering 1844 The authorized parameter values for the queries by a given endpoint 1845 must be registered by the AS. The AS communicates the parameter 1846 values in the token. A separate document needs to specify the 1847 parameter value combinations and their storage in the token. The RD 1848 decodes the token and checks the validity of the queries of the 1849 client. 1851 7.3. Secure endpoint Name assignment 1853 This section only considers the assignment of a name to the endpoint 1854 based on an automatic mechanism without use of AS. More elaborate 1855 protocols are out of scope. The registering endpoint is authorized 1856 by the AS to discover the RD and add registrations. A token is 1857 provided by the AS and communicated from registering endpoint to RD. 1858 It is assumed that DTLS is used to secure the channel between 1859 registering endpoint and RD, where the registering endpoint is the 1860 DTLS client. Assuming that the client is provided by a certificate 1861 at manufacturing time, the certificate is uniquely identified by the 1862 CN field and the serial number. The RD can assign a unique endpoint 1863 name by using the certificate identifier as endpoint name. Proof of 1864 possession of the endpoint name by the registering endpoint is 1865 checked by encrypting the certificate identifier with the private key 1866 of the registering endpoint, which the RD can decrypt with the public 1867 key stored in the certificate. Even simpler, the authorized 1868 registering endpoint can generate a random number (or string) that 1869 identifies the endpoint. The RD can check for the improbable 1870 replication of the random value. The RD MUST check that registering 1871 endpoint uses only one random value for each authorized endpoint. 1873 8. Security Considerations 1875 The security considerations as described in Section 5 of [RFC8288] 1876 and Section 6 of [RFC6690] apply. The "/.well-known/core" resource 1877 may be protected e.g. using DTLS when hosted on a CoAP server as 1878 described in [RFC7252]. DTLS or TLS based security SHOULD be used on 1879 all resource directory interfaces defined in this document. 1881 8.1. Endpoint Identification and Authentication 1883 An Endpoint (name, sector) pair is unique within the et of endpoints 1884 registered by the RD. An Endpoint MUST NOT be identified by its 1885 protocol, port or IP address as these may change over the lifetime of 1886 an Endpoint. 1888 Every operation performed by an Endpoint on a resource directory 1889 SHOULD be mutually authenticated using Pre-Shared Key, Raw Public Key 1890 or Certificate based security. 1892 Consider the following threat: two devices A and B are registered at 1893 a single server. Both devices have unique, per-device credentials 1894 for use with DTLS to make sure that only parties with authorization 1895 to access A or B can do so. 1897 Now, imagine that a malicious device A wants to sabotage the device 1898 B. It uses its credentials during the DTLS exchange. Then, it 1899 specifies the endpoint name of device B as the name of its own 1900 endpoint in device A. If the server does not check whether the 1901 identifier provided in the DTLS handshake matches the identifier used 1902 at the CoAP layer then it may be inclined to use the endpoint name 1903 for looking up what information to provision to the malicious device. 1905 Section 7.3 specifies an example that removes this threat for 1906 endpoints that have a certificate installed. 1908 8.2. Access Control 1910 Access control SHOULD be performed separately for the RD registration 1911 and Lookup API paths, as different endpoints may be authorized to 1912 register with an RD from those authorized to lookup endpoints from 1913 the RD. Such access control SHOULD be performed in as fine-grained a 1914 level as possible. For example access control for lookups could be 1915 performed either at the sector, endpoint or resource level. 1917 8.3. Denial of Service Attacks 1919 Services that run over UDP unprotected are vulnerable to unknowingly 1920 become part of a DDoS attack as UDP does not require return 1921 routability check. Therefore, an attacker can easily spoof the 1922 source IP of the target entity and send requests to such a service 1923 which would then respond to the target entity. This can be used for 1924 large-scale DDoS attacks on the target. Especially, if the service 1925 returns a response that is order of magnitudes larger than the 1926 request, the situation becomes even worse as now the attack can be 1927 amplified. DNS servers have been widely used for DDoS amplification 1928 attacks. There is also a danger that NTP Servers could become 1929 implicated in denial-of-service (DoS) attacks since they run on 1930 unprotected UDP, there is no return routability check, and they can 1931 have a large amplification factor. The responses from the NTP server 1932 were found to be 19 times larger than the request. A Resource 1933 Directory (RD) which responds to wild-card lookups is potentially 1934 vulnerable if run with CoAP over UDP. Since there is no return 1935 routability check and the responses can be significantly larger than 1936 requests, RDs can unknowingly become part of a DDoS amplification 1937 attack. 1939 9. IANA Considerations 1941 9.1. Resource Types 1943 IANA is asked to enter the following values into the Resource Type 1944 (rt=) Link Target Attribute Values sub-registry of the Constrained 1945 Restful Environments (CoRE) Parameters registry defined in [RFC6690]: 1947 +--------------------+--------------------------+-------------------+ 1948 | Value | Description | Reference | 1949 +--------------------+--------------------------+-------------------+ 1950 | core.rd | Directory resource of an | RFCTHIS Section | 1951 | | RD | 5.2 | 1952 | core.rd-lookup-res | Resource lookup of an RD | RFCTHIS Section | 1953 | | | 5.2 | 1954 | core.rd-lookup-ep | Endpoint lookup of an RD | RFCTHIS Section | 1955 | | | 5.2 | 1956 | core.rd-ep | Endpoint resource of an | RFCTHIS Section 6 | 1957 | | RD | | 1958 +--------------------+--------------------------+-------------------+ 1960 9.2. IPv6 ND Resource Directory Address Option 1962 This document registers one new ND option type under the sub-registry 1963 "IPv6 Neighbor Discovery Option Formats": 1965 o Resource Directory address Option (38) 1967 9.3. RD Parameter Registry 1969 This specification defines a new sub-registry for registration and 1970 lookup parameters called "RD Parameters" under "CoRE Parameters". 1971 Although this specification defines a basic set of parameters, it is 1972 expected that other standards that make use of this interface will 1973 define new ones. 1975 Each entry in the registry must include 1977 o the human readable name of the parameter, 1979 o the short name as used in query parameters or target attributes, 1981 o indication of whether it can be passed as a query parameter at 1982 registration of endpoints, as a query parameter in lookups, or be 1983 expressed as a target attribute, 1985 o validity requirements if any, and 1987 o a description. 1989 The query parameter MUST be both a valid URI query key [RFC3986] and 1990 a token as used in [RFC8288]. 1992 The description must give details on whether the parameter can be 1993 updated, and how it is to be processed in lookups. 1995 The mechanisms around new RD parameters should be designed in such a 1996 way that they tolerate RD implementations that are unaware of the 1997 parameter and expose any parameter passed at registration or updates 1998 on in endpoint lookups. (For example, if a parameter used at 1999 registration were to be confidential, the registering endpoint should 2000 be instructed to only set that parameter if the RD advertises support 2001 for keeping it confidential at the discovery step.) 2003 Initial entries in this sub-registry are as follows: 2005 +--------------+-------+---------------+-----+----------------------+ 2006 | Full name | Short | Validity | Use | Description | 2007 +--------------+-------+---------------+-----+----------------------+ 2008 | Endpoint | ep | | RLA | Name of the | 2009 | Name | | | | endpoint, max 63 | 2010 | | | | | bytes | 2011 | Lifetime | lt | 60-4294967295 | R | Lifetime of the | 2012 | | | | | registration in | 2013 | | | | | seconds | 2014 | Sector | d | | RLA | Sector to which this | 2015 | | | | | endpoint belongs | 2016 | Registration | base | URI | RLA | The scheme, address | 2017 | Base URI | | | | and port and path at | 2018 | | | | | which this server is | 2019 | | | | | available | 2020 | Page | page | Integer | L | Used for pagination | 2021 | Count | count | Integer | L | Used for pagination | 2022 | Endpoint | et | | RLA | Semantic name of the | 2023 | Type | | | | endpoint (see | 2024 | | | | | Section 9.4) | 2025 +--------------+-------+---------------+-----+----------------------+ 2027 Table 2: RD Parameters 2029 (Short: Short name used in query parameters or target attributes. 2030 Use: R = used at registration, L = used at lookup, A = expressed in 2031 target attribute 2033 The descriptions for the options defined in this document are only 2034 summarized here. To which registrations they apply and when they are 2035 to be shown is described in the respective sections of this document. 2037 The IANA policy for future additions to the sub-registry is "Expert 2038 Review" as described in [RFC8126]. The evaluation should consider 2039 formal criteria, duplication of functionality (Is the new entry 2040 redundant with an existing one?), topical suitability (E.g. is the 2041 described property actually a property of the endpoint and not a 2042 property of a particular resource, in which case it should go into 2043 the payload of the registration and need not be registered?), and the 2044 potential for conflict with commonly used target attributes (For 2045 example, "if" could be used as a parameter for conditional 2046 registration if it were not to be used in lookup or attributes, but 2047 would make a bad parameter for lookup, because a resource lookup with 2048 an "if" query parameter could ambiguously filter by the registered 2049 endpoint property or the [RFC6690] target attribute). It is expected 2050 that the registry will receive between 5 and 50 registrations in 2051 total over the next years. 2053 9.3.1. Full description of the "Endpoint Type" Registration Parameter 2055 An endpoint registering at an RD can describe itself with endpoint 2056 types, similar to how resources are described with Resource Types in 2057 [RFC6690]. An endpoint type is expressed as a string, which can be 2058 either a URI or one of the values defined in the Endpoint Type sub- 2059 registry. Endpoint types can be passed in the "et" query parameter 2060 as part of extra-attrs at the Registration step, are shown on 2061 endpoint lookups using the "et" target attribute, and can be filtered 2062 for using "et" as a search criterion in resource and endpoint lookup. 2063 Multiple endpoint types are given as separate query parameters or 2064 link attributes. 2066 Note that Endpoint Type differs from Resource Type in that it uses 2067 multiple attributes rather than space separated values. As a result, 2068 Resource Directory implementations automatically support correct 2069 filtering in the lookup interfaces from the rules for unknown 2070 endpoint attributes. 2072 9.4. "Endpoint Type" (et=) RD Parameter values 2074 This specification establishes a new sub-registry under "CoRE 2075 Parameters" called '"Endpoint Type" (et=) RD Parameter values'. The 2076 registry properties (required policy, requirements, template) are 2077 identical to those of the Resource Type parameters in [RFC6690], in 2078 short: 2080 The review policy is IETF Review for values starting with "core", and 2081 Specification Required for others. 2083 The requirements to be enforced are: 2085 o The values MUST be related to the purpose described in 2086 Section 9.3.1. 2088 o The registered values MUST conform to the ABNF reg-rel-type 2089 definition of [RFC6690] and MUST NOT be a URI. 2091 o It is recommended to use the period "." character for 2092 segmentation. 2094 The registry initially contains one value: 2096 o "core.rd-group": An application group as described in Appendix A. 2098 9.5. Multicast Address Registration 2100 IANA has assigned the following multicast addresses for use by CoAP 2101 nodes: 2103 IPv4 - "all CoRE resource directories" address, from the "IPv4 2104 Multicast Address Space Registry" equal to "All CoAP Nodes", 2105 224.0.1.187. As the address is used for discovery that may span 2106 beyond a single network, it has come from the Internetwork Control 2107 Block (224.0.1.x, RFC 5771). 2109 IPv6 - "all CoRE resource directories" address MCD1 (suggestions 2110 FF0X::FE), from the "IPv6 Multicast Address Space Registry", in the 2111 "Variable Scope Multicast Addresses" space (RFC 3307). Note that 2112 there is a distinct multicast address for each scope that interested 2113 CoAP nodes should listen to; CoAP needs the Link-Local and Site-Local 2114 scopes only. 2116 10. Examples 2118 Two examples are presented: a Lighting Installation example in 2119 Section 10.1 and a LWM2M example in Section 10.2. 2121 10.1. Lighting Installation 2123 This example shows a simplified lighting installation which makes use 2124 of the Resource Directory (RD) with a CoAP interface to facilitate 2125 the installation and start-up of the application code in the lights 2126 and sensors. In particular, the example leads to the definition of a 2127 group and the enabling of the corresponding multicast address as 2128 described in Appendix A. No conclusions must be drawn on the 2129 realization of actual installation or naming procedures, because the 2130 example only "emphasizes" some of the issues that may influence the 2131 use of the RD and does not pretend to be normative. 2133 10.1.1. Installation Characteristics 2135 The example assumes that the installation is managed. That means 2136 that a Commissioning Tool (CT) is used to authorize the addition of 2137 nodes, name them, and name their services. The CT can be connected 2138 to the installation in many ways: the CT can be part of the 2139 installation network, connected by WiFi to the installation network, 2140 or connected via GPRS link, or other method. 2142 It is assumed that there are two naming authorities for the 2143 installation: (1) the network manager that is responsible for the 2144 correct operation of the network and the connected interfaces, and 2145 (2) the lighting manager that is responsible for the correct 2146 functioning of networked lights and sensors. The result is the 2147 existence of two naming schemes coming from the two managing 2148 entities. 2150 The example installation consists of one presence sensor, and two 2151 luminaries, luminary1 and luminary2, each with their own wireless 2152 interface. Each luminary contains three lamps: left, right and 2153 middle. Each luminary is accessible through one endpoint. For each 2154 lamp a resource exists to modify the settings of a lamp in a 2155 luminary. The purpose of the installation is that the presence 2156 sensor notifies the presence of persons to a group of lamps. The 2157 group of lamps consists of: middle and left lamps of luminary1 and 2158 right lamp of luminary2. 2160 Before commissioning by the lighting manager, the network is 2161 installed and access to the interfaces is proven to work by the 2162 network manager. 2164 At the moment of installation, the network under installation is not 2165 necessarily connected to the DNS infra structure. Therefore, SLAAC 2166 IPv6 addresses are assigned to CT, RD, luminaries and sensor shown in 2167 Table 3 below: 2169 +--------------------+----------------+ 2170 | Name | IPv6 address | 2171 +--------------------+----------------+ 2172 | luminary1 | 2001:db8:4::1 | 2173 | luminary2 | 2001:db8:4::2 | 2174 | Presence sensor | 2001:db8:4::3 | 2175 | Resource directory | 2001:db8:4::ff | 2176 +--------------------+----------------+ 2178 Table 3: interface SLAAC addresses 2180 In Section 10.1.2 the use of resource directory during installation 2181 is presented. 2183 10.1.2. RD entries 2185 It is assumed that access to the DNS infrastructure is not always 2186 possible during installation. Therefore, the SLAAC addresses are 2187 used in this section. 2189 For discovery, the resource types (rt) of the devices are important. 2190 The lamps in the luminaries have rt: light, and the presence sensor 2191 has rt: p-sensor. The endpoints have names which are relevant to the 2192 light installation manager. In this case luminary1, luminary2, and 2193 the presence sensor are located in room 2-4-015, where luminary1 is 2194 located at the window and luminary2 and the presence sensor are 2195 located at the door. The endpoint names reflect this physical 2196 location. The middle, left and right lamps are accessed via path 2197 /light/middle, /light/left, and /light/right respectively. The 2198 identifiers relevant to the Resource Directory are shown in Table 4 2199 below: 2201 +----------------+------------------+---------------+---------------+ 2202 | Name | endpoint | resource path | resource type | 2203 +----------------+------------------+---------------+---------------+ 2204 | luminary1 | lm_R2-4-015_wndw | /light/left | light | 2205 | luminary1 | lm_R2-4-015_wndw | /light/middle | light | 2206 | luminary1 | lm_R2-4-015_wndw | /light/right | light | 2207 | luminary2 | lm_R2-4-015_door | /light/left | light | 2208 | luminary2 | lm_R2-4-015_door | /light/middle | light | 2209 | luminary2 | lm_R2-4-015_door | /light/right | light | 2210 | Presence | ps_R2-4-015_door | /ps | p-sensor | 2211 | sensor | | | | 2212 +----------------+------------------+---------------+---------------+ 2214 Table 4: Resource Directory identifiers 2216 It is assumed that the CT knows the RD's address, and has performed 2217 URI discovery on it that returned a response like the one in the 2218 Section 5.2 example. 2220 The CT inserts the endpoints of the luminaries and the sensor in the 2221 RD using the registration base URI parameter (base) to specify the 2222 interface address: 2224 Req: POST coap://[2001:db8:4::ff]/rd 2225 ?ep=lm_R2-4-015_wndw&base=coap://[2001:db8:4::1]&d=R2-4-015 2226 Payload: 2227 ;rt="light", 2228 ;rt="light", 2229 ;rt="light" 2231 Res: 2.01 Created 2232 Location-Path: /rd/4521 2234 Req: POST coap://[2001:db8:4::ff]/rd 2235 ?ep=lm_R2-4-015_door&base=coap://[2001:db8:4::2]&d=R2-4-015 2236 Payload: 2237 ;rt="light", 2238 ;rt="light", 2239 ;rt="light" 2241 Res: 2.01 Created 2242 Location-Path: /rd/4522 2244 Req: POST coap://[2001:db8:4::ff]/rd 2245 ?ep=ps_R2-4-015_door&base=coap://[2001:db8:4::3]d&d=R2-4-015 2246 Payload: 2247 ;rt="p-sensor" 2249 Res: 2.01 Created 2250 Location-Path: /rd/4523 2252 The sector name d=R2-4-015 has been added for an efficient lookup 2253 because filtering on "ep" name is more awkward. The same sector name 2254 is communicated to the two luminaries and the presence sensor by the 2255 CT. 2257 The group is specified in the RD. The base parameter is set to the 2258 site-local multicast address allocated to the group. In the POST in 2259 the example below, the resources supported by all group members are 2260 published. 2262 Req: POST coap://[2001:db8:4::ff]/rd 2263 ?ep=grp_R2-4-015&et=core.rd-group&base=coap://[ff05::1] 2264 Payload: 2265 ;rt="light", 2266 ;rt="light", 2267 ;rt="light" 2269 Res: 2.01 Created 2270 Location-Path: /rd/501 2271 After the filling of the RD by the CT, the application in the 2272 luminaries can learn to which groups they belong, and enable their 2273 interface for the multicast address. 2275 The luminary, knowing its sector and being configured to join any 2276 group containing lights, searches for candidate groups and joins 2277 them: 2279 Req: GET coap://[2001:db8:4::ff]/rd-lookup/ep 2280 ?d=R2-4-015&et=core.rd-group&rt=light 2282 Res: 2.05 Content 2283 ;ep="grp_R2-4-015";et="core.rd-group"; 2284 base="coap://[ff05::1]";rt="core.rd-ep" 2286 From the returned base parameter value, the luminary learns the 2287 multicast address of the multicast group. 2289 Alternatively, the CT can communicate the multicast address directly 2290 to the luminaries by using the "coap-group" resource specified in 2291 [RFC7390]. 2293 Req: POST coap://[2001:db8:4::1]/coap-group 2294 Content-Format: application/coap-group+json 2295 Payload: 2296 { "a": "[ff05::1]", "n": "grp_R2-4-015"} 2298 Res: 2.01 Created 2299 Location-Path: /coap-group/1 2301 Dependent on the situation, only the address, "a", or the name, "n", 2302 is specified in the coap-group resource. 2304 The presence sensor can learn the presence of groups that support 2305 resources with rt=light in its own sector by sending the same 2306 request, as used by the luminary. The presence sensor learns the 2307 multicast address to use for sending messages to the luminaries. 2309 10.2. OMA Lightweight M2M (LWM2M) Example 2311 This example shows how the OMA LWM2M specification makes use of 2312 Resource Directory (RD). 2314 OMA LWM2M is a profile for device services based on CoAP(OMA Name 2315 Authority). LWM2M defines a simple object model and a number of 2316 abstract interfaces and operations for device management and device 2317 service enablement. 2319 An LWM2M server is an instance of an LWM2M middleware service layer, 2320 containing a Resource Directory along with other LWM2M interfaces 2321 defined by the LWM2M specification. 2323 CoRE Resource Directory (RD) is used to provide the LWM2M 2324 Registration interface. 2326 LWM2M does not provide for registration sectors and does not 2327 currently use the rd-lookup interface. 2329 The LWM2M specification describes a set of interfaces and a resource 2330 model used between a LWM2M device and an LWM2M server. Other 2331 interfaces, proxies, and applications are currently out of scope for 2332 LWM2M. 2334 The location of the LWM2M Server and RD URI path is provided by the 2335 LWM2M Bootstrap process, so no dynamic discovery of the RD is used. 2336 LWM2M Servers and endpoints are not required to implement the /.well- 2337 known/core resource. 2339 10.2.1. The LWM2M Object Model 2341 The OMA LWM2M object model is based on a simple 2 level class 2342 hierarchy consisting of Objects and Resources. 2344 An LWM2M Resource is a REST endpoint, allowed to be a single value or 2345 an array of values of the same data type. 2347 An LWM2M Object is a resource template and container type that 2348 encapsulates a set of related resources. An LWM2M Object represents 2349 a specific type of information source; for example, there is a LWM2M 2350 Device Management object that represents a network connection, 2351 containing resources that represent individual properties like radio 2352 signal strength. 2354 Since there may potentially be more than one of a given type object, 2355 for example more than one network connection, LWM2M defines instances 2356 of objects that contain the resources that represent a specific 2357 physical thing. 2359 The URI template for LWM2M consists of a base URI followed by Object, 2360 Instance, and Resource IDs: 2362 {/base-uri}{/object-id}{/object-instance}{/resource-id}{/resource- 2363 instance} 2365 The five variables given here are strings. base-uri can also have 2366 the special value "undefined" (sometimes called "null" in RFC 6570). 2368 Each of the variables object-instance, resource-id, and resource- 2369 instance can be the special value "undefined" only if the values 2370 behind it in this sequence also are "undefined". As a special case, 2371 object-instance can be "empty" (which is different from "undefined") 2372 if resource-id is not "undefined". 2374 base-uri := Base URI for LWM2M resources or "undefined" for default 2375 (empty) base URI 2377 object-id := OMNA (OMA Name Authority) registered object ID (0-65535) 2379 object-instance := Object instance identifier (0-65535) or 2380 "undefined"/"empty" (see above)) to refer to all instances of an 2381 object ID 2383 resource-id := OMNA (OMA Name Authority) registered resource ID 2384 (0-65535) or "undefined" to refer to all resources within an instance 2386 resource-instance := Resource instance identifier or "undefined" to 2387 refer to single instance of a resource 2389 LWM2M IDs are 16 bit unsigned integers represented in decimal (no 2390 leading zeroes except for the value 0) by URI format strings. For 2391 example, a LWM2M URI might be: 2393 /1/0/1 2395 The base uri is empty, the Object ID is 1, the instance ID is 0, the 2396 resource ID is 1, and the resource instance is "undefined". This 2397 example URI points to internal resource 1, which represents the 2398 registration lifetime configured, in instance 0 of a type 1 object 2399 (LWM2M Server Object). 2401 10.2.2. LWM2M Register Endpoint 2403 LWM2M defines a registration interface based on the REST API, 2404 described in Section 5. The RD registration URI path of the LWM2M 2405 Resource Directory is specified to be "/rd". 2407 LWM2M endpoints register object IDs, for example , to indicate 2408 that a particular object type is supported, and register object 2409 instances, for example , to indicate that a particular instance 2410 of that object type exists. 2412 Resources within the LWM2M object instance are not registered with 2413 the RD, but may be discovered by reading the resource links from the 2414 object instance using GET with a CoAP Content-Format of application/ 2415 link-format. Resources may also be read as a structured object by 2416 performing a GET to the object instance with a Content-Format of 2417 senml+json. 2419 When an LWM2M object or instance is registered, this indicates to the 2420 LWM2M server that the object and its resources are available for 2421 management and service enablement (REST API) operations. 2423 LWM2M endpoints may use the following RD registration parameters as 2424 defined in Table 2 : 2426 ep - Endpoint Name 2427 lt - registration lifetime 2429 Endpoint Name, Lifetime, and LWM2M Version are mandatory parameters 2430 for the register operation, all other registration parameters are 2431 optional. 2433 Additional optional LWM2M registration parameters are defined: 2435 +-----------+-------+-------------------------------+---------------+ 2436 | Name | Query | Validity | Description | 2437 +-----------+-------+-------------------------------+---------------+ 2438 | Binding | b | {"U",UQ","S","SQ","US","UQS"} | Available | 2439 | Mode | | | Protocols | 2440 | | | | | 2441 | LWM2M | ver | 1.0 | Spec Version | 2442 | Version | | | | 2443 | | | | | 2444 | SMS | sms | | MSISDN | 2445 | Number | | | | 2446 +-----------+-------+-------------------------------+---------------+ 2448 Table 5: LWM2M Additional Registration Parameters 2450 The following RD registration parameters are not currently specified 2451 for use in LWM2M: 2453 et - Endpoint Type 2454 base - Registration Base URI 2456 The endpoint registration must include a payload containing links to 2457 all supported objects and existing object instances, optionally 2458 including the appropriate link-format relations. 2460 Here is an example LWM2M registration payload: 2462 ,,, 2463 This link format payload indicates that object ID 1 (LWM2M Server 2464 Object) is supported, with a single instance 0 existing, object ID 3 2465 (LWM2M Device object) is supported, with a single instance 0 2466 existing, and object 5 (LWM2M Firmware Object) is supported, with no 2467 existing instances. 2469 10.2.3. LWM2M Update Endpoint Registration 2471 The LwM2M update is really very similar to the registration update as 2472 described in Section 5.4.1, with the only difference that there are 2473 more parameters defined and available. All the parameters listed in 2474 that section are also available with the initial registration but are 2475 all optional: 2477 lt - Registration Lifetime 2478 b - Protocol Binding 2479 sms - MSISDN 2480 link payload - new or modified links 2482 A Registration update is also specified to be used to update the 2483 LWM2M server whenever the endpoint's UDP port or IP address are 2484 changed. 2486 10.2.4. LWM2M De-Register Endpoint 2488 LWM2M allows for de-registration using the delete method on the 2489 returned location from the initial registration operation. LWM2M de- 2490 registration proceeds as described in Section 5.4.2. 2492 11. Acknowledgments 2494 Oscar Novo, Srdjan Krco, Szymon Sasin, Kerry Lynn, Esko Dijk, Anders 2495 Brandt, Matthieu Vial, Jim Schaad, Mohit Sethi, Hauke Petersen, 2496 Hannes Tschofenig, Sampo Ukkola, Linyi Tian, and Jan Newmarch have 2497 provided helpful comments, discussions and ideas to improve and shape 2498 this document. Zach would also like to thank his colleagues from the 2499 EU FP7 SENSEI project, where many of the resource directory concepts 2500 were originally developed. 2502 12. Changelog 2504 changes from -17 to -18 2506 o Rather than re-specifying link format (Modernized Link Format), 2507 describe a Limited Link Format that's the uncontested subset of 2508 Link Format 2510 o Acknowledging the -17 version as part of the draft 2511 o Move "Read endpoint links" operation to future specification like 2512 PATCH 2514 o Demote links-json to an informative reference, and removed them 2515 from exchange examples 2517 o Add note on unusability of link-local IP addresses, and describe 2518 mitigation. 2520 o Reshuffling of sections: Move additional operations and endpoint 2521 lookup back from appendix, and groups into one 2523 o Lookup interface tightened to not imply applicability for non 2524 link-format lookups (as those can have vastly different views on 2525 link cardinality) 2527 o Simple registration: Change sequence of GET and POST-response, 2528 ensuring unsuccessful registrations are reported as such, and 2529 suggest how devices that would have required the inverse behavior 2530 can still cope with it. 2532 o Abstract and introduction reworded to avoid the impression that 2533 resources are stored in full in the RD 2535 o Simplify the rules governing when a registration resource can or 2536 must be changed. 2538 o Drop a figure that has become useless due to the changes of and 2539 -13 and -17 2541 o Wording consistency fixes: Use "Registrations" and "target 2542 attributes" 2544 o Fix incorrect use of content negotiation in discovery interface 2545 description (Content-Format -> Accept) 2547 o State that the base attribute value is part of endpoint lookup 2548 even when implicit in the registration 2550 o Update references from RFC5988 to its update RFC8288 2552 o Remove appendix on protocol-negotiation (which had a note to be 2553 removed before publication) 2555 changes from -16 to -17 2557 (Note that -17 is published as a direct follow-up to -16, containing 2558 a single change to be discussed at IETF103) 2559 o Removed groups that are enumerations of registrations and have 2560 dedicated mechanism 2562 o Add groups that are enumerations of shared resources and are a 2563 special case of endpoint registrations 2565 changes from -15 to -16 2567 o Recommend a common set of resources for members of a group 2569 o Clarified use of multicast group in lighting example 2571 o Add note on concurrent registrations from one EP being possible 2572 but not expected 2574 o Refresh web examples appendix to reflect current use of Modernized 2575 Link Format 2577 o Add examples of URIs where Modernized Link Format matters 2579 o Editorial changes 2581 changes from -14 to -15 2583 o Rewrite of section "Security policies" 2585 o Clarify that the "base" parameter text applies both to relative 2586 references both in anchor and href 2588 o Renamed "Registree-EP" to Registrant-EP" 2590 o Talk of "relative references" and "URIs" rather than "relative" 2591 and "absolute" URIs. (The concept of "absolute URIs" of [RFC3986] 2592 is not needed in RD). 2594 o Fixed examples 2596 o Editorial changes 2598 changes from -13 to -14 2600 o Rename "registration context" to "registration base URI" (and 2601 "con" to "base") and "domain" to "sector" (where the abbreviation 2602 "d" stays for compatibility reasons) 2604 o Introduced resource types core.rd-ep and core.rd-gp 2605 o Registration management moved to appendix A, including endpoint 2606 and group lookup 2608 o Minor editorial changes 2610 * PATCH/iPATCH is clearly deferred to another document 2612 * Recommend against query / fragment identifier in con= 2614 * Interface description lists are described as illustrative 2616 * Rewording of Simple Registration 2618 o Simple registration carries no error information and succeeds 2619 immediately (previously, sequence was unspecified) 2621 o Lookup: href are matched against resolved values (previously, this 2622 was unspecified) 2624 o Lookup: lt are not exposed any more 2626 o con/base: Paths are allowed 2628 o Registration resource locations can not have query or fragment 2629 parts 2631 o Default life time extended to 25 hours 2633 o clarified registration update rules 2635 o lt-value semantics for lookup clarified. 2637 o added template for simple registration 2639 changes from -12 to -13 2641 o Added "all resource directory" nodes MC address 2643 o Clarified observation behavior 2645 o version identification 2647 o example rt= and et= values 2649 o domain from figure 2 2651 o more explanatory text 2652 o endpoints of a groups hosted by different RD 2654 o resolve RFC6690-vs-8288 resolution ambiguities: 2656 * require registered links not to be relative when using anchor 2658 * return absolute URIs in resource lookup 2660 changes from -11 to -12 2662 o added Content Model section, including ER diagram 2664 o removed domain lookup interface; domains are now plain attributes 2665 of groups and endpoints 2667 o updated chapter "Finding a Resource Directory"; now distinguishes 2668 configuration-provided, network-provided and heuristic sources 2670 o improved text on: atomicity, idempotency, lookup with multiple 2671 parameters, endpoint removal, simple registration 2673 o updated LWM2M description 2675 o clarified where relative references are resolved, and how context 2676 and anchor interact 2678 o new appendix on the interaction with RFCs 6690, 5988 and 3986 2680 o lookup interface: group and endpoint lookup return group and 2681 registration resources as link targets 2683 o lookup interface: search parameters work the same across all 2684 entities 2686 o removed all methods that modify links in an existing registration 2687 (POST with payload, PATCH and iPATCH) 2689 o removed plurality definition (was only needed for link 2690 modification) 2692 o enhanced IANA registry text 2694 o state that lookup resources can be observable 2696 o More examples and improved text 2698 changes from -09 to -10 2699 o removed "ins" and "exp" link-format extensions. 2701 o removed all text concerning DNS-SD. 2703 o removed inconsistency in RDAO text. 2705 o suggestions taken over from various sources 2707 o replaced "Function Set" with "REST API", "base URI", "base path" 2709 o moved simple registration to registration section 2711 changes from -08 to -09 2713 o clarified the "example use" of the base RD resource values /rd, 2714 /rd-lookup, and /rd-group. 2716 o changed "ins" ABNF notation. 2718 o various editorial improvements, including in examples 2720 o clarifications for RDAO 2722 changes from -07 to -08 2724 o removed link target value returned from domain and group lookup 2725 types 2727 o Maximum length of domain parameter 63 bytes for consistency with 2728 group 2730 o removed option for simple POST of link data, don't require a 2731 .well-known/core resource to accept POST data and handle it in a 2732 special way; we already have /rd for that 2734 o add IPv6 ND Option for discovery of an RD 2736 o clarify group configuration section 6.1 that endpoints must be 2737 registered before including them in a group 2739 o removed all superfluous client-server diagrams 2741 o simplified lighting example 2743 o introduced Commissioning Tool 2745 o RD-Look-up text is extended. 2747 changes from -06 to -07 2749 o added text in the discovery section to allow content format hints 2750 to be exposed in the discovery link attributes 2752 o editorial updates to section 9 2754 o update author information 2756 o minor text corrections 2758 Changes from -05 to -06 2760 o added note that the PATCH section is contingent on the progress of 2761 the PATCH method 2763 changes from -04 to -05 2765 o added Update Endpoint Links using PATCH 2767 o http access made explicit in interface specification 2769 o Added http examples 2771 Changes from -03 to -04: 2773 o Added http response codes 2775 o Clarified endpoint name usage 2777 o Add application/link-format+cbor content-format 2779 Changes from -02 to -03: 2781 o Added an example for lighting and DNS integration 2783 o Added an example for RD use in OMA LWM2M 2785 o Added Read Links operation for link inspection by endpoints 2787 o Expanded DNS-SD section 2789 o Added draft authors Peter van der Stok and Michael Koster 2791 Changes from -01 to -02: 2793 o Added a catalogue use case. 2795 o Changed the registration update to a POST with optional link 2796 format payload. Removed the endpoint type update from the update. 2798 o Additional examples section added for more complex use cases. 2800 o New DNS-SD mapping section. 2802 o Added text on endpoint identification and authentication. 2804 o Error code 4.04 added to Registration Update and Delete requests. 2806 o Made 63 bytes a SHOULD rather than a MUST for endpoint name and 2807 resource type parameters. 2809 Changes from -00 to -01: 2811 o Removed the ETag validation feature. 2813 o Place holder for the DNS-SD mapping section. 2815 o Explicitly disabled GET or POST on returned Location. 2817 o New registry for RD parameters. 2819 o Added support for the JSON Link Format. 2821 o Added reference to the Groupcomm WG draft. 2823 Changes from -05 to WG Document -00: 2825 o Updated the version and date. 2827 Changes from -04 to -05: 2829 o Restricted Update to parameter updates. 2831 o Added pagination support for the Lookup interface. 2833 o Minor editing, bug fixes and reference updates. 2835 o Added group support. 2837 o Changed rt to et for the registration and update interface. 2839 Changes from -03 to -04: 2841 o Added the ins= parameter back for the DNS-SD mapping. 2843 o Integrated the Simple Directory Discovery from Carsten. 2845 o Editorial improvements. 2847 o Fixed the use of ETags. 2849 o Fixed tickets 383 and 372 2851 Changes from -02 to -03: 2853 o Changed the endpoint name back to a single registration parameter 2854 ep= and removed the h= and ins= parameters. 2856 o Updated REST interface descriptions to use RFC6570 URI Template 2857 format. 2859 o Introduced an improved RD Lookup design as its own function set. 2861 o Improved the security considerations section. 2863 o Made the POST registration interface idempotent by requiring the 2864 ep= parameter to be present. 2866 Changes from -01 to -02: 2868 o Added a terminology section. 2870 o Changed the inclusion of an ETag in registration or update to a 2871 MAY. 2873 o Added the concept of an RD Domain and a registration parameter for 2874 it. 2876 o Recommended the Location returned from a registration to be 2877 stable, allowing for endpoint and Domain information to be changed 2878 during updates. 2880 o Changed the lookup interface to accept endpoint and Domain as 2881 query string parameters to control the scope of a lookup. 2883 13. References 2885 13.1. Normative References 2887 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2888 Requirement Levels", BCP 14, RFC 2119, 2889 DOI 10.17487/RFC2119, March 1997, 2890 . 2892 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 2893 Resource Identifier (URI): Generic Syntax", STD 66, 2894 RFC 3986, DOI 10.17487/RFC3986, January 2005, 2895 . 2897 [RFC6570] Gregorio, J., Fielding, R., Hadley, M., Nottingham, M., 2898 and D. Orchard, "URI Template", RFC 6570, 2899 DOI 10.17487/RFC6570, March 2012, 2900 . 2902 [RFC6690] Shelby, Z., "Constrained RESTful Environments (CoRE) Link 2903 Format", RFC 6690, DOI 10.17487/RFC6690, August 2012, 2904 . 2906 [RFC6763] Cheshire, S. and M. Krochmal, "DNS-Based Service 2907 Discovery", RFC 6763, DOI 10.17487/RFC6763, February 2013, 2908 . 2910 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 2911 Writing an IANA Considerations Section in RFCs", BCP 26, 2912 RFC 8126, DOI 10.17487/RFC8126, June 2017, 2913 . 2915 13.2. Informative References 2917 [ER] Chen, P., "The entity-relationship model---toward a 2918 unified view of data", ACM Transactions on Database 2919 Systems Vol. 1, pp. 9-36, DOI 10.1145/320434.320440, March 2920 1976. 2922 [I-D.arkko-core-dev-urn] 2923 Arkko, J., Jennings, C., and Z. Shelby, "Uniform Resource 2924 Names for Device Identifiers", draft-arkko-core-dev-urn-05 2925 (work in progress), October 2017. 2927 [I-D.bormann-t2trg-rel-impl] 2928 Bormann, C., "impl-info: A link relation type for 2929 disclosing implementation information", draft-bormann- 2930 t2trg-rel-impl-00 (work in progress), January 2018. 2932 [I-D.hartke-t2trg-coral] 2933 Hartke, K., "The Constrained RESTful Application Language 2934 (CoRAL)", draft-hartke-t2trg-coral-06 (work in progress), 2935 October 2018. 2937 [I-D.ietf-ace-oauth-authz] 2938 Seitz, L., Selander, G., Wahlstroem, E., Erdtman, S., and 2939 H. Tschofenig, "Authentication and Authorization for 2940 Constrained Environments (ACE) using the OAuth 2.0 2941 Framework (ACE-OAuth)", draft-ietf-ace-oauth-authz-17 2942 (work in progress), November 2018. 2944 [I-D.ietf-anima-bootstrapping-keyinfra] 2945 Pritikin, M., Richardson, M., Behringer, M., Bjarnason, 2946 S., and K. Watsen, "Bootstrapping Remote Secure Key 2947 Infrastructures (BRSKI)", draft-ietf-anima-bootstrapping- 2948 keyinfra-17 (work in progress), November 2018. 2950 [I-D.ietf-core-links-json] 2951 Li, K., Rahman, A., and C. Bormann, "Representing 2952 Constrained RESTful Environments (CoRE) Link Format in 2953 JSON and CBOR", draft-ietf-core-links-json-10 (work in 2954 progress), February 2018. 2956 [I-D.silverajan-core-coap-protocol-negotiation] 2957 Silverajan, B. and M. Ocak, "CoAP Protocol Negotiation", 2958 draft-silverajan-core-coap-protocol-negotiation-09 (work 2959 in progress), July 2018. 2961 [RFC6775] Shelby, Z., Ed., Chakrabarti, S., Nordmark, E., and C. 2962 Bormann, "Neighbor Discovery Optimization for IPv6 over 2963 Low-Power Wireless Personal Area Networks (6LoWPANs)", 2964 RFC 6775, DOI 10.17487/RFC6775, November 2012, 2965 . 2967 [RFC6874] Carpenter, B., Cheshire, S., and R. Hinden, "Representing 2968 IPv6 Zone Identifiers in Address Literals and Uniform 2969 Resource Identifiers", RFC 6874, DOI 10.17487/RFC6874, 2970 February 2013, . 2972 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 2973 Protocol (HTTP/1.1): Message Syntax and Routing", 2974 RFC 7230, DOI 10.17487/RFC7230, June 2014, 2975 . 2977 [RFC7252] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained 2978 Application Protocol (CoAP)", RFC 7252, 2979 DOI 10.17487/RFC7252, June 2014, 2980 . 2982 [RFC7390] Rahman, A., Ed. and E. Dijk, Ed., "Group Communication for 2983 the Constrained Application Protocol (CoAP)", RFC 7390, 2984 DOI 10.17487/RFC7390, October 2014, 2985 . 2987 [RFC7641] Hartke, K., "Observing Resources in the Constrained 2988 Application Protocol (CoAP)", RFC 7641, 2989 DOI 10.17487/RFC7641, September 2015, 2990 . 2992 [RFC8132] van der Stok, P., Bormann, C., and A. Sehgal, "PATCH and 2993 FETCH Methods for the Constrained Application Protocol 2994 (CoAP)", RFC 8132, DOI 10.17487/RFC8132, April 2017, 2995 . 2997 [RFC8288] Nottingham, M., "Web Linking", RFC 8288, 2998 DOI 10.17487/RFC8288, October 2017, 2999 . 3001 [RFC8392] Jones, M., Wahlstroem, E., Erdtman, S., and H. Tschofenig, 3002 "CBOR Web Token (CWT)", RFC 8392, DOI 10.17487/RFC8392, 3003 May 2018, . 3005 Appendix A. Groups Registration and Lookup 3007 The RD-Groups usage pattern allows announcing application groups 3008 inside a Resource Directory. 3010 Groups are represented by endpoint registrations. Their base address 3011 is a multicast address, and they SHOULD be entered with the endpoint 3012 type "core.rd-group". The endpoint name can also be referred to as a 3013 group name in this context. 3015 The registration is inserted into the RD by a Commissioning Tool, 3016 which might also be known as a group manager here. It performs third 3017 party registration and registration updates. 3019 The links it registers SHOULD be available on all members that join 3020 the group. Depending on the application, members that lack some 3021 resource MAY be permissible if requests to them fail gracefully. 3023 The following example shows a CT registering a group with the name 3024 "lights" which provides two resources. The directory resource path 3025 /rd is an example RD location discovered in a request similar to 3026 Figure 5. 3028 Req: POST coap://rd.example.com/rd?ep=lights&et=core.rd-group 3029 &base=coap://[ff35:30:2001:db8::1] 3030 Content-Format: 40 3031 Payload: 3032 ;rt="light";if="core.a", 3033 ;if="core.p";u="K" 3035 Res: 2.01 Created 3036 Location-Path: /rd/12 3038 In this example, the group manager can easily permit devices that 3039 have no writable color-temperature to join, as they would still 3040 respond to brightness changing commands. Had the group instead 3041 contained a single resource that sets brightness and color 3042 temperature atomically, endpoints would need to support both 3043 properties. 3045 The resources of a group can be looked up like any other resource, 3046 and the group registrations (along with any additional registration 3047 parameters) can be looked up using the endpoint lookup interface. 3049 The following example shows a client performing and endpoint lookup 3050 for all groups. 3052 Req: GET /rd-lookup/ep?et=core.rd-group 3054 Res: 2.01 Content 3055 Payload: 3056 ;ep="GRP_R2-4-015";et="core.rd-group"; 3057 base="coap://[ff05::1]", 3058 ;ep=lights&et=core.rd-group; 3059 base="coap://[ff35:30:2001:db8::1]";rt="core.rd-ep" 3061 The following example shows a client performing a lookup of all 3062 resources of all endpoints (groups) with et=core.rd-group. 3064 Req: GET /rd-lookup/res?et=core.rd-group 3066 ;rt="light";if="core.a"; 3067 et="core.rd-group";anchor="coap://[ff35:30:2001:db8::1]", 3068 ;if="core.p";u="K"; 3069 et="core.rd-group"; 3070 anchor="coap://[ff35:30:2001:db8::1]" 3072 Appendix B. Web links and the Resource Directory 3074 Understanding the semantics of a link-format document and its URI 3075 references is a journey through different documents ([RFC3986] 3076 defining URIs, [RFC6690] defining link-format documents based on 3077 [RFC8288] which defines link headers, and [RFC7252] providing the 3078 transport). This appendix summarizes the mechanisms and semantics at 3079 play from an entry in ".well-known/core" to a resource lookup. 3081 This text is primarily aimed at people entering the field of 3082 Constrained Restful Environments from applications that previously 3083 did not use web mechanisms. 3085 The explanation of the steps makes some shortcuts in the more 3086 confusing details of [RFC6690], which are justified as all examples 3087 being in Limited Link Format. 3089 B.1. A simple example 3091 Let's start this example with a very simple host, "2001:db8:f0::1". 3092 A client that follows classical CoAP Discovery ([RFC7252] Section 7), 3093 sends the following multicast request to learn about neighbours 3094 supporting resources with resource-type "temperature". 3096 The client sends a link-local multicast: 3098 GET coap://[ff02::fd]:5683/.well-known/core?rt=temperature 3100 RES 2.05 Content 3101 ;rt=temperature;ct=0 3103 where the response is sent by the server, "[2001:db8:f0::1]:5683". 3105 While the client - on the practical or implementation side - can just 3106 go ahead and create a new request to "[2001:db8:f0::1]:5683" with 3107 Uri-Path: "temp", the full resolution steps for insertion into and 3108 retrieval from the RD without any shortcuts are: 3110 B.1.1. Resolving the URIs 3112 The client parses the single returned record. The link's target 3113 (sometimes called "href") is ""/temp"", which is a relative URI that 3114 needs resolving. The base URI is used to resolve the reference /temp against. 3117 The Base URI of the requested resource can be composed from the 3118 header options of the CoAP GET request by following the steps of 3120 [RFC7252] section 6.5 (with an addition at the end of 8.2) into 3121 ""coap://[2001:db8:f0::1]/.well-known/core"". 3123 Because ""/temp"" starts with a single slash, the record's target is 3124 resolved by replacing the path ""/.well-known/core"" from the Base 3125 URI (section 5.2 [RFC3986]) with the relative target URI ""/temp"" 3126 into ""coap://[2001:db8:f0::1]/temp"". 3128 B.1.2. Interpreting attributes and relations 3130 Some more information but the record's target can be obtained from 3131 the payload: the resource type of the target is "temperature", and 3132 its content type is text/plain (ct=0). 3134 A relation in a web link is a three-part statement that specifies a 3135 named relation between the so-called "context resource" and the 3136 target resource, like "_This page_ has _its table of contents_ at _/ 3137 toc.html_". In link format documents, there is an implicit "host 3138 relation" specified with default parameter: rel="hosts". 3140 In our example, the context resource of the link is the URI specified 3141 in the GET request "coap:://[2001:db8:f0::1]/.well-known/core". A 3142 full English expression of the "host relation" is: 3144 '"coap://[2001:db8:f0::1]/.well-known/core" is hosting the resource 3145 "coap://[2001:db8:f0::1]/temp", which is of the resource type 3146 "temperature" and can be accessed using the text/plain content 3147 format.' 3149 B.2. A slightly more complex example 3151 Omitting the "rt=temperature" filter, the discovery query would have 3152 given some more records in the payload: 3154 GET coap://[ff02::fd]:5683/.well-known/core 3156 RES 2.05 Content 3157 ;rt=temperature;ct=0, 3158 ;rt=light-lux;ct=0, 3159 ;anchor="/sensors/temp";rel=alternate, 3160 ;anchor="/sensors/temp"; 3161 rel="describedby" 3163 Parsing the third record, the client encounters the "anchor" 3164 parameter. It is a URI relative to the Base URI of the request and 3165 is thus resolved to ""coap://[2001:db8:f0::1]/sensors/temp"". That 3166 is the context resource of the link, so the "rel" statement is not 3167 about the target and the Base URI any more, but about the target and 3168 the resolved URI. Thus, the third record could be read as 3169 ""coap://[2001:db8:f0::1]/sensors/temp" has an alternate 3170 representation at "coap://[2001:db8:f0::1]/t"". 3172 Following the same resolution steps, the fourth record can be read as 3173 ""coap://[2001:db8:f0::1]/sensors/temp" is described by 3174 "http://www.example.com/sensors/t123"". 3176 B.3. Enter the Resource Directory 3178 The resource directory tries to carry the semantics obtainable by 3179 classical CoAP discovery over to the resource lookup interface as 3180 faithfully as possible. 3182 For the following queries, we will assume that the simple host has 3183 used Simple Registration to register at the resource directory that 3184 was announced to it, sending this request from its UDP port 3185 "[2001:db8:f0::1]:6553": 3187 POST coap://[2001:db8:f01::ff]/.well-known/core?ep=simple-host1 3189 The resource directory would have accepted the registration, and 3190 queried the simple host's ".well-known/core" by itself. As a result, 3191 the host is registered as an endpoint in the RD with the name 3192 "simple-host1". The registration is active for 90000 seconds, and 3193 the endpoint registration Base URI is ""coap://[2001:db8:f0::1]"" 3194 following the resolution steps described in Appendix B.1.1. It 3195 should be remarked that the Base URI constructed that way always 3196 yields a URI of the form: scheme://authority without path suffix. 3198 If the client now queries the RD as it would previously have issued a 3199 multicast request, it would go through the RD discovery steps by 3200 fetching "coap://[2001:db8:f0::ff]/.well-known/core?rt=core.rd- 3201 lookup-res", obtain "coap://[2001:db8:f0::ff]/rd-lookup/res" as the 3202 resource lookup endpoint, and issue a request to 3203 "coap://[2001:db8:f0::ff]/rd-lookup/res?rt=temperature" to receive 3204 the following data: 3206 ;rt=temperature;ct=0; 3207 anchor="coap://[2001:db8:f0::1]" 3209 This is not _literally_ the same response that it would have received 3210 from a multicast request, but it contains the equivalent statement: 3212 '"coap://[2001:db8:f0::1]" is hosting the resource 3213 "coap://[2001:db8:f0::1]/temp", which is of the resource type 3214 "temperature" and can be accessed using the text/plain content 3215 format.' 3216 (The difference is whether "/" or "/.well-known/core" hosts the 3217 resources, which does not matter in this application; if it did, the 3218 endpoint would have been more explicit. Actually, /.well-known/core 3219 does NOT host the resource but stores a URI reference to the 3220 resource.) 3222 To complete the examples, the client could also query all resources 3223 hosted at the endpoint with the known endpoint name "simple-host1". 3224 A request to "coap://[2001:db8:f0::ff]/rd-lookup/res?ep=simple-host1" 3225 would return 3227 ;rt=temperature;ct=0; 3228 anchor="coap://[2001:db8:f0::1]", 3229 ;rt=light-lux;ct=0; 3230 anchor="coap://[2001:db8:f0::1]", 3231 ; 3232 anchor="coap://[2001:db8:f0::1]/sensors/temp";rel=alternate, 3233 ; 3234 anchor="coap://[2001:db8:f0::1]/sensors/temp";rel="describedby" 3236 All the target and anchor references are already in absolute form 3237 there, which don't need to be resolved any further. 3239 Had the simple host done an equivalent full registration with a base= 3240 parameter (e.g. "?ep=simple-host1&base=coap+tcp://simple- 3241 host1.example.com"), that context would have been used to resolve the 3242 relative anchor values instead, giving 3244 ;rt=temperature;ct=0; 3245 anchor="coap+tcp://simple-host1.example.com" 3247 and analogous records. 3249 B.4. A note on differences between link-format and Link headers 3251 While link-format and Link headers look very similar and are based on 3252 the same model of typed links, there are some differences between 3253 [RFC6690] and [RFC8288], which are dealt with differently: 3255 o "Resolving the target against the anchor": [RFC6690] Section 2.1 3256 states that the anchor of a link is used as the Base URI against 3257 which the term inside the angle brackets (the target) is resolved, 3258 falling back to the resource's URI with paths stripped off (its 3259 "Origin"). In contrast to that, [RFC8288] Section B.2 describes 3260 that the anchor is immaterial to the resolution of the target 3261 reference. 3263 RFC6690, in the same section, also states that absent anchors set 3264 the context of the link to the target's URI with its path stripped 3265 off, while according to [RFC8288] Section 3.2, the context is the 3266 resource's base URI. 3268 The rules introduced in Appendix C ensure that an RD does not need 3269 to deal with those differences when processing input data. Lookup 3270 results are required to be absolute references for the same 3271 reason. 3273 o There is no percent encoding in link-format documents. 3275 A link-format document is a UTF-8 encoded string of Unicode 3276 characters and does not have percent encoding, while Link headers 3277 are practically ASCII strings that use percent encoding for non- 3278 ASCII characters, stating the encoding explicitly when required. 3280 For example, while a Link header in a page about a Swedish city 3281 might read 3283 "Link: ;rel="live-environment-data"" 3285 a link-format document from the same source might describe the 3286 link as 3288 ";rel="live-environment-data"" 3290 Parsers and producers of link-format and header data need to be 3291 aware of this difference. 3293 Appendix C. Limited Link Format 3295 The CoRE Link Format as described in [RFC6690] has been interpreted 3296 differently by implementers, and a strict implementation rules out 3297 some use cases of a Resource Directory (e.g. base values with path 3298 components). 3300 This appendix describes a subset of link format documents called 3301 Limited Link Format. The rules herein are not very limiting in 3302 practice - all examples in RFC6690, and all deployments the authors 3303 are aware of already stick to them - but ease the implementation of 3304 resource directory servers. 3306 It is applicable to representations in the application/link-format 3307 media type, and any other media types that inherit [RFC6690] 3308 Section 2.1. 3310 A link format representation is in Limited Link format if, for each 3311 link in it, the following applies: 3313 o All URI references either follow the URI or the path-absolute ABNF 3314 rule of RFC3986 (i.e. target and anchor each either start with a 3315 scheme or with a single slash), 3317 o if the anchor reference starts with a scheme, the target reference 3318 starts with a scheme as well (i.e. relative references in target 3319 cannot be used when the anchor is a full URI), and 3321 o the application does not care whether links without an explicitly 3322 given anchor have the origin's "/" or "/.well-known/core" resource 3323 as their link context. 3325 Authors' Addresses 3327 Zach Shelby 3328 ARM 3329 150 Rose Orchard 3330 San Jose 95134 3331 USA 3333 Phone: +1-408-203-9434 3334 Email: zach.shelby@arm.com 3336 Michael Koster 3337 SmartThings 3338 665 Clyde Avenue 3339 Mountain View 94043 3340 USA 3342 Phone: +1-707-502-5136 3343 Email: Michael.Koster@smartthings.com 3345 Carsten Bormann 3346 Universitaet Bremen TZI 3347 Postfach 330440 3348 Bremen D-28359 3349 Germany 3351 Phone: +49-421-218-63921 3352 Email: cabo@tzi.org 3353 Peter van der Stok 3354 consultant 3356 Phone: +31-492474673 (Netherlands), +33-966015248 (France) 3357 Email: consultancy@vanderstok.org 3358 URI: www.vanderstok.org 3360 Christian Amsuess (editor) 3361 Hollandstr. 12/4 3362 1020 3363 Austria 3365 Phone: +43-664-9790639 3366 Email: christian@amsuess.com