idnits 2.17.1 draft-ietf-core-resource-directory-23.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 is 1 instance of too long lines in the document, the longest one being 11 characters in excess of 72. == 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 380 has weird spacing: '... target o----...' == Line 382 has weird spacing: '...--o rel o...' == Line 447 has weird spacing: '...o href o----...' == Line 451 has weird spacing: '... o ep o---...' == Line 459 has weird spacing: '... o lt o---...' == (2 more instances...) -- The document date (July 08, 2019) is 1754 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) == 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-08 == Outdated reference: A later version (-46) exists of draft-ietf-ace-oauth-authz-24 -- Obsolete informational reference (is this intentional?): RFC 7230 (Obsoleted by RFC 9110, RFC 9112) Summary: 1 error (**), 0 flaws (~~), 12 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: January 9, 2020 SmartThings 6 C. Bormann 7 Universitaet Bremen TZI 8 P. van der Stok 9 consultant 10 C. Amsuess, Ed. 11 July 08, 2019 13 CoRE Resource Directory 14 draft-ietf-core-resource-directory-23 16 Abstract 18 In many IoT 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 January 9, 2020. 48 Copyright Notice 50 Copyright (c) 2019 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 and zone identifiers . . . . . . . . 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 . . . . . . . . . . . . . . . . 14 75 4. RD discovery and other interface-independent components . . . 14 76 4.1. Finding a Resource Directory . . . . . . . . . . . . . . 15 77 4.1.1. Resource Directory Address Option (RDAO) . . . . . . 17 78 4.2. Payload Content Formats . . . . . . . . . . . . . . . . . 18 79 4.3. URI Discovery . . . . . . . . . . . . . . . . . . . . . . 19 80 5. Registration . . . . . . . . . . . . . . . . . . . . . . . . 21 81 5.1. Simple Registration . . . . . . . . . . . . . . . . . . . 26 82 5.2. Third-party registration . . . . . . . . . . . . . . . . 28 83 5.3. Operations on the Registration Resource . . . . . . . . . 29 84 5.3.1. Registration Update . . . . . . . . . . . . . . . . . 29 85 5.3.2. Registration Removal . . . . . . . . . . . . . . . . 32 86 5.3.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 . . . . . . . . . . . . . . . . . . . 42 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 . . . . . . . . . . . . . . . . . . . . . 44 102 9.1. Resource Types . . . . . . . . . . . . . . . . . . . . . 44 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 . . . . . . . . . . . . . . . . . 48 111 10.1.1. Installation Characteristics . . . . . . . . . . . . 48 112 10.1.2. RD entries . . . . . . . . . . . . . . . . . . . . . 49 113 10.2. OMA Lightweight M2M (LWM2M) Example . . . . . . . . . . 52 114 10.2.1. The LWM2M Object Model . . . . . . . . . . . . . . . 52 115 10.2.2. LWM2M Register Endpoint . . . . . . . . . . . . . . 54 116 10.2.3. LWM2M Update Endpoint Registration . . . . . . . . . 55 117 10.2.4. LWM2M De-Register Endpoint . . . . . . . . . . . . . 56 118 11. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 56 119 12. Changelog . . . . . . . . . . . . . . . . . . . . . . . . . . 56 120 13. References . . . . . . . . . . . . . . . . . . . . . . . . . 66 121 13.1. Normative References . . . . . . . . . . . . . . . . . . 66 122 13.2. Informative References . . . . . . . . . . . . . . . . . 66 123 Appendix A. Groups Registration and Lookup . . . . . . . . . . . 68 124 Appendix B. Web links and the Resource Directory . . . . . . . . 70 125 B.1. A simple example . . . . . . . . . . . . . . . . . . . . 70 126 B.1.1. Resolving the URIs . . . . . . . . . . . . . . . . . 71 127 B.1.2. Interpreting attributes and relations . . . . . . . . 71 128 B.2. A slightly more complex example . . . . . . . . . . . . . 71 129 B.3. Enter the Resource Directory . . . . . . . . . . . . . . 72 130 B.4. A note on differences between link-format and Link 131 headers . . . . . . . . . . . . . . . . . . . . . . . . . 74 132 Appendix C. Limited Link Format . . . . . . . . . . . . . . . . 75 133 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 75 135 1. Introduction 137 In the work on Constrained RESTful Environments (CoRE), a REST 138 architecture suitable for constrained nodes (e.g. with limited RAM 139 and ROM [RFC7228]) and networks (e.g. 6LoWPAN [RFC4944]) has been 140 established and is used in Internet-of-Things (IoT) or machine-to- 141 machine (M2M) applications such as smart energy and building 142 automation. 144 The discovery of resources offered by a constrained server is very 145 important in machine-to-machine applications where there are no 146 humans in the loop and static interfaces result in fragility. The 147 discovery of resources provided by an HTTP Web Server is typically 148 called Web Linking [RFC8288]. The use of Web Linking for the 149 description and discovery of resources hosted by constrained web 150 servers is specified by the CoRE Link Format [RFC6690]. However, 151 [RFC6690] only describes how to discover resources from the web 152 server that hosts them by querying "/.well-known/core". In many 153 constrained scenarios, direct discovery of resources is not practical 154 due to sleeping nodes, disperse networks, or networks where multicast 155 traffic is inefficient. These problems can be solved by employing an 156 entity called a Resource Directory (RD), which contains information 157 about resources held on other servers, allowing lookups to be 158 performed for those resources. 160 This document specifies the web interfaces that a Resource Directory 161 supports for web servers to discover the RD and to register, 162 maintain, lookup and remove information on resources. Furthermore, 163 new target attributes useful in conjunction with a Resource Directory 164 are defined. Although the examples in this document show the use of 165 these interfaces with CoAP [RFC7252], they can be applied in an 166 equivalent manner to HTTP [RFC7230]. 168 2. Terminology 170 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 171 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 172 "OPTIONAL" in this document are to be interpreted as described in 173 [RFC2119]. The term "byte" is used in its now customary sense as a 174 synonym for "octet". 176 This specification requires readers to be familiar with all the terms 177 and concepts that are discussed in [RFC3986], [RFC8288] and 178 [RFC6690]. Readers should also be familiar with the terms and 179 concepts discussed in [RFC7252]. To describe the REST interfaces 180 defined in this specification, the URI Template format is used 181 [RFC6570]. 183 This specification makes use of the following additional terminology: 185 resolve against 186 The expression "a URI-reference is _resolved against_ a base URI" 187 is used to describe the process of [RFC3986] Section 5.2. 188 Noteworthy corner cases are that if the URI-reference is a (full) 189 URI and resolved against any base URI, that gives the original 190 full URI, and that resolving an empty URI reference gives the base 191 URI without any fragment identifier. 193 Resource Directory 194 A web entity that stores information about web resources and 195 implements the REST interfaces defined in this specification for 196 registration and lookup of those resources. 198 Sector 199 In the context of a Resource Directory, a sector is a logical 200 grouping of endpoints. 202 The abbreviation "d=" is used for the sector in query parameters 203 for compatibility with deployed implementations. 205 Endpoint 206 Endpoint (EP) is a term used to describe a web server or client in 207 [RFC7252]. In the context of this specification an endpoint is 208 used to describe a web server that registers resources to the 209 Resource Directory. An endpoint is identified by its endpoint 210 name, which is included during registration, and has a unique name 211 within the associated sector of the registration. 213 Registration Base URI 214 The Base URI of a Registration is a URI that typically gives 215 scheme and authority information about an Endpoint. The 216 Registration Base URI is provided at registration time, and is 217 used by the Resource Directory to resolve relative references of 218 the registration into URIs. 220 Target 221 The target of a link is the destination address (URI) of the link. 222 It is sometimes identified with "href=", or displayed as 223 "". Relative targets need resolving with respect to the 224 Base URI (section 5.2 of [RFC3986]). 226 This use of the term Target is consistent with [RFC8288]'s use of 227 the term. 229 Context 230 The context of a link is the source address (URI) of the link, and 231 describes which resource is linked to the target. A link's 232 context is made explicit in serialized links as the "anchor=" 233 attribute. 235 This use of the term Context is consistent with [RFC8288]'s use of 236 the term. 238 Directory Resource 239 A resource in the Resource Directory (RD) containing registration 240 resources. 242 Registration Resource 243 A resource in the RD that contains information about an Endpoint 244 and its links. 246 Commissioning Tool 247 Commissioning Tool (CT) is a device that assists during the 248 installation of the network by assigning values to parameters, 249 naming endpoints and groups, or adapting the installation to the 250 needs of the applications. 252 Registrant-ep 253 Registrant-ep is the endpoint that is registered into the RD. The 254 registrant-ep can register itself, or a CT registers the 255 registrant-ep. 257 RDAO 258 Resource Directory Address Option. A new IPv6 Neighbor Discovery 259 option defined for announcing a Resource Directory's address. 261 3. Architecture and Use Cases 263 3.1. Principles 265 The Resource Directory is primarily a tool to make discovery 266 operations more efficient than querying /.well-known/core on all 267 connected devices, or across boundaries that would be limiting those 268 operations. 270 It provides information about resources hosted by other devices that 271 could otherwise only be obtained by directly querying the /.well- 272 known/core resource on these other devices, either by a unicast 273 request or a multicast request. 275 Information SHOULD only be stored in the resource directory if it can 276 be obtained by querying the described device's /.well-known/core 277 resource directly. 279 Data in the resource directory can only be provided by the device 280 which hosts those data or a dedicated Commissioning Tool (CT). These 281 CTs are thought to act on behalf of endpoints too constrained, or 282 generally unable, to present that information themselves. No other 283 client can modify data in the resource directory. Changes to the 284 information in the Resource Directory do not propagate automatically 285 back to the web servers from where the information originated. 287 3.2. Architecture 289 The resource directory architecture is illustrated in Figure 1. A 290 Resource Directory (RD) is used as a repository of registrations 291 describing resources hosted on other web servers, also called 292 endpoints (EP). An endpoint is a web server associated with a 293 scheme, IP address and port. A physical node may host one or more 294 endpoints. The RD implements a set of REST interfaces for endpoints 295 to register and maintain resource directory registrations, and for 296 endpoints to lookup resources from the RD. An RD can be logically 297 segmented by the use of Sectors. 299 A mechanism to discover an RD using CoRE Link Format [RFC6690] is 300 defined. 302 Registrations in the RD are soft state and need to be periodically 303 refreshed. 305 An endpoint uses specific interfaces to register, update and remove a 306 registration. It is also possible for an RD to fetch Web Links from 307 endpoints and add their contents to resource directory registrations. 309 At the first registration of an endpoint, a "registration resource" 310 is created, the location of which is returned to the registering 311 endpoint. The registering endpoint uses this registration resource 312 to manage the contents of registrations. 314 A lookup interface for discovering any of the Web Links stored in the 315 RD is provided using the CoRE Link Format. 317 Registration Lookup 318 Interface Interface 319 +----+ | | 320 | EP |---- | | 321 +----+ ---- | | 322 --|- +------+ | 323 +----+ | ----| | | +--------+ 324 | EP | ---------|-----| RD |----|-----| Client | 325 +----+ | ----| | | +--------+ 326 --|- +------+ | 327 +----+ ---- | | 328 | CT |---- | | 329 +----+ 331 Figure 1: The resource directory architecture. 333 A Registrant-EP MAY keep concurrent registrations to more than one RD 334 at the same time if explicitly configured to do so, but that is not 335 expected to be supported by typical EP implementations. Any such 336 registrations are independent of each other. The usual expectation 337 when multiple discovery mechanisms or addresses are configured is 338 that they constitute a fall-back path for a single registration. 340 3.3. RD Content Model 342 The Entity-Relationship (ER) models shown in Figure 2 and Figure 3 343 model the contents of /.well-known/core and the resource directory 344 respectively, with entity-relationship diagrams [ER]. Entities 345 (rectangles) are used for concepts that exist independently. 346 Attributes (ovals) are used for concepts that exist only in 347 connection with a related entity. Relations (diamonds) give a 348 semantic meaning to the relation between entities. Numbers specify 349 the cardinality of the relations. 351 Some of the attribute values are URIs. Those values are always full 352 URIs and never relative references in the information model. They 353 can, however, be expressed as relative references in serializations, 354 and often are. 356 These models provide an abstract view of the information expressed in 357 link-format documents and a Resource Directory. They cover the 358 concepts, but not necessarily all details of an RD's operation; they 359 are meant to give an overview, and not be a template for 360 implementations. 362 +----------------------+ 363 | /.well-known/core | 364 +----------------------+ 365 | 366 | 1 367 ////////\\\\\\\ 368 < contains > 369 \\\\\\\\/////// 370 | 371 | 0+ 372 +--------------------+ 373 | link | 374 +--------------------+ 375 | 376 | 1 oooooooo 377 +-----o target o 378 | oooooooo 379 oooooooooooo 0+ | 380 o target o--------+ 381 o attribute o | 0+ oooooo 382 oooooooooooo +-----o rel o 383 | oooooo 384 | 385 | 1 ooooooooo 386 +-----o context o 387 ooooooooo 389 Figure 2: E-R Model of the content of /.well-known/core 391 The model shown in Figure 2 models the contents of /.well-known/core 392 which contains: 394 o a set of links belonging to the hosting web server 396 The web server is free to choose links it deems appropriate to be 397 exposed in its ".well-known/core". Typically, the links describe 398 resources that are served by the host, but the set can also contain 399 links to resources on other servers (see examples in [RFC6690] page 400 14). The set does not necessarily contain links to all resources 401 served by the host. 403 A link has the following attributes (see [RFC8288]): 405 o Zero or more link relations: They describe relations between the 406 link context and the link target. 408 In link-format serialization, they are expressed as space- 409 separated values in the "rel" attribute, and default to "hosts". 411 o A link context URI: It defines the source of the relation, e.g. 412 _who_ "hosts" something. 414 In link-format serialization, it is expressed in the "anchor" 415 attribute. It defaults to that document's URI. 417 o A link target URI: It defines the destination of the relation 418 (e.g. _what_ is hosted), and is the topic of all target 419 attributes. 421 In link-format serialization, it is expressed between angular 422 brackets, and sometimes called the "href". 424 o Other target attributes (e.g. resource type (rt), interface (if), 425 or content format (ct)). These provide additional information 426 about the target URI. 428 +----------------------+ 429 | resource-directory | 430 +----------------------+ 431 | 1 432 | 433 | 434 | 435 | 436 //////\\\\ 437 < contains > 438 \\\\\///// 439 | 440 0+ | 441 ooooooo 1 +---------------+ 442 o base o-------| registration | 443 ooooooo +---------------+ 444 | | 1 445 | +--------------+ 446 oooooooo 1 | | 447 o href o----+ /////\\\\ 448 oooooooo | < contains > 449 | \\\\\///// 450 oooooooo 1 | | 451 o ep o----+ | 0+ 452 oooooooo | +------------------+ 453 | | link | 454 oooooooo 0-1 | +------------------+ 455 o d o----+ | 456 oooooooo | | 1 oooooooo 457 | +-----o target o 458 oooooooo 1 | | oooooooo 459 o lt o----+ ooooooooooo 0+ | 460 oooooooo | o target o-----+ 461 | o attribute o | 0+ oooooo 462 ooooooooooo 0+ | ooooooooooo +-----o rel o 463 o endpoint o----+ | oooooo 464 o attribute o | 465 ooooooooooo | 1 ooooooooo 466 +----o context o 467 ooooooooo 469 Figure 3: E-R Model of the content of the Resource Directory 471 The model shown in Figure 3 models the contents of the resource 472 directory which contains in addition to /.well-known/core: 474 o 0 to n Registrations of endpoints, 475 A registration is associated with one endpoint. A registration 476 defines a set of links as defined for /.well-known/core. A 477 Registration has six types of attributes: 479 o an endpoint name ("ep", a Unicode string) unique within a sector 481 o a Registration Base URI ("base", a URI typically describing the 482 scheme://authority part) 484 o a lifetime ("lt"), 486 o a registration resource location inside the RD ("href"), 488 o optionally a sector ("d", a Unicode string) 490 o optional additional endpoint attributes (from Section 9.3) 492 The cardinality of "base" is currently 1; future documents are 493 invited to extend the RD specification to support multiple values 494 (e.g. [I-D.silverajan-core-coap-protocol-negotiation]). Its value 495 is used as a Base URI when resolving URIs in the links contained in 496 the endpoint. 498 Links are modelled as they are in Figure 2. 500 3.4. Link-local addresses and zone identifiers 502 Registration Base URIs can contain link-local IP addresses. To be 503 usable across hosts, those can not be serialized to contain zone 504 identifiers (see [RFC6874] Section 1). 506 Link-local addresses can only be used on a single link (therefore RD 507 servers can not announce them when queried on a different link), and 508 lookup clients using them need to keep track of which interface they 509 got them from. 511 Therefore, it is advisable in many scenarios to use addresses with 512 larger scope if available. 514 3.5. Use Case: Cellular M2M 516 Over the last few years, mobile operators around the world have 517 focused on development of M2M solutions in order to expand the 518 business to the new type of users: machines. The machines are 519 connected directly to a mobile network using an appropriate embedded 520 wireless interface (GSM/GPRS, WCDMA, LTE) or via a gateway providing 521 short and wide range wireless interfaces. From the system design 522 point of view, the ambition is to design horizontal solutions that 523 can enable utilization of machines in different applications 524 depending on their current availability and capabilities as well as 525 application requirements, thus avoiding silo like solutions. One of 526 the crucial enablers of such design is the ability to discover 527 resources (machines -- endpoints) capable of providing required 528 information at a given time or acting on instructions from the end 529 users. 531 Imagine a scenario where endpoints installed on vehicles enable 532 tracking of the position of these vehicles for fleet management 533 purposes and allow monitoring of environment parameters. During the 534 boot-up process endpoints register with a Resource Directory, which 535 is hosted by the mobile operator or somewhere in the cloud. 536 Periodically, these endpoints update their registration and may 537 modify resources they offer. 539 When endpoints are not always connected, for example because they 540 enter a sleep mode, a remote server is usually used to provide proxy 541 access to the endpoints. Mobile apps or web applications for 542 environment monitoring contact the RD, look up the endpoints capable 543 of providing information about the environment using an appropriate 544 set of link parameters, obtain information on how to contact them 545 (URLs of the proxy server), and then initiate interaction to obtain 546 information that is finally processed, displayed on the screen and 547 usually stored in a database. Similarly, fleet management systems 548 provide the appropriate link parameters to the RD to look up for EPs 549 deployed on the vehicles the application is responsible for. 551 3.6. Use Case: Home and Building Automation 553 Home and commercial building automation systems can benefit from the 554 use of M2M web services. The discovery requirements of these 555 applications are demanding. Home automation usually relies on run- 556 time discovery to commission the system, whereas in building 557 automation a combination of professional commissioning and run-time 558 discovery is used. Both home and building automation involve peer- 559 to-peer interactions between endpoints, and involve battery-powered 560 sleeping devices. 562 Two phases can be discerned for a network servicing the system: (1) 563 installation and (2) operation. During the operational phase, the 564 network is connected to the Internet with a Border router (6LBR) and 565 the nodes connected to the network can use the Internet services that 566 are provided by the Internet Provider or the network administrator. 567 During the installation phase, the network is completely stand-alone, 568 no 6LBR is connected, and the network only supports the IP 569 communication between the connected nodes. The installation phase is 570 usually followed by the operational phase. 572 3.7. Use Case: Link Catalogues 574 Resources may be shared through data brokers that have no knowledge 575 beforehand of who is going to consume the data. Resource Directory 576 can be used to hold links about resources and services hosted 577 anywhere to make them discoverable by a general class of 578 applications. 580 For example, environmental and weather sensors that generate data for 581 public consumption may provide data to an intermediary server, or 582 broker. Sensor data are published to the intermediary upon changes 583 or at regular intervals. Descriptions of the sensors that resolve to 584 links to sensor data may be published to a Resource Directory. 585 Applications wishing to consume the data can use RD Lookup to 586 discover and resolve links to the desired resources and endpoints. 587 The Resource Directory service need not be coupled with the data 588 intermediary service. Mapping of Resource Directories to data 589 intermediaries may be many-to-many. 591 Metadata in web link formats like [RFC6690] which may be internally 592 stored as triples, or relation/attribute pairs providing metadata 593 about resource links, need to be supported by Resource Directories . 594 External catalogues that are represented in other formats may be 595 converted to common web linking formats for storage and access by 596 Resource Directories. Since it is common practice for these to be 597 URN encoded, simple and lossless structural transforms should 598 generally be sufficient to store external metadata in Resource 599 Directories. 601 The additional features of Resource Directory allow sectors to be 602 defined to enable access to a particular set of resources from 603 particular applications. This provides isolation and protection of 604 sensitive data when needed. Application groups with multicast 605 addresses may be defined to support efficient data transport. 607 4. RD discovery and other interface-independent components 609 This and the following sections define the required set of REST 610 interfaces between a Resource Directory (RD), endpoints and lookup 611 clients. Although the examples throughout these sections assume the 612 use of CoAP [RFC7252], these REST interfaces can also be realized 613 using HTTP [RFC7230]. Only multicast discovery operations are not 614 possible on HTTP, and Simple Registration can not be executed as base 615 attribute (which is mandatory for HTTP) can not be used there. In 616 all definitions in these sections, both CoAP response codes (with dot 617 notation) and HTTP response codes (without dot notation) are shown. 618 An RD implementing this specification MUST support the discovery, 619 registration, update, lookup, and removal interfaces. 621 All operations on the contents of the Resource Directory MUST be 622 atomic and idempotent. 624 For several operations, interface templates are given in list form; 625 those describe the operation participants, request codes, URIs, 626 content formats and outcomes. Sections of those templates contain 627 normative content about Interaction, Method, URI Template and URI 628 Template Variables as well as the details of the Success condition. 629 The additional sections on options like Content-Format and on Failure 630 codes give typical cases that an implementation of the RD should deal 631 with. Those serve to illustrate the typical responses to readers who 632 are not yet familiar with all the details of CoAP based interfaces; 633 they do not limit what a server may respond under atypical 634 circumstances. 636 REST clients (registrant-EPs / CTs, lookup clients, RD servers during 637 simple registrations) MUST be prepared to receive any unsuccessful 638 code and act upon it according to its definition, options and/or 639 payload to the best of their capabilities, falling back to failing 640 the operation if recovery is not possible. In particular, they 641 should retry the request upon 5.03 (Service Unavailable; 503 in HTTP) 642 according to the Max-Age (Retry-After in HTTP) option, and fall back 643 to link-format when receiving 4.15 (Unsupported Content Format; 415 644 in HTTP). 646 A resource directory MAY make the information submitted to it 647 available to further directories, if it can ensure that a loop does 648 not form. The protocol used between directories to ensure loop-free 649 operation is outside the scope of this document. 651 4.1. Finding a Resource Directory 653 A (re-)starting device may want to find one or more resource 654 directories for discovery purposes. Dependent on the operational 655 conditions, one or more of the techniques below apply. The use of 656 DNS-SD [RFC6763] is described in [I-D.ietf-core-rd-dns-sd]. 658 The device may be pre-configured to exercise specific mechanisms for 659 finding the resource directory: 661 1. It may be configured with a specific IP address for the RD. That 662 IP address may also be an anycast address, allowing the network 663 to forward RD requests to an RD that is topologically close; each 664 target network environment in which some of these preconfigured 665 nodes are to be brought up is then configured with a route for 666 this anycast address that leads to an appropriate RD. (Instead 667 of using an anycast address, a multicast address can also be 668 preconfigured. The RD servers then need to configure one of 669 their interfaces with this multicast address.) 671 2. It may be configured with a DNS name for the RD and use DNS to 672 return the IP address of the RD; it can find a DNS server to 673 perform the lookup using the usual mechanisms for finding DNS 674 servers. 676 For cases where the device is not specifically configured with a way 677 to find a resource directory, the network may want to provide a 678 suitable default. 680 1. If the address configuration of the network is performed via 681 SLAAC, this is provided by the RDAO option Section 4.1.1. 683 2. If the address configuration of the network is performed via 684 DHCP, this could be provided via a DHCP option (no such option is 685 defined at the time of writing). 687 Finally, if neither the device nor the network offers any specific 688 configuration, the device may want to employ heuristics to find a 689 suitable resource directory. 691 The present specification does not fully define these heuristics, but 692 suggests a number of candidates: 694 1. In a 6LoWPAN, just assume the Border Router (6LBR) can act as a 695 resource directory (using the ABRO option to find that 696 [RFC6775]). Confirmation can be obtained by sending a Unicast to 697 "coap://[6LBR]/.well-known/core?rt=core.rd*". 699 2. In a network that supports multicast well, discovering the RD 700 using a multicast query for /.well-known/core as specified in 701 CoRE Link Format [RFC6690]: Sending a Multicast GET to 702 "coap://[MCD1]/.well-known/core?rt=core.rd*". RDs within the 703 multicast scope will answer the query. 705 When answering a multicast request directed at a link-local address, 706 the RD may want to respond from a routable address; this makes it 707 easier for registrants to use one of their own routable addresses for 708 registration. 710 As some of the RD addresses obtained by the methods listed here are 711 just (more or less educated) guesses, endpoints MUST make use of any 712 error messages to very strictly rate-limit requests to candidate IP 713 addresses that don't work out. For example, an ICMP Destination 714 Unreachable message (and, in particular, the port unreachable code 715 for this message) may indicate the lack of a CoAP server on the 716 candidate host, or a CoAP error response code such as 4.05 "Method 717 Not Allowed" may indicate unwillingness of a CoAP server to act as a 718 directory server. 720 The following RD discovery mechanisms are recommended: 722 o In managed networks with border routers that need stand-alone 723 operation, the RDAO option is recommended (e.g. operational phase 724 described in Section 3.6). 726 o In managed networks without border router (no Internet services 727 available), the use of a preconfigured anycast address is 728 recommended (e.g. installation phase described in Section 3.6). 730 o The use of DNS facilities is described in 731 [I-D.ietf-core-rd-dns-sd]. 733 The use of multicast discovery in mesh networks is NOT recommended. 735 4.1.1. Resource Directory Address Option (RDAO) 737 The Resource Directory Address Option (RDAO) using IPv6 Neighbor 738 Discovery (ND) carries information about the address of the Resource 739 Directory (RD). This information is needed when endpoints cannot 740 discover the Resource Directory with a link-local or realm-local 741 scope multicast address, for instance because the endpoint and the RD 742 are separated by a Border Router (6LBR). In many circumstances the 743 availability of DHCP cannot be guaranteed either during commissioning 744 of the network. The presence and the use of the RD is essential 745 during commissioning. 747 It is possible to send multiple RDAO options in one message, 748 indicating as many resource directory addresses. 750 The RDAO format is: 752 0 1 2 3 753 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 754 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 755 | Type | Length = 3 | Valid Lifetime | 756 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 757 | Reserved | 758 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 759 | | 760 + + 761 | | 762 + RD Address + 763 | | 764 + + 765 | | 766 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 768 Fields: 770 Type: 38 772 Length: 8-bit unsigned integer. The length of 773 the option in units of 8 bytes. 774 Always 3. 776 Valid Lifetime: 16-bit unsigned integer. The length of 777 time in units of 60 seconds (relative to 778 the time the packet is received) that 779 this Resource Directory address is valid. 780 A value of all zero bits (0x0) indicates 781 that this Resource Directory address 782 is not valid anymore. 784 Reserved: This field is unused. It MUST be 785 initialized to zero by the sender and 786 MUST be ignored by the receiver. 788 RD Address: IPv6 address of the RD. 790 Figure 4: Resource Directory Address Option 792 4.2. Payload Content Formats 794 Resource Directory implementations using this specification MUST 795 support the application/link-format content format (ct=40). 797 Resource Directories implementing this specification MAY support 798 additional content formats. 800 Any additional content format supported by a Resource Directory 801 implementing this specification SHOULD be able to express all the 802 information expressible in link-format. It MAY be able to express 803 information that is inexpressible in link-format, but those 804 expressions SHOULD be avoided where possible. 806 4.3. URI Discovery 808 Before an endpoint can make use of an RD, it must first know the RD's 809 address and port, and the URI path information for its REST APIs. 810 This section defines discovery of the RD and its URIs using the well- 811 known interface of the CoRE Link Format [RFC6690]. A complete set of 812 RD discovery methods is described in Section 4.1. 814 Discovery of the RD registration URI path is performed by sending 815 either a multicast or unicast GET request to "/.well-known/core" and 816 including a Resource Type (rt) parameter [RFC6690] with the value 817 "core.rd" in the query string. Likewise, a Resource Type parameter 818 value of "core.rd-lookup*" is used to discover the URIs for RD Lookup 819 operations, core.rd* is used to discover all URI paths for RD 820 operations. Upon success, the response will contain a payload with a 821 link format entry for each RD function discovered, indicating the URI 822 of the RD function returned and the corresponding Resource Type. 823 When performing multicast discovery, the multicast IP address used 824 will depend on the scope required and the multicast capabilities of 825 the network (see Section 9.5). 827 A Resource Directory MAY provide hints about the content-formats it 828 supports in the links it exposes or registers, using the "ct" target 829 attribute, as shown in the example below. Clients MAY use these 830 hints to select alternate content-formats for interaction with the 831 Resource Directory. 833 HTTP does not support multicast and consequently only unicast 834 discovery can be supported using HTTP. The well-known entry points 835 SHOULD be provided to enable unicast discovery. 837 An implementation of this resource directory specification MUST 838 support query filtering for the rt parameter as defined in [RFC6690]. 840 While the link targets in this discovery step are often expressed in 841 path-absolute form, this is not a requirement. Clients of the RD 842 SHOULD therefore accept URIs of all schemes they support, both as 843 URIs and relative references, and not limit the set of discovered 844 URIs to those hosted at the address used for URI discovery. 846 The URI Discovery operation can yield multiple URIs of a given 847 resource type. The client of the RD can use any of the discovered 848 addresses initially. 850 The discovery request interface is specified as follows (this is 851 exactly the Well-Known Interface of [RFC6690] Section 4, with the 852 additional requirement that the server MUST support query filtering): 854 Interaction: EP and Client -> RD 856 Method: GET 858 URI Template: /.well-known/core{?rt} 860 URI Template Variables: 862 rt := Resource Type. SHOULD contain one of the values "core.rd", 863 "core.rd-lookup*", "core.rd-lookup-res", "core.rd-lookup-ep", 864 or "core.rd*" 866 Accept: absent, application/link-format or any other media type 867 representing web links 869 The following response is expected on this interface: 871 Success: 2.05 "Content" or 200 "OK" with an application/link-format 872 or other web link payload containing one or more matching entries 873 for the RD resource. 875 The following example shows an endpoint discovering an RD using this 876 interface, thus learning that the directory resource location, in 877 this example, is /rd, and that the content-format delivered by the 878 server hosting the resource is application/link-format (ct=40). Note 879 that it is up to the RD to choose its RD locations. 881 Req: GET coap://[MCD1]/.well-known/core?rt=core.rd* 883 Res: 2.05 Content 884 ;rt="core.rd";ct=40, 885 ;rt="core.rd-lookup-ep";ct=40, 886 ;rt="core.rd-lookup-res";ct=40, 888 Figure 5: Example discovery exchange 890 The following example shows the way of indicating that a client may 891 request alternate content-formats. The Content-Format code attribute 892 "ct" MAY include a space-separated sequence of Content-Format codes 893 as specified in Section 7.2.1 of [RFC7252], indicating that multiple 894 content-formats are available. The example below shows the required 895 Content-Format 40 (application/link-format) indicated as well as a 896 CBOR and JSON representation from [I-D.ietf-core-links-json] (which 897 have no numeric values assigned yet, so they are shown as TBD64 and 898 TBD504 as in that draft). The RD resource locations /rd, and /rd- 899 lookup are example values. The server in this example also indicates 900 that it is capable of providing observation on resource lookups. 902 Req: GET coap://[MCD1]/.well-known/core?rt=core.rd* 904 Res: 2.05 Content 905 ;rt="core.rd";ct="40 65225", 906 ;rt="core.rd-lookup-res";ct="40 TBD64 TBD504";obs, 907 ;rt="core.rd-lookup-ep";ct="40 TBD64 TBD504", 909 Figure 6: Example discovery exchange indicating additional content- 910 formats 912 From a management and maintenance perspective, it is necessary to 913 identify the components that constitute the RD server. The 914 identification refers to information about for example client-server 915 incompatibilities, supported features, required updates and other 916 aspects. The URI discovery address, a described in section 4 of 917 [RFC6690] can be used to find the identification. 919 It would typically be stored in an implementation information link 920 (as described in [I-D.bormann-t2trg-rel-impl]): 922 Req: GET /.well-known/core?rel=impl-info 924 Res: 2.05 Content 925 ; 926 rel="impl-info" 928 Figure 7: Example exchange of obtaining implementation information 930 Note that depending on the particular server's architecture, such a 931 link could be anchored at the RD server's root, at the discovery site 932 (as in this example) or at individual RD components. The latter is 933 to be expected when different applications are run on the same 934 server. 936 5. Registration 938 After discovering the location of an RD, a registrant-ep or CT MAY 939 register the resources of the registrant-ep using the registration 940 interface. This interface accepts a POST from an endpoint containing 941 the list of resources to be added to the directory as the message 942 payload in the CoRE Link Format [RFC6690] or other representations of 943 web links, along with query parameters indicating the name of the 944 endpoint, and optionally the sector, lifetime and base URI of the 945 registration. It is expected that other specifications will define 946 further parameters (see Section 9.3). The RD then creates a new 947 registration resource in the RD and returns its location. The 948 receiving endpoint MUST use that location when refreshing 949 registrations using this interface. Registration resources in the RD 950 are kept active for the period indicated by the lifetime parameter. 951 The creating endpoint is responsible for refreshing the registration 952 resource within this period using either the registration or update 953 interface. The registration interface MUST be implemented to be 954 idempotent, so that registering twice with the same endpoint 955 parameters ep and d (sector) does not create multiple registration 956 resources. 958 The following rules apply for a registration request targeting a 959 given (ep, d) value pair: 961 o When the (ep, d) value pair of the registration-request is 962 different from any existing registration, a new registration is 963 generated. 965 o When the (ep, d) value pair of the registration-request is equal 966 to an existing registration, the content and parameters of the 967 existing registration are replaced with the content of the 968 registration request. 970 The posted link-format document can (and typically does) contain 971 relative references both in its link targets and in its anchors, or 972 contain empty anchors. The RD server needs to resolve these 973 references in order to faithfully represent them in lookups. They 974 are resolved against the base URI of the registration, which is 975 provided either explicitly in the "base" parameter or constructed 976 implicitly from the requester's URI as constructed from its network 977 address and scheme. 979 For media types to which Appendix C applies (i.e. documents in 980 application/link-format), the RD only needs to accept representations 981 in Limited Link Format as described there. Its behavior with 982 representations outside that subset is implementation defined. 984 The registration request interface is specified as follows: 986 Interaction: EP -> RD 988 Method: POST 989 URI Template: {+rd}{?ep,d,lt,base,extra-attrs*} 991 URI Template Variables: 993 rd := RD registration URI (mandatory). This is the location of 994 the RD, as obtained from discovery. 996 ep := Endpoint name (mostly mandatory). The endpoint name is an 997 identifier that MUST be unique within a sector. As the 998 endpoint name is a Unicode string, it is encoded in UTF-8 (and 999 possibly pct-encoding) during variable expansion (see [RFC6570] 1000 Section 3.2.1). The endpoint name MUST NOT contain any 1001 character in the inclusive ranges 0-31 or 127-159. The maximum 1002 length of this parameter is 63 UTF-8 encoded bytes. If the RD 1003 is configured to recognize the endpoint (e.g. based on its 1004 security context), the RD assigns an endpoint name based on a 1005 set of configuration parameter values. 1007 d := Sector (optional). The sector to which this endpoint 1008 belongs. When this parameter is not present, the RD MAY 1009 associate the endpoint with a configured default sector or 1010 leave it empty. The sector is encoded like the ep parameter, 1011 and is limited to 63 UTF-8 encoded bytes as well. The endpoint 1012 name and sector name are not set when one or both are set in an 1013 accompanying authorization token. 1015 lt := Lifetime (optional). Lifetime of the registration in 1016 seconds. Range of 60-4294967295. If no lifetime is included 1017 in the initial registration, a default value of 90000 (25 1018 hours) SHOULD be assumed. 1020 base := Base URI (optional). This parameter sets the base URI of 1021 the registration, under which the relative links in the payload 1022 are to be interpreted. The specified URI typically does not 1023 have a path component of its own, and MUST be suitable as a 1024 base URI to resolve any relative references given in the 1025 registration. The parameter is therefore usually of the shape 1026 "scheme://authority" for HTTP and CoAP URIs. The URI SHOULD 1027 NOT have a query or fragment component as any non-empty 1028 relative part in a reference would remove those parts from the 1029 resulting URI. 1031 In the absence of this parameter the scheme of the protocol, 1032 source address and source port of the registration request are 1033 assumed. The Base URI is consecutively constructed by 1034 concatenating the used protocol's scheme with the characters 1035 "://", the requester's source address as an address literal and 1036 ":" followed by its port (if it was not the protocol's default 1037 one) in analogy to [RFC7252] Section 6.5. 1039 This parameter is mandatory when the directory is filled by a 1040 third party such as an commissioning tool. 1042 If the registrant-ep uses an ephemeral port to register with, 1043 it MUST include the base parameter in the registration to 1044 provide a valid network path. 1046 A registrant that can not be reached by potential lookup 1047 clients at the address it registers from (e.g. because it is 1048 behind some form of Network Address Translation (NAT)) MUST 1049 provide a reachable base address with its registration. 1051 If the Base URI contains a link-local IP literal, it MUST NOT 1052 contain a Zone Identifier, and MUST be local to the link on 1053 which the registration request is received. 1055 Endpoints that register with a base that contains a path 1056 component can not meaningfully use [RFC6690] Link Format due to 1057 its prevalence of the Origin concept in relative reference 1058 resolution. Those applications should use different 1059 representations of links to which Appendix C is not applicable 1060 (e.g. [I-D.hartke-t2trg-coral]). 1062 extra-attrs := Additional registration attributes (optional). 1063 The endpoint can pass any parameter registered at Section 9.3 1064 to the directory. If the RD is aware of the parameter's 1065 specified semantics, it processes it accordingly. Otherwise, 1066 it MUST store the unknown key and its value(s) as an endpoint 1067 attribute for further lookup. 1069 Content-Format: application/link-format or any other indicated media 1070 type representing web links 1072 The following response is expected on this interface: 1074 Success: 2.01 "Created" or 201 "Created". The Location-Path option 1075 or Location header MUST be included in the response. This 1076 location MUST be a stable identifier generated by the RD as it is 1077 used for all subsequent operations on this registration resource. 1078 The registration resource location thus returned is for the 1079 purpose of updating the lifetime of the registration and for 1080 maintaining the content of the registered links, including 1081 updating and deleting links. 1083 A registration with an already registered ep and d value pair 1084 responds with the same success code and location as the original 1085 registration; the set of links registered with the endpoint is 1086 replaced with the links from the payload. 1088 The location MUST NOT have a query or fragment component, as that 1089 could conflict with query parameters during the Registration 1090 Update operation. Therefore, the Location-Query option MUST NOT 1091 be present in a successful response. 1093 If the registration fails, including request timeouts, or if delays 1094 from Service Unavailable responses with Max-Age or Retry-After 1095 accumulate to exceed the registrant's configured timeouts, it SHOULD 1096 pick another registration URI from the "URI Discovery" step and if 1097 there is only one or the list is exhausted, pick other choices from 1098 the "Finding a Resource Directory" step. Care has to be taken to 1099 consider the freshness of results obtained earlier, e.g. of the 1100 result of a "/.well-known/core" response, the lifetime of an RDAO 1101 option and of DNS responses. Any rate limits and persistent errors 1102 from the "Finding a Resource Directory" step must be considered for 1103 the whole registration time, not only for a single operation. 1105 The following example shows a registrant-ep with the name "node1" 1106 registering two resources to an RD using this interface. The 1107 location "/rd" is an example RD location discovered in a request 1108 similar to Figure 5. 1110 Req: POST coap://rd.example.com/rd?ep=node1 1111 Content-Format: 40 1112 Payload: 1113 ;ct=41;rt="temperature-c";if="sensor", 1114 ; 1115 anchor="/sensors/temp";rel="describedby" 1117 Res: 2.01 Created 1118 Location-Path: /rd/4521 1120 Figure 8: Example registration payload 1122 A Resource Directory may optionally support HTTP. Here is an example 1123 of almost the same registration operation above, when done using 1124 HTTP. 1126 Req: POST /rd?ep=node1&base=http://[2001:db8:1::1] HTTP/1.1 1127 Host: example.com 1128 Content-Type: application/link-format 1129 Payload: 1130 ;ct=41;rt="temperature-c";if="sensor", 1131 ; 1132 anchor="/sensors/temp";rel="describedby" 1134 Res: 201 Created 1135 Location: /rd/4521 1137 Figure 9: Example registration payload as expressed using HTTP 1139 5.1. Simple Registration 1141 Not all endpoints hosting resources are expected to know how to 1142 upload links to an RD as described in Section 5. Instead, simple 1143 endpoints can implement the Simple Registration approach described in 1144 this section. An RD implementing this specification MUST implement 1145 Simple Registration. However, there may be security reasons why this 1146 form of directory discovery would be disabled. 1148 This approach requires that the registrant-ep makes available the 1149 hosted resources that it wants to be discovered, as links on its 1150 "/.well-known/core" interface as specified in [RFC6690]. The links 1151 in that document are subject to the same limitations as the payload 1152 of a registration (with respect to Appendix C). 1154 o The registrant-ep finds one or more addresses of the directory 1155 server as described in Section 4.1. 1157 o The registrant-ep sends (and regularly refreshes with) a POST 1158 request to the "/.well-known/core" URI of the directory server of 1159 choice. The body of the POST request is empty, and triggers the 1160 resource directory server to perform GET requests at the 1161 requesting registrant-ep's /.well-known/core to obtain the link- 1162 format payload to register. 1164 The registrant-ep includes the same registration parameters in the 1165 POST request as it would per Section 5. The registration base URI 1166 of the registration is taken from the registrant-ep's network 1167 address (as is default with regular registrations). 1169 Example request from registrant-EP to RD (unanswered until the 1170 next step): 1172 Req: POST /.well-known/core?lt=6000&ep=node1 1173 (No payload) 1175 Figure 10: First half example exchange of a simple registration 1177 o The Resource Directory queries the registrant-ep's discovery 1178 resource to determine the success of the operation. It SHOULD 1179 keep a cache of the discovery resource and not query it again as 1180 long as it is fresh. 1182 Example request from the RD to the registrant-EP: 1184 Req: GET /.well-known/core 1185 Accept: 40 1187 Res: 2.05 Content 1188 Content-Format: 40 1189 Payload: 1190 1192 Figure 11: Example exchange of the RD querying the simple endpoint 1194 With this response, the RD would answer the previous step's request: 1196 Res: 2.04 Changed 1198 Figure 12: Second half example exchange of a simple registration 1200 The sequence of fetching the registration content before sending a 1201 successful response was chosen to make responses reliable, and the 1202 caching item was chosen to still allow very constrained registrants. 1203 Registrants MUST be able to serve a GET request to "/.well-known/ 1204 core" after having requested registration. Constrained devices MAY 1205 regard the initial request as temporarily failed when they need RAM 1206 occupied by their own request to serve the RD's GET, and retry later 1207 when the RD already has a cached representation of their discovery 1208 resources. Then, the RD can reply immediately and the registrant can 1209 receive the response. 1211 The simple registration request interface is specified as follows: 1213 Interaction: EP -> RD 1215 Method: POST 1217 URI Template: /.well-known/core{?ep,d,lt,extra-attrs*} 1218 URI Template Variables are as they are for registration in Section 5. 1219 The base attribute is not accepted to keep the registration interface 1220 simple; that rules out registration over CoAP-over-TCP or HTTP that 1221 would need to specify one. 1223 The following response is expected on this interface: 1225 Success: 2.04 "Changed". 1227 For the second interaction triggered by the above, the registrant-ep 1228 takes the role of server and the RD the role of client. (Note that 1229 this is exactly the Well-Known Interface of [RFC6690] Section 4): 1231 Interaction: RD -> EP 1233 Method: GET 1235 URI Template: /.well-known/core 1237 The following response is expected on this interface: 1239 Success: 2.05 "Content". 1241 The RD MUST delete registrations created by simple registration after 1242 the expiration of their lifetime. Additional operations on the 1243 registration resource cannot be executed because no registration 1244 location is returned. 1246 5.2. Third-party registration 1248 For some applications, even Simple Registration may be too taxing for 1249 some very constrained devices, in particular if the security 1250 requirements become too onerous. 1252 In a controlled environment (e.g. building control), the Resource 1253 Directory can be filled by a third party device, called a 1254 Commissioning Tool (CT). The commissioning tool can fill the 1255 Resource Directory from a database or other means. For that purpose 1256 scheme, IP address and port of the URI of the registered device is 1257 the value of the "base" parameter of the registration described in 1258 Section 5. 1260 It should be noted that the value of the "base" parameter applies to 1261 all the links of the registration and has consequences for the anchor 1262 value of the individual links as exemplified in Appendix B. An 1263 eventual (currently non-existing) "base" attribute of the link is not 1264 affected by the value of "base" parameter in the registration. 1266 5.3. Operations on the Registration Resource 1268 This section describes how the registering endpoint can maintain the 1269 registrations that it created. The registering endpoint can be the 1270 registrant-ep or the CT. An endpoint SHOULD NOT use this interface 1271 for registrations that it did not create. The registrations are 1272 resources of the RD. 1274 After the initial registration, the registering endpoint retains the 1275 returned location of the Registration Resource for further 1276 operations, including refreshing the registration in order to extend 1277 the lifetime and "keep-alive" the registration. When the lifetime of 1278 the registration has expired, the RD SHOULD NOT respond to discovery 1279 queries concerning this endpoint. The RD SHOULD continue to provide 1280 access to the Registration Resource after a registration time-out 1281 occurs in order to enable the registering endpoint to eventually 1282 refresh the registration. The RD MAY eventually remove the 1283 registration resource for the purpose of garbage collection. If the 1284 Registration Resource is removed, the corresponding endpoint will 1285 need to be re-registered. 1287 The Registration Resource may also be used cancel the registration 1288 using DELETE, and to perform further operations beyond the scope of 1289 this specification. 1291 These operations are described below. 1293 5.3.1. Registration Update 1295 The update interface is used by the registering endpoint to refresh 1296 or update its registration with an RD. To use the interface, the 1297 registering endpoint sends a POST request to the registration 1298 resource returned by the initial registration operation. 1300 An update MAY update the lifetime or the base URI registration 1301 parameters "lt", "base" as in Section 5. Parameters that are not 1302 being changed SHOULD NOT be included in an update. Adding parameters 1303 that have not changed increases the size of the message but does not 1304 have any other implications. Parameters MUST be included as query 1305 parameters in an update operation as in Section 5. 1307 A registration update resets the timeout of the registration to the 1308 (possibly updated) lifetime of the registration, independent of 1309 whether a "lt" parameter was given. 1311 If the base URI of the registration is changed in an update, relative 1312 references submitted in the original registration or later updates 1313 are resolved anew against the new base. 1315 The registration update operation only describes the use of POST with 1316 an empty payload. Future standards might describe the semantics of 1317 using content formats and payloads with the POST method to update the 1318 links of a registration (see Section 5.3.3). 1320 The update registration request interface is specified as follows: 1322 Interaction: EP -> RD 1324 Method: POST 1326 URI Template: {+location}{?lt,base,extra-attrs*} 1328 URI Template Variables: 1330 location := This is the Location returned by the RD as a result 1331 of a successful earlier registration. 1333 lt := Lifetime (optional). Lifetime of the registration in 1334 seconds. Range of 60-4294967295. If no lifetime is included, 1335 the previous last lifetime set on a previous update or the 1336 original registration (falling back to 90000) SHOULD be used. 1338 base := Base URI (optional). This parameter updates the Base URI 1339 established in the original registration to a new value. If 1340 the parameter is set in an update, it is stored by the RD as 1341 the new Base URI under which to interpret the relative links 1342 present in the payload of the original registration, following 1343 the same restrictions as in the registration. If the parameter 1344 is not set in the request but was set before, the previous Base 1345 URI value is kept unmodified. If the parameter is not set in 1346 the request and was not set before either, the source address 1347 and source port of the update request are stored as the Base 1348 URI. 1350 extra-attrs := Additional registration attributes (optional). As 1351 with the registration, the RD processes them if it knows their 1352 semantics. Otherwise, unknown attributes are stored as 1353 endpoint attributes, overriding any previously stored endpoint 1354 attributes of the same key. 1356 Note that this default behavior does not allow removing an 1357 endpoint attribute in an update. For attributes whose 1358 functionality depends on the endpoints' ability to remove them 1359 in an update, it can make sense to define a value whose 1360 presence is equivalent to the absence of a value. As an 1361 alternative, an extension can define different updating rules 1362 for their attributes. That necessitates either discovery of 1363 whether the RD is aware of that extension, or tolerating the 1364 default behavior. 1366 Content-Format: none (no payload) 1368 The following responses are expected on this interface: 1370 Success: 2.04 "Changed" or 204 "No Content" if the update was 1371 successfully processed. 1373 Failure: 4.04 "Not Found" or 404 "Not Found". Registration does not 1374 exist (e.g. may have been removed). 1376 If the registration fails in any way, including "Not Found" and 1377 request timeouts, or if the time indicated in a Service Unabailable 1378 Max-Age/Retry-After exceeds the remaining lifetime, the registering 1379 endpoint SHOULD attempt registration again. 1381 The following example shows how the registering endpoint updates its 1382 registration resource at an RD using this interface with the example 1383 location value: /rd/4521. 1385 Req: POST /rd/4521 1387 Res: 2.04 Changed 1389 Figure 13: Example update of a registration 1391 The following example shows the registering endpoint updating its 1392 registration resource at an RD using this interface with the example 1393 location value: /rd/4521. The initial registration by the 1394 registering endpoint set the following values: 1396 o endpoint name (ep)=endpoint1 1398 o lifetime (lt)=500 1400 o Base URI (base)=coap://local-proxy-old.example.com:5683 1402 o payload of Figure 8 1404 The initial state of the Resource Directory is reflected in the 1405 following request: 1407 Req: GET /rd-lookup/res?ep=endpoint1 1409 Res: 2.01 Content 1410 Payload: 1411 ;ct=41; 1412 rt="temperature-c";if="sensor"; 1413 anchor="coap://local-proxy-old.example.com:5683/", 1414 ; 1415 anchor="coap://local-proxy-old.example.com:5683/sensors/temp";rel="describedby" 1417 Figure 14: Example lookup before a change to the base address 1419 The following example shows the registering endpoint changing the 1420 Base URI to "coaps://new.example.com:5684": 1422 Req: POST /rd/4521?base=coaps://new.example.com:5684 1424 Res: 2.04 Changed 1426 Figure 15: Example registration update that changes the base address 1428 The consecutive query returns: 1430 Req: GET /rd-lookup/res?ep=endpoint1 1432 Res: 2.01 Content 1433 Payload: 1434 ;ct=41; 1435 rt="temperature-c";if="sensor"; 1436 anchor="coap://new.example.com:5684/", 1437 ; 1438 anchor="coap://new.example.com:5684/sensors/temp";rel="describedby" 1440 Figure 16: Example lookup after a change to the base address 1442 5.3.2. Registration Removal 1444 Although RD registrations have soft state and will eventually timeout 1445 after their lifetime, the registering endpoint SHOULD explicitly 1446 remove an entry from the RD if it knows it will no longer be 1447 available (for example on shut-down). This is accomplished using a 1448 removal interface on the RD by performing a DELETE on the endpoint 1449 resource. 1451 The removal request interface is specified as follows: 1453 Interaction: EP -> RD 1454 Method: DELETE 1456 URI Template: {+location} 1458 URI Template Variables: 1460 location := This is the Location returned by the RD as a result 1461 of a successful earlier registration. 1463 The following responses are expected on this interface: 1465 Success: 2.02 "Deleted" or 204 "No Content" upon successful deletion 1467 Failure: 4.04 "Not Found" or 404 "Not Found". Registration does not 1468 exist (e.g. may already have been removed). 1470 The following examples shows successful removal of the endpoint from 1471 the RD with example location value /rd/4521. 1473 Req: DELETE /rd/4521 1475 Res: 2.02 Deleted 1477 Figure 17: Example of a registration removal 1479 5.3.3. Further operations 1481 Additional operations on the registration can be specified in future 1482 documents, for example: 1484 o Send iPATCH (or PATCH) updates ([RFC8132]) to add, remove or 1485 change the links of a registration. 1487 o Use GET to read the currently stored set of links in a 1488 registration resource. 1490 Those operations are out of scope of this document, and will require 1491 media types suitable for modifying sets of links. 1493 6. RD Lookup 1495 To discover the resources registered with the RD, a lookup interface 1496 must be provided. This lookup interface is defined as a default, and 1497 it is assumed that RDs may also support lookups to return resource 1498 descriptions in alternative formats (e.g. JSON or CBOR link format 1499 [I-D.ietf-core-links-json]) or using more advanced interfaces (e.g. 1500 supporting context or semantic based lookup) on different resources 1501 that are discovered independently. 1503 RD Lookup allows lookups for endpoints and resources using attributes 1504 defined in this document and for use with the CoRE Link Format. The 1505 result of a lookup request is the list of links (if any) 1506 corresponding to the type of lookup. Thus, an endpoint lookup MUST 1507 return a list of endpoints and a resource lookup MUST return a list 1508 of links to resources. 1510 The lookup type is selected by a URI endpoint, which is indicated by 1511 a Resource Type as per Table 1 below: 1513 +-------------+--------------------+-----------+ 1514 | Lookup Type | Resource Type | Mandatory | 1515 +-------------+--------------------+-----------+ 1516 | Resource | core.rd-lookup-res | Mandatory | 1517 | Endpoint | core.rd-lookup-ep | Mandatory | 1518 +-------------+--------------------+-----------+ 1520 Table 1: Lookup Types 1522 6.1. Resource lookup 1524 Resource lookup results in links that are semantically equivalent to 1525 the links submitted to the RD. The links and link parameters 1526 returned by the lookup are equal to the submitted ones, except that 1527 the target and anchor references are fully resolved. 1529 Links that did not have an anchor attribute are therefore returned 1530 with the base URI of the registration as the anchor. Links of which 1531 href or anchor was submitted as a (full) URI are returned with these 1532 attributes unmodified. 1534 Above rules allow the client to interpret the response as links 1535 without any further knowledge of the storage conventions of the RD. 1536 The Resource Directory MAY replace the registration base URIs with a 1537 configured intermediate proxy, e.g. in the case of an HTTP lookup 1538 interface for CoAP endpoints. 1540 If the base URI of a registration contains a link-local address, the 1541 RD MUST NOT show its links unless the lookup was made from the same 1542 link. The RD MUST NOT include zone identifiers in the resolved URIs. 1544 6.2. Lookup filtering 1546 Using the Accept Option, the requester can control whether the 1547 returned list is returned in CoRE Link Format ("application/link- 1548 format", default) or in alternate content-formats (e.g. from 1549 [I-D.ietf-core-links-json]). 1551 The page and count parameters are used to obtain lookup results in 1552 specified increments using pagination, where count specifies how many 1553 links to return and page specifies which subset of links organized in 1554 sequential pages, each containing 'count' links, starting with link 1555 zero and page zero. Thus, specifying count of 10 and page of 0 will 1556 return the first 10 links in the result set (links 0-9). Count = 10 1557 and page = 1 will return the next 'page' containing links 10-19, and 1558 so on. 1560 Multiple search criteria MAY be included in a lookup. All included 1561 criteria MUST match for a link to be returned. The Resource 1562 Directory MUST support matching with multiple search criteria. 1564 A link matches a search criterion if it has an attribute of the same 1565 name and the same value, allowing for a trailing "*" wildcard 1566 operator as in Section 4.1 of [RFC6690]. Attributes that are defined 1567 as "link-type" match if the search value matches any of their values 1568 (see Section 4.1 of [RFC6690]; e.g. "?if=core.s" matches ";if="abc 1569 core.s";"). A resource link also matches a search criterion if its 1570 endpoint would match the criterion, and vice versa, an endpoint link 1571 matches a search criterion if any of its resource links matches it. 1573 Note that "href" is a valid search criterion and matches target 1574 references. Like all search criteria, on a resource lookup it can 1575 match the target reference of the resource link itself, but also the 1576 registration resource of the endpoint that registered it. Queries 1577 for resource link targets MUST be in URI form (i.e. not relative 1578 references) and are matched against a resolved link target. Queries 1579 for endpoints SHOULD be expressed in path-absolute form if possible 1580 and MUST be expressed in URI form otherwise; the RD SHOULD recognize 1581 either. 1583 Endpoints that are interested in a lookup result repeatedly or 1584 continuously can use mechanisms like ETag caching, resource 1585 observation ([RFC7641]), or any future mechanism that might allow 1586 more efficient observations of collections. These are advertised, 1587 detected and used according to their own specifications and can be 1588 used with the lookup interface as with any other resource. 1590 When resource observation is used, every time the set of matching 1591 links changes, or the content of a matching link changes, the RD 1592 sends a notification with the matching link set. The notification 1593 contains the successful current response to the given request, 1594 especially with respect to representing zero matching links (see 1595 "Success" item below). 1597 The lookup interface is specified as follows: 1599 Interaction: Client -> RD 1601 Method: GET 1603 URI Template: {+type-lookup-location}{?page,count,search*} 1605 URI Template Variables: 1607 type-lookup-location := RD Lookup URI for a given lookup type 1608 (mandatory). The address is discovered as described in 1609 Section 4.3. 1611 search := Search criteria for limiting the number of results 1612 (optional). 1614 page := Page (optional). Parameter cannot be used without the 1615 count parameter. Results are returned from result set in pages 1616 that contain 'count' links starting from index (page * count). 1617 Page numbering starts with zero. 1619 count := Count (optional). Number of results is limited to this 1620 parameter value. If the page parameter is also present, the 1621 response MUST only include 'count' links starting with the 1622 (page * count) link in the result set from the query. If the 1623 count parameter is not present, then the response MUST return 1624 all matching links in the result set. Link numbering starts 1625 with zero. 1627 Accept: absent, application/link-format or any other indicated 1628 media type representing web links 1630 The following responses codes are defined for this interface: 1632 Success: 2.05 "Content" or 200 "OK" with an "application/link- 1633 format" or other web link payload containing matching entries for 1634 the lookup. The payload can contain zero links (which is an empty 1635 payload in [RFC6690] link format, but could also be "[]" in JSON 1636 based formats), indicating that no entities matched the request. 1638 6.3. Resource lookup examples 1640 The examples in this section assume the existence of CoAP hosts with 1641 a default CoAP port 61616. HTTP hosts are possible and do not change 1642 the nature of the examples. 1644 The following example shows a client performing a resource lookup 1645 with the example resource look-up locations discovered in Figure 5: 1647 Req: GET /rd-lookup/res?rt=temperature 1649 Res: 2.05 Content 1650 ;rt="temperature"; 1651 anchor="coap://[2001:db8:3::123]:61616" 1653 Figure 18: Example a resource lookup 1655 A client that wants to be notified of new resources as they show up 1656 can use observation: 1658 Req: GET /rd-lookup/res?rt=light 1659 Observe: 0 1661 Res: 2.05 Content 1662 Observe: 23 1663 Payload: empty 1665 (at a later point in time) 1667 Res: 2.05 Content 1668 Observe: 24 1669 Payload: 1670 ;rt="light"; 1671 anchor="coap://[2001:db8:3::124]", 1672 ;rt="light"; 1673 anchor="coap://[2001:db8:3::124]", 1674 ;rt="light"; 1675 anchor="coap://[2001:db8:3::124]" 1677 Figure 19: Example an observing resource lookup 1679 The following example shows a client performing a paginated resource 1680 lookup 1681 Req: GET /rd-lookup/res?page=0&count=5 1683 Res: 2.05 Content 1684 ;rt=sensor;ct=60; 1685 anchor="coap://[2001:db8:3::123]:61616", 1686 ;rt=sensor;ct=60; 1687 anchor="coap://[2001:db8:3::123]:61616", 1688 ;rt=sensor;ct=60; 1689 anchor="coap://[2001:db8:3::123]:61616", 1690 ;rt=sensor;ct=60; 1691 anchor="coap://[2001:db8:3::123]:61616", 1692 ;rt=sensor;ct=60; 1693 anchor="coap://[2001:db8:3::123]:61616" 1695 Req: GET /rd-lookup/res?page=1&count=5 1697 Res: 2.05 Content 1698 ;rt=sensor;ct=60; 1699 anchor="coap://[2001:db8:3::123]:61616", 1700 ;rt=sensor;ct=60; 1701 anchor="coap://[2001:db8:3::123]:61616", 1702 ;rt=sensor;ct=60; 1703 anchor="coap://[2001:db8:3::123]:61616", 1704 ;rt=sensor;ct=60; 1705 anchor="coap://[2001:db8:3::123]:61616", 1706 ;rt=sensor;ct=60; 1707 anchor="coap://[2001:db8:3::123]:61616" 1709 Figure 20: Examples of paginated resource lookup 1711 The following example shows a client performing a lookup of all 1712 resources of all endpoints of a given endpoint type. It assumes that 1713 two endpoints (with endpoint names "sensor1" and "sensor2") have 1714 previously registered with their respective addresses 1715 "coap://sensor1.example.com" and "coap://sensor2.example.com", and 1716 posted the very payload of the 6th request of section 5 of [RFC6690]. 1718 It demonstrates how absolute link targets stay unmodified, while 1719 relative ones are resolved: 1721 Req: GET /rd-lookup/res?et=oic.d.sensor 1723 ;ct=40;title="Sensor Index"; 1724 anchor="coap://sensor1.example.com", 1725 ;rt="temperature-c"; 1726 if="sensor"; anchor="coap://sensor1.example.com", 1727 ;rt="light-lux"; 1728 if="sensor"; anchor="coap://sensor1.example.com", 1729 ;rel="describedby"; 1730 anchor="coap://sensor1.example.com/sensors/temp", 1731 ;rel="alternate"; 1732 anchor="coap://sensor1.example.com/sensors/temp", 1733 ;ct=40;title="Sensor Index"; 1734 anchor="coap://sensor2.example.com", 1735 ;rt="temperature-c"; 1736 if="sensor"; anchor="coap://sensor2.example.com", 1737 ;rt="light-lux"; 1738 if="sensor"; anchor="coap://sensor2.example.com", 1739 ;rel="describedby"; 1740 anchor="coap://sensor2.example.com/sensors/temp", 1741 ;rel="alternate"; 1742 anchor="coap://sensor2.example.com/sensors/temp" 1744 Figure 21: Example of resource lookup from multiple endpoints 1746 6.4. Endpoint lookup 1748 The endpoint lookup returns registration resources which can only be 1749 manipulated by the registering endpoint. 1751 Endpoint registration resources are annotated with their endpoint 1752 names (ep), sectors (d, if present) and registration base URI (base; 1753 reports the registrant-ep's address if no explicit base was given) as 1754 well as a constant resource type (rt="core.rd-ep"); the lifetime (lt) 1755 is not reported. Additional endpoint attributes are added as target 1756 attributes to their endpoint link unless their specification says 1757 otherwise. 1759 Links to endpoints SHOULD be presented in path-absolute form or, if 1760 required, as absolute references. (This avoids the RFC6690 1761 ambiguities.) 1763 Base addresses that contain link-local addresses MUST NOT include 1764 zone identifiers, and such registrations MUST NOT be shown unless the 1765 lookup was made from the same link from which the registration was 1766 made. 1768 While Endpoint Lookup does expose the registration resources, the RD 1769 does not need to make them accessible to clients. Clients SHOULD NOT 1770 attempt to dereference or manipulate them. 1772 A Resource Directory can report endpoints in lookup that are not 1773 hosted at the same address. Lookup clients MUST be prepared to see 1774 arbitrary URIs as registration resources in the results and treat 1775 them as opaque identifiers; the precise semantics of such links are 1776 left to future specifications. 1778 The following example shows a client performing an endpoint type (et) 1779 lookup with the value oic.d.sensor (which is currently a registered 1780 rt value): 1782 Req: GET /rd-lookup/ep?et=oic.d.sensor 1784 Res: 2.05 Content 1785 ;base="coap://[2001:db8:3::127]:61616";ep="node5"; 1786 et="oic.d.sensor";ct="40";rt="core.rd-ep", 1787 ;base="coap://[2001:db8:3::129]:61616";ep="node7"; 1788 et="oic.d.sensor";ct="40";d="floor-3";rt="core.rd-ep" 1790 Figure 22: Examples of endpoint lookup 1792 7. Security policies 1794 The Resource Directory (RD) provides assistance to applications 1795 situated on a selection of nodes to discover endpoints on connected 1796 nodes. This section discusses different security aspects of 1797 accessing the RD. 1799 The contents of the RD are inserted in two ways: 1801 1. The node hosting the discoverable endpoint fills the RD with the 1802 contents of /.well-known/core by: 1804 * Storing the contents directly into RD (see Section 5) 1806 * Requesting the RD to load the contents from /.well-known/core 1807 (see Section 5.1) 1809 2. A Commissioning Tool (CT) fills the RD with endpoint information 1810 for a set of discoverable nodes. (see Section 5 with 1811 base=authority parameter value) 1813 In both cases, the nodes filling the RD should be authenticated and 1814 authorized to change the contents of the RD. An Authorization Server 1815 (AS) is responsible to assign a token to the registering node to 1816 authorize the node to discover or register endpoints in a given RD 1817 [I-D.ietf-ace-oauth-authz]. 1819 It can be imagined that an installation is divided in a set of 1820 security regions, each one with its own RD(s) to discover the 1821 endpoints that are part of a given security region. An endpoint that 1822 wants to discover an RD, responsible for a given region, needs to be 1823 authorized to learn the contents of a given RD. Within a region, for 1824 a given RD, a more fine-grained security division is possible based 1825 on the values of the endpoint registration parameters. Authorization 1826 to discover endpoints with a given set of filter values is 1827 recommended for those cases. 1829 When a node registers its endpoints, criteria are needed to authorize 1830 the node to enter them. An important aspect is the uniqueness of the 1831 (endpoint name, and optional sector) pair within the RD. Consider 1832 the two cases separately: (1) CT registers endpoints, and (2) the 1833 registering node registers its own endpoint(s). 1835 o A CT needs authorization to register a set of endpoints. This 1836 authorization can be based on the region, i.e. a given CT is 1837 authorized to register any endpoint (endpoint name, sector) into a 1838 given RD, or to register an endpoint with (endpoint name, sector) 1839 value pairs assigned by the AS, or can be more fine-grained, 1840 including a subset of registration parameter values. 1842 o A given endpoint that registers itself, needs to proof its 1843 possession of its unique (endpoint name, sector) value pair. 1844 Alternatively, the AS can authorize the endpoint to register with 1845 an (endpoint name, sector) value pair assigned by the AS. 1847 A separate document needs to specify these aspects to ensure 1848 interoperability between registering nodes and RD. The subsections 1849 below give some hints how to handle a subset of the different 1850 aspects. 1852 7.1. Secure RD discovery 1854 The Resource Server (RS) discussed in [I-D.ietf-ace-oauth-authz] is 1855 equated to the RD. The client (C) needs to discover the RD as 1856 discussed in Section 4.1. C can discover the related AS by sending a 1857 request to the RD. The RD denies the request by sending the address 1858 of the related AS, as discussed in section 5.1 of 1859 [I-D.ietf-ace-oauth-authz]. The client MUST send an authorization 1860 request to the AS. When appropriate, the AS returns a token that 1861 specifies the authorization permission which needs to be specified in 1862 a separate document. 1864 7.2. Secure RD filtering 1866 The authorized parameter values for the queries by a given endpoint 1867 must be registered by the AS. The AS communicates the parameter 1868 values in the token. A separate document needs to specify the 1869 parameter value combinations and their storage in the token. The RD 1870 decodes the token and checks the validity of the queries of the 1871 client. 1873 7.3. Secure endpoint Name assignment 1875 This section only considers the assignment of a name to the endpoint 1876 based on an automatic mechanism without use of AS. More elaborate 1877 protocols are out of scope. The registering endpoint is authorized 1878 by the AS to discover the RD and add registrations. A token is 1879 provided by the AS and communicated from registering endpoint to RD. 1880 It is assumed that DTLS is used to secure the channel between 1881 registering endpoint and RD, where the registering endpoint is the 1882 DTLS client. Assuming that the client is provided by a certificate 1883 at manufacturing time, the certificate is uniquely identified by the 1884 CN field and the serial number. The RD can assign a unique endpoint 1885 name by using the certificate identifier as endpoint name. Proof of 1886 possession of the endpoint name by the registering endpoint is 1887 checked by encrypting the certificate identifier with the private key 1888 of the registering endpoint, which the RD can decrypt with the public 1889 key stored in the certificate. Even simpler, the authorized 1890 registering endpoint can generate a random number (or string) that 1891 identifies the endpoint. The RD can check for the improbable 1892 replication of the random value. The RD MUST check that registering 1893 endpoint uses only one random value for each authorized endpoint. 1895 8. Security Considerations 1897 The security considerations as described in Section 5 of [RFC8288] 1898 and Section 6 of [RFC6690] apply. The "/.well-known/core" resource 1899 may be protected e.g. using DTLS when hosted on a CoAP server as 1900 described in [RFC7252]. DTLS or TLS based security SHOULD be used on 1901 all resource directory interfaces defined in this document. 1903 8.1. Endpoint Identification and Authentication 1905 An Endpoint (name, sector) pair is unique within the et of endpoints 1906 registered by the RD. An Endpoint MUST NOT be identified by its 1907 protocol, port or IP address as these may change over the lifetime of 1908 an Endpoint. 1910 Every operation performed by an Endpoint on a resource directory 1911 SHOULD be mutually authenticated using Pre-Shared Key, Raw Public Key 1912 or Certificate based security. 1914 Consider the following threat: two devices A and B are registered at 1915 a single server. Both devices have unique, per-device credentials 1916 for use with DTLS to make sure that only parties with authorization 1917 to access A or B can do so. 1919 Now, imagine that a malicious device A wants to sabotage the device 1920 B. It uses its credentials during the DTLS exchange. Then, it 1921 specifies the endpoint name of device B as the name of its own 1922 endpoint in device A. If the server does not check whether the 1923 identifier provided in the DTLS handshake matches the identifier used 1924 at the CoAP layer then it may be inclined to use the endpoint name 1925 for looking up what information to provision to the malicious device. 1927 Section 7.3 specifies an example that removes this threat for 1928 endpoints that have a certificate installed. 1930 8.2. Access Control 1932 Access control SHOULD be performed separately for the RD registration 1933 and Lookup API paths, as different endpoints may be authorized to 1934 register with an RD from those authorized to lookup endpoints from 1935 the RD. Such access control SHOULD be performed in as fine-grained a 1936 level as possible. For example access control for lookups could be 1937 performed either at the sector, endpoint or resource level. 1939 8.3. Denial of Service Attacks 1941 Services that run over UDP unprotected are vulnerable to unknowingly 1942 become part of a DDoS attack as UDP does not require return 1943 routability check. Therefore, an attacker can easily spoof the 1944 source IP of the target entity and send requests to such a service 1945 which would then respond to the target entity. This can be used for 1946 large-scale DDoS attacks on the target. Especially, if the service 1947 returns a response that is order of magnitudes larger than the 1948 request, the situation becomes even worse as now the attack can be 1949 amplified. DNS servers have been widely used for DDoS amplification 1950 attacks. There is also a danger that NTP Servers could become 1951 implicated in denial-of-service (DoS) attacks since they run on 1952 unprotected UDP, there is no return routability check, and they can 1953 have a large amplification factor. The responses from the NTP server 1954 were found to be 19 times larger than the request. A Resource 1955 Directory (RD) which responds to wild-card lookups is potentially 1956 vulnerable if run with CoAP over UDP. Since there is no return 1957 routability check and the responses can be significantly larger than 1958 requests, RDs can unknowingly become part of a DDoS amplification 1959 attack. 1961 9. IANA Considerations 1963 9.1. Resource Types 1965 IANA is asked to enter the following values into the Resource Type 1966 (rt=) Link Target Attribute Values sub-registry of the Constrained 1967 Restful Environments (CoRE) Parameters registry defined in [RFC6690]: 1969 +--------------------+--------------------------+-------------------+ 1970 | Value | Description | Reference | 1971 +--------------------+--------------------------+-------------------+ 1972 | core.rd | Directory resource of an | RFCTHIS Section | 1973 | | RD | 4.3 | 1974 | core.rd-lookup-res | Resource lookup of an RD | RFCTHIS Section | 1975 | | | 4.3 | 1976 | core.rd-lookup-ep | Endpoint lookup of an RD | RFCTHIS Section | 1977 | | | 4.3 | 1978 | core.rd-ep | Endpoint resource of an | RFCTHIS Section 6 | 1979 | | RD | | 1980 +--------------------+--------------------------+-------------------+ 1982 9.2. IPv6 ND Resource Directory Address Option 1984 This document registers one new ND option type under the sub-registry 1985 "IPv6 Neighbor Discovery Option Formats": 1987 o Resource Directory Address Option (38) 1989 9.3. RD Parameter Registry 1991 This specification defines a new sub-registry for registration and 1992 lookup parameters called "RD Parameters" under "CoRE Parameters". 1993 Although this specification defines a basic set of parameters, it is 1994 expected that other standards that make use of this interface will 1995 define new ones. 1997 Each entry in the registry must include 1999 o the human readable name of the parameter, 2001 o the short name as used in query parameters or target attributes, 2003 o indication of whether it can be passed as a query parameter at 2004 registration of endpoints, as a query parameter in lookups, or be 2005 expressed as a target attribute, 2007 o validity requirements if any, and 2009 o a description. 2011 The query parameter MUST be both a valid URI query key [RFC3986] and 2012 a token as used in [RFC8288]. 2014 The description must give details on whether the parameter can be 2015 updated, and how it is to be processed in lookups. 2017 The mechanisms around new RD parameters should be designed in such a 2018 way that they tolerate RD implementations that are unaware of the 2019 parameter and expose any parameter passed at registration or updates 2020 on in endpoint lookups. (For example, if a parameter used at 2021 registration were to be confidential, the registering endpoint should 2022 be instructed to only set that parameter if the RD advertises support 2023 for keeping it confidential at the discovery step.) 2025 Initial entries in this sub-registry are as follows: 2027 +--------------+-------+---------------+-----+----------------------+ 2028 | Full name | Short | Validity | Use | Description | 2029 +--------------+-------+---------------+-----+----------------------+ 2030 | Endpoint | ep | Unicode* | RLA | Name of the endpoint | 2031 | Name | | | | | 2032 | Lifetime | lt | 60-4294967295 | R | Lifetime of the | 2033 | | | | | registration in | 2034 | | | | | seconds | 2035 | Sector | d | Unicode* | RLA | Sector to which this | 2036 | | | | | endpoint belongs | 2037 | Registration | base | URI | RLA | The scheme, address | 2038 | Base URI | | | | and port and path at | 2039 | | | | | which this server is | 2040 | | | | | available | 2041 | Page | page | Integer | L | Used for pagination | 2042 | Count | count | Integer | L | Used for pagination | 2043 | Endpoint | et | Section 9.3.1 | RLA | Semantic type of the | 2044 | Type | | | | endpoint (see | 2045 | | | | | Section 9.4) | 2046 +--------------+-------+---------------+-----+----------------------+ 2048 Table 2: RD Parameters 2050 (Short: Short name used in query parameters or target attributes. 2051 Validity: Unicode* = 63 Bytes of UTF-8 encoded Unicode, with no 2052 control characters as per Section 5. Use: R = used at registration, 2053 L = used at lookup, A = expressed in target attribute 2054 The descriptions for the options defined in this document are only 2055 summarized here. To which registrations they apply and when they are 2056 to be shown is described in the respective sections of this document. 2058 The IANA policy for future additions to the sub-registry is "Expert 2059 Review" as described in [RFC8126]. The evaluation should consider 2060 formal criteria, duplication of functionality (Is the new entry 2061 redundant with an existing one?), topical suitability (E.g. is the 2062 described property actually a property of the endpoint and not a 2063 property of a particular resource, in which case it should go into 2064 the payload of the registration and need not be registered?), and the 2065 potential for conflict with commonly used target attributes (For 2066 example, "if" could be used as a parameter for conditional 2067 registration if it were not to be used in lookup or attributes, but 2068 would make a bad parameter for lookup, because a resource lookup with 2069 an "if" query parameter could ambiguously filter by the registered 2070 endpoint property or the [RFC6690] target attribute). It is expected 2071 that the registry will receive between 5 and 50 registrations in 2072 total over the next years. 2074 9.3.1. Full description of the "Endpoint Type" Registration Parameter 2076 An endpoint registering at an RD can describe itself with endpoint 2077 types, similar to how resources are described with Resource Types in 2078 [RFC6690]. An endpoint type is expressed as a string, which can be 2079 either a URI or one of the values defined in the Endpoint Type sub- 2080 registry. Endpoint types can be passed in the "et" query parameter 2081 as part of extra-attrs at the Registration step, are shown on 2082 endpoint lookups using the "et" target attribute, and can be filtered 2083 for using "et" as a search criterion in resource and endpoint lookup. 2084 Multiple endpoint types are given as separate query parameters or 2085 link attributes. 2087 Note that Endpoint Type differs from Resource Type in that it uses 2088 multiple attributes rather than space separated values. As a result, 2089 Resource Directory implementations automatically support correct 2090 filtering in the lookup interfaces from the rules for unknown 2091 endpoint attributes. 2093 9.4. "Endpoint Type" (et=) RD Parameter values 2095 This specification establishes a new sub-registry under "CoRE 2096 Parameters" called '"Endpoint Type" (et=) RD Parameter values'. The 2097 registry properties (required policy, requirements, template) are 2098 identical to those of the Resource Type parameters in [RFC6690], in 2099 short: 2101 The review policy is IETF Review for values starting with "core", and 2102 Specification Required for others. 2104 The requirements to be enforced are: 2106 o The values MUST be related to the purpose described in 2107 Section 9.3.1. 2109 o The registered values MUST conform to the ABNF reg-rel-type 2110 definition of [RFC6690] and MUST NOT be a URI. 2112 o It is recommended to use the period "." character for 2113 segmentation. 2115 The registry initially contains one value: 2117 o "core.rd-group": An application group as described in Appendix A. 2119 9.5. Multicast Address Registration 2121 IANA is asked to assign the following multicast addresses for use by 2122 CoAP nodes: 2124 IPv4 - "all CoRE resource directories" address MCD2 (suggestion: 2125 224.0.1.189), from the "IPv4 Multicast Address Space Registry". As 2126 the address is used for discovery that may span beyond a single 2127 network, it has come from the Internetwork Control Block (224.0.1.x, 2128 RFC 5771). 2130 IPv6 - "all CoRE resource directories" address MCD1 (suggestions 2131 FF0X::FE), from the "IPv6 Multicast Address Space Registry", in the 2132 "Variable Scope Multicast Addresses" space (RFC 3307). Note that 2133 there is a distinct multicast address for each scope that interested 2134 CoAP nodes should listen to; CoAP needs the Link-Local and Site-Local 2135 scopes only. 2137 [ The RFC editor is asked to replace MCD1 and MCD2 with the assigned 2138 addresses throughout the document. ] 2140 10. Examples 2142 Two examples are presented: a Lighting Installation example in 2143 Section 10.1 and a LWM2M example in Section 10.2. 2145 10.1. Lighting Installation 2147 This example shows a simplified lighting installation which makes use 2148 of the Resource Directory (RD) with a CoAP interface to facilitate 2149 the installation and start-up of the application code in the lights 2150 and sensors. In particular, the example leads to the definition of a 2151 group and the enabling of the corresponding multicast address as 2152 described in Appendix A. No conclusions must be drawn on the 2153 realization of actual installation or naming procedures, because the 2154 example only "emphasizes" some of the issues that may influence the 2155 use of the RD and does not pretend to be normative. 2157 10.1.1. Installation Characteristics 2159 The example assumes that the installation is managed. That means 2160 that a Commissioning Tool (CT) is used to authorize the addition of 2161 nodes, name them, and name their services. The CT can be connected 2162 to the installation in many ways: the CT can be part of the 2163 installation network, connected by WiFi to the installation network, 2164 or connected via GPRS link, or other method. 2166 It is assumed that there are two naming authorities for the 2167 installation: (1) the network manager that is responsible for the 2168 correct operation of the network and the connected interfaces, and 2169 (2) the lighting manager that is responsible for the correct 2170 functioning of networked lights and sensors. The result is the 2171 existence of two naming schemes coming from the two managing 2172 entities. 2174 The example installation consists of one presence sensor, and two 2175 luminaries, luminary1 and luminary2, each with their own wireless 2176 interface. Each luminary contains three lamps: left, right and 2177 middle. Each luminary is accessible through one endpoint. For each 2178 lamp a resource exists to modify the settings of a lamp in a 2179 luminary. The purpose of the installation is that the presence 2180 sensor notifies the presence of persons to a group of lamps. The 2181 group of lamps consists of: middle and left lamps of luminary1 and 2182 right lamp of luminary2. 2184 Before commissioning by the lighting manager, the network is 2185 installed and access to the interfaces is proven to work by the 2186 network manager. 2188 At the moment of installation, the network under installation is not 2189 necessarily connected to the DNS infra structure. Therefore, SLAAC 2190 IPv6 addresses are assigned to CT, RD, luminaries and sensor shown in 2191 Table 3 below: 2193 +--------------------+----------------+ 2194 | Name | IPv6 address | 2195 +--------------------+----------------+ 2196 | luminary1 | 2001:db8:4::1 | 2197 | luminary2 | 2001:db8:4::2 | 2198 | Presence sensor | 2001:db8:4::3 | 2199 | Resource directory | 2001:db8:4::ff | 2200 +--------------------+----------------+ 2202 Table 3: interface SLAAC addresses 2204 In Section 10.1.2 the use of resource directory during installation 2205 is presented. 2207 10.1.2. RD entries 2209 It is assumed that access to the DNS infrastructure is not always 2210 possible during installation. Therefore, the SLAAC addresses are 2211 used in this section. 2213 For discovery, the resource types (rt) of the devices are important. 2214 The lamps in the luminaries have rt: light, and the presence sensor 2215 has rt: p-sensor. The endpoints have names which are relevant to the 2216 light installation manager. In this case luminary1, luminary2, and 2217 the presence sensor are located in room 2-4-015, where luminary1 is 2218 located at the window and luminary2 and the presence sensor are 2219 located at the door. The endpoint names reflect this physical 2220 location. The middle, left and right lamps are accessed via path 2221 /light/middle, /light/left, and /light/right respectively. The 2222 identifiers relevant to the Resource Directory are shown in Table 4 2223 below: 2225 +----------------+------------------+---------------+---------------+ 2226 | Name | endpoint | resource path | resource type | 2227 +----------------+------------------+---------------+---------------+ 2228 | luminary1 | lm_R2-4-015_wndw | /light/left | light | 2229 | luminary1 | lm_R2-4-015_wndw | /light/middle | light | 2230 | luminary1 | lm_R2-4-015_wndw | /light/right | light | 2231 | luminary2 | lm_R2-4-015_door | /light/left | light | 2232 | luminary2 | lm_R2-4-015_door | /light/middle | light | 2233 | luminary2 | lm_R2-4-015_door | /light/right | light | 2234 | Presence | ps_R2-4-015_door | /ps | p-sensor | 2235 | sensor | | | | 2236 +----------------+------------------+---------------+---------------+ 2238 Table 4: Resource Directory identifiers 2240 It is assumed that the CT knows the RD's address, and has performed 2241 URI discovery on it that returned a response like the one in the 2242 Section 4.3 example. 2244 The CT inserts the endpoints of the luminaries and the sensor in the 2245 RD using the registration base URI parameter (base) to specify the 2246 interface address: 2248 Req: POST coap://[2001:db8:4::ff]/rd 2249 ?ep=lm_R2-4-015_wndw&base=coap://[2001:db8:4::1]&d=R2-4-015 2250 Payload: 2251 ;rt="light", 2252 ;rt="light", 2253 ;rt="light" 2255 Res: 2.01 Created 2256 Location-Path: /rd/4521 2258 Req: POST coap://[2001:db8:4::ff]/rd 2259 ?ep=lm_R2-4-015_door&base=coap://[2001:db8:4::2]&d=R2-4-015 2260 Payload: 2261 ;rt="light", 2262 ;rt="light", 2263 ;rt="light" 2265 Res: 2.01 Created 2266 Location-Path: /rd/4522 2268 Req: POST coap://[2001:db8:4::ff]/rd 2269 ?ep=ps_R2-4-015_door&base=coap://[2001:db8:4::3]d&d=R2-4-015 2270 Payload: 2271 ;rt="p-sensor" 2273 Res: 2.01 Created 2274 Location-Path: /rd/4523 2276 Figure 23: Example of registrations a CT enters into an RD 2278 The sector name d=R2-4-015 has been added for an efficient lookup 2279 because filtering on "ep" name is more awkward. The same sector name 2280 is communicated to the two luminaries and the presence sensor by the 2281 CT. 2283 The group is specified in the RD. The base parameter is set to the 2284 site-local multicast address allocated to the group. In the POST in 2285 the example below, the resources supported by all group members are 2286 published. 2288 Req: POST coap://[2001:db8:4::ff]/rd 2289 ?ep=grp_R2-4-015&et=core.rd-group&base=coap://[ff05::1] 2290 Payload: 2291 ;rt="light", 2292 ;rt="light", 2293 ;rt="light" 2295 Res: 2.01 Created 2296 Location-Path: /rd/501 2298 Figure 24: Example of a multicast group a CT enters into an RD 2300 After the filling of the RD by the CT, the application in the 2301 luminaries can learn to which groups they belong, and enable their 2302 interface for the multicast address. 2304 The luminary, knowing its sector and being configured to join any 2305 group containing lights, searches for candidate groups and joins 2306 them: 2308 Req: GET coap://[2001:db8:4::ff]/rd-lookup/ep 2309 ?d=R2-4-015&et=core.rd-group&rt=light 2311 Res: 2.05 Content 2312 ;ep="grp_R2-4-015";et="core.rd-group"; 2313 base="coap://[ff05::1]";rt="core.rd-ep" 2315 Figure 25: Example of a lookup exchange to find suitable multicast 2316 addresses 2318 From the returned base parameter value, the luminary learns the 2319 multicast address of the multicast group. 2321 Alternatively, the CT can communicate the multicast address directly 2322 to the luminaries by using the "coap-group" resource specified in 2323 [RFC7390]. 2325 Req: POST coap://[2001:db8:4::1]/coap-group 2326 Content-Format: application/coap-group+json 2327 Payload: 2328 { "a": "[ff05::1]", "n": "grp_R2-4-015"} 2330 Res: 2.01 Created 2331 Location-Path: /coap-group/1 2333 Figure 26: Example use of direct multicast address configuration 2335 Dependent on the situation, only the address, "a", or the name, "n", 2336 is specified in the coap-group resource. 2338 The presence sensor can learn the presence of groups that support 2339 resources with rt=light in its own sector by sending the same 2340 request, as used by the luminary. The presence sensor learns the 2341 multicast address to use for sending messages to the luminaries. 2343 10.2. OMA Lightweight M2M (LWM2M) Example 2345 This example shows how the OMA LWM2M specification makes use of 2346 Resource Directory (RD). 2348 OMA LWM2M is a profile for device services based on CoAP(OMA Name 2349 Authority). LWM2M defines a simple object model and a number of 2350 abstract interfaces and operations for device management and device 2351 service enablement. 2353 An LWM2M server is an instance of an LWM2M middleware service layer, 2354 containing a Resource Directory along with other LWM2M interfaces 2355 defined by the LWM2M specification. 2357 CoRE Resource Directory (RD) is used to provide the LWM2M 2358 Registration interface. 2360 LWM2M does not provide for registration sectors and does not 2361 currently use the rd-lookup interface. 2363 The LWM2M specification describes a set of interfaces and a resource 2364 model used between a LWM2M device and an LWM2M server. Other 2365 interfaces, proxies, and applications are currently out of scope for 2366 LWM2M. 2368 The location of the LWM2M Server and RD URI path is provided by the 2369 LWM2M Bootstrap process, so no dynamic discovery of the RD is used. 2370 LWM2M Servers and endpoints are not required to implement the /.well- 2371 known/core resource. 2373 10.2.1. The LWM2M Object Model 2375 The OMA LWM2M object model is based on a simple 2 level class 2376 hierarchy consisting of Objects and Resources. 2378 An LWM2M Resource is a REST endpoint, allowed to be a single value or 2379 an array of values of the same data type. 2381 An LWM2M Object is a resource template and container type that 2382 encapsulates a set of related resources. An LWM2M Object represents 2383 a specific type of information source; for example, there is a LWM2M 2384 Device Management object that represents a network connection, 2385 containing resources that represent individual properties like radio 2386 signal strength. 2388 Since there may potentially be more than one of a given type object, 2389 for example more than one network connection, LWM2M defines instances 2390 of objects that contain the resources that represent a specific 2391 physical thing. 2393 The URI template for LWM2M consists of a base URI followed by Object, 2394 Instance, and Resource IDs: 2396 {/base-uri}{/object-id}{/object-instance}{/resource-id}{/resource- 2397 instance} 2399 The five variables given here are strings. base-uri can also have 2400 the special value "undefined" (sometimes called "null" in RFC 6570). 2401 Each of the variables object-instance, resource-id, and resource- 2402 instance can be the special value "undefined" only if the values 2403 behind it in this sequence also are "undefined". As a special case, 2404 object-instance can be "empty" (which is different from "undefined") 2405 if resource-id is not "undefined". 2407 base-uri := Base URI for LWM2M resources or "undefined" for default 2408 (empty) base URI 2410 object-id := OMNA (OMA Name Authority) registered object ID (0-65535) 2412 object-instance := Object instance identifier (0-65535) or 2413 "undefined"/"empty" (see above)) to refer to all instances of an 2414 object ID 2416 resource-id := OMNA (OMA Name Authority) registered resource ID 2417 (0-65535) or "undefined" to refer to all resources within an instance 2419 resource-instance := Resource instance identifier or "undefined" to 2420 refer to single instance of a resource 2422 LWM2M IDs are 16 bit unsigned integers represented in decimal (no 2423 leading zeroes except for the value 0) by URI format strings. For 2424 example, a LWM2M URI might be: 2426 /1/0/1 2428 The base uri is empty, the Object ID is 1, the instance ID is 0, the 2429 resource ID is 1, and the resource instance is "undefined". This 2430 example URI points to internal resource 1, which represents the 2431 registration lifetime configured, in instance 0 of a type 1 object 2432 (LWM2M Server Object). 2434 10.2.2. LWM2M Register Endpoint 2436 LWM2M defines a registration interface based on the REST API, 2437 described in Section 5. The RD registration URI path of the LWM2M 2438 Resource Directory is specified to be "/rd". 2440 LWM2M endpoints register object IDs, for example , to indicate 2441 that a particular object type is supported, and register object 2442 instances, for example , to indicate that a particular instance 2443 of that object type exists. 2445 Resources within the LWM2M object instance are not registered with 2446 the RD, but may be discovered by reading the resource links from the 2447 object instance using GET with a CoAP Content-Format of application/ 2448 link-format. Resources may also be read as a structured object by 2449 performing a GET to the object instance with a Content-Format of 2450 senml+json. 2452 When an LWM2M object or instance is registered, this indicates to the 2453 LWM2M server that the object and its resources are available for 2454 management and service enablement (REST API) operations. 2456 LWM2M endpoints may use the following RD registration parameters as 2457 defined in Table 2 : 2459 ep - Endpoint Name 2460 lt - registration lifetime 2462 Endpoint Name, Lifetime, and LWM2M Version are mandatory parameters 2463 for the register operation, all other registration parameters are 2464 optional. 2466 Additional optional LWM2M registration parameters are defined: 2468 +-----------+-------+-------------------------------+---------------+ 2469 | Name | Query | Validity | Description | 2470 +-----------+-------+-------------------------------+---------------+ 2471 | Binding | b | {"U",UQ","S","SQ","US","UQS"} | Available | 2472 | Mode | | | Protocols | 2473 | | | | | 2474 | LWM2M | ver | 1.0 | Spec Version | 2475 | Version | | | | 2476 | | | | | 2477 | SMS | sms | | MSISDN | 2478 | Number | | | | 2479 +-----------+-------+-------------------------------+---------------+ 2481 Table 5: LWM2M Additional Registration Parameters 2483 The following RD registration parameters are not currently specified 2484 for use in LWM2M: 2486 et - Endpoint Type 2487 base - Registration Base URI 2489 The endpoint registration must include a payload containing links to 2490 all supported objects and existing object instances, optionally 2491 including the appropriate link-format relations. 2493 Here is an example LWM2M registration payload: 2495 ,,, 2497 This link format payload indicates that object ID 1 (LWM2M Server 2498 Object) is supported, with a single instance 0 existing, object ID 3 2499 (LWM2M Device object) is supported, with a single instance 0 2500 existing, and object 5 (LWM2M Firmware Object) is supported, with no 2501 existing instances. 2503 10.2.3. LWM2M Update Endpoint Registration 2505 The LwM2M update is really very similar to the registration update as 2506 described in Section 5.3.1, with the only difference that there are 2507 more parameters defined and available. All the parameters listed in 2508 that section are also available with the initial registration but are 2509 all optional: 2511 lt - Registration Lifetime 2512 b - Protocol Binding 2513 sms - MSISDN 2514 link payload - new or modified links 2515 A Registration update is also specified to be used to update the 2516 LWM2M server whenever the endpoint's UDP port or IP address are 2517 changed. 2519 10.2.4. LWM2M De-Register Endpoint 2521 LWM2M allows for de-registration using the delete method on the 2522 returned location from the initial registration operation. LWM2M de- 2523 registration proceeds as described in Section 5.3.2. 2525 11. Acknowledgments 2527 Oscar Novo, Srdjan Krco, Szymon Sasin, Kerry Lynn, Esko Dijk, Anders 2528 Brandt, Matthieu Vial, Jim Schaad, Mohit Sethi, Hauke Petersen, 2529 Hannes Tschofenig, Sampo Ukkola, Linyi Tian, Jan Newmarch, Matthias 2530 Kovatsch, Jaime Jimenez and Ted Lemon have provided helpful comments, 2531 discussions and ideas to improve and shape this document. Zach would 2532 also like to thank his colleagues from the EU FP7 SENSEI project, 2533 where many of the resource directory concepts were originally 2534 developed. 2536 12. Changelog 2538 changes from -22 to -23 2540 o Explain that updates can not remove attributes 2542 o Typo fixes 2544 changes from -21 to -22 2546 o Request a dedicated IPv4 address from IANA (rather than sharing 2547 with All CoAP nodes) 2549 o Fix erroneous examples 2551 o Editorial changes 2553 * Add figure numbers to examples 2555 * Update RD parameters table to reflect changes of earlier 2556 versions in the text 2558 * Typos and minor wording 2560 changes from -20 to -21 2562 (Processing comments during WGLC) 2563 o Defer outdated description of using DNS-SD to find an RD to the 2564 defining document 2566 o Describe operational conditions in automation example 2568 o Recommend particular discovery mechanisms for some managed network 2569 scenarios 2571 changes from -19 to -20 2573 (Processing comments from the WG chair review) 2575 o Define the permissible characters in endpoint and sector names 2577 o Express requirements on NAT situations in more abstract terms 2579 o Shifted heading levels to have the interfaces on the same level 2581 o Group instructions for error handling into general section 2583 o Simple Registration: process reflowed into items list 2585 o Updated introduction to reflect state of CoRE in general, 2586 reference RFC7228 (defining "constrained") and use "IoT" term in 2587 addition to "M2M" 2589 o Update acknowledgements 2591 o Assorted editorial changes 2593 * Unify examples style 2595 * Terminology: RDAO defined and not only expanded 2597 * Add CT to Figure 1 2599 * Consistency in the use of the term "Content Format" 2601 changes from -18 to -19 2603 o link-local addresses: allow but prescribe split-horizon fashion 2604 when used, disallow zone identifiers 2606 o Remove informative references to documents not mentioned any more 2608 changes from -17 to -18 2609 o Rather than re-specifying link format (Modernized Link Format), 2610 describe a Limited Link Format that's the uncontested subset of 2611 Link Format 2613 o Acknowledging the -17 version as part of the draft 2615 o Move "Read endpoint links" operation to future specification like 2616 PATCH 2618 o Demote links-json to an informative reference, and removed them 2619 from exchange examples 2621 o Add note on unusability of link-local IP addresses, and describe 2622 mitigation. 2624 o Reshuffling of sections: Move additional operations and endpoint 2625 lookup back from appendix, and groups into one 2627 o Lookup interface tightened to not imply applicability for non 2628 link-format lookups (as those can have vastly different views on 2629 link cardinality) 2631 o Simple registration: Change sequence of GET and POST-response, 2632 ensuring unsuccessful registrations are reported as such, and 2633 suggest how devices that would have required the inverse behavior 2634 can still cope with it. 2636 o Abstract and introduction reworded to avoid the impression that 2637 resources are stored in full in the RD 2639 o Simplify the rules governing when a registration resource can or 2640 must be changed. 2642 o Drop a figure that has become useless due to the changes of and 2643 -13 and -17 2645 o Wording consistency fixes: Use "Registrations" and "target 2646 attributes" 2648 o Fix incorrect use of content negotiation in discovery interface 2649 description (Content-Format -> Accept) 2651 o State that the base attribute value is part of endpoint lookup 2652 even when implicit in the registration 2654 o Update references from RFC5988 to its update RFC8288 2655 o Remove appendix on protocol-negotiation (which had a note to be 2656 removed before publication) 2658 changes from -16 to -17 2660 (Note that -17 is published as a direct follow-up to -16, containing 2661 a single change to be discussed at IETF103) 2663 o Removed groups that are enumerations of registrations and have 2664 dedicated mechanism 2666 o Add groups that are enumerations of shared resources and are a 2667 special case of endpoint registrations 2669 changes from -15 to -16 2671 o Recommend a common set of resources for members of a group 2673 o Clarified use of multicast group in lighting example 2675 o Add note on concurrent registrations from one EP being possible 2676 but not expected 2678 o Refresh web examples appendix to reflect current use of Modernized 2679 Link Format 2681 o Add examples of URIs where Modernized Link Format matters 2683 o Editorial changes 2685 changes from -14 to -15 2687 o Rewrite of section "Security policies" 2689 o Clarify that the "base" parameter text applies both to relative 2690 references both in anchor and href 2692 o Renamed "Registree-EP" to Registrant-EP" 2694 o Talk of "relative references" and "URIs" rather than "relative" 2695 and "absolute" URIs. (The concept of "absolute URIs" of [RFC3986] 2696 is not needed in RD). 2698 o Fixed examples 2700 o Editorial changes 2702 changes from -13 to -14 2703 o Rename "registration context" to "registration base URI" (and 2704 "con" to "base") and "domain" to "sector" (where the abbreviation 2705 "d" stays for compatibility reasons) 2707 o Introduced resource types core.rd-ep and core.rd-gp 2709 o Registration management moved to appendix A, including endpoint 2710 and group lookup 2712 o Minor editorial changes 2714 * PATCH/iPATCH is clearly deferred to another document 2716 * Recommend against query / fragment identifier in con= 2718 * Interface description lists are described as illustrative 2720 * Rewording of Simple Registration 2722 o Simple registration carries no error information and succeeds 2723 immediately (previously, sequence was unspecified) 2725 o Lookup: href are matched against resolved values (previously, this 2726 was unspecified) 2728 o Lookup: lt are not exposed any more 2730 o con/base: Paths are allowed 2732 o Registration resource locations can not have query or fragment 2733 parts 2735 o Default life time extended to 25 hours 2737 o clarified registration update rules 2739 o lt-value semantics for lookup clarified. 2741 o added template for simple registration 2743 changes from -12 to -13 2745 o Added "all resource directory" nodes MC address 2747 o Clarified observation behavior 2749 o version identification 2750 o example rt= and et= values 2752 o domain from figure 2 2754 o more explanatory text 2756 o endpoints of a groups hosted by different RD 2758 o resolve RFC6690-vs-8288 resolution ambiguities: 2760 * require registered links not to be relative when using anchor 2762 * return absolute URIs in resource lookup 2764 changes from -11 to -12 2766 o added Content Model section, including ER diagram 2768 o removed domain lookup interface; domains are now plain attributes 2769 of groups and endpoints 2771 o updated chapter "Finding a Resource Directory"; now distinguishes 2772 configuration-provided, network-provided and heuristic sources 2774 o improved text on: atomicity, idempotency, lookup with multiple 2775 parameters, endpoint removal, simple registration 2777 o updated LWM2M description 2779 o clarified where relative references are resolved, and how context 2780 and anchor interact 2782 o new appendix on the interaction with RFCs 6690, 5988 and 3986 2784 o lookup interface: group and endpoint lookup return group and 2785 registration resources as link targets 2787 o lookup interface: search parameters work the same across all 2788 entities 2790 o removed all methods that modify links in an existing registration 2791 (POST with payload, PATCH and iPATCH) 2793 o removed plurality definition (was only needed for link 2794 modification) 2796 o enhanced IANA registry text 2797 o state that lookup resources can be observable 2799 o More examples and improved text 2801 changes from -09 to -10 2803 o removed "ins" and "exp" link-format extensions. 2805 o removed all text concerning DNS-SD. 2807 o removed inconsistency in RDAO text. 2809 o suggestions taken over from various sources 2811 o replaced "Function Set" with "REST API", "base URI", "base path" 2813 o moved simple registration to registration section 2815 changes from -08 to -09 2817 o clarified the "example use" of the base RD resource values /rd, 2818 /rd-lookup, and /rd-group. 2820 o changed "ins" ABNF notation. 2822 o various editorial improvements, including in examples 2824 o clarifications for RDAO 2826 changes from -07 to -08 2828 o removed link target value returned from domain and group lookup 2829 types 2831 o Maximum length of domain parameter 63 bytes for consistency with 2832 group 2834 o removed option for simple POST of link data, don't require a 2835 .well-known/core resource to accept POST data and handle it in a 2836 special way; we already have /rd for that 2838 o add IPv6 ND Option for discovery of an RD 2840 o clarify group configuration section 6.1 that endpoints must be 2841 registered before including them in a group 2843 o removed all superfluous client-server diagrams 2844 o simplified lighting example 2846 o introduced Commissioning Tool 2848 o RD-Look-up text is extended. 2850 changes from -06 to -07 2852 o added text in the discovery section to allow content format hints 2853 to be exposed in the discovery link attributes 2855 o editorial updates to section 9 2857 o update author information 2859 o minor text corrections 2861 Changes from -05 to -06 2863 o added note that the PATCH section is contingent on the progress of 2864 the PATCH method 2866 changes from -04 to -05 2868 o added Update Endpoint Links using PATCH 2870 o http access made explicit in interface specification 2872 o Added http examples 2874 Changes from -03 to -04: 2876 o Added http response codes 2878 o Clarified endpoint name usage 2880 o Add application/link-format+cbor content-format 2882 Changes from -02 to -03: 2884 o Added an example for lighting and DNS integration 2886 o Added an example for RD use in OMA LWM2M 2888 o Added Read Links operation for link inspection by endpoints 2890 o Expanded DNS-SD section 2891 o Added draft authors Peter van der Stok and Michael Koster 2893 Changes from -01 to -02: 2895 o Added a catalogue use case. 2897 o Changed the registration update to a POST with optional link 2898 format payload. Removed the endpoint type update from the update. 2900 o Additional examples section added for more complex use cases. 2902 o New DNS-SD mapping section. 2904 o Added text on endpoint identification and authentication. 2906 o Error code 4.04 added to Registration Update and Delete requests. 2908 o Made 63 bytes a SHOULD rather than a MUST for endpoint name and 2909 resource type parameters. 2911 Changes from -00 to -01: 2913 o Removed the ETag validation feature. 2915 o Place holder for the DNS-SD mapping section. 2917 o Explicitly disabled GET or POST on returned Location. 2919 o New registry for RD parameters. 2921 o Added support for the JSON Link Format. 2923 o Added reference to the Groupcomm WG draft. 2925 Changes from -05 to WG Document -00: 2927 o Updated the version and date. 2929 Changes from -04 to -05: 2931 o Restricted Update to parameter updates. 2933 o Added pagination support for the Lookup interface. 2935 o Minor editing, bug fixes and reference updates. 2937 o Added group support. 2939 o Changed rt to et for the registration and update interface. 2941 Changes from -03 to -04: 2943 o Added the ins= parameter back for the DNS-SD mapping. 2945 o Integrated the Simple Directory Discovery from Carsten. 2947 o Editorial improvements. 2949 o Fixed the use of ETags. 2951 o Fixed tickets 383 and 372 2953 Changes from -02 to -03: 2955 o Changed the endpoint name back to a single registration parameter 2956 ep= and removed the h= and ins= parameters. 2958 o Updated REST interface descriptions to use RFC6570 URI Template 2959 format. 2961 o Introduced an improved RD Lookup design as its own function set. 2963 o Improved the security considerations section. 2965 o Made the POST registration interface idempotent by requiring the 2966 ep= parameter to be present. 2968 Changes from -01 to -02: 2970 o Added a terminology section. 2972 o Changed the inclusion of an ETag in registration or update to a 2973 MAY. 2975 o Added the concept of an RD Domain and a registration parameter for 2976 it. 2978 o Recommended the Location returned from a registration to be 2979 stable, allowing for endpoint and Domain information to be changed 2980 during updates. 2982 o Changed the lookup interface to accept endpoint and Domain as 2983 query string parameters to control the scope of a lookup. 2985 13. References 2987 13.1. Normative References 2989 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2990 Requirement Levels", BCP 14, RFC 2119, 2991 DOI 10.17487/RFC2119, March 1997, 2992 . 2994 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 2995 Resource Identifier (URI): Generic Syntax", STD 66, 2996 RFC 3986, DOI 10.17487/RFC3986, January 2005, 2997 . 2999 [RFC6570] Gregorio, J., Fielding, R., Hadley, M., Nottingham, M., 3000 and D. Orchard, "URI Template", RFC 6570, 3001 DOI 10.17487/RFC6570, March 2012, 3002 . 3004 [RFC6690] Shelby, Z., "Constrained RESTful Environments (CoRE) Link 3005 Format", RFC 6690, DOI 10.17487/RFC6690, August 2012, 3006 . 3008 [RFC6763] Cheshire, S. and M. Krochmal, "DNS-Based Service 3009 Discovery", RFC 6763, DOI 10.17487/RFC6763, February 2013, 3010 . 3012 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 3013 Writing an IANA Considerations Section in RFCs", BCP 26, 3014 RFC 8126, DOI 10.17487/RFC8126, June 2017, 3015 . 3017 13.2. Informative References 3019 [ER] Chen, P., "The entity-relationship model---toward a 3020 unified view of data", ACM Transactions on Database 3021 Systems Vol. 1, pp. 9-36, DOI 10.1145/320434.320440, March 3022 1976. 3024 [I-D.bormann-t2trg-rel-impl] 3025 Bormann, C., "impl-info: A link relation type for 3026 disclosing implementation information", draft-bormann- 3027 t2trg-rel-impl-00 (work in progress), January 2018. 3029 [I-D.hartke-t2trg-coral] 3030 Hartke, K., "The Constrained RESTful Application Language 3031 (CoRAL)", draft-hartke-t2trg-coral-08 (work in progress), 3032 March 2019. 3034 [I-D.ietf-ace-oauth-authz] 3035 Seitz, L., Selander, G., Wahlstroem, E., Erdtman, S., and 3036 H. Tschofenig, "Authentication and Authorization for 3037 Constrained Environments (ACE) using the OAuth 2.0 3038 Framework (ACE-OAuth)", draft-ietf-ace-oauth-authz-24 3039 (work in progress), March 2019. 3041 [I-D.ietf-core-links-json] 3042 Li, K., Rahman, A., and C. Bormann, "Representing 3043 Constrained RESTful Environments (CoRE) Link Format in 3044 JSON and CBOR", draft-ietf-core-links-json-10 (work in 3045 progress), February 2018. 3047 [I-D.ietf-core-rd-dns-sd] 3048 Stok, P., Koster, M., and C. Amsuess, "CoRE Resource 3049 Directory: DNS-SD mapping", draft-ietf-core-rd-dns-sd-05 3050 (work in progress), July 2019. 3052 [I-D.silverajan-core-coap-protocol-negotiation] 3053 Silverajan, B. and M. Ocak, "CoAP Protocol Negotiation", 3054 draft-silverajan-core-coap-protocol-negotiation-09 (work 3055 in progress), July 2018. 3057 [RFC4944] Montenegro, G., Kushalnagar, N., Hui, J., and D. Culler, 3058 "Transmission of IPv6 Packets over IEEE 802.15.4 3059 Networks", RFC 4944, DOI 10.17487/RFC4944, September 2007, 3060 . 3062 [RFC6775] Shelby, Z., Ed., Chakrabarti, S., Nordmark, E., and C. 3063 Bormann, "Neighbor Discovery Optimization for IPv6 over 3064 Low-Power Wireless Personal Area Networks (6LoWPANs)", 3065 RFC 6775, DOI 10.17487/RFC6775, November 2012, 3066 . 3068 [RFC6874] Carpenter, B., Cheshire, S., and R. Hinden, "Representing 3069 IPv6 Zone Identifiers in Address Literals and Uniform 3070 Resource Identifiers", RFC 6874, DOI 10.17487/RFC6874, 3071 February 2013, . 3073 [RFC7228] Bormann, C., Ersue, M., and A. Keranen, "Terminology for 3074 Constrained-Node Networks", RFC 7228, 3075 DOI 10.17487/RFC7228, May 2014, 3076 . 3078 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 3079 Protocol (HTTP/1.1): Message Syntax and Routing", 3080 RFC 7230, DOI 10.17487/RFC7230, June 2014, 3081 . 3083 [RFC7252] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained 3084 Application Protocol (CoAP)", RFC 7252, 3085 DOI 10.17487/RFC7252, June 2014, 3086 . 3088 [RFC7390] Rahman, A., Ed. and E. Dijk, Ed., "Group Communication for 3089 the Constrained Application Protocol (CoAP)", RFC 7390, 3090 DOI 10.17487/RFC7390, October 2014, 3091 . 3093 [RFC7641] Hartke, K., "Observing Resources in the Constrained 3094 Application Protocol (CoAP)", RFC 7641, 3095 DOI 10.17487/RFC7641, September 2015, 3096 . 3098 [RFC8132] van der Stok, P., Bormann, C., and A. Sehgal, "PATCH and 3099 FETCH Methods for the Constrained Application Protocol 3100 (CoAP)", RFC 8132, DOI 10.17487/RFC8132, April 2017, 3101 . 3103 [RFC8288] Nottingham, M., "Web Linking", RFC 8288, 3104 DOI 10.17487/RFC8288, October 2017, 3105 . 3107 Appendix A. Groups Registration and Lookup 3109 The RD-Groups usage pattern allows announcing application groups 3110 inside a Resource Directory. 3112 Groups are represented by endpoint registrations. Their base address 3113 is a multicast address, and they SHOULD be entered with the endpoint 3114 type "core.rd-group". The endpoint name can also be referred to as a 3115 group name in this context. 3117 The registration is inserted into the RD by a Commissioning Tool, 3118 which might also be known as a group manager here. It performs third 3119 party registration and registration updates. 3121 The links it registers SHOULD be available on all members that join 3122 the group. Depending on the application, members that lack some 3123 resource MAY be permissible if requests to them fail gracefully. 3125 The following example shows a CT registering a group with the name 3126 "lights" which provides two resources. The directory resource path 3127 /rd is an example RD location discovered in a request similar to 3128 Figure 5. 3130 Req: POST coap://rd.example.com/rd?ep=lights&et=core.rd-group 3131 &base=coap://[ff35:30:2001:db8::1] 3132 Content-Format: 40 3133 Payload: 3134 ;rt="light";if="core.a", 3135 ;if="core.p";u="K" 3137 Res: 2.01 Created 3138 Location-Path: /rd/12 3140 Figure 27: Example registration of a group 3142 In this example, the group manager can easily permit devices that 3143 have no writable color-temperature to join, as they would still 3144 respond to brightness changing commands. Had the group instead 3145 contained a single resource that sets brightness and color 3146 temperature atomically, endpoints would need to support both 3147 properties. 3149 The resources of a group can be looked up like any other resource, 3150 and the group registrations (along with any additional registration 3151 parameters) can be looked up using the endpoint lookup interface. 3153 The following example shows a client performing and endpoint lookup 3154 for all groups. 3156 Req: GET /rd-lookup/ep?et=core.rd-group 3158 Res: 2.01 Content 3159 Payload: 3160 ;ep="GRP_R2-4-015";et="core.rd-group"; 3161 base="coap://[ff05::1]", 3162 ;ep=lights&et=core.rd-group; 3163 base="coap://[ff35:30:2001:db8::1]";rt="core.rd-ep" 3165 Figure 28: Example lookup of groups 3167 The following example shows a client performing a lookup of all 3168 resources of all endpoints (groups) with et=core.rd-group. 3170 Req: GET /rd-lookup/res?et=core.rd-group 3172 ;rt="light";if="core.a"; 3173 et="core.rd-group";anchor="coap://[ff35:30:2001:db8::1]", 3174 ;if="core.p";u="K"; 3175 et="core.rd-group"; 3176 anchor="coap://[ff35:30:2001:db8::1]" 3178 Figure 29: Example lookup of resources inside groups 3180 Appendix B. Web links and the Resource Directory 3182 Understanding the semantics of a link-format document and its URI 3183 references is a journey through different documents ([RFC3986] 3184 defining URIs, [RFC6690] defining link-format documents based on 3185 [RFC8288] which defines link headers, and [RFC7252] providing the 3186 transport). This appendix summarizes the mechanisms and semantics at 3187 play from an entry in ".well-known/core" to a resource lookup. 3189 This text is primarily aimed at people entering the field of 3190 Constrained Restful Environments from applications that previously 3191 did not use web mechanisms. 3193 The explanation of the steps makes some shortcuts in the more 3194 confusing details of [RFC6690], which are justified as all examples 3195 being in Limited Link Format. 3197 B.1. A simple example 3199 Let's start this example with a very simple host, "2001:db8:f0::1". 3200 A client that follows classical CoAP Discovery ([RFC7252] Section 7), 3201 sends the following multicast request to learn about neighbours 3202 supporting resources with resource-type "temperature". 3204 The client sends a link-local multicast: 3206 GET coap://[ff02::fd]:5683/.well-known/core?rt=temperature 3208 RES 2.05 Content 3209 ;rt=temperature;ct=0 3211 Figure 30: Example of direct resource discovery 3213 where the response is sent by the server, "[2001:db8:f0::1]:5683". 3215 While the client - on the practical or implementation side - can just 3216 go ahead and create a new request to "[2001:db8:f0::1]:5683" with 3217 Uri-Path: "temp", the full resolution steps for insertion into and 3218 retrieval from the RD without any shortcuts are: 3220 B.1.1. Resolving the URIs 3222 The client parses the single returned record. The link's target 3223 (sometimes called "href") is ""/temp"", which is a relative URI that 3224 needs resolving. The base URI is used to resolve the reference /temp against. 3227 The Base URI of the requested resource can be composed from the 3228 header options of the CoAP GET request by following the steps of 3229 [RFC7252] section 6.5 (with an addition at the end of 8.2) into 3230 ""coap://[2001:db8:f0::1]/.well-known/core"". 3232 Because ""/temp"" starts with a single slash, the record's target is 3233 resolved by replacing the path ""/.well-known/core"" from the Base 3234 URI (section 5.2 [RFC3986]) with the relative target URI ""/temp"" 3235 into ""coap://[2001:db8:f0::1]/temp"". 3237 B.1.2. Interpreting attributes and relations 3239 Some more information but the record's target can be obtained from 3240 the payload: the resource type of the target is "temperature", and 3241 its content format is text/plain (ct=0). 3243 A relation in a web link is a three-part statement that specifies a 3244 named relation between the so-called "context resource" and the 3245 target resource, like "_This page_ has _its table of contents_ at _/ 3246 toc.html_". In link format documents, there is an implicit "host 3247 relation" specified with default parameter: rel="hosts". 3249 In our example, the context resource of the link is the URI specified 3250 in the GET request "coap:://[2001:db8:f0::1]/.well-known/core". A 3251 full English expression of the "host relation" is: 3253 '"coap://[2001:db8:f0::1]/.well-known/core" is hosting the resource 3254 "coap://[2001:db8:f0::1]/temp", which is of the resource type 3255 "temperature" and can be accessed using the text/plain content 3256 format.' 3258 B.2. A slightly more complex example 3260 Omitting the "rt=temperature" filter, the discovery query would have 3261 given some more records in the payload: 3263 GET coap://[ff02::fd]:5683/.well-known/core 3265 RES 2.05 Content 3266 ;rt=temperature;ct=0, 3267 ;rt=light-lux;ct=0, 3268 ;anchor="/sensors/temp";rel=alternate, 3269 ;anchor="/temp"; 3270 rel="describedby" 3272 Figure 31: Extended example of direct resource discovery 3274 Parsing the third record, the client encounters the "anchor" 3275 parameter. It is a URI relative to the Base URI of the request and 3276 is thus resolved to ""coap://[2001:db8:f0::1]/sensors/temp"". That 3277 is the context resource of the link, so the "rel" statement is not 3278 about the target and the Base URI any more, but about the target and 3279 the resolved URI. Thus, the third record could be read as 3280 ""coap://[2001:db8:f0::1]/sensors/temp" has an alternate 3281 representation at "coap://[2001:db8:f0::1]/t"". 3283 Following the same resolution steps, the fourth record can be read as 3284 ""coap://[2001:db8:f0::1]/sensors/temp" is described by 3285 "http://www.example.com/sensors/t123"". 3287 B.3. Enter the Resource Directory 3289 The resource directory tries to carry the semantics obtainable by 3290 classical CoAP discovery over to the resource lookup interface as 3291 faithfully as possible. 3293 For the following queries, we will assume that the simple host has 3294 used Simple Registration to register at the resource directory that 3295 was announced to it, sending this request from its UDP port 3296 "[2001:db8:f0::1]:6553": 3298 POST coap://[2001:db8:f01::ff]/.well-known/core?ep=simple-host1 3300 Figure 32: Example request starting a simple registration 3302 The resource directory would have accepted the registration, and 3303 queried the simple host's ".well-known/core" by itself. As a result, 3304 the host is registered as an endpoint in the RD with the name 3305 "simple-host1". The registration is active for 90000 seconds, and 3306 the endpoint registration Base URI is ""coap://[2001:db8:f0::1]"" 3307 following the resolution steps described in Appendix B.1.1. It 3308 should be remarked that the Base URI constructed that way always 3309 yields a URI of the form: scheme://authority without path suffix. 3311 If the client now queries the RD as it would previously have issued a 3312 multicast request, it would go through the RD discovery steps by 3313 fetching "coap://[2001:db8:f0::ff]/.well-known/core?rt=core.rd- 3314 lookup-res", obtain "coap://[2001:db8:f0::ff]/rd-lookup/res" as the 3315 resource lookup endpoint, and issue a request to 3316 "coap://[2001:db8:f0::ff]/rd-lookup/res?rt=temperature" to receive 3317 the following data: 3319 ;rt=temperature;ct=0; 3320 anchor="coap://[2001:db8:f0::1]" 3322 Figure 33: Example payload of a response to a resource lookup 3324 This is not _literally_ the same response that it would have received 3325 from a multicast request, but it contains the equivalent statement: 3327 '"coap://[2001:db8:f0::1]" is hosting the resource 3328 "coap://[2001:db8:f0::1]/temp", which is of the resource type 3329 "temperature" and can be accessed using the text/plain content 3330 format.' 3332 (The difference is whether "/" or "/.well-known/core" hosts the 3333 resources, which does not matter in this application; if it did, the 3334 endpoint would have been more explicit. Actually, /.well-known/core 3335 does NOT host the resource but stores a URI reference to the 3336 resource.) 3338 To complete the examples, the client could also query all resources 3339 hosted at the endpoint with the known endpoint name "simple-host1". 3340 A request to "coap://[2001:db8:f0::ff]/rd-lookup/res?ep=simple-host1" 3341 would return 3343 ;rt=temperature;ct=0; 3344 anchor="coap://[2001:db8:f0::1]", 3345 ;rt=light-lux;ct=0; 3346 anchor="coap://[2001:db8:f0::1]", 3347 ; 3348 anchor="coap://[2001:db8:f0::1]/sensors/temp";rel=alternate, 3349 ; 3350 anchor="coap://[2001:db8:f0::1]/sensors/temp";rel="describedby" 3352 Figure 34: Extended example payload of a response to a resource 3353 lookup 3355 All the target and anchor references are already in absolute form 3356 there, which don't need to be resolved any further. 3358 Had the simple host done an equivalent full registration with a base= 3359 parameter (e.g. "?ep=simple-host1&base=coap+tcp://simple- 3360 host1.example.com"), that context would have been used to resolve the 3361 relative anchor values instead, giving 3363 ;rt=temperature;ct=0; 3364 anchor="coap+tcp://simple-host1.example.com" 3366 Figure 35: Example payload of a response to a resource lookup with a 3367 dedicated base URI 3369 and analogous records. 3371 B.4. A note on differences between link-format and Link headers 3373 While link-format and Link headers look very similar and are based on 3374 the same model of typed links, there are some differences between 3375 [RFC6690] and [RFC8288], which are dealt with differently: 3377 o "Resolving the target against the anchor": [RFC6690] Section 2.1 3378 states that the anchor of a link is used as the Base URI against 3379 which the term inside the angle brackets (the target) is resolved, 3380 falling back to the resource's URI with paths stripped off (its 3381 "Origin"). In contrast to that, [RFC8288] Section B.2 describes 3382 that the anchor is immaterial to the resolution of the target 3383 reference. 3385 RFC6690, in the same section, also states that absent anchors set 3386 the context of the link to the target's URI with its path stripped 3387 off, while according to [RFC8288] Section 3.2, the context is the 3388 resource's base URI. 3390 The rules introduced in Appendix C ensure that an RD does not need 3391 to deal with those differences when processing input data. Lookup 3392 results are required to be absolute references for the same 3393 reason. 3395 o There is no percent encoding in link-format documents. 3397 A link-format document is a UTF-8 encoded string of Unicode 3398 characters and does not have percent encoding, while Link headers 3399 are practically ASCII strings that use percent encoding for non- 3400 ASCII characters, stating the encoding explicitly when required. 3402 For example, while a Link header in a page about a Swedish city 3403 might read 3405 "Link: ;rel="live-environment-data"" 3406 a link-format document from the same source might describe the 3407 link as 3409 ";rel="live-environment-data"" 3411 Parsers and producers of link-format and header data need to be 3412 aware of this difference. 3414 Appendix C. Limited Link Format 3416 The CoRE Link Format as described in [RFC6690] has been interpreted 3417 differently by implementers, and a strict implementation rules out 3418 some use cases of a Resource Directory (e.g. base values with path 3419 components). 3421 This appendix describes a subset of link format documents called 3422 Limited Link Format. The rules herein are not very limiting in 3423 practice - all examples in RFC6690, and all deployments the authors 3424 are aware of already stick to them - but ease the implementation of 3425 resource directory servers. 3427 It is applicable to representations in the application/link-format 3428 media type, and any other media types that inherit [RFC6690] 3429 Section 2.1. 3431 A link format representation is in Limited Link format if, for each 3432 link in it, the following applies: 3434 o All URI references either follow the URI or the path-absolute ABNF 3435 rule of RFC3986 (i.e. target and anchor each either start with a 3436 scheme or with a single slash), 3438 o if the anchor reference starts with a scheme, the target reference 3439 starts with a scheme as well (i.e. relative references in target 3440 cannot be used when the anchor is a full URI), and 3442 o the application does not care whether links without an explicitly 3443 given anchor have the origin's "/" or "/.well-known/core" resource 3444 as their link context. 3446 Authors' Addresses 3447 Zach Shelby 3448 ARM 3449 150 Rose Orchard 3450 San Jose 95134 3451 USA 3453 Phone: +1-408-203-9434 3454 Email: zach.shelby@arm.com 3456 Michael Koster 3457 SmartThings 3458 665 Clyde Avenue 3459 Mountain View 94043 3460 USA 3462 Phone: +1-707-502-5136 3463 Email: Michael.Koster@smartthings.com 3465 Carsten Bormann 3466 Universitaet Bremen TZI 3467 Postfach 330440 3468 Bremen D-28359 3469 Germany 3471 Phone: +49-421-218-63921 3472 Email: cabo@tzi.org 3474 Peter van der Stok 3475 consultant 3477 Phone: +31-492474673 (Netherlands), +33-966015248 (France) 3478 Email: consultancy@vanderstok.org 3479 URI: www.vanderstok.org 3481 Christian Amsuess (editor) 3482 Hollandstr. 12/4 3483 1020 3484 Austria 3486 Phone: +43-664-9790639 3487 Email: christian@amsuess.com