Document return value can be 0 for both being valid and returning on error.
Same is true for coap_encode_var_safe().
[Error should assert() by default]
Add new function coap_package_build() which returns "git describe --tags"
if available at library build time, else standard package version.
The value of "git describe --tags" is created at run time and passed in as
a compiler -D definition.
Update copyright end dates for updated files.
Aids tracking issues with the libcoap block handling logic to easily
differentiate when libcoap sends a response and when app handler is called
to send a response.
The interface description of coap_send_internal says that COAP_INVALID_MID
is returned in the case of errors. Presently, it, however, returns
"(coap_mid_t)bytes_written" in a special case. Accidentally,
bytes_written == -1 == COAP_INVALID_MID in this specific case, which is why
no problems occur in practice due to this. As a cosmetic fix, this commit
changes the return value to COAP_INVALID_MID.
Do not make it a hard error if mbedtls library exists, but the mbedtls
development environment is missing.
Just remove mbedtls support if this is the case.
Handle "separate" response types correctly.
Make proxy based traffic handling mode COAP_BLOCK_SINGLE_BODY to remove
complexities.
Rename proxy_message_handler() to proxy_response_handler() as it is a
response handler.
Build a dummy 'received' PDU for use with coap_add_data_large_response() in
proxy_response_handler() to be consistant across all uses of
coap_add_data_large_response().
Add appropriate resource_flags (so that NON can be used in observe) for
resources "async" and "example_data".
Include actual session address in the hash, not first 8 bytes of session.
Include actual option number in the hash, not the delta which may vary
if there are different non-cachable option across the payloads of a body.
Simplify token handling by having a state token for Block1 requests where the
top 16 bits are an incrementing request counter and the bottom 48 bits are the
base token.
Re-order struct coap_lg_crcv_t to reduce data space usage.
Track request method for Block2 requests.
Make coap_add_data_large_internal() a static function.
Make sure that lg_srcv is freed off when all PUT/POST data is in to
prevent next PUT/POST to same resource not getting correctly updated.
Add in additional handler coap_register_request_handler() in addition to
coap_register_handler() but now only refer to and use
coap_register_request_handler() to aid readability.
The new function coap_session_get_psk_identity() returns the given
session's psk_identity as provided during the handhake (for CoAP server)
or a session setup (for CoAP client).
Make the retrieval of PSK hint / key / identity items simpler, remove
duplicate coding, remove a set of memcpy() and handle all these internally
as coap_bin_const_t.
This removes the need for libcoap internally to allocate (potentially
limited) holding space for these items on the stack.
The respective (D)TLS interface modules then convert these items into
the format required for the underlying (D)TLS libraries.
If the underlying (D)TLS library indicates that there is insufficient
space for an item (defined by a max_len type parameter), then the item
is truncated to that size and a warning issued about the provided item
being too large for the underlying (D)TLS library.
The item access functions are now standalone, not indexed through
coap_context_t.
doc/module_api_wrap.h: New
Used to split modules into Application and Internal only.
include/coap/*.h:
Module (@defgroup) description put into group application_api or internal_api
as appropriate.
Add in @file information if missing.
src/*.c
Add in @file information.
Add in new ./configure options --enable-client-mode or
--enable-server-mode which by default are enabled.
If --disable-client-mode is set, then disable all the client specific code.
[ COAP_CLIENT_SUPPORT is not defined ]
If --disable-server-mode is set, then disable all the server specific code.
[ COAP_SERVER_SUPPORT is not defined ]
Functions and variables are only #ifdef'd out in the include/coap3/*_internal.h
files. They cannot be #ifdef'd out in the other include files as
COAP_CLIENT_SUPPORT and COAP_SERVER_SUPPORT are not available for application
compilations. The result of this is if, say, client only API functons are used
in a server application and COAP_CLIENT_SUPPORT is not defined, there will be
linking issues (missing functions). Providing stub functions unecessarily
increases the code size.
For coap-server, if it is able to provide proxy support, requires both
COAP_SERVER_SUPPORT and COAP_CLIENT_SUPPORT to set up the ongoing sessions.
So, the build environment deliberatly sets SERVER_CAN_PROXY=0 if
COAP_CLIENT_SUPPORT is not available to allow linking.
Some of the tests have to be disabled if COAP_SERVER_SUPPORT or
COAP_CLIENT_SUPPORT is not set.
Code size change indications
text data bss sum filename
155912 1728 12080 169720 libcoap-3-notls.a
138300 1728 12080 152108 libcoap-3-notls.a --disable-client-mode
106734 1632 10304 118670 libcoap-3-notls.a --disable-server-mode
180485 1733 12080 194298 libcoap-3-openssl.a
160306 1733 12080 174119 libcoap-3-openssl.a --disable-client-mode
125543 1637 10304 137484 libcoap-3-openssl.a --disable-server-mode
181755 1728 12080 195563 libcoap-3-gnutls.a
160972 1728 12080 174780 libcoap-3-gnutls.a --disable-client-mode
127178 1632 10304 139114 libcoap-3-gnutls.a --disable-server-mode
165879 1855 12128 179862 libcoap-3-tinydtls.a
147022 1855 12128 161005 libcoap-3-tinydtls.a --disable-client-mode
115618 1759 10352 127729 libcoap-3-tinydtls.a --disable-server-mode
171690 1728 13744 187162 libcoap-3-mbedtls.a
152099 1728 13712 167539 libcoap-3-mbedtls.a --disable-client-mode
118786 1632 11984 132402 libcoap-3-mbedtls.a --disable-server-mode