From de2d33f65b55fd343aed0d2bc22888beb1fce60b Mon Sep 17 00:00:00 2001 From: Akshai M Date: Wed, 17 Jun 2020 20:14:36 +0530 Subject: [PATCH] sys/net/cord : Move 'CORD_LT' to 'CONFIG_' --- examples/cord_ep/Makefile | 2 +- examples/cord_ep/README.md | 2 +- examples/cord_ep/main.c | 2 +- examples/cord_epsim/Makefile | 2 +- examples/cord_epsim/main.c | 4 ++-- sys/include/net/cord/common.h | 2 +- sys/include/net/cord/config.h | 6 +++--- sys/include/net/cord/epsim.h | 2 +- sys/net/application_layer/cord/common/cord_common.c | 4 ++-- sys/net/application_layer/cord/ep/cord_ep.c | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/examples/cord_ep/Makefile b/examples/cord_ep/Makefile index 95ab5d09a2..ca58630c1a 100644 --- a/examples/cord_ep/Makefile +++ b/examples/cord_ep/Makefile @@ -25,7 +25,7 @@ USEMODULE += fmt DEVELHELP ?= 1 # For debugging and demonstration purposes, we limit the lifetime to 60s -CFLAGS += -DCORD_LT=60 +CFLAGS += -DCONFIG_CORD_LT=60 # Change this to 0 show compiler invocation lines by default: QUIET ?= 1 diff --git a/examples/cord_ep/README.md b/examples/cord_ep/README.md index 4b11baf715..2a23d14d04 100644 --- a/examples/cord_ep/README.md +++ b/examples/cord_ep/README.md @@ -13,7 +13,7 @@ RD, called `cord_ep`. Simply use that shell command without parameters for more information on its usage. Some connection parameters are configured statically during compile time, -namely the lifetime (`CORD_LT`) and the node's endpoint name (`CORD_EP`). You +namely the lifetime (`CONFIG_CORD_LT`) and the node's endpoint name (`CORD_EP`). You can change these values at compile time by overriding their defines using command line arguments: ``` diff --git a/examples/cord_ep/main.c b/examples/cord_ep/main.c index c8f91307cd..dae203ebcc 100644 --- a/examples/cord_ep/main.c +++ b/examples/cord_ep/main.c @@ -103,7 +103,7 @@ int main(void) puts("Client information:"); printf(" ep: %s\n", cord_common_get_ep()); - printf(" lt: %is\n", (int)CORD_LT); + printf(" lt: %is\n", (int)CONFIG_CORD_LT); char line_buf[SHELL_DEFAULT_BUFSIZE]; shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE); diff --git a/examples/cord_epsim/Makefile b/examples/cord_epsim/Makefile index 1259e54f59..ac0fbe48c9 100644 --- a/examples/cord_epsim/Makefile +++ b/examples/cord_epsim/Makefile @@ -26,7 +26,7 @@ DEVELHELP ?= 1 # For debugging and demonstration purposes, we limit the lifetime to the minimal # allowed value of 60s (see draft-ietf-core-resource-directory-11, Table 2) RD_LT ?= 60 -CFLAGS += -DCORD_LT=$(RD_LT) +CFLAGS += -DCONFIG_CORD_LT=$(RD_LT) # The RD server's address must be defined by the build environment by setting # the RD_ADDR environment variable. Per default, this value is set to the diff --git a/examples/cord_epsim/main.c b/examples/cord_epsim/main.c index dfa3d3cf36..03ffa95776 100644 --- a/examples/cord_epsim/main.c +++ b/examples/cord_epsim/main.c @@ -76,7 +76,7 @@ int main(void) /* fill riot info */ sprintf(riot_info, "{\"ep\":\"%s\",\"lt\":%u}", - cord_common_get_ep(), CORD_LT); + cord_common_get_ep(), CONFIG_CORD_LT); /* parse RD address information */ sock_udp_ep_t rd_ep; @@ -112,7 +112,7 @@ int main(void) /* print RD client information */ puts("epsim configuration:"); printf(" ep: %s\n", cord_common_get_ep()); - printf(" lt: %is\n", (int)CORD_LT); + printf(" lt: %is\n", (int)CONFIG_CORD_LT); printf(" RD address: [%s]:%u\n\n", ep_str, ep_port); xtimer_sleep(STARTUP_DELAY); diff --git a/sys/include/net/cord/common.h b/sys/include/net/cord/common.h index 050a19959d..5248b62bac 100644 --- a/sys/include/net/cord/common.h +++ b/sys/include/net/cord/common.h @@ -52,7 +52,7 @@ static inline const char *cord_common_get_ep(void) * * This function adds: * - `ep` -> as extracted by cord_common_get_ep() - * - [optional] `lt` -> if defined by CORD_LT + * - [optional] `lt` -> if defined by CONFIG_CORD_LT * - [optional] 'd' -> if defined by CORD_D * * @return 0 on success diff --git a/sys/include/net/cord/config.h b/sys/include/net/cord/config.h index 48605ede5f..25cb2ea884 100644 --- a/sys/include/net/cord/config.h +++ b/sys/include/net/cord/config.h @@ -29,8 +29,8 @@ extern "C" { /** * @brief Default lifetime in seconds (the default is 1 day) */ -#ifndef CORD_LT -#define CORD_LT (86400UL) +#ifndef CONFIG_CORD_LT +#define CONFIG_CORD_LT (86400UL) #endif /** @@ -44,7 +44,7 @@ extern "C" { * @brief Default client update interval (default is 3/4 the lifetime) */ #ifndef CORD_UPDATE_INTERVAL -#define CORD_UPDATE_INTERVAL ((CORD_LT / 4) * 3) +#define CORD_UPDATE_INTERVAL ((CONFIG_CORD_LT / 4) * 3) #endif /** diff --git a/sys/include/net/cord/epsim.h b/sys/include/net/cord/epsim.h index 50bb030caa..4b14a9e695 100644 --- a/sys/include/net/cord/epsim.h +++ b/sys/include/net/cord/epsim.h @@ -15,7 +15,7 @@ * This module is designed to provide nodes with the possibility to register * with resource directories without having to allocate a lot of resources. All * the user has to do, is to call the cord_epsim_register() function in periodic - * intervals, depending on the value of the `CORD_LT` variable. + * intervals, depending on the value of the `CONFIG_CORD_LT` variable. * * @{ * diff --git a/sys/net/application_layer/cord/common/cord_common.c b/sys/net/application_layer/cord/common/cord_common.c index d9320a5acd..86d603cc33 100644 --- a/sys/net/application_layer/cord/common/cord_common.c +++ b/sys/net/application_layer/cord/common/cord_common.c @@ -63,9 +63,9 @@ int cord_common_add_qstring(coap_pkt_t *pkt) } /* [optional] set the lifetime parameter */ -#if CORD_LT +#if CONFIG_CORD_LT char lt[11]; - lt[fmt_u32_dec(lt, CORD_LT)] = '\0'; + lt[fmt_u32_dec(lt, CONFIG_CORD_LT)] = '\0'; res = coap_opt_add_uri_query(pkt, "lt", lt); if (res < 0) { return res; diff --git a/sys/net/application_layer/cord/ep/cord_ep.c b/sys/net/application_layer/cord/ep/cord_ep.c index 4549f267b2..1495a7ebba 100644 --- a/sys/net/application_layer/cord/ep/cord_ep.c +++ b/sys/net/application_layer/cord/ep/cord_ep.c @@ -359,7 +359,7 @@ void cord_ep_dump_status(void) printf("RD address: coap://[%s]:%i\n", addr, (int)_rd_remote.port); printf(" ep name: %s\n", cord_common_get_ep()); - printf(" lifetime: %is\n", (int)CORD_LT); + printf(" lifetime: %is\n", (int)CONFIG_CORD_LT); printf(" reg if: %s\n", _rd_regif); printf(" location: %s\n", _rd_loc); }