Merge pull request #10163 from haukepetersen/opt_cord_restructuring

net/rdcli*: restructure and rename RD related modules
This commit is contained in:
Martine Lenders 2018-10-17 15:39:07 +02:00 committed by GitHub
commit 266f7ee342
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 536 additions and 464 deletions

View File

@ -749,34 +749,32 @@ ifneq (,$(filter skald,$(USEMODULE)))
USEMODULE += random USEMODULE += random
endif endif
ifneq (,$(filter rdcli_simple_standalone,$(USEMODULE))) ifneq (,$(filter cord_epsim_standalone,$(USEMODULE)))
USEMODULE += rdcli_simple USEMODULE += cord_epsim
USEMODULE += xtimer USEMODULE += xtimer
endif endif
ifneq (,$(filter rdcli_simple,$(USEMODULE))) ifneq (,$(filter cord_epsim,$(USEMODULE)))
USEMODULE += rdcli_common USEMODULE += cord_common
USEMODULE += fmt USEMODULE += gcoap
endif endif
ifneq (,$(filter rdcli_standalone,$(USEMODULE))) ifneq (,$(filter cord_ep_standalone,$(USEMODULE)))
USEMODULE += rdcli USEMODULE += cord_ep
USEMODULE += xtimer USEMODULE += xtimer
endif endif
ifneq (,$(filter rdcli,$(USEMODULE))) ifneq (,$(filter cord_ep,$(USEMODULE)))
USEMODULE += rdcli_common USEMODULE += cord_common
USEMODULE += core_thread_flags USEMODULE += core_thread_flags
USEMODULE += gcoap USEMODULE += gcoap
USEMODULE += fmt
ifneq (,$(filter shell_commands,$(USEMODULE))) ifneq (,$(filter shell_commands,$(USEMODULE)))
USEMODULE += sock_util USEMODULE += sock_util
endif endif
endif endif
ifneq (,$(filter rdcli_common,$(USEMODULE))) ifneq (,$(filter cord_common,$(USEMODULE)))
USEMODULE += fmt USEMODULE += fmt
USEMODULE += gcoap
USEMODULE += luid USEMODULE += luid
endif endif

View File

@ -1,5 +1,5 @@
# name of your application # name of your application
APPLICATION = rdcli APPLICATION = cord_ep
# If no BOARD is found in the environment, use this default: # If no BOARD is found in the environment, use this default:
BOARD ?= native BOARD ?= native
@ -19,7 +19,7 @@ USEMODULE += auto_init_gnrc_netif
USEMODULE += gnrc_ipv6_default USEMODULE += gnrc_ipv6_default
USEMODULE += gnrc_icmpv6_echo USEMODULE += gnrc_icmpv6_echo
USEMODULE += rdcli_standalone USEMODULE += cord_ep_standalone
USEMODULE += shell USEMODULE += shell
USEMODULE += shell_commands USEMODULE += shell_commands
@ -32,7 +32,7 @@ USEMODULE += fmt
CFLAGS += -DDEVELHELP CFLAGS += -DDEVELHELP
# For debugging and demonstration purposes, we limit the lifetime to 60s # For debugging and demonstration purposes, we limit the lifetime to 60s
CFLAGS += -DRDCLI_LT=60 CFLAGS += -DCORD_LT=60
# Change this to 0 show compiler invocation lines by default: # Change this to 0 show compiler invocation lines by default:
QUIET ?= 1 QUIET ?= 1

View File

