跳到主要内容

12. IANA 考虑

12.1. CoAP Code 注册表​

本文档在 "Constrained RESTful Environments (CoRE) Parameters" 注册表中为 CoAP header 的 Code 字段值定义两个子注册表, 下文称为 "CoRE Parameters" 注册表.

两个子注册表中的值是 8-bit 值, 记为三位十进制数字 c.dd, 第一位和第二位之间以句点分隔. 第一位 c 位于 0 到 7 之间, 表示 code class. 第二位和第三位 dd 表示 00 到 31 之间的十进制 detail.

所有 Code 值按以下范围由子注册表分配:

0.00 指示 Empty message (见 Section 4.1).

0.01-0.31 指示请求. 该范围内的值由 "CoAP Method Codes" 子注册表分配 (见 Section 12.1.1).

1.00-1.31 Reserved

2.00-5.31 指示响应. 该范围内的值由 "CoAP Response Codes" 子注册表分配 (见 Section 12.1.2).

6.00-7.31 Reserved

12.1.1. Method Codes​

子注册表名称为 "CoAP Method Codes".

子注册表中的每个条目必须包含 0.01-0.31 范围内的 Method Code, 方法名称, 以及方法文档的引用.

该子注册表的初始条目如下:

                   +------+--------+-----------+
| Code | Name | Reference |
+------+--------+-----------+
| 0.01 | GET | [RFC7252] |
| 0.02 | POST | [RFC7252] |
| 0.03 | PUT | [RFC7252] |
| 0.04 | DELETE | [RFC7252] |
+------+--------+-----------+

Table 5: CoAP Method Codes

所有其他 Method Codes 均为 Unassigned.

未来向该子注册表新增条目的 IANA 策略为 [RFC5226] 中描述的 "IETF Review or IESG Approval".

Method Code 的文档应规定带有该 code 的请求语义, 包括以下属性:

o 该方法在成功情况下返回的 Response Codes.

o 该方法是否 idempotent, safe, 或二者皆是.

12.1.2. Response Codes​

子注册表名称为 "CoAP Response Codes".

子注册表中的每个条目必须包含 2.00-5.31 范围内的 Response Code, Response Code 描述, 以及 Response Code 文档的引用.

该子注册表的初始条目如下:

        +------+------------------------------+-----------+
| Code | Description | Reference |
+------+------------------------------+-----------+
| 2.01 | Created | [RFC7252] |
| 2.02 | Deleted | [RFC7252] |
| 2.03 | Valid | [RFC7252] |
| 2.04 | Changed | [RFC7252] |
| 2.05 | Content | [RFC7252] |
| 4.00 | Bad Request | [RFC7252] |
| 4.01 | Unauthorized | [RFC7252] |
| 4.02 | Bad Option | [RFC7252] |
| 4.03 | Forbidden | [RFC7252] |
| 4.04 | Not Found | [RFC7252] |
| 4.05 | Method Not Allowed | [RFC7252] |
| 4.06 | Not Acceptable | [RFC7252] |
| 4.12 | Precondition Failed | [RFC7252] |
| 4.13 | Request Entity Too Large | [RFC7252] |
| 4.15 | Unsupported Content-Format | [RFC7252] |
| 5.00 | Internal Server Error | [RFC7252] |
| 5.01 | Not Implemented | [RFC7252] |
| 5.02 | Bad Gateway | [RFC7252] |
| 5.03 | Service Unavailable | [RFC7252] |
| 5.04 | Gateway Timeout | [RFC7252] |
| 5.05 | Proxying Not Supported | [RFC7252] |
+------+------------------------------+-----------+

Table 6: CoAP Response Codes

Response Codes 3.00-3.31 Reserved for future use. 所有其他 Response Codes 均为 Unassigned.

未来向该子注册表新增条目的 IANA 策略为 [RFC5226] 中描述的 "IETF Review or IESG Approval".

