Files
libcoap/examples/lwip
Jon Shallow de1bc9f3cb LwIP: Add in support for client
New demo client app.

Update some of the memory sizes.
New coap_lwip_dump_memory_pools() to dump LwIP memory pool usage.

Add in logic to handle new client sessions.

New coap_io_process() to handle LwIP which can invoke a callback handler
to wait / timeout for the next input handler.
New coap_lwip_set_input_wait_handler() to define this handler.

Update coap_io_prepare_io() to handle LwIP.

Support re-use of pbuf for PDU re-transmissions.

Make sure that NSTART is correctly obeyed.

Build the client with client only libcoap code.

Build the server with server only libcoap code.

Update LwIP source to latest stable release.

Reserve memory for a response PDU.

New coap_lwip(3) man page.

Update directory structures for config files.

Update files contained in "make dist" and check lwip rebuilds
in the github workflows.
2022-09-22 10:14:48 +01:00
..
2022-09-22 10:14:48 +01:00
2022-09-22 10:14:48 +01:00
2022-09-22 10:14:48 +01:00
2022-09-22 10:14:48 +01:00
2022-09-22 10:14:48 +01:00
2022-09-22 10:14:48 +01:00
2022-09-22 10:14:48 +01:00
2022-09-22 10:14:48 +01:00
2022-09-22 10:14:48 +01:00
2022-09-22 10:14:48 +01:00

Example of libcoap running on lwIP
==================================

To run the server 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://192.168.113.2/.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 supports the "-v level" option where logging "level" can be 0 to 7.

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 `config/lwippools.h`.

To run the client example

    $ make
    $ sudo ./client

As this tries to connect to coap://libcoap.net/, the tap0 interface will need IP
forwarding enabled

    $ sudo sysctl -w net.ipv4.conf.default.forwarding=1

As well as the interface connecting to the internet will need a NAT rule to
masquerade the internal IP address (192.168.114.2) to the IP of the outgoing
interface (where eth0 is replaced by your public facing interface name)

    $ iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

The client supports the "-v level" option where logging "level" can be 0 to 7.
The client supports an optional parameter which is the CoAP URI to connect to
.e.g "coap://libcoap.net/.well-known/core".  The default
is "coap://libcoap.net/".