CoAP
参考
IETF
RFC 7252 中文
coap.technology
www.rfc-base.org Constrained RESTful Environments (CoRE) Parameters
CoAP
RFC 7252 Constrained Application Protocol
“The Constrained Application Protocol (CoAP) is a specialized web transfer protocol for use with constrained nodes and constrained networks in the Internet of Things. The protocol is designed for machine-to-machine (M2M) applications such as smart energy and building automation.”
Specification
CoAP is specified in a Standards-Track RFC. RFCs that serve as Internet Standards Documents are generated by the IETF based on an extensive technical review and quality control process. These are meant to last.
涉及标准
- RFC 7252 The Constrained Application Protocol (CoAP)
- RFC7252 (CoAP, Core)
- RFC7641 (Observe)
- RFC7641 advanced transmission
- Blockwise Transfers
适用场景 特点 局限性
- 点对点通信
- 数据采集
- M2M
- 反向控制能力弱
- 无状态连接
- 遵循RESTful
- DTLS
CoAP占用资源
RFC 7228 Terminology for Constrained-Node Networks
- RAM:10KB
- ROM:100KB
CoAP 实现
-
wakaama http://www.eclipse.org/wakaama/
OMA Lightweight M2M C implementation designed to be portable on POSIX compliant systems -
libcoap https://libcoap.net/
C-Implementation of CoAP
libcoap implements a lightweight application-protocol for devices that are constrained their resources such as computing power, RF range, memory, bandwith, or network packet sizes -
microcoap https://github.com/1248/microcoap
A tiny CoAP server for microcontrollers
最精简实现,只有最简单的CoAP build dump,适用于单片机 -
lobaro-coap http://www.lobaro.com/portfolio/lobaro-coap/
Complete CoAP Implementation in C 完整的实现CoAP
The target audiance are experienced programmers with rich knowledge of the „C“ programming language.- Royalty-free CoAP stack
- complete request/response logic
- easy to use
- small memory footprint
- using C99 stdlib, suitable for embedded projects
- detached packet receive/send logic
- Arduino support (experimental)
DTLS
- tinydtls
tinydtls is a library for Datagram Transport Layer Security (DTLS) covering both the client and the server state machine. It is implemented in C and provides support for the mandatory cipher suites specified in CoAP.
COAP工具
为了测试代码的正确性,需要CoAP相关测试工具。
- CoAP-cli,一个基于NodeJS的CoAP命令行工具,其核心是基于Node-CoAP库。
- libcooap,一个用C写的CoAP命令行工具。
- FireFox Copper, 一个Firefox的插件。
- Wireshark,Wireshark 支持CoAP协议的解析器
REST model for small devices
server 提供可用的资源在一个URL下,client 使用四种方法获取GET, PUT, POST, and DELETE.
- GET
- PUT
- POST
- DELET
REST
web client 可以通过跨协议代理(CoAP HTTP)访问web资源和传感器资源,client不必关心资源到底是web提供还是传感器提供。