mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-12 11:40:39 +03:00
.github/workflows/main.yml: Build all the cmake TLS variants. CMakeLists.txt: Add in missing file. examples/tiny.c: include/coap2/encode.h: Move COAP_PSEUDOFP_ENCODE_8_4 functions from encode.h to tiny.c. Fix COAP_PSEUDOFP_ENCODE_8_4_DOWN 'ls' ordering complaint. man/examples-code-check.c: Fix compile warning, allow 'Unused but set variables' in examples and set -Werror when compling the examples. examples/lwip/Makefile: Remove compilation option -fpack-struct
Example of libcoap running on lwIP
==================================
To run the example, do
$ make
$ sudo ./server
(and in a second terminal)
$ sudo ip a a dev tap0 192.168.113.1/24
and query `coap://192.168.113.2/time?ticks` with any coap tool,
or query `coap://[aaaa::1000]/.well-known/core`
This will
* download lwip and lwip-contrib from the upstream git sources
* build the server application
* run the server application, creating a virtual network device tap0 (unless
that exists)
* configure your network interface to make the server accessible.
* return the appropriate response from the server to the client.
The server creates a resource for 'time' with a query 'ticks'. This is
reported for `.well-known/core`. The work flow for adding more resources does
not differ from regular libcoap usage. If you seem to run out of memory
creating the resources, tweak the number of pre-allocated resources
in `include/coap/lwippools.h`.