Wakaama (formerly liblwm2m) is an implementation of the Open Mobile Alliance's LightWeight M2M protocol (LWM2M).
Developers mailing list: https://dev.eclipse.org/mailman/listinfo/wakaama-dev
The only official release of Wakaama, version 1.0, is affected by various security issues (CVE-2019-9004, CVE-2021-41040).
Please use the most recent commit in the main branch. Release 1.0 is not supported anymore.
This work is dual-licensed under the Eclipse Public License v2.0 and Eclipse Distribution License v1.0.
SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
git clone https://github.com/eclipse/wakaama.git
When working on Wakaama itself, or intending to run the example client application, submodules must be checked out:
git clone --recurse-submodules https://github.com/eclipse/wakaama.git
Wakaama is a highly configurable library. It is built with CMake. Look at examples/server/CMakeLists.txt for an example of how to include it.
The different settings can be configured with CMake cache variables (e.g. cmake -DLOG_LEVEL=INFO
).
Wakaama supports multiple modes. At least one mode needs to be defined with CMake cache variables.
Wakaama supports additional client related options. These are only available if the client mode is enabled.
Please note: LwM2M version 1.0 is only supported by clients, while servers are backward compatible.
The following data formats are configurable for Wakaama:
The logging infrastructure can be configured with CMake cache variables (e.g. cmake -DWAKAAMA_LOG_LEVEL=INFO
).
If NONE
is chosen, the user of Wakaama needs to implement a custom transport layer. Check the available implementations for more information.
If NONE
is chosen, the user of Wakaama needs to implement a custom platform abstraction layer. Check the available POSIX implementation for more information.
Wakaama provides a simple CLI library. It can be enabled with:
On Ubuntu 24.04, used in CI, the dependencies can be installed as such:
apt install build-essential clang-format clang-format-18 clang-tools-18 cmake gcovr git libcunit1-dev ninja-build python3-pip
pip3 install -r tools/requirements-compliance.txt
For macOS the development dependencies can be installed as such:
brew install automake clang-format cmake cunit gcc gitlint gnu-getopt make ninja
New C code must be formatted with clang-format.
The style is based on the LLVM style, but with 4 instead of 2 spaces indentation and allowing for 120 instead of 80 characters per line.
To check if your code matches the expected style, the following commands are helpful:
git clang-format-18 --diff
: Show what needs to be changed to match the expected code stylegit clang-format-18
: Apply all needed changes directlygit clang-format-18 --commit main
: Fix code style for all changes since mainIf existing code gets reformatted, this must be done in a separate commit. Its commit id has to be added to the file
.git-blame-ignore-revs
and committed in yet another commit.
All CMake code must be formatted with cmake-format.
To check if your code matches the expected style, the following commands are helpful:
tools/ci/run_ci.sh --run-cmake-format
: Test all CMake files, print offending onescmake-format --in-place <unformatted-file>
: Apply all needed changes directly to To avoid unneeded load on the GitHub infrastructure, please consider running tools/ci/run_ci.sh --all
before pushing.
cd wakaama
tools/ci/run_ci.sh --run-build
pytest -v tests/integration
The examples can be enabled (or disabled) with the CMake cache variable WAKAAMA_ENABLE_EXAMPLES
(e.g.
cmake -DWAKAAMA_ENABLE_EXAMPLES=OFF
).
There are some example applications provided to test the server, client and bootstrap capabilities of Wakaama. The following recipes assume you are on a unix like platform and you have cmake and make installed.
cmake -S examples/server -B build-server
cmake --build build-server
./build-server/lwm2mserver [Options]
The lwm2mserver listens on UDP port 5683. It features a basic command line interface. Type 'help' for a list of supported commands.
Options are:
Usage: lwm2mserver [OPTION]
Launch a LWM2M server on localhost.
Options:
-4 Use IPv4 connection. Default: IPv6 connection
-l PORT Set the local UDP port of the Server. Default: 5683
-S BYTES CoAP block size. Options: 16, 32, 64, 128, 256, 512, 1024. Default: 1024
cmake -S examples/client -B build-client -DWAKAAMA_MODE_CLIENT=ON
cmake --build build-client
./build-client/lwm2mclient [Options]
Next to lwm2mclient a DTLS enabled variant named lwm2mclient_tinydtls gets built.
The lwm2mclient features nine LWM2M objects:
Test Object (id: 31024) with the following description:
Multiple
Object | ID | Instances | Mandatory |
Test | 31024 | Yes | No |
Resources:
Supported Multiple
Name | ID | Operations | Instances | Mandatory | Type | Range |
test | 1 | R/W | No | Yes | Integer | 0-255 |
exec | 2 | E | No | Yes | | |
dec | 3 | R/W | No | Yes | Float | |
The lwm2mclient opens UDP port 56830 and tries to register to a LWM2M Server at 127.0.0.1:5683. It features a basic command line interface. Type 'help' for a list of supported commands.
Options are:
Usage: lwm2mclient [OPTION]
Launch a LWM2M client.
Options:
-n NAME Set the endpoint name of the Client. Default: testlwm2mclient
-l PORT Set the local UDP port of the Client. Default: 56830
-h HOST Set the hostname of the LWM2M Server to connect to. Default: localhost
-p PORT Set the port of the LWM2M Server to connect to. Default: 5683
-4 Use IPv4 connection. Default: IPv6 connection
-t TIME Set the lifetime of the Client. Default: 300
-b Bootstrap requested.
-c Change battery level over time.
-S BYTES CoAP block size. Options: 16, 32, 64, 128, 256, 512, 1024. Default: 1024
Additional values for the lwm2mclient_tinydtls binary:
-i Set the device management or bootstrap server PSK identity. If not set use none secure mode
-s Set the device management or bootstrap server Pre-Shared-Key. If not set use none secure mode
To launch a bootstrap session:
./lwm2mclient -b
cmake -S examples/lightclient -B build-lightclient
cmake --build build-lightclient
./build-lightclient/lightclient [Options]
The lightclient is much simpler that the lwm2mclient and features only four LWM2M objects:
The lightclient does not feature any command-line interface.
Options are:
Usage: lwm2mclient [OPTION]
Launch a LWM2M client.
Options:
-n NAME Set the endpoint name of the Client. Default: testlightclient
-l PORT Set the local UDP port of the Client. Default: 56830
-4 Use IPv4 connection. Default: IPv6 connection
-S BYTES CoAP block size. Options: 16, 32, 64, 128, 256, 512, 1024. Default: 1024
cmake -S examples/bootstrap_server -B build-bootstrap
cmake --build build-bootstrap
./build-bootstrap/bootstrap_server [Options]
Refer to examples/bootstrap_server/README for more information.