[RFC] Zephyr IoT Protocols
Flavio Santes <flavio.santes@...>
[RFC] Zephyr IoT Protocols
Currently, Zephyr does not support any machine-to-machine protocol
(M2M). These protocols were defined for inter-communication between
devices or nodes in a constrained networking environment .
Aim and scope
This document proposes the integration of M2M protocols to Zephyr.
Specifically, we are interested in the following protocols:
CoAP , LightweightM2M (LWM2M) , MQTT  and MQTT-SN .
State of the art
LWM2M is a device-management protocol frequently used on the top of
CoAP. CoAP requires UDP as a transport protocol. Optionally, CoAP may
use DTLS (on the top of UDP) for securing communications between
On the other hand, MQTT, a publish-subscribe messaging protocol,
requires TCP as a transport protocol and may use TLS to create a secure
A lightweight version of MQTT for sensor networks (MQTT-SN) can be
deployed in almost any kind of network and it doesn't require any
specific transport protocol. MQTT-SN was created with short-range
wireless networks in mind. However, MQTT-SN can be used with wired or
Support for short-range wireless communications in Zephyr is present
via Bluetooth. Furthermore, the Zephyr's TCP/IP stack only offers UDP.
So far, TCP is work in progress. Zephyr offers a networking security
layer by means of DTLS.
LWM2M + CoAP (wakaama)
A plain C BSD-licensed implementation of LWM2M is available at .
MQTT client library
A client-side plain C implementation, licensed under the Eclipse
Public License .
MQTT client full implementation
Project Paho provides a full implementation in C++ licensed under
the Eclipse Public License .
C library licensed under the Eclipse Public License .
Integrating M2M protocols with Zephyr
MQTT relies on TCP as a transport protocol, and this could be an
stopper. So far, there is no evidence of any other inconvenience for
integrating LWM2M, CoAP and MQTT-SN.
The integration of the M2M protocols could fit into the lib/m2m
directory (to be created), generating a directory per protocol:
MQTT-SN can be the first protocol added to Zephyr, given the few
dependencies involved in its development and testing. We can continue
with CoAP/LWM2M and finally with MQTT. However, it's not clear if the
Zephyr's licenses are compatible with the Eclipse Public License, so
this could be a stopper (we can always write the code from scratch if
this license is incompatible with Zephyr's).
 Terminology for Constrained-Node Networks
C. Bormann, et al.
 OMA Lightweight M2M (LWM2M) protocol
Open Mobile Alliance
 The Constrained Application Protocol (CoAP)
Z. Shelby, et al.
 MQTT Version 3.1.1
Andrew Banks and Rahul Gupta
 MQTT For Sensor Networks Protocol Specification Version 1.2
Andy Stanford-Clark and Hong Linh Truong
 LWM2M implementation - Wakaama Project
 MQTT C client - Eclipse Paho
 MQTT C/C++ Embedded clients - Eclipse Paho
 MQTT-SN - Eclipse Paho