Response Code 的文档应规定带有该 code 的响应语义, 包括以下属性:

o 该 Response Code 适用的方法.

o payload 是 required, optional, 还是 not allowed.

o payload 的语义. 例如, 2.05 (Content) 响应的 payload 是目标资源的表示. 错误响应中的 payload 是 human-readable diagnostic payload.

o payload 的格式. 例如, 2.05 (Content) 响应中的格式由 Content-Format Option 指示. 错误响应中的 payload 格式始终为 Net-Unicode text.

o 根据 freshness model, 响应是否可缓存.

o 根据 validation model, 响应是否可验证.

o 响应是否导致缓存将为 request URI 存储的响应标记为不新鲜.

12.2. CoAP Option Numbers 注册表​

本文档在 "CoRE Parameters" 注册表中为 CoAP options 使用的 Option Numbers 定义一个子注册表. 子注册表名称为 "CoAP Option Numbers".

子注册表中的每个条目必须包含 Option Number, option 名称, 以及 option 文档的引用.

该子注册表的初始条目如下:

             +--------+------------------+-----------+
| Number | Name | Reference |
+--------+------------------+-----------+
| 0 | (Reserved) | [RFC7252] |
| 1 | If-Match | [RFC7252] |
| 3 | Uri-Host | [RFC7252] |
| 4 | ETag | [RFC7252] |
| 5 | If-None-Match | [RFC7252] |
| 7 | Uri-Port | [RFC7252] |
| 8 | Location-Path | [RFC7252] |
| 11 | Uri-Path | [RFC7252] |
| 12 | Content-Format | [RFC7252] |
| 14 | Max-Age | [RFC7252] |
| 15 | Uri-Query | [RFC7252] |
| 17 | Accept | [RFC7252] |
| 20 | Location-Query | [RFC7252] |
| 35 | Proxy-Uri | [RFC7252] |
| 39 | Proxy-Scheme | [RFC7252] |
| 60 | Size1 | [RFC7252] |
| 128 | (Reserved) | [RFC7252] |
| 132 | (Reserved) | [RFC7252] |
| 136 | (Reserved) | [RFC7252] |
| 140 | (Reserved) | [RFC7252] |
+--------+------------------+-----------+

Table 7: CoAP Option Numbers

未来向该子注册表新增条目的 IANA 策略分为三层. 0..255 范围保留给 IETF 定义的 options (IETF Review or IESG Approval). 256..2047 范围保留给具有公开规范的常用 options (Specification Required). 2048..64999 范围用于所有其他 options, 包括私有或供应商特定 options, 并经过 Designated Expert review 以帮助确保 option 语义被正确定义. 65000 到 65535 (含) 之间的 option numbers 保留用于实验. 它们不用于任何形式的供应商特定用途, 并且 MUST NOT 用于运行部署.

      +-------------+---------------------------------------+
| Range | Registration Procedures |
+-------------+---------------------------------------+
| 0-255 | IETF Review or IESG Approval |
| 256-2047 | Specification Required |
| 2048-64999 | Expert Review |
| 65000-65535 | Experimental use (no operational use) |
+-------------+---------------------------------------+

Table 8: CoAP Option Numbers: Registration Procedures

Option Number 的文档应规定具有该 number 的 option 语义, 包括以下属性:

o option 在请求中的含义.

o option 在响应中的含义.

o option 是 critical 还是 elective, 由 Option Number 决定.

o option 是否 Safe-to-Forward, 如果是, 它是否属于 Cache-Key, 由 Option Number 决定 (见 Section 5.4.2).

o option 值的格式和长度.

o option 是否最多只能出现一次, 或是否可以出现多次.

o 默认值, 如果有. 对于具有默认值的 critical option, 应讨论该默认值如何让不支持该 critical option 的实现进行处理 (Section 5.4.4).

12.3. CoAP Content-Formats 注册表​

