Do not make reference to NDEBUG in public headers to modify the ABI. This macro is defined automatically in all windows projects and will create a lot of confusion.
Merge changes from PR #47 related to windows platform support.
Add full windows platform support including correct error checking and working regression tests and examples.
Remove need to build applications using libcoap with -DWITH_POSIX and to include coap_config.h. This applies to the examples as well.
As IN_MULTICAST does a 32 bit comparison in host byte order,
sin_addr.s_addr needs to be converted using ntohl(). This change
also moves the coap_is_mcast() implementation to address.c because
it has become too complex for inlining.
When the No-Response became RFC 7967, the numeric value was changed
to better reflect its characteristics. This modification fixes the
reference in the documentation the option value.
The documentation for Observe and Block1/Block2 referenced
outdated Internet Drafts which have become RFCs some time ago.
This change now mentions the correct RFC numbers.
Issue #37 [0] argued that coap_split_uri() should not change the
string that was passed as its first argument. The old behavior
was to normalize the scheme and the host part of the given URI by
converting both to lower case. This commit drops that normalization
step and leaves the original string as is. As a consequence,
implementations that employ virtual hosts now must canonicalize
the host part by themselves.
CAUTION: The constness is not (yet) reflected in the str components
of the result parameter of type coap_uri_t. Care must be taken not
to accidently change an immutable component of the coap_uri_t object.
[0] https://github.com/obgm/libcoap/issues/37
config includes can't be handled with the usual strictness ("No config
includes in public header files", notwithstanding discussion of whether
lwippools is one) because the lwip compilation unit for the memory pools
needs to know about the configured sizeof the various CoAP objects.
The include is not required, as the `struct ud_pcb *` pointer doesn't
require the struct to be known yet, but caused trouble when the include
led to an inclusion loop back again to libcoap via the lwippools. (The
loop was caught by include guards and caused undeclared type errors
because the later parts of the headers were not yet processed).
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.
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.
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.