mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
net/rdcli_config: rename to cord_config
This commit is contained in:
parent
787524400c
commit
152623577e
@ -21,7 +21,7 @@
|
||||
#ifndef NET_CORD_COMMON_H
|
||||
#define NET_CORD_COMMON_H
|
||||
|
||||
#include "net/rdcli_config.h"
|
||||
#include "net/cord/config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -7,21 +7,20 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup net_rdcli_config CoRE RD Client Configuration
|
||||
* @ingroup net
|
||||
* @brief Shared CoRE Resource Directory Client Configuration
|
||||
* @defgroup net_cord_config CoRE RD Endpoint and Lookup Client Configuration
|
||||
* @ingroup net_cord
|
||||
* @brief Configuration options for CoRE RD endpoints and lookup clients
|
||||
* @{
|
||||
*
|
||||
* @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>
|
||||
*/
|
||||
|
||||
#ifndef NET_RDCLI_CONFIG_H
|
||||
#define NET_RDCLI_CONFIG_H
|
||||
|
||||
#include "net/ipv6/addr.h"
|
||||
#ifndef NET_CORD_CONFIG_H
|
||||
#define NET_CORD_CONFIG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -30,49 +29,49 @@ extern "C" {
|
||||
/**
|
||||
* @brief Default lifetime in seconds (the default is 1 day)
|
||||
*/
|
||||
#ifndef RDCLI_LT
|
||||
#define RDCLI_LT (86400UL)
|
||||
#ifndef CORD_LT
|
||||
#define CORD_LT (86400UL)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Delay until the RD client starts to try registering (in seconds)
|
||||
*/
|
||||
#ifndef RDCLI_STARTUP_DELAY
|
||||
#define RDCLI_STARTUP_DELAY (3U)
|
||||
#ifndef CORD_STARTUP_DELAY
|
||||
#define CORD_STARTUP_DELAY (3U)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Default client update interval (default is 3/4 the lifetime)
|
||||
*/
|
||||
#ifndef RDCLI_UPDATE_INTERVAL
|
||||
#define RDCLI_UPDATE_INTERVAL ((RDCLI_LT / 4) * 3)
|
||||
#ifndef CORD_UPDATE_INTERVAL
|
||||
#define CORD_UPDATE_INTERVAL ((CORD_LT / 4) * 3)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name Endpoint ID definition
|
||||
*
|
||||
* 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
|
||||
* (RDCLI_EP_SUFFIX_LEN).
|
||||
* (CORD_EP_SUFFIX_LEN).
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
#define RDCLI_EP_PREFIX "RIOT-"
|
||||
#define CORD_EP_PREFIX "RIOT-"
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
@ -80,20 +79,20 @@ extern "C" {
|
||||
* @brief Use ALL_NODES multicast address as default address when looking for
|
||||
* a RD server
|
||||
*/
|
||||
#ifndef RDCLI_SERVER_ADDR
|
||||
#define RDCLI_SERVER_ADDR "ff02::1"
|
||||
#ifndef CORD_SERVER_ADDR
|
||||
#define CORD_SERVER_ADDR "ff02::1"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Default Port to use when looking for RDs
|
||||
*/
|
||||
#ifndef RDCLI_SERVER_PORT
|
||||
#define RDCLI_SERVER_PORT COAP_PORT
|
||||
#ifndef CORD_SERVER_PORT
|
||||
#define CORD_SERVER_PORT COAP_PORT
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* NET_RDCLI_CONFIG_H */
|
||||
#endif /* NET_CORD_CONFIG_H */
|
||||
/** @} */
|
@ -28,24 +28,24 @@
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
#ifdef RDCLI_EP
|
||||
#define BUFSIZE (sizeof(RDCLI_EP)) /* contains \0 termination char */
|
||||
#ifdef CORD_EP
|
||||
#define BUFSIZE (sizeof(CORD_EP)) /* contains \0 termination char */
|
||||
#else
|
||||
#define PREFIX_LEN (sizeof(RDCLI_EP_PREFIX)) /* contains \0 char */
|
||||
#define BUFSIZE (PREFIX_LEN + RDCLI_EP_SUFFIX_LEN)
|
||||
#define PREFIX_LEN (sizeof(CORD_EP_PREFIX)) /* contains \0 char */
|
||||
#define BUFSIZE (PREFIX_LEN + CORD_EP_SUFFIX_LEN)
|
||||
#endif
|
||||
|
||||
char cord_common_ep[BUFSIZE];
|
||||
|
||||
void cord_common_init(void)
|
||||
{
|
||||
#ifdef RDCLI_EP
|
||||
memcpy(cord_common_ep, RDCLI_EP, BUFSIZE);
|
||||
#ifdef CORD_EP
|
||||
memcpy(cord_common_ep, CORD_EP, BUFSIZE);
|
||||
#else
|
||||
uint8_t luid[RDCLI_EP_SUFFIX_LEN / 2];
|
||||
uint8_t luid[CORD_EP_SUFFIX_LEN / 2];
|
||||
|
||||
if (PREFIX_LEN > 1) {
|
||||
memcpy(cord_common_ep, RDCLI_EP_PREFIX, (PREFIX_LEN - 1));
|
||||
memcpy(cord_common_ep, CORD_EP_PREFIX, (PREFIX_LEN - 1));
|
||||
}
|
||||
|
||||
luid_get(luid, sizeof(luid));
|
||||
@ -63,9 +63,9 @@ int cord_common_add_qstring(coap_pkt_t *pkt)
|
||||
}
|
||||
|
||||
/* [optional] set the lifetime parameter */
|
||||
#if RDCLI_LT
|
||||
#if CORD_LT
|
||||
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);
|
||||
if (res < 0) {
|
||||
return res;
|
||||
@ -73,8 +73,8 @@ int cord_common_add_qstring(coap_pkt_t *pkt)
|
||||
#endif
|
||||
|
||||
/* [optional] set the domain parameter */
|
||||
#ifdef RDCLI_D
|
||||
res = gcoap_add_qstring(pkt, "d", RDCLI_D);
|
||||
#ifdef CORD_D
|
||||
res = gcoap_add_qstring(pkt, "d", CORD_D);
|
||||
if (res < 0) {
|
||||
return res;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "net/ipv6/addr.h"
|
||||
#include "net/rdcli.h"
|
||||
#include "net/cord/common.h"
|
||||
#include "net/rdcli_config.h"
|
||||
#include "net/cord/config.h"
|
||||
|
||||
#ifdef MODULE_RDCLI_STANDALONE
|
||||
#include "net/rdcli_standalone.h"
|
||||
@ -356,7 +356,7 @@ void rdcli_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)RDCLI_LT);
|
||||
printf(" lifetime: %is\n", (int)CORD_LT);
|
||||
printf(" reg if: %s\n", _rd_regif);
|
||||
printf(" location: %s\n", _rd_loc);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "thread.h"
|
||||
#include "xtimer.h"
|
||||
#include "net/rdcli.h"
|
||||
#include "net/rdcli_config.h"
|
||||
#include "net/cord/config.h"
|
||||
#include "net/rdcli_standalone.h"
|
||||
|
||||
#define ENABLE_DEBUG (0)
|
||||
@ -38,7 +38,7 @@
|
||||
|
||||
#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];
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#include "fmt.h"
|
||||
#include "net/gcoap.h"
|
||||
#include "net/rdcli_config.h"
|
||||
#include "net/cord/config.h"
|
||||
#include "net/cord/common.h"
|
||||
#include "net/rdcli_simple.h"
|
||||
#include "net/ipv6/addr.h"
|
||||
@ -39,7 +39,7 @@ int rdcli_simple_register(void)
|
||||
sock_udp_ep_t remote = {
|
||||
.family = AF_INET6,
|
||||
.netif = SOCK_ADDR_ANY_NETIF,
|
||||
.port = RDCLI_SERVER_PORT,
|
||||
.port = CORD_SERVER_PORT,
|
||||
};
|
||||
|
||||
/* parse RD server address */
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "log.h"
|
||||
#include "thread.h"
|
||||
#include "xtimer.h"
|
||||
#include "net/rdcli_config.h"
|
||||
#include "net/cord/config.h"
|
||||
#include "net/rdcli_simple.h"
|
||||
|
||||
#define STACKSIZE (THREAD_STACKSIZE_DEFAULT)
|
||||
@ -35,7 +35,7 @@ static void *reg_runner(void *arg)
|
||||
(void)arg;
|
||||
|
||||
/* wait some seconds to give the address configuration some time to settle */
|
||||
xtimer_sleep(RDCLI_STARTUP_DELAY);
|
||||
xtimer_sleep(CORD_STARTUP_DELAY);
|
||||
|
||||
while (1) {
|
||||
if (rdcli_simple_register() != RDCLI_SIMPLE_OK) {
|
||||
@ -44,7 +44,7 @@ static void *reg_runner(void *arg)
|
||||
LOG_ERROR("[rdcli_simple] error: unable to send registration\n");
|
||||
break;
|
||||
}
|
||||
xtimer_sleep(RDCLI_UPDATE_INTERVAL);
|
||||
xtimer_sleep(CORD_UPDATE_INTERVAL);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "net/rdcli.h"
|
||||
#include "net/nanocoap.h"
|
||||
#include "net/sock/util.h"
|
||||
#include "net/rdcli_config.h"
|
||||
#include "net/cord/config.h"
|
||||
|
||||
static int make_sock_ep(sock_udp_ep_t *ep, const char *addr)
|
||||
{
|
||||
@ -35,7 +35,7 @@ static int make_sock_ep(sock_udp_ep_t *ep, const char *addr)
|
||||
ep->family = AF_INET6;
|
||||
ep->netif = SOCK_ADDR_ANY_NETIF;
|
||||
if (ep->port == 0) {
|
||||
ep->port = RDCLI_SERVER_PORT;
|
||||
ep->port = CORD_SERVER_PORT;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user