mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-06 09:42:54 +03:00
Changes: - Remove duplicate OBSERVE_PERSIST configuration block Improve example build: - Make virtual environment activation optional in Makefile - Remove --fresh flag unsupported in newer west versions - Copy mbedTLS config header to workspace include directory - Add TARGET check for mbedTLS before configuring include directories - Add mbedTLS linking to coap-3 target Add POSIX API support: - Enable CONFIG_POSIX_API=y in examples/zephyr - Replace direct Linux/Windows system calls with Zephyr POSIX API equivalents - Add Zephyr's sys_rand_get() to coap_prng_default() - Define missing network macros (IN_MULTICAST, IN6_IS_ADDR_MULTICAST, etc.) - Add FIONBIO and OPTVAL_T/OPTVAL_GT macro definitions for Zephyr - Add native Zephyr timing functions to replace missing mbedTLS timing support - Fix fd_set mapping using zephyr/net/socket_select.h - Exclude strnlen redefinition conflicts for Zephyr - Add proper IPv6 packet info and address mapped definitions (Patch) Add DNS resolution and net setup to example client: - Enable CONFIG_DNS_RESOLVER for hostname resolution - Add Linux networking setup instructions for native_sim board - Configure static IP gateway and DNS server (8.8.8.8) - Add DHCP vs static IP configuration documentation Co-authored-by: mrdeep1
Example of libcoap running in Zephyr
====================================
The Zephyr project environment needs to be pre-installed. By default, the
libcoap Makefile assumes that this is located at ~/zephyrproject .
To build the coap-client example, do
$ make
The executable gets built in ~/zephyrproject/zephyr/build/zephyr/zephyr.exe
which is then copied to coap-client .
For using the native_sim board using Linux, you may need to do something like
the following (ens32 is the external interface name)
$ sudo iptables -t nat -A POSTROUTING -o ens32 -j MASQUERADE
$ sudo sysctl -w net.ipv4.conf.all.forwarding=1
so that ./coap-client is able to get out onto the internet.