net/rdcli_common: rename to cord_common

This commit is contained in:
Hauke Petersen 2018-10-15 10:05:33 +02:00
parent f0b0e25254
commit 787524400c
11 changed files with 46 additions and 47 deletions

View File

@ -755,7 +755,7 @@ ifneq (,$(filter rdcli_simple_standalone,$(USEMODULE)))
endif endif
ifneq (,$(filter rdcli_simple,$(USEMODULE))) ifneq (,$(filter rdcli_simple,$(USEMODULE)))
USEMODULE += rdcli_common USEMODULE += cord_common
USEMODULE += fmt USEMODULE += fmt
endif endif
@ -765,7 +765,7 @@ ifneq (,$(filter rdcli_standalone,$(USEMODULE)))
endif endif
ifneq (,$(filter rdcli,$(USEMODULE))) ifneq (,$(filter rdcli,$(USEMODULE)))
USEMODULE += rdcli_common USEMODULE += cord_common
USEMODULE += core_thread_flags USEMODULE += core_thread_flags
USEMODULE += gcoap USEMODULE += gcoap
USEMODULE += fmt USEMODULE += fmt
@ -774,7 +774,7 @@ ifneq (,$(filter rdcli,$(USEMODULE)))
endif endif
endif endif
ifneq (,$(filter rdcli_common,$(USEMODULE))) ifneq (,$(filter cord_common,$(USEMODULE)))
USEMODULE += fmt USEMODULE += fmt
USEMODULE += gcoap USEMODULE += gcoap
USEMODULE += luid USEMODULE += luid

View File

@ -24,7 +24,7 @@
#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/rdcli_standalone.h"
#define MAIN_QUEUE_SIZE (8) #define MAIN_QUEUE_SIZE (8)
@ -98,7 +98,7 @@ int main(void)
rdcli_standalone_reg_cb(_on_rdcli_event); rdcli_standalone_reg_cb(_on_rdcli_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)RDCLI_LT);
char line_buf[SHELL_DEFAULT_BUFSIZE]; char line_buf[SHELL_DEFAULT_BUFSIZE];

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,7 +68,7 @@ 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(), RDCLI_LT);
/* register resource handlers with gcoap */ /* register resource handlers with gcoap */
gcoap_register_listener(&listener); gcoap_register_listener(&listener);
@ -77,7 +77,7 @@ int main(void)
puts("RD client information:"); puts("RD client information:");
printf(" RD addr: %s\n", RDCLI_SERVER_ADDR); printf(" RD addr: %s\n", RDCLI_SERVER_ADDR);
printf(" RD port: %u\n", (unsigned)RDCLI_SERVER_PORT); printf(" RD port: %u\n", (unsigned)RDCLI_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)RDCLI_LT);
/* run the shell */ /* run the shell */

View File

@ -127,7 +127,7 @@ 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/cord/common DIRS += net/application_layer/cord/common
endif endif
ifneq (,$(filter rdcli_simple,$(USEMODULE))) ifneq (,$(filter rdcli_simple,$(USEMODULE)))

View File

@ -158,10 +158,10 @@ 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_RDCLI_STANDALONE
DEBUG("Auto init rdcli_standalone\n"); DEBUG("Auto init rdcli_standalone\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,19 +7,19 @@
*/ */
/** /**
* @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/rdcli_config.h"
@ -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

@ -1,3 +1,3 @@
MODULE = rdcli_common 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,7 +22,7 @@
#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"
@ -35,29 +35,29 @@
#define BUFSIZE (PREFIX_LEN + RDCLI_EP_SUFFIX_LEN) #define BUFSIZE (PREFIX_LEN + RDCLI_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 RDCLI_EP
memcpy(rdcli_ep, RDCLI_EP, BUFSIZE); memcpy(cord_common_ep, RDCLI_EP, BUFSIZE);
#else #else
uint8_t luid[RDCLI_EP_SUFFIX_LEN / 2]; uint8_t luid[RDCLI_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, RDCLI_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;
} }

View File

@ -27,7 +27,7 @@
#include "net/gcoap.h" #include "net/gcoap.h"
#include "net/ipv6/addr.h" #include "net/ipv6/addr.h"
#include "net/rdcli.h" #include "net/rdcli.h"
#include "net/rdcli_common.h" #include "net/cord/common.h"
#include "net/rdcli_config.h" #include "net/rdcli_config.h"
#ifdef MODULE_RDCLI_STANDALONE #ifdef MODULE_RDCLI_STANDALONE
@ -273,7 +273,7 @@ int rdcli_register(const sock_udp_ep_t *remote, const char *regif)
} }
/* 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,
@ -355,7 +355,7 @@ 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)RDCLI_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

@ -23,7 +23,7 @@
#include "fmt.h" #include "fmt.h"
#include "net/gcoap.h" #include "net/gcoap.h"
#include "net/rdcli_config.h" #include "net/rdcli_config.h"
#include "net/rdcli_common.h" #include "net/cord/common.h"
#include "net/rdcli_simple.h" #include "net/rdcli_simple.h"
#include "net/ipv6/addr.h" #include "net/ipv6/addr.h"
@ -56,7 +56,7 @@ int rdcli_simple_register(void)
/* 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 RDCLI_SIMPLE_ERROR;
} }
/* finish, we don't have any payload */ /* finish, we don't have any payload */

View File

@ -25,7 +25,6 @@
#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/rdcli_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)
{ {