mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
net/rdcli_common: rename to cord_common
This commit is contained in:
parent
f0b0e25254
commit
787524400c
@ -755,7 +755,7 @@ ifneq (,$(filter rdcli_simple_standalone,$(USEMODULE)))
|
||||
endif
|
||||
|
||||
ifneq (,$(filter rdcli_simple,$(USEMODULE)))
|
||||
USEMODULE += rdcli_common
|
||||
USEMODULE += cord_common
|
||||
USEMODULE += fmt
|
||||
endif
|
||||
|
||||
@ -765,7 +765,7 @@ ifneq (,$(filter rdcli_standalone,$(USEMODULE)))
|
||||
endif
|
||||
|
||||
ifneq (,$(filter rdcli,$(USEMODULE)))
|
||||
USEMODULE += rdcli_common
|
||||
USEMODULE += cord_common
|
||||
USEMODULE += core_thread_flags
|
||||
USEMODULE += gcoap
|
||||
USEMODULE += fmt
|
||||
@ -774,7 +774,7 @@ ifneq (,$(filter rdcli,$(USEMODULE)))
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq (,$(filter rdcli_common,$(USEMODULE)))
|
||||
ifneq (,$(filter cord_common,$(USEMODULE)))
|
||||
USEMODULE += fmt
|
||||
USEMODULE += gcoap
|
||||
USEMODULE += luid
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "shell.h"
|
||||
#include "net/ipv6/addr.h"
|
||||
#include "net/gcoap.h"
|
||||
#include "net/rdcli_common.h"
|
||||
#include "net/cord/common.h"
|
||||
#include "net/rdcli_standalone.h"
|
||||
|
||||
#define MAIN_QUEUE_SIZE (8)
|
||||
@ -98,7 +98,7 @@ int main(void)
|
||||
rdcli_standalone_reg_cb(_on_rdcli_event);
|
||||
|
||||
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);
|
||||
|
||||
char line_buf[SHELL_DEFAULT_BUFSIZE];
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "shell.h"
|
||||
#include "net/gcoap.h"
|
||||
#include "net/rdcli_common.h"
|
||||
#include "net/cord/common.h"
|
||||
|
||||
#define BUFSIZE (64U)
|
||||
|
||||
@ -68,7 +68,7 @@ int main(void)
|
||||
|
||||
/* fill riot info */
|
||||
sprintf(riot_info, "{\"ep\":\"%s\",\"lt\":%u}",
|
||||
rdcli_common_get_ep(), RDCLI_LT);
|
||||
cord_common_get_ep(), RDCLI_LT);
|
||||
|
||||
/* register resource handlers with gcoap */
|
||||
gcoap_register_listener(&listener);
|
||||
@ -77,7 +77,7 @@ int main(void)
|
||||
puts("RD client information:");
|
||||
printf(" RD addr: %s\n", RDCLI_SERVER_ADDR);
|
||||
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);
|
||||
|
||||
/* run the shell */
|
||||
|
@ -127,7 +127,7 @@ endif
|
||||
ifneq (,$(filter skald,$(USEMODULE)))
|
||||
DIRS += net/skald
|
||||
endif
|
||||
ifneq (,$(filter rdcli_common,$(USEMODULE)))
|
||||
ifneq (,$(filter cord_common,$(USEMODULE)))
|
||||
DIRS += net/application_layer/cord/common
|
||||
endif
|
||||
ifneq (,$(filter rdcli_simple,$(USEMODULE)))
|
||||
|
@ -158,10 +158,10 @@ void auto_init(void)
|
||||
DEBUG("Auto init Skald\n");
|
||||
skald_init();
|
||||
#endif
|
||||
#ifdef MODULE_RDCLI_COMMON
|
||||
DEBUG("Auto init rdcli_common module\n");
|
||||
extern void rdcli_common_init(void);
|
||||
rdcli_common_init();
|
||||
#ifdef MODULE_CORD_COMMON
|
||||
DEBUG("Auto init cord_common module\n");
|
||||
extern void cord_common_init(void);
|
||||
cord_common_init();
|
||||
#endif
|
||||
#ifdef MODULE_RDCLI_STANDALONE
|
||||
DEBUG("Auto init rdcli_standalone\n");
|
||||
|
@ -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
|
||||
* 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
|
||||
* @ingroup net
|
||||
* @brief Shared functionality for CoRE Resource Directory clients
|
||||
* @defgroup net_cord_common CoRE RD Common
|
||||
* @ingroup net_cord
|
||||
* @brief Shared functionality for CoRE Resource Directory endpoints
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Shared CoRE RD client functions
|
||||
* @brief Shared CoRE RD endpoint functions
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
*/
|
||||
|
||||
#ifndef NET_RDCLI_COMMON_H
|
||||
#define NET_RDCLI_COMMON_H
|
||||
#ifndef NET_CORD_COMMON_H
|
||||
#define NET_CORD_COMMON_H
|
||||
|
||||
#include "net/rdcli_config.h"
|
||||
|
||||
@ -30,39 +30,39 @@ extern "C" {
|
||||
/**
|
||||
* @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)
|
||||
*/
|
||||
void rdcli_common_init(void);
|
||||
void cord_common_init(void);
|
||||
|
||||
/**
|
||||
* @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
|
||||
*
|
||||
* This function adds:
|
||||
* - `ep` -> as extracted by rdcli_commont_get_ep()
|
||||
* - [optional] `lt` -> if defined by RDCLI_LT
|
||||
* - [optional] 'd' -> if defined by RDCLI_D
|
||||
* - `ep` -> as extracted by cord_common_get_ep()
|
||||
* - [optional] `lt` -> if defined by CORD_LT
|
||||
* - [optional] 'd' -> if defined by CORD_D
|
||||
*
|
||||
* @return 0 on success
|
||||
* @return <0 on error
|
||||
*/
|
||||
int rdcli_common_add_qstring(coap_pkt_t *pkt);
|
||||
int cord_common_add_qstring(coap_pkt_t *pkt);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* NET_RDCLI_COMMON_H */
|
||||
#endif /* NET_CORD_COMMON_H */
|
||||
/** @} */
|
@ -1,3 +1,3 @@
|
||||
MODULE = rdcli_common
|
||||
MODULE = cord_common
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
||||
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup net_rdcli_common
|
||||
* @ingroup net_cord_common
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
@ -22,7 +22,7 @@
|
||||
#include "luid.h"
|
||||
|
||||
#include "net/gcoap.h"
|
||||
#include "net/rdcli_common.h"
|
||||
#include "net/cord/common.h"
|
||||
|
||||
#define ENABLE_DEBUG (0)
|
||||
#include "debug.h"
|
||||
@ -35,29 +35,29 @@
|
||||
#define BUFSIZE (PREFIX_LEN + RDCLI_EP_SUFFIX_LEN)
|
||||
#endif
|
||||
|
||||
char rdcli_ep[BUFSIZE];
|
||||
char cord_common_ep[BUFSIZE];
|
||||
|
||||
void rdcli_common_init(void)
|
||||
void cord_common_init(void)
|
||||
{
|
||||
#ifdef RDCLI_EP
|
||||
memcpy(rdcli_ep, RDCLI_EP, BUFSIZE);
|
||||
memcpy(cord_common_ep, RDCLI_EP, BUFSIZE);
|
||||
#else
|
||||
uint8_t luid[RDCLI_EP_SUFFIX_LEN / 2];
|
||||
|
||||
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));
|
||||
fmt_bytes_hex(&rdcli_ep[PREFIX_LEN - 1], luid, sizeof(luid));
|
||||
rdcli_ep[BUFSIZE - 1] = '\0';
|
||||
fmt_bytes_hex(&cord_common_ep[PREFIX_LEN - 1], luid, sizeof(luid));
|
||||
cord_common_ep[BUFSIZE - 1] = '\0';
|
||||
#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 */
|
||||
int res = gcoap_add_qstring(pkt, "ep", rdcli_ep);
|
||||
int res = gcoap_add_qstring(pkt, "ep", cord_common_ep);
|
||||
if (res < 0) {
|
||||
return res;
|
||||
}
|
@ -27,7 +27,7 @@
|
||||
#include "net/gcoap.h"
|
||||
#include "net/ipv6/addr.h"
|
||||
#include "net/rdcli.h"
|
||||
#include "net/rdcli_common.h"
|
||||
#include "net/cord/common.h"
|
||||
#include "net/rdcli_config.h"
|
||||
|
||||
#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 */
|
||||
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 */
|
||||
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));
|
||||
|
||||
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(" reg if: %s\n", _rd_regif);
|
||||
printf(" location: %s\n", _rd_loc);
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "fmt.h"
|
||||
#include "net/gcoap.h"
|
||||
#include "net/rdcli_config.h"
|
||||
#include "net/rdcli_common.h"
|
||||
#include "net/cord/common.h"
|
||||
#include "net/rdcli_simple.h"
|
||||
#include "net/ipv6/addr.h"
|
||||
|
||||
@ -56,7 +56,7 @@ int rdcli_simple_register(void)
|
||||
/* make packet confirmable */
|
||||
coap_hdr_set_type(pkt.hdr, COAP_TYPE_CON);
|
||||
/* add Uri-Query options */
|
||||
if (rdcli_common_add_qstring(&pkt) < 0) {
|
||||
if (cord_common_add_qstring(&pkt) < 0) {
|
||||
return RDCLI_SIMPLE_ERROR;
|
||||
}
|
||||
/* finish, we don't have any payload */
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "net/nanocoap.h"
|
||||
#include "net/sock/util.h"
|
||||
#include "net/rdcli_config.h"
|
||||
#include "net/rdcli_common.h"
|
||||
|
||||
static int make_sock_ep(sock_udp_ep_t *ep, const char *addr)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user