diff --git a/sys/include/net/sock/dtls.h b/sys/include/net/sock/dtls.h index fa9a8d7061..1d64351443 100644 --- a/sys/include/net/sock/dtls.h +++ b/sys/include/net/sock/dtls.h @@ -491,13 +491,35 @@ extern "C" { #endif +/** + * @defgroup net_sock_dtls_conf SOCK DTLS compile configuration + * @ingroup net_sock_conf + * @{ + */ +/** + * @brief Default buffer size for DTLS handshake (as exponent of 2^n) + * + * As the buffer size ALWAYS needs to be power of two, this option represents + * the exponent of 2^n, which will be used as the size of the buffer + * ( @ref DTLS_HANDSHAKE_BUFSIZE ). + * + */ +#ifndef CONFIG_DTLS_HANDSHAKE_BUFSIZE_EXP +#define CONFIG_DTLS_HANDSHAKE_BUFSIZE_EXP 8 +#endif +/** @} */ + +/** + * @brief Size buffer used in handshake to hold credentials + */ #ifndef DTLS_HANDSHAKE_BUFSIZE -#define DTLS_HANDSHAKE_BUFSIZE (256) /**< Size buffer used in handshake to - hold credentials */ +#define DTLS_HANDSHAKE_BUFSIZE (1 << CONFIG_DTLS_HANDSHAKE_BUFSIZE_EXP) #endif -#define SOCK_DTLS_HANDSHAKE (EXDEV) /**< Return value for a successful - handshake */ +/** + * @brief Return value for a successful handshake + */ +#define SOCK_DTLS_HANDSHAKE (EXDEV) /** * @brief DTLS version number diff --git a/sys/include/net/sock/util.h b/sys/include/net/sock/util.h index 1bb32a797f..9f5336a34b 100644 --- a/sys/include/net/sock/util.h +++ b/sys/include/net/sock/util.h @@ -206,11 +206,9 @@ static inline bool sock_udp_ep_equal(const sock_udp_ep_t *a, /** * @defgroup net_sock_util_conf SOCK utility functions compile configurations - * @ingroup net_sock_util - * @ingroup config + * @ingroup net_sock_conf * @{ */ - /** * @brief maximum length of the scheme part for sock_urlsplit. * @@ -233,7 +231,6 @@ static inline bool sock_udp_ep_equal(const sock_udp_ep_t *a, #ifndef CONFIG_SOCK_URLPATH_MAXLEN #define CONFIG_SOCK_URLPATH_MAXLEN (64U) #endif - /** @} */ #ifdef __cplusplus diff --git a/sys/net/sock/Kconfig b/sys/net/sock/Kconfig index e92827496e..3ddf8f6fc6 100644 --- a/sys/net/sock/Kconfig +++ b/sys/net/sock/Kconfig @@ -29,3 +29,19 @@ config SOCK_URLPATH_MAXLEN This value is used in sock_urlsplit(). endif # KCONFIG_USEMODULE_SOCK_UTIL + +menuconfig KCONFIG_USEMODULE_SOCK_DTLS + bool "Configure SOCK DTLS" + depends on USEMODULE_SOCK_DTLS + +if KCONFIG_USEMODULE_SOCK_DTLS + +config DTLS_HANDSHAKE_BUFSIZE_EXP + int "Exponent for the DTLS buffer size (resulting in the buffer size 2^n)" + default 8 + help + As the buffer size ALWAYS needs to be power of two, this option + represents the exponent of 2^n, which will be used as the size of the + buffer. The buffer is used to hold credentials during DTLS handshakes. + +endif # KCONFIG_USEMODULE_SOCK_DTLS diff --git a/sys/net/sock/doc.txt b/sys/net/sock/doc.txt new file mode 100644 index 0000000000..cfbe1343ee --- /dev/null +++ b/sys/net/sock/doc.txt @@ -0,0 +1,11 @@ +# Copyright (c) 2020 Freie Universitaet Berlin +# +# This file is subject to the terms and conditions of the GNU Lesser +# General Public License v2.1. See the file LICENSE in the top level +# directory for more details. +# +/** + * @defgroup net_sock_conf SOCK compile configurations + * @ingroup config + * @brief Group of compile time configurations related to SOCK + */