Skip to main content

12. IANA Considerations (IANA考虑)

本规范为CoAP定义了几个新的IANA注册表:

12.1. CoAP Code Registries (CoAP代码注册表)

IANA维护CoAP方法码和响应码的注册表.

12.1.1. Method Codes (方法码)

初始注册包括:

  • 0.01 GET
  • 0.02 POST
  • 0.03 PUT
  • 0.04 DELETE

12.1.2. Response Codes (响应码)

响应码分为三类:

  • 2.xx Success (成功): 2.01 Created, 2.02 Deleted, 2.03 Valid, 2.04 Changed, 2.05 Content
  • 4.xx Client Error (客户端错误): 4.00 Bad Request, 4.01 Unauthorized, 4.02 Bad Option, 4.03 Forbidden, 4.04 Not Found, 4.05 Method Not Allowed, 4.06 Not Acceptable, 4.12 Precondition Failed, 4.13 Request Entity Too Large, 4.15 Unsupported Content-Format
  • 5.xx Server Error (服务器错误): 5.00 Internal Server Error, 5.01 Not Implemented, 5.02 Bad Gateway, 5.03 Service Unavailable, 5.04 Gateway Timeout, 5.05 Proxying Not Supported

12.2. CoAP Option Numbers Registry (CoAP选项编号注册表)

IANA维护CoAP选项编号的注册表, 包括:

  • 1: If-Match
  • 3: Uri-Host
  • 4: ETag
  • 5: If-None-Match
  • 7: Uri-Port
  • 8: Location-Path
  • 11: Uri-Path
  • 12: Content-Format
  • 14: Max-Age
  • 15: Uri-Query
  • 17: Accept
  • 20: Location-Query
  • 35: Proxy-Uri
  • 39: Proxy-Scheme
  • 60: Size1

12.3. CoAP Content-Formats Registry (CoAP内容格式注册表)

定义了常见媒体类型的数字标识符, 例如:

  • 0: text/plain;charset=utf-8
  • 40: application/link-format
  • 41: application/xml
  • 42: application/octet-stream
  • 47: application/exi
  • 50: application/json

12.4-12.8. URI和端口注册

包括:

  • coap和coaps URI方案注册
  • CoAP和CoAPs的服务名称和端口号注册 (5683和5684)
  • 组播地址注册

这些注册表确保CoAP实现之间的互操作性, 并为协议的未来扩展提供了框架.