From 2cbf9de2eb246dbfde480f64eff00051a1476059 Mon Sep 17 00:00:00 2001 From: Akshai M Date: Tue, 1 Sep 2020 18:27:44 +0530 Subject: [PATCH 1/3] net/sock/dtls : Model 'DTLS_HANDSHAKE_BUFSIZE' with exponent Introduced CONFIG_DTLS_HANDSHAKE_BUFSIZE_EXP to hold exponent and update documentation --- sys/include/net/sock/dtls.h | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) 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 From b8d2d30a6de9457dbae119689aeec96186d228e8 Mon Sep 17 00:00:00 2001 From: Akshai M Date: Tue, 1 Sep 2020 19:38:37 +0530 Subject: [PATCH 2/3] net/sock/dtls : Expose to Kconfig --- sys/net/sock/Kconfig | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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 From 55fe4a464f1bcc7f17c3c97558fc284c6472b20e Mon Sep 17 00:00:00 2001 From: Akshai M Date: Fri, 4 Sep 2020 16:24:58 +0530 Subject: [PATCH 3/3] net/sock : Update documentation Added net_sock_conf super group and updated sock_util to the super group. --- sys/include/net/sock/util.h | 5 +---- sys/net/sock/doc.txt | 11 +++++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 sys/net/sock/doc.txt 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/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 + */