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
The syslog LOG_ definitions are defined in <syslog.h> and can be defined in
coap_debug.h (wrapped by a HAVE_SYSLOG_H wrapper to prevent duplicaton).
However, the coding order of
include <coap3/coap.h>
include <stdio.h
works, but
include <stdio.h
include <coap3/coap.h>
but fails if the application build environment does not define HAVE_SYSLOG_H
(as is the case of the examples in the examples/ directory).
The former "just" happens to work as the values of the variables are the same.
This fix is to remove the coap_log_t enum and replace it by simple #define
if LOG_ALERT etc. is not already defined.
Make coap_log_t int to remove Visual Studio compile warnings.
The pre-processor values COAP_DTLS_MAX_PSK and
COAP_DTLS_MAX_PSK_IDENTITY now can be set at build time. Both values
default to 64. Static buffer sizes in the TLS library wrappers are
adjusted accordingly.
Following transmission of a large body by a server using BLOCK2,
session->lg_xmit is not getting released. It does get released when the session
is freed off.
A client doing transmission of a large body idoes release session->lg_xmit.
Timeout lg_xmit after 4 * ACK_TIMEOUT seconds after final block is transmitted.
Remind users in the documentation that the full path defining the resource in
the uri_path parameter does not normally need a leading '/'.
E.g. It should be "full/path/for/resource", not "/full/path/for/resource".
This change adds 'SPDX-License-Identifier: BSD-2-Clause' [1] to
the source code files that originate in the libcoap project.
Note that not all files are tagged because they are pulled in
from other sources and thus may fall under a different license.
More information about these is contained in the LICENSE file.
[1] https://spdx.org/licenses/BSD-2-Clause.html
As it is not that intuitive when to use coap_send() or coap_send_large()
in applications, rename libcoap usage of coap_send() to coap_send_internal()
and then all usages of coap_send_large() to coap_send() so that only
coap_send() is required in applications.
Documentation updated accordingly.
'unknown' is updated by coap_option_check_critical if there is a critical
option, but as it is not passed in by reference, any caller does not see
any change to 'unknown'.
Pass in 'unknown' by reference.
Issue got missed in change e2e7830
The original requesting PDU is now kept with the Observe request along with
its data and used whenever an additional response needs to be generated.
Abstracted information from the requesting PDU is no longer kept in
coap_subscription_t as it can be obtained from the kept PDU.
No longer any need to check for request PDU in request handlers as it is now
always provided.
coap_resource_notify_observers() now ignores the query parameter, as a
cache_key is now used for request matching.
As the uthash macros have been moved to coap_resource_internal.h by
PR #582 [1], see commit da18643, the convenience macros and uthash.h
inclusion can be removed from resource.h
[1] https://github.com/obgm/libcoap/pull/582
This change removes a doxygen comment starter because doxygen is
getting confused otherwise because of the immediately preceding
documentation group start.
Move coap_pdu_t to coap_pdu_internal.h.
Move internal PDU based function definitions to coap_pdu_internal.h.
Replace most references to "struct coap_pdu_t" with "coap_pdu_t".
Create new enum coap_pdu_type_t, enum coap_pdu_code_t and coap_option_num_t,
using them where appropriate for clarity of documentation.
Provide new functions to allow applications to access/update parts of
coap_pdu_t as appropriate and document as appropriate.
Update examples to use these new access functions where appropriate.
The new configuration option --disable-async now allows to switch
of support for asynchronous operations.
The new function coap_async_is_supported() can be used to check
if the library was built with async support.
Move coap_socket_t and coap_packet_t to coap_io_internal.h.
Move internal io based function definitions to coap_io_internal.h.
Replace most references to "struct coap_socket_t" with "coap_socket_t" and
references to "struct coap_packet_t" with "coap_packet_t".