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).
Incoming messages are matched to nodes in the retransmission
queue by comparing a hash value over (message id, port, ip addr).
For IPv4, the entire sockaddr_in structure was compared which
is potentially wrong (see merge request #7 from Dag Björklund).
Hopefully, this fixes the encountered issue.
Usually, the block number can grow to 20 bits which is not
guaranteed to fit in a single unsigned int. To avoid compilers
(especially msp430-gcc) complaining about the width of the used
bit field, the type for num has been changed to unsigned int
hence restricting the number of acceptable blocks to 65536 on
those platforms. (No bounds check is done yet.)
m and szx now share a uint8_t.
Two new functions coap_malloc_type() and coap_free_type() have been
added to centralize the typed memory allocation for Contiki and LWIP.
Currently, calls to memb_alloc(), memp_malloc() and coap_malloc() are
distributed across several modules. The idea of the new functions is
to centralize memory management in one place (mem.c). coap_malloc()
and coap_free() are still available as wrappers for the new functions.
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).
This module defines a structure coap_endpoint_t that will be used to
identify the local interface for network I/O in libcoap. coap_endpoint_t
has an opaque handle and the local interface address. The tuple (handle,
address) uniquely identifies a virtual endpoint within a libcoap context.
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()).
In case the ACK of a separate message is lost, the request would be
retransmitted until the maximum number of transmissions is reached because
the response usually has a different messsage id. The matching at this
point is done based on the response's source address and token.