22 Commits

Author SHA1 Message Date
Sebastian Schüller
c6609c83e3 dtls_debug.c: only enable _GNU_SOURCE for MinGW builds. 2024-05-13 10:17:15 +01:00
Achim Kraus
0e865aae7c dtls_debug.c: enable _GNU_SOURCE to prevent %zu error on MinGW build.
Signed-off-by: Achim Kraus <achim.kraus@cloudcoap.net>
2023-12-22 11:09:07 +01:00
Achim Kraus
f1d47d533b Fix includes for zephyr 3.2.99.
Signed-off-by: Achim Kraus <achim.kraus@cloudcoap.net>
2023-08-07 14:55:38 +02:00
Benjamin Valentin
ba830a3906 dtls_debug: mock dsrv_log() when NDEBUG is set
Setting NDEBUG already replaces dtls_dsrv_hexdump_log(), dtls_dsrv_log_addr()
etc with dummy implementations.

This extends this to also replace dsrv_log() and dtls_{get,set}_log_level()
with a no-op implementation.
2023-07-24 10:59:58 +02:00
Olaf Bergmann
d055d8d001 session.h: Move inclusion of string.h into .c files
string.h is required for memcmp() that is used in session.c and
dtls_debug.c. Therefore, the header file needs to be included
only in these two files.

Change-Id: I11db1c37a7cc13d8fa2826f6d3e38d3765f4a4ec
2023-07-22 15:19:13 +02:00
Jon Shallow
c84e36ff60 LwIP: Fix unused parameter compiler warnings
Signed-off-by: Jon Shallow <supjps-libcoap@jpshallow.com>
2022-10-26 13:02:38 +02:00
Jon Shallow
70a2b397af dtls_debug: Add in support for separate logging handler
Allow the application to define a log handler callback to use to provide
consistency in the logging output logic.

Signed-off-by: Jon Shallow <supjps-libcoap@jpshallow.com>
2022-10-26 13:00:29 +02:00
Jon Shallow
cd02cad6c3 LwIP: Support LwIP builds when NO_SYS = 1
Follow the model of how things are done for Contiki.

Set up a new WITH_LWIP_NO_SOCKET (which happens with NO_SYS = 1)
and use this when setting up addresses.

Add in platform specific for dtls_prng_lwip.c and lwip_platform.h

Update dtls_time.[ch] to handle LWIP version of time.

Code works for NO_SYS = 1 or NO_SYS = 0.

Signed-off-by: Jon Shallow <supjps-libcoap@jpshallow.com>
2022-10-21 16:30:16 +02:00
Jan Romann
9320251212 Add Windows support 2022-09-27 14:31:54 +02:00
Achim Kraus
16d3764191 Support zephyr.
Add initial support for zephyr.
Mutex is currently not supported, nor used.

Signed-off-by: Achim Kraus <achim.kraus@cloudcoap.net>
2022-07-08 14:51:05 +02:00
Achim Kraus
d7b94c0fe7 dtls_debug.c: fix minor bug with zero termination.
Providing a too small buffer may result in missing the zero termination.
This adds an assert to ensure, that the buffer is large enough.

Signed-off-by: Achim Kraus <achim.kraus@bosch.io>
2022-01-21 09:15:36 +01:00
Jon Shallow
a37ba81034 Use of -Wwrite-strings and -Wextra throw up compiler warnings
dtls.c:
Add in const for dtls_handshake_type_to_name()

dtls_debug.[ch]:

Add in const where appropriate for dsrv_log().
In addition, get dsrv_log() to check printf syntax.

sha2/sha2.c:

Re-order "const static" to "static const" and add in needed const.