Internet media types 由字符串标识, 例如 "application/xml" [RFC2046]. 为了最小化使用这些 media types 指示 payload 格式的开销, 本文档为 CoAP 中使用的 Internet media types 子集定义一个子注册表, 并为每个 media type 与 content-coding 的组合分配一个数值标识符. 子注册表名称为 "CoAP Content-Formats", 位于 "CoRE Parameters" 注册表内.

子注册表中的每个条目必须包含向 IANA 注册的 media type, CoAP 中用于该 media type 的 0-65535 范围内数值标识符, 与该标识符关联的 content-coding, 以及描述带有该 media type 的 payload 在语义上含义的文档引用.

CoAP 不包含用于在请求或响应中单独传递 content-encoding 信息的方式. 因此, 每个标识符也指定 content-encoding (如果有). 如果一个 media type 将使用多个 content-encodings, 则要为每个 content-encoding 注册单独的 Content-Format identifier. 类似地, 与 Internet media type 相关的其他参数, 例如 level, 也可以为 CoAP Content-Format 条目定义.

该子注册表的初始条目如下:

+--------------------------+----------+----+------------------------+ | Media type | Encoding | ID | Reference | +--------------------------+----------+----+------------------------+ | text/plain; | - | 0 | [RFC2046] [RFC3676] | | charset=utf-8 | | | [RFC5147] | | application/link-format | - | 40 | [RFC6690] | | application/xml | - | 41 | [RFC3023] | | application/octet-stream | - | 42 | [RFC2045] [RFC2046] | | application/exi | - | 47 | [REC-exi-20140211] | | application/json | - | 50 | [RFC7159] | +--------------------------+----------+----+------------------------+

                   Table 9: CoAP Content-Formats

65000 到 65535 (含) 之间的 identifiers 保留用于实验. 它们不用于任何形式的供应商特定用途, 并且 MUST NOT 用于运行部署. 256 到 9999 之间的 identifiers 保留用于未来的 IETF 规范 (IETF Review or IESG Approval). 所有其他 identifiers 均为 Unassigned.

由于 single-byte identifiers 的命名空间很小, 未来向该子注册表 0-255 (含) 范围新增条目的 IANA 策略为 [RFC5226] 中描述的 "Expert Review". 10000-64999 (含) 范围新增条目的 IANA 策略为 [RFC5226] 中描述的 "First Come First Served". 下表对此作出总结.

      +-------------+---------------------------------------+
| Range | Registration Procedures |
+-------------+---------------------------------------+
| 0-255 | Expert Review |
| 256-9999 | IETF Review or IESG Approval |
| 10000-64999 | First Come First Served |
| 65000-65535 | Experimental use (no operational use) |
+-------------+---------------------------------------+

Table 10: CoAP Content-Formats: Registration Procedures

在机器到机器应用中, 长期来看, text/plain, application/xml 或 application/octet-stream 这类通用 Internet media types 不太可能对真实应用有用. 建议使用 CoAP 的 M2M 应用向 IANA 请求新的 Internet media types, 以指示关于如何创建或解析 payload 的语义信息. 例如, 以 XML 承载的 Smart Energy 应用 payload 可能请求更具体的类型, 如 application/se+xml 或 application/se-exi.

12.4. URI Scheme 注册​

本文档包含注册 Uniform Resource Identifier (URI) scheme "coap" 的请求. 该注册请求符合 [RFC4395].

URI scheme name. coap

Status. Permanent.

URI scheme syntax. Defined in Section 6.1 of [RFC7252].

URI scheme semantics. "coap" URI scheme 提供一种标识可能可通过 Constrained Application Protocol (CoAP) 访问的资源的方式. 可以通过联系管辖该资源的 CoAP 服务器来定位资源, 并通过向该服务器发送 CoAP 请求来对资源执行操作. 因此, 该 scheme 可与 "http" URI scheme [RFC2616] 相比较. 操作细节见 [RFC7252] Section 6.

