This update enables cross-compilation by specifying the option
--host to configure. For example, building libcoap with tinydtls
for raspberry pi now can be done as follows (given that you have
the required compiler; on Debian, apt-get install gcc-arm-linux-gnueabihf
should do):
git submodule update --init --recursive
./autogen.sh
./configure --host=arm-linux-gnueabihf --disable-shared --disable-documentation
make
The error that happen while cross compiling is quite logical if you
know what the check AC_FUNC_MALLOC is made for. The behavior isn't
really wrong (for me) because autoconf can't really test the created
code due it's for another platform. Some nice explanation about the
whole problem can be found here:
http://wiki.buici.com/xwiki/bin/view/Programing+C+and+C%2B%2B/Autoconf+and+RPL_MALLOC
As long as libcoap uses malloc from the libc we need a check for
the proper implementation for this cases. So removing AC_FUNC_MALLOC
isn't solving the problem. We need at least a check for a malloc
functionality which can be done by AC_CHECK_FUNC(S).
(cherry picked from commit 04d806fe4d)
When compiled without support for DTLS, coap_dtls.c contains a set
of dummy functions to make certain compilers and linkers happy. As
the function signature now differs from the prototype, the attribute
has been removed entirely (causing a set of warnings that report the
unused parameters.)
The new function coap_dtls_set_log_level() can be used to control
the logging facility of the underlying DTLS library. The argument's
semantics are defined by the library itself.
coap_dtls_get_log_level() returns the current log level of the
underlying DTLS library.
As automake processing prevents using makefile variables in prefixed
automake constructs such as *la_SOURCES, platform-specific locations
must be spelled out literally.
This fixes issue #30, see https://github.com/obgm/libcoap/issues/30
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.
As automake processing prevents using makefile variables in prefixed
automake constructs such as *la_SOURCES, platform-specific locations
must be spelled out literally.
This fixes issue #30, see https://github.com/obgm/libcoap/issues/30
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.