Signed-off-by: Jon Shallow <supjps-libcoap@jpshallow.com>
2019-04-01 15:43:01 +01:00
Olaf Bergmann
84f1f4e3ca dtls_debug.c: removed pathologic use of NDEBUG
Change-Id: I4005b671fce0e27e028b6bc1d109e1a2bac3d88f
2018-04-13 11:13:20 +02:00
Olaf Bergmann
50b2fb5cd5 dtls_debug.[ch]: move helper functions to .c file
Some helper functions such as hexdump() were declared as empty
when the NDEBUG symbol was defined. To clean up the API, the
actual implementation now is moved from dtls_debug.h (were it
was inlined) to dtls_debug.c.

Change-Id: I465f35310e1c64eb59e122a06ae79880fa21aec1
2018-02-16 10:27:27 +01:00
Raul Fuentes
3993d52800 dtls_debug.[ch] Adding (void) lines and initial RIOT support
NOTE: RIOT OS own lines for debugging and print must be used
      in future patch.

Change-Id: I8733215fd0c649c02a4ecfd8587d1916f020f4b8
Signed-off-by: Raul Fuentes <ra.fuentes.sam@gmail.com>
Signed-off-by: Olaf Bergmann <bergmann@tzi.org>
2018-02-16 10:27:27 +01:00
Raul Fuentes
9e40ab6b11 dtls_debug.c: Removing trailing whitespace and adding (void) lines
Change-Id: Iacd6e2d53ca1429d98e9f06c2cf411b9a59d50ed
Signed-off-by: Raul Fuentes <ra.fuentes.sam@gmail.com>
2018-02-08 16:43:15 +01:00
Gaëtan Harter
43c7265e0b contiki: re-add dtls_package_name and dtls_package_version
Statically define PACKAGE_NAME and PACKAGE_VERSION in contiki platform header.
This will require maintaining them in addition to values in configure.ac.

Change-Id: I08948dfdb4ddeafeed273a917367ee5ad237df8f
Signed-off-by: Gaëtan Harter <gaetan.harter@inria.fr>
2017-03-01 13:55:56 +01:00
Olaf Bergmann
320c04b96d Fixes for compiler warnings
The code has been cleaned up to
1. provide proper prototypes for functions that take no arguments (void),
2. avoid signedness issues, and
3. provide missing cases for switch statements.

Change-Id: I9e84ddb9ef6594c374ad817330a43b22642ebb33
2017-03-01 13:32:14 +01:00
Olaf Bergmann
53756a6cd0 dtls_debug.c: fix output of IP addresses for Contiki
* UIP_CONF_IPV6 is now called NETSTACK_CONF_WITH_IPV6
* As sprintf() is used anyway when NDEBUG is not set, we can also
  use it for printing IPv4 addresses.

Change-Id: I91247ba0292c23a2e389a4a6a8f15c6204473b5f
2017-02-28 15:02:11 +01:00
Gaëtan Harter
080013fd2d contiki: work without running configure
When building with contiki, 'CONTIKI' is defined and is used to detect contiki.
Configure options can be configured with:

    DTLS_CONF_ECC, DTLS_CONF_PSK, DTLS_CONF_NDEBUG

All files now include 'tinydtls.h' instead of 'dtls_config.h'.

Change-Id: I9a558a7d6bd777656d7b29028852bfc08911b8b7
Signed-off-by: Gaëtan Harter <gaetan.harter@inria.fr>
2017-02-27 18:05:10 +01:00
Gaëtan Harter
c9adbab655 tinydtls.h: include dtls_config.h in tinydtls.h
Fixes dtls_config.h not visible in headers
Include dtls_config.h in tinydtls.h and include tinydtls.h in all necessary
headers.

Remaining headers do not use 'ifdef', but they may require it too.

Change-Id: I39c86dffc8bbc8bd7551e74386994f92f49d00ec
Signed-off-by: Gaëtan Harter <gaetan.harter@inria.fr>
2017-02-27 18:05:10 +01:00
Olaf Bergmann
f623c23ba4 renamed debug.[hc] to dtls_debug.[hc] to avoid naming conflicts 2016-03-08 12:47:11 +01:00