Encoding considerations. 该 scheme 编码符合 [RFC3986] 中为 URIs 建立的编码规则, 即 internationalized 和 reserved characters 使用基于 UTF-8 的 percent-encoding 表达.

Applications/protocols that use this URI scheme name. 该 scheme 由 CoAP 端点用于访问 CoAP 资源.

Interoperability considerations. None.

Security considerations. See Section 11.1 of [RFC7252].

Contact. IETF Chair [email protected]

Author/Change controller. IESG [email protected]

References. [RFC7252]

12.5. 安全 URI Scheme 注册​

本文档包含注册 Uniform Resource Identifier (URI) scheme "coaps" 的请求. 该注册请求符合 [RFC4395].

URI scheme name. coaps

Status. Permanent.

URI scheme syntax. Defined in Section 6.2 of [RFC7252].

URI scheme semantics. "coaps" URI scheme 提供一种标识可能可通过 Constrained Application Protocol (CoAP) 访问的资源的方式, 其中使用 Datagram Transport Layer Security (DTLS) 提供传输安全. 可以通过联系管辖该资源的 CoAP 服务器来定位资源, 并通过向该服务器发送 CoAP 请求来对资源执行操作. 因此, 该 scheme 可与 "https" URI scheme [RFC2616] 相比较. 操作细节见 [RFC7252] Section 6.

Encoding considerations. 该 scheme 编码符合 [RFC3986] 中为 URIs 建立的编码规则, 即 internationalized 和 reserved characters 使用基于 UTF-8 的 percent-encoding 表达.

Applications/protocols that use this URI scheme name. 该 scheme 由 CoAP 端点用于通过 DTLS 访问 CoAP 资源.

Interoperability considerations. None.

Security considerations. See Section 11.1 of [RFC7252].

Contact. IETF Chair [email protected]

Author/Change controller. IESG [email protected]

References. [RFC7252]

12.6. 服务名称和端口号注册​

CoAP 的功能之一是 resource discovery: CoAP 客户端可以询问 CoAP 服务器它所提供的资源 (见 Section 7). 为了仅基于 IP 地址知识启用 resource discovery, 用于 resource discovery 的 CoAP 端口需要标准化.

IANA 已根据 [RFC6335] 分配端口号 5683 和服务名称 "coap".

除单播外, CoAP 还可以与组播和任播一起使用.

Service Name. coap

Transport Protocol. udp

Assignee. IESG [email protected]

Contact. IETF Chair [email protected]

Description. Constrained Application Protocol (CoAP)

Reference. [RFC7252]

Port Number. 5683

12.7. 安全服务名称和端口号注册​

CoAP resource discovery 也可以使用由 DTLS 保护的 CoAP "coaps" scheme 提供. 因此, 用于安全 resource discovery 的 CoAP 端口需要标准化.

IANA 已根据 [RFC6335] 分配端口号 5684 和服务名称 "coaps".

除单播外, DTLS-secured CoAP 还可以与任播一起使用.

Service Name. coaps

Transport Protocol. udp

Assignee. IESG [email protected]

Contact. IETF Chair [email protected]

Description. DTLS-secured CoAP

Reference. [RFC7252]

Port Number. 5684

12.8. 组播地址注册​

Section 8, "Multicast CoAP", 定义了组播的使用. IANA 已为 CoAP 节点使用分配以下组播地址:

IPv4 -- "All CoAP Nodes" address 224.0.1.187, 来自 "IPv4 Multicast Address Space Registry". 由于该地址用于可能跨越单个网络之外的发现, 它来自 Internetwork Control Block (224.0.1.x, RFC 5771).

IPv6 -- "All CoAP Nodes" address FF0X::FD, 来自 "IPv6 Multicast Address Space Registry", 位于 "Variable Scope Multicast Addresses" 空间 (RFC 3307). 注意, 对于感兴趣的 CoAP 节点应监听的每个 scope, 都有一个不同的组播地址. CoAP 只需要 Link-Local 和 Site-Local scopes.