From 02ac4967d478afcfd619142581195f170833ef91 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Tue, 28 Jan 2020 21:36:40 +0100 Subject: [PATCH] net/coap: Expose configurations to Kconfig --- sys/net/Kconfig | 2 +- sys/net/application_layer/Kconfig | 8 +++++ sys/net/application_layer/Kconfig.coap | 49 ++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 sys/net/application_layer/Kconfig create mode 100644 sys/net/application_layer/Kconfig.coap diff --git a/sys/net/Kconfig b/sys/net/Kconfig index ee6f5991b26fb..ec70b12027a0d 100644 --- a/sys/net/Kconfig +++ b/sys/net/Kconfig @@ -6,7 +6,7 @@ # menu "Networking" -rsource "application_layer/gcoap/Kconfig" +rsource "application_layer/Kconfig" rsource "gnrc/Kconfig" rsource "sock/Kconfig" diff --git a/sys/net/application_layer/Kconfig b/sys/net/application_layer/Kconfig new file mode 100644 index 0000000000000..71efc74d8543e --- /dev/null +++ b/sys/net/application_layer/Kconfig @@ -0,0 +1,8 @@ +# Copyright (c) 2020 HAW Hamburg +# +# 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. +# +rsource "gcoap/Kconfig" +rsource "Kconfig.coap" diff --git a/sys/net/application_layer/Kconfig.coap b/sys/net/application_layer/Kconfig.coap new file mode 100644 index 0000000000000..7ba5b12360801 --- /dev/null +++ b/sys/net/application_layer/Kconfig.coap @@ -0,0 +1,49 @@ +# Copyright (c) 2020 HAW Hamburg +# +# 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. +# + +config HAS_PROTOCOL_COAP + bool +#TODO: This should be selected the Kconfig of the modules that provide it, but +# nanocoap does not have Kconfig file yet. + default y if MODULE_NANOCOAP + help + Specifies that CoAP support is present. + +menuconfig KCONFIG_COAP + bool "Configure CoAP generic options" + depends on HAS_PROTOCOL_COAP + help + Configure CoAP generic options via Kconfig. + +if KCONFIG_COAP + +config COAP_ACK_TIMEOUT + int "Timeout in seconds for a response to a confirmable request" + default 2 + help + This value is for the response to the initial confirmable message. The + timeout doubles for subsequent retries. To avoid synchronization of + resends across hosts, the actual timeout is chosen randomly between + @ref CONFIG_COAP_ACK_TIMEOUT and + (@ref CONFIG_COAP_ACK_TIMEOUT * @ref CONFIG_COAP_RANDOM_FACTOR_1000 / 1000). + +config COAP_RANDOM_FACTOR_1000 + int "Timeout random factor (multiplied by 1000)" + default 1500 + help + This value is used to calculate the upper bound for the timeout. It + represents the `ACK_RANDOM_FACTOR` + ([RFC 7252, section 4.2](https://tools.ietf.org/html/rfc7252#section-4.2)) + multiplied by 1000, to avoid floating point arithmetic. + +config COAP_MAX_RETRANSMIT + int "Maximum number of retransmissions" + default 4 + help + Maximum number of retransmissions for a confirmable request. + +endif # KCONFIG_COAP