coap_send_impl() now decides if outbound data is passed to coap_dtls_send()
or to the registered network_send callback function.
For coap_send_confirmed() this implies that retransmitted PDUs are
passed to coap_dtls_send() as well, causing retransmissions on the
DTLS layer when the session is established. As long as the DTLS handshake
is not complete, coap_dtls_send() caches the outbound application data
for this particular PDU hence avoiding duplicate messages.
The example server creates a new endpoint for DTLS-secured traffic.
The secure endpoint is bound to the port number of the unsecure
port plus one (i.e. if the default port number 5683 is used for
cleartext CoAP traffic, the secure port is bound to 5684).
This server uses the credentials "Client_identity" as user name and
"secretPSK" as password for testing. DO NOT USE THIS FOR PRODUCTION.
An application can register a callback function of type
coap_event_handler_t that will be called by the library on certain
events. Currently, the DTLS implementation invokes coap_handle_event()
with session-specific events such as session close or
renegotiation.
The local endpoint object, peer address and data buffer address and
length now are passed as arguments to coap_handle_message(). This
change reverts a previous attempt to provide a more concise interface
for this function that hides the actual implementation-specific data.
As the DTLS implementation needs to deal with this implementation-
specific parts, it has to be made explicit, either by making the
packet abstraction public or passing the relevant parameters
explicitely to coap_handle_message(). As this has worked smoothly
before, this approach has been taken.
This change breaks the LWIP implementation (for now). It will be fixed
when integrating the DTLS code with LWIP in this branch.
coap_keystore.[hc] provides a simple data structure for managing
credentials to be used during DTLS handshake. Each coap_context_t
has its own keystore object that is independent of the actual
DTLS context. Applications can access the keystore during the
entire lifetime of the coap context. The existing implementation
is not thread-safe.
Making the posix sockets non-blocking was missing from coap_new_endpoint().
This wasn't much of a problem because recvmsg() was called only after
select() had indicated that data is available. Setting this flag explicitly
would also allow for peeking into the socket.
Endpoints will be attached to the context object using a new function
coap_attach_endpoint(). The sockfd component has been removed from
coap_context_t as it is accessible by the endpoint.
coap_endpoint_t has a new field 'context' that refers to the context
object the respective endpoint has been associated with, or NULL
if it is not attached to any context. An endpoint can be attached
to at least one context at a time.
This change introduces a new subtree in the library's directory structure.
Platform-specific code now should be placed into the corresponding directory
in src/platform/. To illustrate this, prng.h has been split into three
distinct files, one for each platform (contiki, lwip, posix) and moved into
the respective subdirectory.
When a client sends a GET request with Observe: 1, it must be removed from
the list of observers before the resource handler is called. Otherwise, it
will add an Observe option to its response.
The API version was missed to the 'Libs' entry in commit
45760a922d
We need the the correct API version in the *.pc file as pkgconfig can't
find the required libray without.
This example now uses LwIP release 1.4.1 as the devel branch seems
to have disappeared from the git repository. Moreover, we just do
a shallow clone so maybe the server does not kick us that often.
The new structure of libcoap allows to clone Contiki in a
subdirectory. The example build now uses Makefile to first clone
Contiki and then invoke Makefile.contiki for the actual build.
The TARGET is set to minimal-net by default but can be changed to
any other (tested) target.
Some configuration flags have been changed since Contiki version 3.
The Makefile.contiki for building a server example that uses libcoap
as a Contiki app has been fixed. The following builds now succeed:
make -f Makefile.contiki TARGET=minimal-net
make -f Makefile.contiki TARGET=econotag
make -f Makefile.contiki TARGET=mbxxx
When TESTS=yes is given, the scripts invokes the test driver from
the top build directory. Platform-specific actions hence must ensure
that they stay in that directory and keep the last exit code.
The build script invokes configure and make with different
parameters depending on the environment variables PLATFORM
and TESTS. PLATFORM currently must be one of 'posix', 'contiki', or
'lwip'. If TESTS is set to 'yes' or 'true', the option --enable-tests
will be passed to configure and tests/testdriver will be invoked
after configuration and make.