@ -0,0 +1,25 @@
CoRE Resource Directory: Endpoint Example
=========================================
This example application demonstrates the usage of RIOT's Resource Directory
(RD) endpoint module, called `cord_ep`. This module supports the registration,
update, and removal procedures as defined in
[draft-ietf-core-resource-directory-15](https://tools.ietf.org/html/draft-ietf-core-resource-directory-15).
Usage
=====
The examples includes a shell command that you can use to interact with a given
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
can change these values at compile time by overriding their defines using
command line arguments:
```
CFLAGS="-DCORD_EP=\\\"your_ep_name_here\\\"" make all
```
or by setting their values in the application's Makefile:
```
CFLAGS += "-DCORD_EP=\"MyNewEpName\""
```

View File

@ -11,7 +11,7 @@
* @{ * @{
* *
* @file * @file
* @brief CoRE Resource Directory client (rdcli) example application * @brief CoRE Resource Directory endpoint (cord_ep) example
* *
* @author Hauke Petersen <hauke.petersen@fu-berlin.de> * @author Hauke Petersen <hauke.petersen@fu-berlin.de>
* *
@ -24,24 +24,24 @@
#include "shell.h" #include "shell.h"
#include "net/ipv6/addr.h" #include "net/ipv6/addr.h"
#include "net/gcoap.h" #include "net/gcoap.h"
#include "net/rdcli_common.h" #include "net/cord/common.h"
#include "net/rdcli_standalone.h" #include "net/cord/ep_standalone.h"
#define MAIN_QUEUE_SIZE (8) #define MAIN_QUEUE_SIZE (8)
static msg_t _main_msg_queue[MAIN_QUEUE_SIZE]; static msg_t _main_msg_queue[MAIN_QUEUE_SIZE];
/* we will use a custom event handler for dumping rdcli_standalone events */ /* we will use a custom event handler for dumping cord_ep events */
static void _on_rdcli_event(rdcli_standalone_event_t event) static void _on_ep_event(cord_ep_standalone_event_t event)
{ {
switch (event) { switch (event) {
case RDCLI_REGISTERED: case CORD_EP_REGISTERED:
puts("rdcli event: now registered with a RD"); puts("RD endpoint event: now registered with a RD");
break; break;
case RDCLI_DEREGISTERED: case CORD_EP_DEREGISTERED:
puts("rdcli event: dropped client registration"); puts("RD endpoint event: dropped client registration");
break; break;
case RDCLI_UPDATED: case CORD_EP_UPDATED:
puts("rdcli event: successfully updated client registration"); puts("RD endpoint event: successfully updated client registration");
break; break;
} }
} }
@ -94,12 +94,12 @@ int main(void)
/* setup CoAP resources */ /* setup CoAP resources */
gcoap_register_listener(&_listener); gcoap_register_listener(&_listener);
/* register event callback with rdcli_standalone */ /* register event callback with cord_ep_standalone */
rdcli_standalone_reg_cb(_on_rdcli_event); cord_ep_standalone_reg_cb(_on_ep_event);
puts("Client information:"); puts("Client information:");
printf(" ep: %s\n", rdcli_common_get_ep()); printf(" ep: %s\n", cord_common_get_ep());
printf(" lt: %is\n", (int)RDCLI_LT); printf(" lt: %is\n", (int)CORD_LT);
char line_buf[SHELL_DEFAULT_BUFSIZE]; char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE); shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);

View File

@ -1,5 +1,5 @@
# name of your application # name of your application
APPLICATION = rdcli_simple APPLICATION = cord_epsim
# If no BOARD is found in the environment, use this default: # If no BOARD is found in the environment, use this default:
BOARD ?= native BOARD ?= native
@ -20,7 +20,7 @@ USEMODULE += auto_init_gnrc_netif
USEMODULE += gnrc_ipv6_default USEMODULE += gnrc_ipv6_default
# Run the simple CoRE resource directory # Run the simple CoRE resource directory
USEMODULE += rdcli_simple_standalone USEMODULE += cord_epsim_standalone
# Include the shell for testing purposes # Include the shell for testing purposes
USEMODULE += shell USEMODULE += shell
@ -40,8 +40,8 @@ RD_LT ?= 60
RD_ADDR ?= \"ff02::1\" RD_ADDR ?= \"ff02::1\"
RD_PORT ?= 5683 RD_PORT ?= 5683
CFLAGS += -DRDCLI_LT=$(RD_LT) CFLAGS += -DCORD_LT=$(RD_LT)
CFLAGS += -DRDCLI_SERVER_ADDR=$(RD_ADDR) CFLAGS += -DCORD_SERVER_ADDR=$(RD_ADDR)
CFLAGS += -DRDCLI_SERVER_PORT=$(RD_PORT) CFLAGS += -DCORD_SERVER_PORT=$(RD_PORT)
include $(RIOTBASE)/Makefile.include include $(RIOTBASE)/Makefile.include

View File

@ -1,15 +1,15 @@
CoRE Resource Directory: Simple Registration Example CoRE Resource Directory: Simple Endpoint Example
==================================================== ================================================
This example shows how a node can register with a CoRE resource directory using This example shows how a node can register with a CoRE resource directory using
the simple registration process as described in the simple registration procedure as described in
draft-ietf-core-resource-directory-11, section 5.3.2. draft-ietf-core-resource-directory-15, section 5.3.1.
The registration process needs an endpoint name as well as a lifetime for the The registration process needs an endpoint name as well as a lifetime for the
registry entry. You can edit these values by overriding `RDCLI_EP` and registry entry. These are statically defined during compile time and you can
`RDCLI_LT`: edit these values by overriding `CORD_EP` and `CORD_LT`:
``` ```
CFLAGS="-DRDCLI_LT=\"7200\" -DRDCLI_EP=\"MyNode\"" make all CFLAGS="-DCORD_LT=\"7200\" -DCORD_EP=\"MyNode\"" make all
``` ```
Per default, the node is looking for the CoRE RD at the all nodes link-local Per default, the node is looking for the CoRE RD at the all nodes link-local

View File

@ -23,7 +23,7 @@
#include "shell.h" #include "shell.h"
#include "net/gcoap.h" #include "net/gcoap.h"
#include "net/rdcli_common.h" #include "net/cord/common.h"
#define BUFSIZE (64U) #define BUFSIZE (64U)
@ -68,17 +68,17 @@ int main(void)
/* fill riot info */ /* fill riot info */
sprintf(riot_info, "{\"ep\":\"%s\",\"lt\":%u}", sprintf(riot_info, "{\"ep\":\"%s\",\"lt\":%u}",
rdcli_common_get_ep(), RDCLI_LT); cord_common_get_ep(), CORD_LT);
/* register resource handlers with gcoap */ /* register resource handlers with gcoap */
gcoap_register_listener(&listener); gcoap_register_listener(&listener);
/* print RD client information */ /* print RD client information */
puts("RD client information:"); puts("RD client information:");
printf(" RD addr: %s\n", RDCLI_SERVER_ADDR); printf(" RD addr: %s\n", CORD_SERVER_ADDR);
printf(" RD port: %u\n", (unsigned)RDCLI_SERVER_PORT); printf(" RD port: %u\n", (unsigned)CORD_SERVER_PORT);
printf(" ep: %s\n", rdcli_common_get_ep()); printf(" ep: %s\n", cord_common_get_ep());
printf(" lt: %is\n", (int)RDCLI_LT); printf(" lt: %is\n", (int)CORD_LT);
/* run the shell */ /* run the shell */
char line_buf[SHELL_DEFAULT_BUFSIZE]; char line_buf[SHELL_DEFAULT_BUFSIZE];

View File

@ -1,20 +0,0 @@
CoRE Resource Directory Client Example
======================================
This example application demonstrates the usage of RIOT's Resource Directory
(RD) client module, called `rdcli`. This module supports the registration,
update, and removal processes as defined in the
[Resource Directory Draft](https://tools.ietf.org/html/draft-ietf-core-resource-directory-14).
Usage
=====
The examples includes a shell command that you can use to interact with a given
RD server, called `rdcli`. 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 (`RDCLI_LT`) and the node's endpoint name (`RDCLI_EP`). You
can change these values during command line by overriding these values in the
application's Makefile, e.g. add
```
CFLAGS += "-DRDCLI_EP=\"MyNewEpName\""
```

View File

@ -5,6 +5,8 @@ PSEUDOMODULES += can_pm
PSEUDOMODULES += can_raw PSEUDOMODULES += can_raw
PSEUDOMODULES += ccn-lite-utils PSEUDOMODULES += ccn-lite-utils
PSEUDOMODULES += conn_can_isotp_multi PSEUDOMODULES += conn_can_isotp_multi
PSEUDOMODULES += cord_ep_standalone
PSEUDOMODULES += cord_epsim_standalone
PSEUDOMODULES += core_% PSEUDOMODULES += core_%
PSEUDOMODULES += ecc_% PSEUDOMODULES += ecc_%
PSEUDOMODULES += emb6_router PSEUDOMODULES += emb6_router
@ -52,8 +54,6 @@ PSEUDOMODULES += pktqueue
PSEUDOMODULES += printf_float PSEUDOMODULES += printf_float
PSEUDOMODULES += prng PSEUDOMODULES += prng
PSEUDOMODULES += prng_% PSEUDOMODULES += prng_%
PSEUDOMODULES += rdcli_standalone
PSEUDOMODULES += rdcli_simple_standalone
PSEUDOMODULES += saul_adc PSEUDOMODULES += saul_adc
PSEUDOMODULES += saul_default PSEUDOMODULES += saul_default
PSEUDOMODULES += saul_gpio PSEUDOMODULES += saul_gpio

View File

@ -127,14 +127,14 @@ endif
ifneq (,$(filter skald,$(USEMODULE))) ifneq (,$(filter skald,$(USEMODULE)))
DIRS += net/skald DIRS += net/skald
endif endif
ifneq (,$(filter rdcli_common,$(USEMODULE))) ifneq (,$(filter cord_common,$(USEMODULE)))
DIRS += net/application_layer/rdcli_common DIRS += net/application_layer/cord/common
endif endif
ifneq (,$(filter rdcli_simple,$(USEMODULE))) ifneq (,$(filter cord_epsim,$(USEMODULE)))
DIRS += net/application_layer/rdcli_simple DIRS += net/application_layer/cord/epsim
endif endif
ifneq (,$(filter rdcli,$(USEMODULE))) ifneq (,$(filter cord_ep,$(USEMODULE)))
DIRS += net/application_layer/rdcli DIRS += net/application_layer/cord/ep
endif endif

View File

@ -158,20 +158,20 @@ void auto_init(void)
DEBUG("Auto init Skald\n"); DEBUG("Auto init Skald\n");
skald_init(); skald_init();
#endif #endif
#ifdef MODULE_RDCLI_COMMON #ifdef MODULE_CORD_COMMON
DEBUG("Auto init rdcli_common module\n"); DEBUG("Auto init cord_common module\n");
extern void rdcli_common_init(void); extern void cord_common_init(void);
rdcli_common_init(); cord_common_init();
#endif #endif
#ifdef MODULE_RDCLI_STANDALONE #ifdef MODULE_CORD_EP_STANDALONE
DEBUG("Auto init rdcli_standalone\n"); DEBUG("Auto init cord_ep_standalone\n");
extern void rdcli_standalone_run(void); extern void cord_ep_standalone_run(void);
rdcli_standalone_run(); cord_ep_standalone_run();
#endif #endif
#ifdef MODULE_RDCLI_SIMPLE_STANDALONE #ifdef MODULE_CORD_EPSIM_STANDALONE
DEBUG("Auto init rdcli_simple module\n"); DEBUG("Auto init cord_epsim module\n");
extern void rdcli_simple_run(void); extern void cord_epsim_run(void);
rdcli_simple_run(); cord_epsim_run();
#endif #endif
#ifdef MODULE_ASYMCUTE #ifdef MODULE_ASYMCUTE
DEBUG("Auto init Asymcute\n"); DEBUG("Auto init Asymcute\n");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017 Freie Universität Berlin * Copyright (C) 2017,2018 Freie Universität Berlin
* *
* This file is subject to the terms and conditions of the GNU Lesser * 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 * General Public License v2.1. See the file LICENSE in the top level
@ -7,21 +7,21 @@
*/ */
/** /**
* @defgroup net_rdcli_common CoRE RD Client Common * @defgroup net_cord_common CoRE RD Common
* @ingroup net * @ingroup net_cord
* @brief Shared functionality for CoRE Resource Directory clients * @brief Shared functionality for CoRE Resource Directory endpoints
* @{ * @{
* *
* @file * @file
* @brief Shared CoRE RD client functions * @brief Shared CoRE RD endpoint functions
* *
* @author Hauke Petersen <hauke.petersen@fu-berlin.de> * @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*/ */
#ifndef NET_RDCLI_COMMON_H #ifndef NET_CORD_COMMON_H
#define NET_RDCLI_COMMON_H #define NET_CORD_COMMON_H
#include "net/rdcli_config.h" #include "net/cord/config.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -30,39 +30,39 @@ extern "C" {
/** /**
* @brief Export the local endpoint identifier * @brief Export the local endpoint identifier
* *
* @note Use rdcli_common_get_ep() for accessing the endpoint identifier * @note Use cord_common_get_ep() for accessing the endpoint identifier
*/ */
extern char rdcli_ep[]; extern char cord_common_ep[];
/** /**
* @brief Generate unique endpoint identifier (ep) * @brief Generate unique endpoint identifier (ep)
*/ */
void rdcli_common_init(void); void cord_common_init(void);
/** /**
* @brief Get the local endpoint identifier * @brief Get the local endpoint identifier
*/ */
static inline const char *rdcli_common_get_ep(void) static inline const char *cord_common_get_ep(void)
{ {
return (const char *)rdcli_ep; return (const char *)cord_common_ep;
} }
/** /**
* @brief Add selected query string options to a gcoap request * @brief Add selected query string options to a gcoap request
* *
* This function adds: * This function adds:
* - `ep` -> as extracted by rdcli_commont_get_ep() * - `ep` -> as extracted by cord_common_get_ep()
* - [optional] `lt` -> if defined by RDCLI_LT * - [optional] `lt` -> if defined by CORD_LT
* - [optional] 'd' -> if defined by RDCLI_D * - [optional] 'd' -> if defined by CORD_D
* *
* @return 0 on success * @return 0 on success
* @return <0 on error * @return <0 on error
*/ */
int rdcli_common_add_qstring(coap_pkt_t *pkt); int cord_common_add_qstring(coap_pkt_t *pkt);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* NET_RDCLI_COMMON_H */ #endif /* NET_CORD_COMMON_H */
/** @} */ /** @} */

View File

@ -7,21 +7,20 @@
*/ */
/** /**
* @defgroup net_rdcli_config CoRE RD Client Configuration * @defgroup net_cord_config CoRE RD Endpoint and Lookup Client Configuration
* @ingroup net * @ingroup net_cord
* @brief Shared CoRE Resource Directory Client Configuration * @brief Configuration options for CoRE RD endpoints and lookup clients
* @{ * @{
* *
* @file * @file
* @brief CoRE RD Client static configuration default values * @brief (Default) configuration values for CoRE RD endpoints and lookup
* clients
* *
* @author Hauke Petersen <hauke.petersen@fu-berlin.de> * @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*/ */
#ifndef NET_RDCLI_CONFIG_H #ifndef NET_CORD_CONFIG_H
#define NET_RDCLI_CONFIG_H #define NET_CORD_CONFIG_H
#include "net/ipv6/addr.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -30,49 +29,49 @@ extern "C" {
/** /**
* @brief Default lifetime in seconds (the default is 1 day) * @brief Default lifetime in seconds (the default is 1 day)
*/ */
#ifndef RDCLI_LT #ifndef CORD_LT
#define RDCLI_LT (86400UL) #define CORD_LT (86400UL)
#endif #endif
/** /**
* @brief Delay until the RD client starts to try registering (in seconds) * @brief Delay until the RD client starts to try registering (in seconds)
*/ */
#ifndef RDCLI_STARTUP_DELAY #ifndef CORD_STARTUP_DELAY
#define RDCLI_STARTUP_DELAY (3U) #define CORD_STARTUP_DELAY (3U)
#endif #endif
/** /**
* @brief Default client update interval (default is 3/4 the lifetime) * @brief Default client update interval (default is 3/4 the lifetime)
*/ */
#ifndef RDCLI_UPDATE_INTERVAL #ifndef CORD_UPDATE_INTERVAL
#define RDCLI_UPDATE_INTERVAL ((RDCLI_LT / 4) * 3) #define CORD_UPDATE_INTERVAL ((CORD_LT / 4) * 3)
#endif #endif
/** /**
* @name Endpoint ID definition * @name Endpoint ID definition
* *
* Per default, the endpoint ID (ep) is generated by concatenation of a user * Per default, the endpoint ID (ep) is generated by concatenation of a user
* defined prefix (RDCLI_EP_PREFIX) and a locally unique ID (luid) encoded in * defined prefix (CORD_EP_PREFIX) and a locally unique ID (luid) encoded in
* hexadecimal formatting with the given length of characters * hexadecimal formatting with the given length of characters
* (RDCLI_EP_SUFFIX_LEN). * (CORD_EP_SUFFIX_LEN).
* *
* Alternatively, the endpoint ID value can be defined at compile time by * Alternatively, the endpoint ID value can be defined at compile time by
* assigning a string value to the RDCLI_ED macro. * assigning a string value to the CORD_ED macro.
* *
* @{ * @{
*/ */
#ifndef RDCLI_EP #ifndef CORD_EP
/** /**
* @brief Number of generated hexadecimal characters added to the ep * @brief Number of generated hexadecimal characters added to the ep
* *
* @note Must be an even number * @note Must be an even number
*/ */
#define RDCLI_EP_SUFFIX_LEN (16) #define CORD_EP_SUFFIX_LEN (16)
/** /**
* @brief Default static prefix used for the generated ep * @brief Default static prefix used for the generated ep
*/ */
#define RDCLI_EP_PREFIX "RIOT-" #define CORD_EP_PREFIX "RIOT-"
#endif #endif
/** @} */ /** @} */
@ -80,20 +79,20 @@ extern "C" {
* @brief Use ALL_NODES multicast address as default address when looking for * @brief Use ALL_NODES multicast address as default address when looking for
* a RD server * a RD server
*/ */
#ifndef RDCLI_SERVER_ADDR #ifndef CORD_SERVER_ADDR
#define RDCLI_SERVER_ADDR "ff02::1" #define CORD_SERVER_ADDR "ff02::1"
#endif #endif
/** /**
* @brief Default Port to use when looking for RDs * @brief Default Port to use when looking for RDs
*/ */
#ifndef RDCLI_SERVER_PORT #ifndef CORD_SERVER_PORT
#define RDCLI_SERVER_PORT COAP_PORT #define CORD_SERVER_PORT COAP_PORT
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* NET_RDCLI_CONFIG_H */ #endif /* NET_CORD_CONFIG_H */
/** @} */ /** @} */

View File

@ -7,8 +7,8 @@
*/ */
/** /**
* @defgroup net_rdcli CoRE RD Endpoint Library * @defgroup net_cord_ep CoRE RD Endpoint
* @ingroup net * @ingroup net_cord
* @brief Library for using RIOT as CoRE Resource Directory endpoint * @brief Library for using RIOT as CoRE Resource Directory endpoint
* *
* This module implements a CoRE Resource Directory endpoint library, that * This module implements a CoRE Resource Directory endpoint library, that
@ -17,14 +17,10 @@
* draft-ietf-core-resource-directory-15. * draft-ietf-core-resource-directory-15.
* @see https://tools.ietf.org/html/draft-ietf-core-resource-directory-15 * @see https://tools.ietf.org/html/draft-ietf-core-resource-directory-15
* *
* @note As the name of this library (`rdcli`) can be misleading in
* context of the RD draft (endpoint vs client), this library
* will most likely undergo a name change in the near future...
*
* # Design Decisions * # Design Decisions
* - all operations provided by this module are fully synchronous, meaning that * - all operations provided by this module are fully synchronous, meaning that
* the functions will block until an operation is successful or will time out * the functions will block until an operation is successful or will time out
* - the implementation limits the client to be registered with a single RD at * - the implementation limits the endpoint to be registered with a single RD at
* any point in time * any point in time
* *
* @{ * @{
@ -35,8 +31,8 @@
* @author Hauke Petersen <hauke.petersen@fu-berlin.de> * @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*/ */
#ifndef NET_RDCLI_H #ifndef NET_CORD_EP_H
#define NET_RDCLI_H #define NET_CORD_EP_H
#include "net/sock/udp.h" #include "net/sock/udp.h"
@ -48,11 +44,11 @@ extern "C" {
* @brief Return values and error codes used by this module * @brief Return values and error codes used by this module
*/ */
enum { enum {
RDCLI_OK = 0, /**< everything went as expected */ CORD_EP_OK = 0, /**< everything went as expected */
RDCLI_TIMEOUT = -1, /**< no response from the network */ CORD_EP_TIMEOUT = -1, /**< no response from the network */
RDCLI_ERR = -2, /**< internal error or invalid reply */ CORD_EP_ERR = -2, /**< internal error or invalid reply */
RDCLI_NORD = -3, /**< not connected to an RD */ CORD_EP_NORD = -3, /**< not connected to an RD */
RDCLI_OVERFLOW = -4, /**< internal buffers can not handle input */ CORD_EP_OVERFLOW = -4, /**< internal buffers can not handle input */
}; };
/** /**
@ -62,19 +58,19 @@ enum {
* @param[out] regif the registration interface is written to this buffer * @param[out] regif the registration interface is written to this buffer
* @param[in] maxlen size of @p regif * @param[in] maxlen size of @p regif
* *
* @return RDCLI_OK on success * @return CORD_EP_OK on success
* @return RDCLI_TIMEOUT if the discovery request times out * @return CORD_EP_TIMEOUT if the discovery request times out
* @return RDCLI_NORD if addressed endpoint is not a RD * @return CORD_EP_NORD if addressed endpoint is not a RD
* @return RDCLI_ERR on any other internal error * @return CORD_EP_ERR on any other internal error
*/ */
int rdcli_discover_regif(const sock_udp_ep_t *remote, int cord_ep_discover_regif(const sock_udp_ep_t *remote,
char *regif, size_t maxlen); char *regif, size_t maxlen);
/** /**
* @brief Initiate the node registration by sending an empty push * @brief Initiate the node registration by sending an empty push
* *
* - if registration fails (e.g. timeout), we are not associated with any RD * - if registration fails (e.g. timeout), we are not associated with any RD
* anymore (even if we have been before we called rdcli_register) * anymore (even if we have been before we called cord_ep_register)
* *
* @note In case a multicast address is given, the @p regif parameter MUST be * @note In case a multicast address is given, the @p regif parameter MUST be
* NULL. The first RD responding to the request will be chosen and all * NULL. The first RD responding to the request will be chosen and all
@ -84,40 +80,40 @@ int rdcli_discover_regif(const sock_udp_ep_t *remote,
* @param[in] regif registration interface resource of the RD, it will be * @param[in] regif registration interface resource of the RD, it will be
* discovered automatically when set to NULL * discovered automatically when set to NULL
* *
* @return RDCLI_OK on success * @return CORD_EP_OK on success
* @return RDCLI_TIMEOUT on registration timeout * @return CORD_EP_TIMEOUT on registration timeout
* @return RDCLI_NORD if addressed endpoint is not a RD * @return CORD_EP_NORD if addressed endpoint is not a RD
* @return RDCLI_OVERFLOW if @p regif does not fit into internal buffer * @return CORD_EP_OVERFLOW if @p regif does not fit into internal buffer
* @return RDCLI_ERR on any other internal error * @return CORD_EP_ERR on any other internal error
*/ */
int rdcli_register(const sock_udp_ep_t *remote, const char *regif); int cord_ep_register(const sock_udp_ep_t *remote, const char *regif);
/** /**
* @brief Update our current entry at the RD * @brief Update our current entry at the RD
* *
* @return RDCLI_OK on success * @return CORD_EP_OK on success
* @return RDCLI_TIMEOUT if the update request times out * @return CORD_EP_TIMEOUT if the update request times out
* @return RDCLI_ERR on any other internal error * @return CORD_EP_ERR on any other internal error
*/ */
int rdcli_update(void); int cord_ep_update(void);
/** /**
* @brief Unregister from a given RD server * @brief Unregister from a given RD server
* *
* @return RDCLI_OK on success * @return CORD_EP_OK on success
* @return RDCLI_TIMEOUT if the remove request times out * @return CORD_EP_TIMEOUT if the remove request times out
* @return RDCLI_ERR on any other internal error * @return CORD_EP_ERR on any other internal error
*/ */
int rdcli_remove(void); int cord_ep_remove(void);
/** /**
* @brief Dump the current RD connection status to STDIO (for debugging) * @brief Dump the current RD connection status to STDIO (for debugging)
*/ */
void rdcli_dump_status(void); void cord_ep_dump_status(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* NET_RDCLI_H */ #endif /* NET_CORD_EP_H */
/** @} */ /** @} */

View File

@ -0,0 +1,88 @@
/*
* Copyright (C) 2017-2018 Freie Universität 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_cord_ep_standalone CoRE RD Endpoint Standalone Extension
* @ingroup net_cord_ep
* @brief Run a CoRE Resource Directory endpoint standalone
*
* This sub-module enables a CoRE RD endpoint to manage is registration state
* with a RD autonomously by periodically running the update procedure. This
* is implemented by running a dedicated thread.
*
* @{
*
* @file
* @brief CoRE Resource Directory endpoint standalone extension
*
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*/
#ifndef NET_CORD_EP_STANDALONE_H
#define NET_CORD_EP_STANDALONE_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Possible types of events triggered by the cord_ep_standalone module
*/
typedef enum {
CORD_EP_REGISTERED,
CORD_EP_DEREGISTERED,
CORD_EP_UPDATED,
} cord_ep_standalone_event_t;
/**
* @brief Callback function signature for RD endpoint state synchronization
*
* The registered callback function is executed in the context of the dedicated
* standalone RD endpoint's thread.
*
* @param[in] t type of event
*/
typedef void(*cord_ep_standalone_cb_t)(cord_ep_standalone_event_t event);
/**
* @brief Spawn a new thread that takes care of sending periodic updates to an
* active RD entry
*
* @warning This function must only be called once (typically during system
* initialization)
*/
void cord_ep_standalone_run(void);
/**
* @brief Register a callback to be notified about RD endpoint state changes
*
* Only a single callback can be active at any point in time, so setting a new
* callback will override the existing one.
*
* @pre @p cb != NULL
*
* @param[in] cb callback to execute on RD endpoint state changes
*/
void cord_ep_standalone_reg_cb(cord_ep_standalone_cb_t cb);
/**
* @brief Signal the cord_ep thread about connection status change
*
* @note This function should not be called by a user, but it is called from
* withing the cord_ep implementation
*
* @param[in] connected set to true if we are connected to a RD
*/
void cord_ep_standalone_signal(bool connected);
#ifdef __cplusplus
}
#endif
#endif /* NET_CORD_EP_STANDALONE_H */
/** @} */

View File

@ -0,0 +1,68 @@
/*
* Copyright (C) 2017-2018 Freie Universität 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_cord_epsim CoRE RD Simple Registration Endpoint
* @ingroup net_cord
* @brief CoRE Resource Directory endpoint using the simple registration
* procedure
* @{
*
* @file
* @brief Interface for the CoRE RD simple registration endpoint
*
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*/
#ifndef NET_CORD_EPSIM_H
#define NET_CORD_EPSIM_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Error codes used by the cord_epsim implementation
*/
enum {
CORD_EPSIM_OK = 0, /**< all good */
CORD_EPSIM_NOADDR = -1, /**< on address conversion errors */
CORD_EPSIM_ERROR = -2, /**< on other errors */
};
/**
* @brief Initiate the node registration by sending an empty CoAP POST message
* to the RD server's /.well-known/core resource
*
* @return CORD_EPSIM_OK on success
* @return CORD_EPSIM_NOADDR if conversion of RD address fails
* @return CORD_EPSIM_ERROR if something goes wrong preparing or sending the
* initial request
*/
int cord_epsim_register(void);
#if defined(MODULE_CORD_EPSIM_STANDALONE) || defined(DOXYGEN)
/**
* @brief Spawn a new thread that registers the node and updates the
* registration with all responding RDs using the simple registration
* process
*
* @note Only available with the `cord_epsim_standalone` module compiled in
*
* @warning This function must only be called once (typically during system
* initialization)
*/
void cord_epsim_run(void);
#endif
#ifdef __cplusplus
}
#endif
#endif /* NET_CORD_EPSIM_H */
/** @} */

View File

@ -1,61 +0,0 @@
/*
* Copyright (C) 2017-2018 Freie Universität 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_rdcli_simple CoRE RD Simple Client
* @ingroup net
* @brief CoAP-based CoRE Resource Directory client supporting the simple
* registration only
* @{
*
* @file
* @brief Interface for a simple CoRE RD registration
*
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*/
#ifndef NET_RDCLI_SIMPLE_H
#define NET_RDCLI_SIMPLE_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Error codes used by the rdcli_simple implementation
*/
enum {
RDCLI_SIMPLE_OK = 0, /**< all good */
RDCLI_SIMPLE_NOADDR = -1, /**< on address conversion errors */
RDCLI_SIMPLE_ERROR = -2, /**< on other errors */
};
/**
* @brief Initiate the node registration by sending an empty CoAP POST message
* to the RD server's /.well-known/core resource
*
* @return RDCLI_SIMPLE_OK on success
* @return RDCLI_SIMPLE_NOADDR if conversion of RD address fails
* @return RDCLI_SIMPLE_ERROR if something goes wrong preparing or sending the
* initial request
*/
int rdcli_simple_register(void);
/**
* @brief Spawn a new thread that registers the node and updates the
* registration with all responding RDs using the simple registration
* process
*/
void rdcli_simple_run(void);
#ifdef __cplusplus
}
#endif
#endif /* NET_RDCLI_SIMPLE_H */
/** @} */

View File

@ -1,90 +0,0 @@
/*
* Copyright (C) 2017-2018 Freie Universität 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_rdcli_standalone CoRE RD Standalone Extension
* @ingroup net_rdcli
* @brief Run CoRE Resource Directory client in standalone configuration
*
* This sub-module enables the CoRE RD client to manage is registration state
* with a server autonomously by periodically running the update procedure. This
* is implemented by running a dedicated thread.
*
* @{
*
* @file
* @brief CoRE Resource Directory client standalone extension
*
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*/
#ifndef NET_RDCLI_STANDALONE_H
#define NET_RDCLI_STANDALONE_H
#include "net/sock/udp.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Possible types of events triggered by the standalone rdcli module
*/
typedef enum {
RDCLI_REGISTERED,
RDCLI_DEREGISTERED,
RDCLI_UPDATED,
} rdcli_standalone_event_t;
/**
* @brief Callback function signature for RD client state synchronization
*
* The registered callback function is executed in the context of the dedicated
* standalone RD client's thread.
*
* @param[in] t type of event
*/
typedef void(*rdcli_standalone_cb_t)(rdcli_standalone_event_t event);
/**
* @brief Spawn a new thread that takes care of sending periodic updates to an
* active RD entry
*
* @note This function must only be called once (typically during system
* initialization)
*/
void rdcli_standalone_run(void);
/**
* @brief Register a callback to be notified about RD client state changes
*
* Only a single callback can be active at any point in time, so setting a new
* callback will override the existing one.
*
* @pre @p cb != NULL
*
* @param[in] cb callback to execute on RD client state changes
*/
void rdcli_standalone_reg_cb(rdcli_standalone_cb_t cb);
/**
* @brief Signal the rdcli thread about connection status change
*
* @note This function should not be called by a user, but it is called from
* withing the rdcli implementation
*
* @param[in] connected set to true if we are connected to a RD
*/
void rdcli_standalone_signal(bool connected);
#ifdef __cplusplus
}
#endif
#endif /* NET_RDCLI_STANDALONE_H */
/** @} */

View File

@ -1 +1,3 @@
MODULE = cord_common
include $(RIOTBASE)/Makefile.base include $(RIOTBASE)/Makefile.base

View File

@ -7,7 +7,7 @@
*/ */
/** /**
* @ingroup net_rdcli_common * @ingroup net_cord_common
* @{ * @{
* *
* @file * @file
@ -22,50 +22,50 @@
#include "luid.h" #include "luid.h"
#include "net/gcoap.h" #include "net/gcoap.h"
#include "net/rdcli_common.h" #include "net/cord/common.h"
#define ENABLE_DEBUG (0) #define ENABLE_DEBUG (0)
#include "debug.h" #include "debug.h"
#ifdef RDCLI_EP #ifdef CORD_EP
#define BUFSIZE (sizeof(RDCLI_EP)) /* contains \0 termination char */ #define BUFSIZE (sizeof(CORD_EP)) /* contains \0 termination char */
#else #else
#define PREFIX_LEN (sizeof(RDCLI_EP_PREFIX)) /* contains \0 char */ #define PREFIX_LEN (sizeof(CORD_EP_PREFIX)) /* contains \0 char */
#define BUFSIZE (PREFIX_LEN + RDCLI_EP_SUFFIX_LEN) #define BUFSIZE (PREFIX_LEN + CORD_EP_SUFFIX_LEN)
#endif #endif
char rdcli_ep[BUFSIZE]; char cord_common_ep[BUFSIZE];
void rdcli_common_init(void) void cord_common_init(void)
{ {
#ifdef RDCLI_EP #ifdef CORD_EP
memcpy(rdcli_ep, RDCLI_EP, BUFSIZE); memcpy(cord_common_ep, CORD_EP, BUFSIZE);
#else #else
uint8_t luid[RDCLI_EP_SUFFIX_LEN / 2]; uint8_t luid[CORD_EP_SUFFIX_LEN / 2];
if (PREFIX_LEN > 1) { if (PREFIX_LEN > 1) {
memcpy(rdcli_ep, RDCLI_EP_PREFIX, (PREFIX_LEN - 1)); memcpy(cord_common_ep, CORD_EP_PREFIX, (PREFIX_LEN - 1));
} }
luid_get(luid, sizeof(luid)); luid_get(luid, sizeof(luid));
fmt_bytes_hex(&rdcli_ep[PREFIX_LEN - 1], luid, sizeof(luid)); fmt_bytes_hex(&cord_common_ep[PREFIX_LEN - 1], luid, sizeof(luid));
rdcli_ep[BUFSIZE - 1] = '\0'; cord_common_ep[BUFSIZE - 1] = '\0';
#endif #endif
} }
int rdcli_common_add_qstring(coap_pkt_t *pkt) int cord_common_add_qstring(coap_pkt_t *pkt)
{ {
/* extend the url with some query string options */ /* extend the url with some query string options */
int res = gcoap_add_qstring(pkt, "ep", rdcli_ep); int res = gcoap_add_qstring(pkt, "ep", cord_common_ep);
if (res < 0) { if (res < 0) {
return res; return res;
} }
/* [optional] set the lifetime parameter */ /* [optional] set the lifetime parameter */
#if RDCLI_LT #if CORD_LT
char lt[11]; char lt[11];
lt[fmt_u32_dec(lt, RDCLI_LT)] = '\0'; lt[fmt_u32_dec(lt, CORD_LT)] = '\0';
res = gcoap_add_qstring(pkt, "lt", lt); res = gcoap_add_qstring(pkt, "lt", lt);
if (res < 0) { if (res < 0) {
return res; return res;
@ -73,8 +73,8 @@ int rdcli_common_add_qstring(coap_pkt_t *pkt)
#endif #endif
/* [optional] set the domain parameter */ /* [optional] set the domain parameter */
#ifdef RDCLI_D #ifdef CORD_D
res = gcoap_add_qstring(pkt, "d", RDCLI_D); res = gcoap_add_qstring(pkt, "d", CORD_D);
if (res < 0) { if (res < 0) {
return res; return res;
} }

View File

@ -0,0 +1,65 @@
/*
* Copyright (C) 2018 Freie Universität 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_cord CoRE RD Endpoint and Lookup Client
* @ingroup net
* @brief Library for interacting as endpoint and lookup client with CoRE
* Resource Directories
*
* # About
* The `cord` ([Co]RE [R]esource [D]irectory) module provides endpoint and
* lookup client functionality for interacting with CoRE Resource Directories
* (RDs) as defined in `draft-ietf-core-resource-directory-15`.
*
* @see https://tools.ietf.org/html/draft-ietf-core-resource-directory-15
*
* `draft-ietf-core-resource-directory-15` defines two types different roles for
* nodes when interacting with a RD:
* - `endpoint`: registers and manages entries at the RD
* - `client`: performs different kind of lookups
*
* ```
* Registration Lookup, Group
* Interface Interfaces
* +----+ | |
* | EP |---- | |
* +----+ ---- | |
* --|- +------+ |
* +----+ | ----| | | +--------+
* | EP | ---------|-----| RD |----|-----| Client |
* +----+ | ----| | | +--------+
* --|- +------+ |
* +----+ ---- | |
* | EP |---- | |
* +----+
* ```
* Figure copied form `draft-ietf-core-resource-directory-15`.
*
* @note In the context of this module, we refer to these roles as `endpoint
* (ep)` and `lookup client (lc)`. This should hopefully prevent some
* confusion in conjunction with the `client` and `server` roles as
* defined by CoAP.
*
* # Structure
*
* This module is structured in a number of submodules with goal to reflect the
* different roles described in `draft-ietf-core-resource-directory-15`:
*
* - `cord_ep`: standard endpoint implementation following the rules as
* defined i.a. in sections 5.2, 5.3, A.1, and A.2
* - `cord_epsim`: endpoint implementation following the simple registration
* procedure as defined in section 5.3.1
* - `cord_lc`: lookup client implementation for querying information from
* an RD using the lookup and group interfaces (**NOT
* YET IMPLEMENTED**)
* - `cord_config`: header file collection (default) configuration values used
* throughout this module
* - `cord_common`: shared functionality used by the above submodules
*
*/

View File

@ -0,0 +1,9 @@
MODULE = cord_ep
SRC = cord_ep.c
ifneq (,$(filter cord_ep_standalone,$(USEMODULE)))
SRC += cord_ep_standalone.c
endif
include $(RIOTBASE)/Makefile.base

View File

@ -7,11 +7,11 @@
*/ */
/** /**
* @ingroup net_rdcli * @ingroup net_cord_ep
* @{ * @{
* *
* @file * @file
* @brief CoRE Resource Directory client implementation * @brief CoRE Resource Directory endpoint implementation
* *
* @author Hauke Petersen <hauke.petersen@fu-berlin.de> * @author Hauke Petersen <hauke.petersen@fu-berlin.de>
* *
@ -20,18 +20,18 @@
#include <string.h> #include <string.h>
#include "fmt.h"
#include "mutex.h" #include "mutex.h"
#include "assert.h"
#include "thread_flags.h" #include "thread_flags.h"
#include "net/gcoap.h" #include "net/gcoap.h"
#include "net/ipv6/addr.h" #include "net/ipv6/addr.h"
#include "net/rdcli.h" #include "net/cord/ep.h"
#include "net/rdcli_common.h" #include "net/cord/common.h"
#include "net/rdcli_config.h" #include "net/cord/config.h"
#ifdef MODULE_RDCLI_STANDALONE #ifdef MODULE_CORD_EP_STANDALONE
#include "net/rdcli_standalone.h" #include "net/cord/ep_standalone.h"
#endif #endif
#define ENABLE_DEBUG (0) #define ENABLE_DEBUG (0)
@ -68,16 +68,16 @@ static int _sync(void)
thread_flags_t flags = thread_flags_wait_any(FLAG_MASK); thread_flags_t flags = thread_flags_wait_any(FLAG_MASK);
if (flags & FLAG_ERR) { if (flags & FLAG_ERR) {
return RDCLI_ERR; return CORD_EP_ERR;
} }
else if (flags & FLAG_TIMEOUT) { else if (flags & FLAG_TIMEOUT) {
return RDCLI_TIMEOUT; return CORD_EP_TIMEOUT;
} }
else if (flags & FLAG_OVERFLOW) { else if (flags & FLAG_OVERFLOW) {
return RDCLI_OVERFLOW; return CORD_EP_OVERFLOW;
} }
else { else {
return RDCLI_OK; return CORD_EP_OK;
} }
} }
@ -137,13 +137,13 @@ static int _update_remove(unsigned code, gcoap_resp_handler_t handle)
coap_pkt_t pkt; coap_pkt_t pkt;
if (_rd_loc[0] == 0) { if (_rd_loc[0] == 0) {
return RDCLI_NORD; return CORD_EP_NORD;
} }
/* build CoAP request packet */ /* build CoAP request packet */
int res = gcoap_req_init(&pkt, buf, sizeof(buf), code, _rd_loc); int res = gcoap_req_init(&pkt, buf, sizeof(buf), code, _rd_loc);
if (res < 0) { if (res < 0) {
return RDCLI_ERR; return CORD_EP_ERR;
} }
coap_hdr_set_type(pkt.hdr, COAP_TYPE_CON); coap_hdr_set_type(pkt.hdr, COAP_TYPE_CON);
ssize_t pkt_len = gcoap_finish(&pkt, 0, COAP_FORMAT_NONE); ssize_t pkt_len = gcoap_finish(&pkt, 0, COAP_FORMAT_NONE);
@ -158,7 +158,7 @@ static int _update_remove(unsigned code, gcoap_resp_handler_t handle)
static void _on_discover(unsigned req_state, coap_pkt_t *pdu, static void _on_discover(unsigned req_state, coap_pkt_t *pdu,
sock_udp_ep_t *remote) sock_udp_ep_t *remote)
{ {
thread_flags_t flag = RDCLI_NORD; thread_flags_t flag = CORD_EP_NORD;
(void)remote; (void)remote;
if (req_state == GCOAP_MEMO_RESP) { if (req_state == GCOAP_MEMO_RESP) {
@ -216,19 +216,19 @@ static int _discover_internal(const sock_udp_ep_t *remote,
int res = gcoap_req_init(&pkt, buf, sizeof(buf), COAP_METHOD_GET, int res = gcoap_req_init(&pkt, buf, sizeof(buf), COAP_METHOD_GET,
"/.well-known/core"); "/.well-known/core");
if (res < 0) { if (res < 0) {
return RDCLI_ERR; return CORD_EP_ERR;
} }
coap_hdr_set_type(pkt.hdr, COAP_TYPE_CON); coap_hdr_set_type(pkt.hdr, COAP_TYPE_CON);
gcoap_add_qstring(&pkt, "rt", "core.rd"); gcoap_add_qstring(&pkt, "rt", "core.rd");
size_t pkt_len = gcoap_finish(&pkt, 0, COAP_FORMAT_NONE); size_t pkt_len = gcoap_finish(&pkt, 0, COAP_FORMAT_NONE);
res = gcoap_req_send2(buf, pkt_len, remote, _on_discover); res = gcoap_req_send2(buf, pkt_len, remote, _on_discover);
if (res < 0) { if (res < 0) {
return RDCLI_ERR; return CORD_EP_ERR;
} }
return _sync(); return _sync();
} }
int rdcli_discover_regif(const sock_udp_ep_t *remote, char *regif, size_t maxlen) int cord_ep_discover_regif(const sock_udp_ep_t *remote, char *regif, size_t maxlen)
{ {
assert(remote && regif); assert(remote && regif);
@ -238,7 +238,7 @@ int rdcli_discover_regif(const sock_udp_ep_t *remote, char *regif, size_t maxlen
return res; return res;
} }
int rdcli_register(const sock_udp_ep_t *remote, const char *regif) int cord_ep_register(const sock_udp_ep_t *remote, const char *regif)
{ {
assert(remote); assert(remote);
@ -253,13 +253,13 @@ int rdcli_register(const sock_udp_ep_t *remote, const char *regif)
* discovery for it first (see section 5.2) */ * discovery for it first (see section 5.2) */
if (regif == NULL) { if (regif == NULL) {
retval = _discover_internal(remote, _rd_regif, sizeof(_rd_regif)); retval = _discover_internal(remote, _rd_regif, sizeof(_rd_regif));
if (retval != RDCLI_OK) { if (retval != CORD_EP_OK) {
goto end; goto end;
} }
} }
else { else {
if (strlen(_rd_regif) >= sizeof(_rd_regif)) { if (strlen(_rd_regif) >= sizeof(_rd_regif)) {
retval = RDCLI_OVERFLOW; retval = CORD_EP_OVERFLOW;
goto end; goto end;
} }
strncpy(_rd_regif, regif, sizeof(_rd_regif)); strncpy(_rd_regif, regif, sizeof(_rd_regif));
@ -268,18 +268,18 @@ int rdcli_register(const sock_udp_ep_t *remote, const char *regif)
/* build and send CoAP POST request to the RD's registration interface */ /* build and send CoAP POST request to the RD's registration interface */
res = gcoap_req_init(&pkt, buf, sizeof(buf), COAP_METHOD_POST, _rd_regif); res = gcoap_req_init(&pkt, buf, sizeof(buf), COAP_METHOD_POST, _rd_regif);
if (res < 0) { if (res < 0) {
retval = RDCLI_ERR; retval = CORD_EP_ERR;
goto end; goto end;
} }
/* set some packet options and write query string */ /* set some packet options and write query string */
coap_hdr_set_type(pkt.hdr, COAP_TYPE_CON); coap_hdr_set_type(pkt.hdr, COAP_TYPE_CON);
rdcli_common_add_qstring(&pkt); cord_common_add_qstring(&pkt);
/* add the resource description as payload */ /* add the resource description as payload */
res = gcoap_get_resource_list(pkt.payload, pkt.payload_len, res = gcoap_get_resource_list(pkt.payload, pkt.payload_len,
COAP_FORMAT_LINK); COAP_FORMAT_LINK);
if (res < 0) { if (res < 0) {
retval = RDCLI_ERR; retval = CORD_EP_ERR;
goto end; goto end;
} }
@ -289,19 +289,19 @@ int rdcli_register(const sock_udp_ep_t *remote, const char *regif)
/* send out the request */ /* send out the request */
res = gcoap_req_send2(buf, pkt_len, remote, _on_register); res = gcoap_req_send2(buf, pkt_len, remote, _on_register);
if (res < 0) { if (res < 0) {
retval = RDCLI_ERR; retval = CORD_EP_ERR;
goto end; goto end;
} }
retval = _sync(); retval = _sync();
end: end:
/* if we encountered any error, we mark the client as not connected */ /* if we encountered any error, we mark the endpoint as not connected */
if (retval != RDCLI_OK) { if (retval != CORD_EP_OK) {
_rd_loc[0] = '\0'; _rd_loc[0] = '\0';
} }
#ifdef MODULE_RDCLI_STANDALONE #ifdef MODULE_CORD_EP_STANDALONE
else { else {
rdcli_standalone_signal(true); cord_ep_standalone_signal(true);
} }
#endif #endif
@ -309,14 +309,14 @@ end:
return retval; return retval;
} }
int rdcli_update(void) int cord_ep_update(void)
{ {
_lock(); _lock();
int res = _update_remove(COAP_METHOD_POST, _on_update); int res = _update_remove(COAP_METHOD_POST, _on_update);
if (res != RDCLI_OK) { if (res != CORD_EP_OK) {
/* in case we are not able to reach the RD, we drop the association */ /* in case we are not able to reach the RD, we drop the association */
#ifdef MODULE_RDCLI_STANDALONE #ifdef MODULE_CORD_EP_STANDALONE
rdcli_standalone_signal(false); cord_ep_standalone_signal(false);
#endif #endif
_rd_loc[0] = '\0'; _rd_loc[0] = '\0';
} }
@ -324,25 +324,25 @@ int rdcli_update(void)
return res; return res;
} }
int rdcli_remove(void) int cord_ep_remove(void)
{ {
_lock(); _lock();
if (_rd_loc[0] == '\0') { if (_rd_loc[0] == '\0') {
mutex_unlock(&_mutex); mutex_unlock(&_mutex);
return RDCLI_NORD; return CORD_EP_NORD;
} }
#ifdef MODULE_RDCLI_STANDALONE #ifdef MODULE_CORD_EP_STANDALONE
rdcli_standalone_signal(false); cord_ep_standalone_signal(false);
#endif #endif
_update_remove(COAP_METHOD_DELETE, _on_remove); _update_remove(COAP_METHOD_DELETE, _on_remove);
/* we actually do not care about the result, we drop the RD local RD entry /* we actually do not care about the result, we drop the RD local RD entry
* in any case */ * in any case */
_rd_loc[0] = '\0'; _rd_loc[0] = '\0';
mutex_unlock(&_mutex); mutex_unlock(&_mutex);
return RDCLI_OK; return CORD_EP_OK;
} }
void rdcli_dump_status(void) void cord_ep_dump_status(void)
{ {
puts("CoAP RD connection status:"); puts("CoAP RD connection status:");
@ -355,8 +355,8 @@ void rdcli_dump_status(void)
ipv6_addr_to_str(addr, (ipv6_addr_t *)&_rd_remote.addr, sizeof(addr)); ipv6_addr_to_str(addr, (ipv6_addr_t *)&_rd_remote.addr, sizeof(addr));
printf("RD address: coap://[%s]:%i\n", addr, (int)_rd_remote.port); printf("RD address: coap://[%s]:%i\n", addr, (int)_rd_remote.port);
printf(" ep name: %s\n", rdcli_common_get_ep()); printf(" ep name: %s\n", cord_common_get_ep());
printf(" lifetime: %is\n", (int)RDCLI_LT); printf(" lifetime: %is\n", (int)CORD_LT);
printf(" reg if: %s\n", _rd_regif); printf(" reg if: %s\n", _rd_regif);
printf(" location: %s\n", _rd_loc); printf(" location: %s\n", _rd_loc);
} }

View File

@ -7,11 +7,11 @@
*/ */
/** /**
* @ingroup net_rdcli_simple * @ingroup net_cord_ep_standalone
* @{ * @{
* *
* @file * @file
* @brief Standalone extension for the simple RD registration client * @brief Standalone extension for the CoRE RD endpoint implementation
* *
* @author Hauke Petersen <hauke.petersen@fu-berlin.de> * @author Hauke Petersen <hauke.petersen@fu-berlin.de>
* *
@ -24,9 +24,9 @@
#include "assert.h" #include "assert.h"
#include "thread.h" #include "thread.h"
#include "xtimer.h" #include "xtimer.h"
#include "net/rdcli.h" #include "net/cord/ep.h"
#include "net/rdcli_config.h" #include "net/cord/config.h"
#include "net/rdcli_standalone.h" #include "net/cord/ep_standalone.h"
#define ENABLE_DEBUG (0) #define ENABLE_DEBUG (0)
#include "debug.h" #include "debug.h"
@ -34,11 +34,11 @@
/* stack configuration */ /* stack configuration */
#define STACKSIZE (THREAD_STACKSIZE_DEFAULT) #define STACKSIZE (THREAD_STACKSIZE_DEFAULT)
#define PRIO (THREAD_PRIORITY_MAIN - 1) #define PRIO (THREAD_PRIORITY_MAIN - 1)
#define TNAME "rdcli" #define TNAME "cord_ep"
#define UPDATE_TIMEOUT (0xe537) #define UPDATE_TIMEOUT (0xe537)
#define TIMEOUT_US ((uint64_t)(RDCLI_UPDATE_INTERVAL * US_PER_SEC)) #define TIMEOUT_US ((uint64_t)(CORD_UPDATE_INTERVAL * US_PER_SEC))
static char _stack[STACKSIZE]; static char _stack[STACKSIZE];
@ -46,14 +46,14 @@ static xtimer_t _timer;
static kernel_pid_t _runner_pid; static kernel_pid_t _runner_pid;
static msg_t _msg; static msg_t _msg;
static rdcli_standalone_cb_t _cb = NULL; static cord_ep_standalone_cb_t _cb = NULL;
static void _set_timer(void) static void _set_timer(void)
{ {
xtimer_set_msg64(&_timer, TIMEOUT_US, &_msg, _runner_pid); xtimer_set_msg64(&_timer, TIMEOUT_US, &_msg, _runner_pid);
} }
static void _notify(rdcli_standalone_event_t event) static void _notify(cord_ep_standalone_event_t event)
{ {
if (_cb) { if (_cb) {
_cb(event); _cb(event);
@ -70,16 +70,14 @@ static void *_reg_runner(void *arg)
_msg.type = UPDATE_TIMEOUT; _msg.type = UPDATE_TIMEOUT;
while (1) { while (1) {
DEBUG("rd stand: waiting for message\n");
msg_receive(&in); msg_receive(&in);
if (in.type == UPDATE_TIMEOUT) { if (in.type == UPDATE_TIMEOUT) {
if (rdcli_update() == RDCLI_OK) { if (cord_ep_update() == CORD_EP_OK) {
DEBUG("rd stand: update ok\n");
_set_timer(); _set_timer();
_notify(RDCLI_UPDATED); _notify(CORD_EP_UPDATED);
} }
else { else {
_notify(RDCLI_DEREGISTERED); _notify(CORD_EP_DEREGISTERED);
} }
} }
} }
@ -87,25 +85,25 @@ static void *_reg_runner(void *arg)
return NULL; /* should never be reached */ return NULL; /* should never be reached */
} }
void rdcli_standalone_run(void) void cord_ep_standalone_run(void)
{ {
thread_create(_stack, sizeof(_stack), PRIO, 0, _reg_runner, NULL, TNAME); thread_create(_stack, sizeof(_stack), PRIO, 0, _reg_runner, NULL, TNAME);
} }
void rdcli_standalone_signal(bool connected) void cord_ep_standalone_signal(bool connected)
{ {
/* clear timer in any case */ /* clear timer in any case */
xtimer_remove(&_timer); xtimer_remove(&_timer);
/* reset the update timer in case a connection was established or updated */ /* reset the update timer in case a connection was established or updated */
if (connected) { if (connected) {
_set_timer(); _set_timer();
_notify(RDCLI_REGISTERED); _notify(CORD_EP_REGISTERED);
} else { } else {
_notify(RDCLI_DEREGISTERED); _notify(CORD_EP_DEREGISTERED);
} }
} }
void rdcli_standalone_reg_cb(rdcli_standalone_cb_t cb) void cord_ep_standalone_reg_cb(cord_ep_standalone_cb_t cb)
{ {
/* Note: we do not allow re-setting the callback (via passing cb := NULL), /* Note: we do not allow re-setting the callback (via passing cb := NULL),
* as this would mean additional complexity for synchronizing the * as this would mean additional complexity for synchronizing the

View File

@ -0,0 +1,9 @@
MODULE = cord_epsim
SRC = cord_epsim.c
ifneq (,$(filter cord_epsim_standalone,$(USEMODULE)))
SRC += cord_epsim_standalone.c
endif
include $(RIOTBASE)/Makefile.base

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017 Freie Universität Berlin * Copyright (C) 2017-2018 Freie Universität Berlin
* *
* This file is subject to the terms and conditions of the GNU Lesser * 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 * General Public License v2.1. See the file LICENSE in the top level
@ -7,11 +7,11 @@
*/ */
/** /**
* @ingroup net_rdcli_simple * @ingroup net_cord_epsim
* @{ * @{
* *
* @file * @file
* @brief Simplified CoAP resource directory client implementation * @brief CoRE RD simple registration endpoint implementation
* *
* @author Hauke Petersen <hauke.petersen@fu-berlin.de> * @author Hauke Petersen <hauke.petersen@fu-berlin.de>
* *
@ -20,11 +20,10 @@
#include <string.h> #include <string.h>
#include "fmt.h"
#include "net/gcoap.h" #include "net/gcoap.h"
#include "net/rdcli_config.h" #include "net/cord/epsim.h"
#include "net/rdcli_common.h" #include "net/cord/config.h"
#include "net/rdcli_simple.h" #include "net/cord/common.h"
#include "net/ipv6/addr.h" #include "net/ipv6/addr.h"
#define BUFSIZE (128U) #define BUFSIZE (128U)
@ -34,36 +33,36 @@
static coap_pkt_t pkt; static coap_pkt_t pkt;
static uint8_t buf[BUFSIZE]; static uint8_t buf[BUFSIZE];
int rdcli_simple_register(void) int cord_epsim_register(void)
{ {
sock_udp_ep_t remote = { sock_udp_ep_t remote = {
.family = AF_INET6, .family = AF_INET6,
.netif = SOCK_ADDR_ANY_NETIF, .netif = SOCK_ADDR_ANY_NETIF,
.port = RDCLI_SERVER_PORT, .port = CORD_SERVER_PORT,
}; };
/* parse RD server address */ /* parse RD server address */
if (ipv6_addr_from_str((ipv6_addr_t *)&remote.addr.ipv6, if (ipv6_addr_from_str((ipv6_addr_t *)&remote.addr.ipv6,
RDCLI_SERVER_ADDR) == NULL) { CORD_SERVER_ADDR) == NULL) {
return RDCLI_SIMPLE_NOADDR; return CORD_EPSIM_NOADDR;
} }
/* build the initial CON packet */ /* build the initial CON packet */
if (gcoap_req_init(&pkt, buf, sizeof(buf), COAP_METHOD_POST, if (gcoap_req_init(&pkt, buf, sizeof(buf), COAP_METHOD_POST,
"/.well-known/core") < 0) { "/.well-known/core") < 0) {
return RDCLI_SIMPLE_ERROR; return CORD_EPSIM_ERROR;
} }
/* make packet confirmable */ /* make packet confirmable */
coap_hdr_set_type(pkt.hdr, COAP_TYPE_CON); coap_hdr_set_type(pkt.hdr, COAP_TYPE_CON);
/* add Uri-Query options */ /* add Uri-Query options */
if (rdcli_common_add_qstring(&pkt) < 0) { if (cord_common_add_qstring(&pkt) < 0) {
return RDCLI_SIMPLE_ERROR; return CORD_EPSIM_ERROR;
} }
/* finish, we don't have any payload */ /* finish, we don't have any payload */
ssize_t len = gcoap_finish(&pkt, 0, COAP_FORMAT_NONE); ssize_t len = gcoap_finish(&pkt, 0, COAP_FORMAT_NONE);
if (gcoap_req_send2(buf, len, &remote, NULL) == 0) { if (gcoap_req_send2(buf, len, &remote, NULL) == 0) {
return RDCLI_SIMPLE_ERROR; return CORD_EPSIM_ERROR;
} }
return RDCLI_SIMPLE_OK; return CORD_EPSIM_OK;
} }

View File

@ -7,11 +7,11 @@
*/ */
/** /**
* @ingroup net_rdcli_simple * @ingroup net_cord_epsim
* @{ * @{
* *
* @file * @file
* @brief Standalone extension for the simple RD registration client * @brief Standalone extension for the simple RD registration endpoint
* *
* @author Hauke Petersen <hauke.petersen@fu-berlin.de> * @author Hauke Petersen <hauke.petersen@fu-berlin.de>
* *
@ -21,12 +21,12 @@
#include "log.h" #include "log.h"
#include "thread.h" #include "thread.h"
#include "xtimer.h" #include "xtimer.h"
#include "net/rdcli_config.h" #include "net/cord/epsim.h"
#include "net/rdcli_simple.h" #include "net/cord/config.h"
#define STACKSIZE (THREAD_STACKSIZE_DEFAULT) #define STACKSIZE (THREAD_STACKSIZE_DEFAULT)
#define PRIO (THREAD_PRIORITY_MAIN - 1) #define PRIO (THREAD_PRIORITY_MAIN - 1)
#define TNAME "rdcli_simple" #define TNAME "cord_epsim"
static char _stack[STACKSIZE]; static char _stack[STACKSIZE];
@ -35,22 +35,24 @@ static void *reg_runner(void *arg)
(void)arg; (void)arg;
/* wait some seconds to give the address configuration some time to settle */ /* wait some seconds to give the address configuration some time to settle */
xtimer_sleep(RDCLI_STARTUP_DELAY); xtimer_sleep(CORD_STARTUP_DELAY);
while (1) { while (1) {
if (rdcli_simple_register() != RDCLI_SIMPLE_OK) { if (cord_epsim_register() != CORD_EPSIM_OK) {
/* if this fails once, it will always fail, so we might as well /* if this fails once, it will always fail, so we might as well
* quit now */ * quit now */
LOG_ERROR("[rdcli_simple] error: unable to send registration\n"); LOG_ERROR("[cord_epsim] error: unable to send registration\n");
break; break;
} }
xtimer_sleep(RDCLI_UPDATE_INTERVAL); xtimer_sleep(CORD_UPDATE_INTERVAL);
} }
return NULL; return NULL;
} }
void rdcli_simple_run(void) #ifdef MODULE_CORD_EPSIM_STANDALONE
void cord_epsim_run(void)
{ {
thread_create(_stack, sizeof(_stack), PRIO, 0, reg_runner, NULL, TNAME); thread_create(_stack, sizeof(_stack), PRIO, 0, reg_runner, NULL, TNAME);
} }
#endif

View File

@ -1,7 +0,0 @@
SRC = rdcli.c
ifneq (,$(filter rdcli_standalone,$(USEMODULE)))
SRC += rdcli_standalone.c
endif
include $(RIOTBASE)/Makefile.base

View File

@ -1,7 +0,0 @@
SRC = rdcli_simple.c
ifneq (,$(filter rdcli_simple_standalone,$(USEMODULE)))
SRC += rdcli_simple_standalone.c
endif
include $(RIOTBASE)/Makefile.base

View File

@ -66,8 +66,8 @@ endif
ifneq (,$(filter conn_can,$(USEMODULE))) ifneq (,$(filter conn_can,$(USEMODULE)))
SRC += sc_can.c SRC += sc_can.c
endif endif
ifneq (,$(filter rdcli,$(USEMODULE))) ifneq (,$(filter cord_ep,$(USEMODULE)))
SRC += sc_rdcli.c SRC += sc_cord_ep.c
endif endif
ifneq (,$(filter periph_rtc,$(FEATURES_PROVIDED))) ifneq (,$(filter periph_rtc,$(FEATURES_PROVIDED)))

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017 Freie Universität Berlin * Copyright (C) 2017-2018 Freie Universität Berlin
* *
* This file is subject to the terms and conditions of the GNU Lesser * 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 * General Public License v2.1. See the file LICENSE in the top level
@ -11,7 +11,7 @@
* @{ * @{
* *
* @file * @file
* @brief Shell commands for the rdcli module * @brief Shell commands for the cord_ep module
* *
* @author Hauke Petersen <hauke.petersen@fu-berlin.de> * @author Hauke Petersen <hauke.petersen@fu-berlin.de>
* *
@ -21,11 +21,10 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "net/rdcli.h" #include "net/cord/ep.h"
#include "net/nanocoap.h" #include "net/nanocoap.h"
#include "net/sock/util.h" #include "net/sock/util.h"
#include "net/rdcli_config.h" #include "net/cord/config.h"
#include "net/rdcli_common.h"
static int make_sock_ep(sock_udp_ep_t *ep, const char *addr) static int make_sock_ep(sock_udp_ep_t *ep, const char *addr)
{ {
@ -36,12 +35,12 @@ static int make_sock_ep(sock_udp_ep_t *ep, const char *addr)
ep->family = AF_INET6; ep->family = AF_INET6;
ep->netif = SOCK_ADDR_ANY_NETIF; ep->netif = SOCK_ADDR_ANY_NETIF;
if (ep->port == 0) { if (ep->port == 0) {
ep->port = RDCLI_SERVER_PORT; ep->port = CORD_SERVER_PORT;
} }
return 0; return 0;
} }
int _rdcli_handler(int argc, char **argv) int _cord_ep_handler(int argc, char **argv)
{ {
int res; int res;
@ -61,12 +60,12 @@ int _rdcli_handler(int argc, char **argv)
regif = argv[3]; regif = argv[3];
} }
puts("Registering with RD now, this may take a short while..."); puts("Registering with RD now, this may take a short while...");
if (rdcli_register(&remote, regif) != RDCLI_OK) { if (cord_ep_register(&remote, regif) != CORD_EP_OK) {
puts("error: registration failed"); puts("error: registration failed");
} }
else { else {
puts("registration successful\n"); puts("registration successful\n");
rdcli_dump_status(); cord_ep_dump_status();
} }
} }
else if ((argc > 1) && (strcmp(argv[1], "discover") == 0)) { else if ((argc > 1) && (strcmp(argv[1], "discover") == 0)) {
@ -80,7 +79,7 @@ int _rdcli_handler(int argc, char **argv)
printf("error: unable to parse address\n"); printf("error: unable to parse address\n");
return 1; return 1;
} }
if (rdcli_discover_regif(&remote, regif, sizeof(regif)) == RDCLI_OK) { if (cord_ep_discover_regif(&remote, regif, sizeof(regif)) == CORD_EP_OK) {
printf("the registration interface is '%s'\n", regif); printf("the registration interface is '%s'\n", regif);
} }
else { else {
@ -88,14 +87,14 @@ int _rdcli_handler(int argc, char **argv)
} }
} }
else if ((argc > 1) && (strcmp(argv[1], "update") == 0)) { else if ((argc > 1) && (strcmp(argv[1], "update") == 0)) {
res = rdcli_update(); res = cord_ep_update();
if (res == RDCLI_OK) { if (res == CORD_EP_OK) {
puts("RD update successful"); puts("RD update successful");
} }
else if (res == RDCLI_NORD) { else if (res == CORD_EP_NORD) {
puts("error: not associated with any RD"); puts("error: not associated with any RD");
} }
else if (res == RDCLI_TIMEOUT) { else if (res == CORD_EP_TIMEOUT) {
puts("error: unable to reach RD - dropped association"); puts("error: unable to reach RD - dropped association");
} }
else { else {
@ -103,14 +102,14 @@ int _rdcli_handler(int argc, char **argv)
} }
} }
else if ((argc > 1) && (strcmp(argv[1], "remove") == 0)) { else if ((argc > 1) && (strcmp(argv[1], "remove") == 0)) {
res = rdcli_remove(); res = cord_ep_remove();
if (res == RDCLI_OK) { if (res == CORD_EP_OK) {
puts("node successfully removed from RD"); puts("node successfully removed from RD");
} }
else if (res == RDCLI_NORD) { else if (res == CORD_EP_NORD) {
puts("error: not associated with any RD"); puts("error: not associated with any RD");
} }
else if (res == RDCLI_TIMEOUT) { else if (res == CORD_EP_TIMEOUT) {
puts("error: unable to reach RD - remove association only locally"); puts("error: unable to reach RD - remove association only locally");
} }
else { else {
@ -118,7 +117,7 @@ int _rdcli_handler(int argc, char **argv)
} }
} }
else if ((argc > 1) && (strcmp(argv[1], "info") == 0)) { else if ((argc > 1) && (strcmp(argv[1], "info") == 0)) {
rdcli_dump_status(); cord_ep_dump_status();
} }
else { else {
printf("usage: %s <register|discover|update|remove|info>\n", printf("usage: %s <register|discover|update|remove|info>\n",

View File

@ -142,8 +142,8 @@ extern int _ls_handler(int argc, char **argv);
extern int _can_handler(int argc, char **argv); extern int _can_handler(int argc, char **argv);
#endif #endif
#ifdef MODULE_RDCLI #ifdef MODULE_CORD_EP
extern int _rdcli_handler(int argc, char **argv); extern int _cord_ep_handler(int argc, char **argv);
#endif #endif
const shell_command_t _shell_command_list[] = { const shell_command_t _shell_command_list[] = {
@ -237,8 +237,8 @@ const shell_command_t _shell_command_list[] = {
#ifdef MODULE_CONN_CAN #ifdef MODULE_CONN_CAN
{"can", "CAN commands", _can_handler}, {"can", "CAN commands", _can_handler},
#endif #endif
#ifdef MODULE_RDCLI #ifdef MODULE_CORD_EP
{"rdcli", "CoAP RD client commands", _rdcli_handler }, {"cord_ep", "Resource directory endpoint commands", _cord_ep_handler },
#endif #endif
{NULL, NULL, NULL} {NULL, NULL, NULL}
}; };