To normalize (and in preparation for manpages) the currently used files
for the example implementation of a CoAP based client, server and a
resource directory various files and variables are rename to coap-*.
With commit cda3b72 the migration to a fully Autotools controled build
environment was started which is now finished. The previous used *.in
files was renamed to *.in.old to hold some maybe usefull informations
from the old system. We don't need this renamed files any longer so kill
it with fire.
The build of the examples is complaining about a function that are not
inline'd. The compiler is mentioned this because we use the '-I'
directive for pointing to the header files. Just say the compiler also
that the header files are system headers so the false positive is going
away.
For POSIX, coap_tick_t is defined as unsigned long to support
timestamps in wallclock time. The rd uses ticks to make node
identifiers locally unique. As this is just one part of the
generated identifier, the timestamp's lower 32 bits are
sufficient.
After including the doc/ and the tests/ folder under the hood of the
autotools now adding the examples/ foolder too.
The user is now able to add the build of the example binarys if
configure is called with '--enable-examples' as option. The example
binarys will not be build by default!
Currently only 'coap-client', 'coap-server' and 'rd' is build.
* Removed tne preprocessor defines for coap_tick() and coap_clock_init() --
this made the code less readable and seemed to be of little use.
* Introduced the new type coap_time_t to represent wall clock time. On POSIX,
this is the number of seconds since the epoch, while on embedded systems
without a real time clock, this could be the number of seconds since the
last reboot. The new function coap_ticks_to_rt() is used to convert
coap_tick_t to coap_time.h. Currently, this is a division by COAP_TICKS_PER_SECOND
on all platforms.
* POSIX: coap_tick_t is now defined as unsigned long to avoid overflows in
coap_ticks().
The helper functions decode_segment() and check_segment() are private
functions in uri.c and thus should not be accessible from outside. For
simplicity, these functions have been copied to client.c.
Made vpath %.c point to ../../src and repaired include path.
The common part of the Makefile has been moved to Makefile.common
to leverage Makefile creation for other platforms such as econotag.
coap_insert() now appends every item at the list's end, sorting must
be done explicitly using LL_SORT. As a side-effect, the new
implementation makes valgrind happy :-)
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.
* resolve file resolution conflicts between lwip and libcoap in favor of
lwip by rearranging the makefile
* cover the config.h of a configured base libcoap with the local one
using the deprecated -I- gcc switch
* enable etharp (no idea why it wouldn't work ootb, the complete
server.c lwip-contrib copy needs to be reviewed)
* disable optimizations for easier debugging, enable -g3 for macro
expansions
This change contains a quick and dirty workaround for the following
bug that has been reported by Andrea Azzarà:
"When sending a file with a POST to a CoAP server, such as
./coap-client -m post coap://vs0.inf.ethz.ch:5683/large-create/ -b 64
-t 0 -f test
the M bit is not correctly set to 1."
Since the local_interface was added to the request handler callback,
the examples rd.c and etsi_iot_01.c were broken. This change fixes
rd.c and abandons etsi_iot_01.c (as it is very outdated).
Changed various functions to pass the local interface using the
new coap_endpoint_t abstraction. This change uses the functions
implemented earlier in commit 786ca6da (branch dcaf) but does not
use callback functions for network I/O.
This change closes bug #23 "server responds from wrong endpoint
(ipv6 address)" (POSIX only, CONTIKI and LWIP tbd).
Adding and removal of observes is now handled by libcoap. The application's
GET handler only needs to add the Observe option (see server.c:hnd_get_time()).
This new behavior is described in Section 4.6 of draft-ietf-core-observe-12.
The idea is to send a response with code 7.31 and the token to identify
the subscription.