Update code to use new APIs
[Some code changes modelled on PR #202, some code being moved between files]
Remove #ifdef WITH_LWIP from coap_io.c as file is not used
Add in resource time to lwip
Update for Travis build
Report on Contiki memory allocate failures to ease debugging
Make the different memory type counts configurable by using the -D option
included in a CFLAGS definition to the ./configure command line
.travis.yml
BUILDING
Makefile.libcoap
examples/contiki/Makefile
examples/contiki/README new
examples/contiki/server.c
examples/contiki/.gitignore (new)
examples/lwip/Makefile
examples/lwip/README
examples/lwip/lwipopts.h
examples/lwip/server-coap.c
examples/lwip/server.c
include/coap/address.h
include/coap/coap_io.h
include/coap/lwippools.h
include/coap/pdu.h
scripts/build.sh
src/address.c
src/coap_io.c
src/coap_io_lwip.c
src/coap_session.c
src/mem.c
src/net.c
src/pdu.c
New struct coap_binary_t - same as coap_string_t, used for tokens
Deprecate struct str with the intent of removing it downstream as it
polutes namespace.
Make end of coap_string_t data a NUL.
Updated coap_make_str_const(), removing .length= and .s= to keep upstream
compilers happy.
Update Doxygen for str.h
Files:
examples/client.c
examples/coap-rd.c
examples/coap-server.c
examples/contiki/server.c
examples/etsi_iot_01.c
include/coap/resource.h
include/coap/str.h
include/coap/subscribe.h
man/coap_observe.txt.in
src/net.c
src/resource.c
src/str.c
src/uri.c
tests/test_options.c
Update
Update code / examples / man pages with the updated function.
include/coap/libcoap.h:
Add in new define COAP_DEPRECATED to generate compiler warnings when used
include/coap/encode.h
New coap_encode_var_safe() function that includes the size of the output
buffer as a parameter.
Make coap_encode_var_bytes() a wrapper for coap_encode_var_safe() and
mark it as COAP_DEPRECATED for backwards compatability
src/encode.c:
New coap_encode_var_safe() function that includes the size of the output
buffer as a parameter.
examples/coap-server.c:
examples/contiki/server.c:
Make the ticks resource consistent in case
The value of the observe option is kept for each resource rather than being global to the context.
The value of the observe option must wrap to be stay below 2^24.
The value of the observe option must be different from the initial value when a notification is sent.
The debug function for printing lladdress have been renamed and moved
to net-debug.h. This change now includes this header and uses the
appropriate macros instead.
uip_ds6_prefix_add is using 6 arguments, better use explicit argument
list than let the compiler decide. Some compiler will complain if some
optionally arguments are missed.
Directory examples/contiki now contains a small example server for
Contiki and a Makefile for platform minimal-net.
Build:
make contiki # clones Contiki
make server # creates the minimal-net coap server
Run:
Unfortunately, you have to run the server with sudo unless you
set CAP_NET_ADMIN for both, the server executable, and ifconfig
(sudo setcap cap_net_admin+pei ...).
sudo ./server
Then, add the server's interface address to the tap0 device and
optionally set a default route:
sudo ip -6 a a aaaa::1000 dev tap0
sudo ip -6 r a aaaa::/64 dev tap0
Although everything should work now, it does not. I had to send
router advertisements on tap0:
sudo radvd -C ./radvd.conf
Note that on Debian (and Ubuntu, and ...), radvd will not start
when IPv6 forwarding is disabled (which is usually the case on
end systems). Trying to enable like this did not work for me:
sudo sysctl -w net.ipv6.conf.tap0.forwarding=1
sudo sysctl -w net.ipv6.conf.tap0.mc_forwarding=1
Workaround (ugly): get the radvd sources, compile them and use that.