mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-24 22:13:52 +01:00
pkg/ndn-riot: drop unmaintained pkg
Upstream [1] has seen no activity since 2018, so it safe to assume this is dead. It is reasonable to assume that any users - if there ever were any - have moved on. Fixes https://github.com/RIOT-OS/RIOT/issues/15638 [1]: https://github.com/named-data-iot/ndn-riot
This commit is contained in:
parent
19ce68dd2e
commit
bf168e4b54
@ -1,26 +0,0 @@
|
||||
# name of your application
|
||||
APPLICATION = ndn_ping
|
||||
|
||||
# If no BOARD is found in the environment, use this default:
|
||||
BOARD ?= native
|
||||
|
||||
# This has to be the absolute path to the RIOT base directory:
|
||||
RIOTBASE ?= $(CURDIR)/../../
|
||||
|
||||
# Include packages that pull up and auto-init the link layer.
|
||||
USEMODULE += netdev_default
|
||||
USEMODULE += auto_init_gnrc_netif
|
||||
USEMODULE += random
|
||||
USEMODULE += shell_cmds_default
|
||||
|
||||
USEPKG += ndn-riot
|
||||
|
||||
# Comment this out to disable code in RIOT that does safety checking
|
||||
# which is not needed in a production environment but helps in the
|
||||
# development process:
|
||||
DEVELHELP ?= 1
|
||||
|
||||
# Change this to 0 show compiler invocation lines by default:
|
||||
QUIET ?= 1
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
@ -1,32 +0,0 @@
|
||||
BOARD_INSUFFICIENT_MEMORY := \
|
||||
arduino-duemilanove \
|
||||
arduino-leonardo \
|
||||
arduino-mega2560 \
|
||||
arduino-nano \
|
||||
arduino-uno \
|
||||
atmega328p \
|
||||
atmega328p-xplained-mini \
|
||||
atxmega-a3bu-xplained \
|
||||
bluepill-stm32f030c8 \
|
||||
i-nucleo-lrwan1 \
|
||||
msb-430 \
|
||||
msb-430h \
|
||||
nucleo-f030r8 \
|
||||
nucleo-f031k6 \
|
||||
nucleo-f042k6 \
|
||||
nucleo-l011k4 \
|
||||
nucleo-l031k6 \
|
||||
nucleo-l053r8 \
|
||||
samd10-xmini \
|
||||
slstk3400a \
|
||||
stk3200 \
|
||||
stm32f030f4-demo \
|
||||
stm32f0discovery \
|
||||
stm32g0316-disco \
|
||||
stm32l0538-disco \
|
||||
telosb \
|
||||
waspmote-pro \
|
||||
weio \
|
||||
z1 \
|
||||
zigduino \
|
||||
#
|
||||
@ -1,49 +0,0 @@
|
||||
# ndn-ping
|
||||
|
||||
This application demonstrates the usage of the package ndn-riot.
|
||||
This example basically enables the user to setup a ndn data server, and a ndn client that can request the data.
|
||||
Any board with a default netdev can be used to run this example.
|
||||
|
||||
# Setting up for native
|
||||
|
||||
Create `tap` and `tapbr` devices using RIOT's `tapsetup` script before stating the application:
|
||||
```bash
|
||||
sudo ./RIOTDIR/dist/tools/tapsetup/tapsetup
|
||||
```
|
||||
|
||||
Then run the application on 2 different terminals :
|
||||
```bash
|
||||
# on the first terminal
|
||||
make PORT=tap0 term
|
||||
# on the second terminal
|
||||
make PORT=tap1 term
|
||||
```
|
||||
|
||||
# Usage
|
||||
|
||||
The user can run shell commands (type "help" to see the list).
|
||||
Only one command is relative to ndn : `ndnping`.
|
||||
|
||||
## Start a server
|
||||
|
||||
```
|
||||
ndnping server name_uri server_id
|
||||
```
|
||||
|
||||
Replace `name_uri` by a ndn name (for example `/test`), and `server_id` by a number.
|
||||
`server_id` will be appended to the name of the data sent by the server.
|
||||
This can help when several servers are running using the same `name_uri`, but is not useful in our example.
|
||||
|
||||
A server will start and answer to any interest message matching the name.
|
||||
|
||||
## Start a client
|
||||
|
||||
```
|
||||
ndnping client name_uri max_count
|
||||
```
|
||||
|
||||
Replace `name_uri` by a ndn name, and `max_count` by a number.
|
||||
`max_count` is the number of interest message that will be sent.
|
||||
|
||||
A client will start, send a first interest message and wait for a data message.
|
||||
Once data is received or timeout is reached, the client can send the next interest message, or stop when the last interest have been sent.
|
||||
@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Wentao Shang
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup examples
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief NDN ping application
|
||||
*
|
||||
* @author Wentao Shang <wentaoshang@gmail.com>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "ndn-riot/ndn.h"
|
||||
#include "shell.h"
|
||||
#include "msg.h"
|
||||
|
||||
extern int ndn_ping(int argc, char **argv);
|
||||
|
||||
static const shell_command_t shell_commands[] = {
|
||||
{ "ndnping", "start ndn-ping client and server", ndn_ping },
|
||||
{ NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
int main(void)
|
||||
{
|
||||
/* start shell */
|
||||
puts("All up, running the shell now");
|
||||
char line_buf[SHELL_DEFAULT_BUFSIZE];
|
||||
shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE);
|
||||
|
||||
/* should be never reached */
|
||||
return 0;
|
||||
}
|
||||
@ -1,328 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Wentao Shang
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup examples
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief NDN ping client and server implementation
|
||||
*
|
||||
* @author Wentao Shang <wentaoshang@gmail.com>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "thread.h"
|
||||
#include "random.h"
|
||||
#include "test_utils/expect.h"
|
||||
|
||||
#include "ndn-riot/app.h"
|
||||
#include "ndn-riot/ndn.h"
|
||||
#include "ndn-riot/encoding/name.h"
|
||||
#include "ndn-riot/encoding/interest.h"
|
||||
#include "ndn-riot/encoding/data.h"
|
||||
#include "ndn-riot/msg-type.h"
|
||||
|
||||
static ndn_app_t* handle = NULL;
|
||||
|
||||
static const uint8_t ecc_key_pri[] = {
|
||||
0x38, 0x67, 0x54, 0x73, 0x8B, 0x72, 0x4C, 0xD6,
|
||||
0x3E, 0xBD, 0x52, 0xF3, 0x64, 0xD8, 0xF5, 0x7F,
|
||||
0xB5, 0xE6, 0xF2, 0x9F, 0xC2, 0x7B, 0xD6, 0x90,
|
||||
0x42, 0x9D, 0xC8, 0xCE, 0xF0, 0xDE, 0x75, 0xB3
|
||||
};
|
||||
|
||||
static const uint8_t ecc_key_pub[] = {
|
||||
0x2C, 0x3C, 0x18, 0xCB, 0x31, 0x88, 0x0B, 0xC3,
|
||||
0x73, 0xF4, 0x4A, 0xD4, 0x3F, 0x8C, 0x80, 0x24,
|
||||
0xD4, 0x8E, 0xBE, 0xB4, 0xAD, 0xF0, 0x69, 0xA6,
|
||||
0xFE, 0x29, 0x12, 0xAC, 0xC1, 0xE1, 0x26, 0x7E,
|
||||
0x2B, 0x25, 0x69, 0x02, 0xD5, 0x85, 0x51, 0x4B,
|
||||
0x91, 0xAC, 0xB9, 0xD1, 0x19, 0xE9, 0x5E, 0x97,
|
||||
0x20, 0xBB, 0x16, 0x2A, 0xD3, 0x2F, 0xB5, 0x11,
|
||||
0x1B, 0xD1, 0xAF, 0x76, 0xDB, 0xAD, 0xB8, 0xCE
|
||||
};
|
||||
|
||||
static int on_data(ndn_block_t* interest, ndn_block_t* data)
|
||||
{
|
||||
(void)interest;
|
||||
|
||||
ndn_block_t name;
|
||||
int r = ndn_data_get_name(data, &name);
|
||||
expect(r == 0);
|
||||
printf("client (pid=%" PRIkernel_pid "): data received, name=",
|
||||
handle->id);
|
||||
ndn_name_print(&name);
|
||||
putchar('\n');
|
||||
|
||||
ndn_block_t content;
|
||||
r = ndn_data_get_content(data, &content);
|
||||
expect(r == 0);
|
||||
expect(content.len == 6);
|
||||
|
||||
printf("client (pid=%" PRIkernel_pid "): content=%02X%02X%02X%02X\n",
|
||||
handle->id, *(content.buf + 2), *(content.buf + 3),
|
||||
*(content.buf + 4), *(content.buf + 5));
|
||||
|
||||
r = ndn_data_verify_signature(data, ecc_key_pub, sizeof(ecc_key_pub));
|
||||
|
||||
if (r != 0) {
|
||||
printf("client (pid=%" PRIkernel_pid "): fail to verify signature\n",
|
||||
handle->id);
|
||||
}
|
||||
else {
|
||||
printf("client (pid=%" PRIkernel_pid "): signature valid\n",
|
||||
handle->id);
|
||||
}
|
||||
|
||||
return NDN_APP_CONTINUE;
|
||||
}
|
||||
|
||||
static int on_timeout(ndn_block_t* interest)
|
||||
{
|
||||
ndn_block_t name;
|
||||
int r = ndn_interest_get_name(interest, &name);
|
||||
expect(r == 0);
|
||||
|
||||
printf("client (pid=%" PRIkernel_pid "): interest timeout, name=",
|
||||
handle->id);
|
||||
ndn_name_print(&name);
|
||||
putchar('\n');
|
||||
|
||||
return NDN_APP_CONTINUE;
|
||||
}
|
||||
|
||||
static uint16_t count = 0;
|
||||
static uint16_t max_count;
|
||||
|
||||
static int send_interest(void* context)
|
||||
{
|
||||
const char* uri = (const char*)context;
|
||||
|
||||
printf("client (pid=%" PRIkernel_pid "): in sched callback, count=%d\n",
|
||||
handle->id, ++count);
|
||||
if (count > max_count) {
|
||||
/* This is pure hack: ideally should wait for all pending I/O requests
|
||||
* to finish before stopping the app. However, this may cause the app
|
||||
* to block forever if not implemented very carefully. */
|
||||
printf("client (pid=%" PRIkernel_pid "): stop the app\n", handle->id);
|
||||
return NDN_APP_STOP;
|
||||
}
|
||||
|
||||
ndn_shared_block_t* sn = ndn_name_from_uri(uri, strlen(uri));
|
||||
if (sn == NULL) {
|
||||
printf("client (pid=%" PRIkernel_pid "): cannot create name from uri "
|
||||
"\"%s\"\n", handle->id, uri);
|
||||
return NDN_APP_ERROR;
|
||||
}
|
||||
|
||||
uint32_t rand = random_uint32();
|
||||
ndn_shared_block_t* sin = ndn_name_append_uint32(&sn->block, rand);
|
||||
ndn_shared_block_release(sn);
|
||||
if (sin == NULL) {
|
||||
printf("client (pid=%" PRIkernel_pid "): cannot append component to "
|
||||
"name \"%s\"\n", handle->id, uri);
|
||||
return NDN_APP_ERROR;
|
||||
}
|
||||
|
||||
uint32_t lifetime = 1000; // 1 sec
|
||||
|
||||
printf("client (pid=%" PRIkernel_pid "): express interest, name=",
|
||||
handle->id);
|
||||
ndn_name_print(&sin->block);
|
||||
putchar('\n');
|
||||
|
||||
if (ndn_app_express_interest(handle, &sin->block, NULL, lifetime,
|
||||
on_data, on_timeout) != 0) {
|
||||
printf("client (pid=%" PRIkernel_pid "): failed to express interest\n",
|
||||
handle->id);
|
||||
ndn_shared_block_release(sin);
|
||||
return NDN_APP_ERROR;
|
||||
}
|
||||
ndn_shared_block_release(sin);
|
||||
|
||||
if (ndn_app_schedule(handle, send_interest, context, 2000000) != 0) {
|
||||
printf("client (pid=%" PRIkernel_pid "): cannot schedule next interest"
|
||||
"\n", handle->id);
|
||||
return NDN_APP_ERROR;
|
||||
}
|
||||
printf("client (pid=%" PRIkernel_pid "): schedule next interest in 2 sec"
|
||||
"\n", handle->id);
|
||||
|
||||
return NDN_APP_CONTINUE;
|
||||
}
|
||||
|
||||
static void run_client(const char* uri, int max_cnt)
|
||||
{
|
||||
printf("client (pid=%" PRIkernel_pid "): start\n", thread_getpid());
|
||||
|
||||
handle = ndn_app_create();
|
||||
if (handle == NULL) {
|
||||
printf("client (pid=%" PRIkernel_pid "): cannot create app handle\n",
|
||||
thread_getpid());
|
||||
return;
|
||||
}
|
||||
|
||||
max_count = max_cnt;
|
||||
count = 0;
|
||||
|
||||
if (ndn_app_schedule(handle, send_interest, (void*)uri, 1000000) != 0) {
|
||||
printf("client (pid=%" PRIkernel_pid "): cannot schedule first "
|
||||
"interest\n", handle->id);
|
||||
ndn_app_destroy(handle);
|
||||
return;
|
||||
}
|
||||
printf("client (pid=%" PRIkernel_pid "): schedule first interest in 1 sec"
|
||||
"\n", handle->id);
|
||||
|
||||
printf("client (pid=%" PRIkernel_pid "): enter app run loop\n",
|
||||
handle->id);
|
||||
|
||||
ndn_app_run(handle);
|
||||
|
||||
printf("client (pid=%" PRIkernel_pid "): returned from app run loop\n",
|
||||
handle->id);
|
||||
|
||||
ndn_app_destroy(handle);
|
||||
}
|
||||
|
||||
static uint8_t sid = 0;
|
||||
|
||||
static int on_interest(ndn_block_t* interest)
|
||||
{
|
||||
ndn_block_t in;
|
||||
if (ndn_interest_get_name(interest, &in) != 0) {
|
||||
printf("server (pid=%" PRIkernel_pid "): cannot get name from interest"
|
||||
"\n", handle->id);
|
||||
return NDN_APP_ERROR;
|
||||
}
|
||||
|
||||
printf("server (pid=%" PRIkernel_pid "): interest received, name=",
|
||||
handle->id);
|
||||
ndn_name_print(&in);
|
||||
putchar('\n');
|
||||
|
||||
ndn_shared_block_t* sdn = ndn_name_append_uint8(&in, sid);
|
||||
if (sdn == NULL) {
|
||||
printf("server (pid=%" PRIkernel_pid "): cannot append component to "
|
||||
"name\n", handle->id);
|
||||
return NDN_APP_ERROR;
|
||||
}
|
||||
|
||||
ndn_metainfo_t meta = { NDN_CONTENT_TYPE_BLOB, -1 };
|
||||
|
||||
uint32_t rand = random_uint32();
|
||||
uint8_t* buf = (uint8_t*)(&rand);
|
||||
ndn_block_t content = { buf, sizeof(rand) };
|
||||
|
||||
ndn_shared_block_t* sd =
|
||||
ndn_data_create(&sdn->block, &meta, &content,
|
||||
NDN_SIG_TYPE_ECDSA_SHA256, NULL,
|
||||
ecc_key_pri, sizeof(ecc_key_pri));
|
||||
if (sd == NULL) {
|
||||
printf("server (pid=%" PRIkernel_pid "): cannot create data block\n",
|
||||
handle->id);
|
||||
ndn_shared_block_release(sdn);
|
||||
return NDN_APP_ERROR;
|
||||
}
|
||||
|
||||
printf("server (pid=%" PRIkernel_pid "): send data to NDN thread, name=",
|
||||
handle->id);
|
||||
ndn_name_print(&sdn->block);
|
||||
putchar('\n');
|
||||
ndn_shared_block_release(sdn);
|
||||
|
||||
/* pass ownership of "sd" to the API */
|
||||
if (ndn_app_put_data(handle, sd) != 0) {
|
||||
printf("server (pid=%" PRIkernel_pid "): cannot put data\n",
|
||||
handle->id);
|
||||
return NDN_APP_ERROR;
|
||||
}
|
||||
|
||||
printf("server (pid=%" PRIkernel_pid "): return to the app\n", handle->id);
|
||||
return NDN_APP_CONTINUE;
|
||||
}
|
||||
|
||||
static void run_server(const char* prefix, int id)
|
||||
{
|
||||
printf("server (pid=%" PRIkernel_pid "): start\n", thread_getpid());
|
||||
|
||||
handle = ndn_app_create();
|
||||
if (handle == NULL) {
|
||||
printf("server (pid=%" PRIkernel_pid "): cannot create app handle\n",
|
||||
thread_getpid());
|
||||
return;
|
||||
}
|
||||
sid = (uint8_t)id;
|
||||
|
||||
ndn_shared_block_t* sp = ndn_name_from_uri(prefix, strlen(prefix));
|
||||
if (sp == NULL) {
|
||||
printf("server (pid=%" PRIkernel_pid "): cannot create name from uri "
|
||||
"\"%s\"\n", handle->id, prefix);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("server (pid=%" PRIkernel_pid "): register prefix \"%s\"\n",
|
||||
handle->id, prefix);
|
||||
/* pass ownership of "sp" to the API */
|
||||
if (ndn_app_register_prefix(handle, sp, on_interest) != 0) {
|
||||
printf("server (pid=%" PRIkernel_pid "): failed to register prefix\n",
|
||||
handle->id);
|
||||
ndn_app_destroy(handle);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("server (pid=%" PRIkernel_pid "): enter app run loop\n",
|
||||
handle->id);
|
||||
|
||||
ndn_app_run(handle);
|
||||
|
||||
printf("server (pid=%" PRIkernel_pid "): returned from app run loop\n",
|
||||
handle->id);
|
||||
|
||||
ndn_app_destroy(handle);
|
||||
}
|
||||
|
||||
int ndn_ping(int argc, char **argv)
|
||||
{
|
||||
if (argc < 2) {
|
||||
printf("usage: %s [client|server]\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "client") == 0) {
|
||||
if (argc < 4) {
|
||||
printf("usage: %s client _name_uri_ _max_count_\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int max_cnt = atoi(argv[3]);
|
||||
if (max_cnt == 0) {
|
||||
printf("invalid max count number: %s\n", argv[3]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
run_client(argv[2], max_cnt);
|
||||
}
|
||||
else if (strcmp(argv[1], "server") == 0) {
|
||||
if (argc < 4) {
|
||||
printf("usage: %s server _prefix_ _server_id_\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
run_server(argv[2], atoi(argv[3]));
|
||||
}
|
||||
else {
|
||||
puts("error: invalid command");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
PKG_NAME=ndn-riot
|
||||
PKG_URL=https://github.com/named-data-iot/ndn-riot
|
||||
PKG_VERSION=34c5eb8adf198049f0a56048825b505c561a8874
|
||||
PKG_LICENSE=LGPLv2.1
|
||||
|
||||
include $(RIOTBASE)/pkg/pkg.mk
|
||||
|
||||
CFLAGS += -Wno-cast-align
|
||||
|
||||
all:
|
||||
$(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)
|
||||
@ -1,12 +0,0 @@
|
||||
USEMODULE += ndn-encoding
|
||||
USEMODULE += gnrc
|
||||
USEMODULE += gnrc_nettype_ndn
|
||||
USEMODULE += ztimer_usec
|
||||
USEMODULE += random
|
||||
USEMODULE += hashes
|
||||
USEPKG += micro-ecc
|
||||
|
||||
# Blacklist platforms using nimble_netif with gnrc netif, e.g providing
|
||||
# ble_nimble: NimBLE and ndn-riot use different crypto libraries that have
|
||||
# name clashes (tinycrypt vs uECC)
|
||||
FEATURES_BLACKLIST += ble_nimble
|
||||
@ -1 +0,0 @@
|
||||
INCLUDES += -I$(PKGDIRBASE)
|
||||
@ -1,53 +0,0 @@
|
||||
From 1534f82714a2a11bb338e14ed9dd18a24799cd38 Mon Sep 17 00:00:00 2001
|
||||
From: Michel Rottleuthner <michel.rottleuthner@haw-hamburg.de>
|
||||
Date: Thu, 9 Jan 2020 11:16:38 +0100
|
||||
Subject: [PATCH] update xtimer_t struct clearing
|
||||
|
||||
---
|
||||
app.c | 2 +-
|
||||
l2.c | 2 +-
|
||||
pit.c | 2 +-
|
||||
3 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/app.c b/app.c
|
||||
index 8d37bd970af..bc4718d31b9 100644
|
||||
--- a/app.c
|
||||
+++ b/app.c
|
||||
@@ -380,7 +380,7 @@ int ndn_app_schedule(ndn_app_t* handle, ndn_app_sched_cb_t cb, void* context,
|
||||
if (entry == NULL) return -1;
|
||||
|
||||
// initialize the timer
|
||||
- entry->timer.target = entry->timer.long_target = 0;
|
||||
+ entry->timer = (xtimer_t) {0};
|
||||
|
||||
// initialize the msg struct
|
||||
entry->timer_msg.type = MSG_XTIMER;
|
||||
diff --git a/l2.c b/l2.c
|
||||
index 77d6be49cd9..a0546b5e4a2 100644
|
||||
--- a/l2.c
|
||||
+++ b/l2.c
|
||||
@@ -155,7 +155,7 @@ ndn_shared_block_t* ndn_l2_frag_receive(kernel_pid_t iface,
|
||||
entry->id = id;
|
||||
|
||||
// initialize timer
|
||||
- entry->timer.target = entry->timer.long_target = 0;
|
||||
+ entry->timer = (xtimer_t) {0};
|
||||
entry->timer_msg.type = NDN_L2_FRAG_MSG_TYPE_TIMEOUT;
|
||||
entry->timer_msg.content.ptr = (char*)(&entry->timer_msg);
|
||||
|
||||
diff --git a/pit.c b/pit.c
|
||||
index 644cf089d9c..692105ea1ed 100644
|
||||
--- a/pit.c
|
||||
+++ b/pit.c
|
||||
@@ -155,7 +155,7 @@ int ndn_pit_add(kernel_pid_t face_id, int face_type, ndn_shared_block_t* si,
|
||||
*pit_entry = entry;
|
||||
|
||||
/* initialize the timer */
|
||||
- entry->timer.target = entry->timer.long_target = 0;
|
||||
+ entry->timer = (xtimer_t) {0};
|
||||
|
||||
/* initialize the msg struct */
|
||||
entry->timer_msg.type = NDN_PIT_MSG_TYPE_TIMEOUT;
|
||||
--
|
||||
2.25.0
|
||||
|
||||
@ -1,59 +0,0 @@
|
||||
From 43da6ef67dea118695d6b1dd2542ce1f199956e8 Mon Sep 17 00:00:00 2001
|
||||
From: Jose Alamos <jose.alamos@haw-hamburg.de>
|
||||
Date: Tue, 24 Mar 2020 14:29:26 +0100
|
||||
Subject: [PATCH] ndn-riot: add MAX_GNRC_NETIFS macro
|
||||
|
||||
---
|
||||
netif.c | 6 +++---
|
||||
netif.h | 7 +++++++
|
||||
2 files changed, 10 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/netif.c b/netif.c
|
||||
index 5e24c6d..7e3edb9 100644
|
||||
--- a/netif.c
|
||||
+++ b/netif.c
|
||||
@@ -29,12 +29,12 @@
|
||||
#include <random.h>
|
||||
#include <thread.h>
|
||||
|
||||
-static ndn_netif_t _netif_table[GNRC_NETIF_NUMOF];
|
||||
+static ndn_netif_t _netif_table[MAX_GNRC_NETIFS];
|
||||
|
||||
void ndn_netif_auto_add(void)
|
||||
{
|
||||
/* initialize the netif table entry */
|
||||
- for (int i = 0; i < GNRC_NETIF_NUMOF; ++i) {
|
||||
+ for (int i = 0; i < MAX_GNRC_NETIFS; ++i) {
|
||||
_netif_table[i].iface = KERNEL_PID_UNDEF;
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ static ndn_netif_t* _ndn_netif_find(kernel_pid_t iface)
|
||||
{
|
||||
if (iface == KERNEL_PID_UNDEF) return NULL;
|
||||
|
||||
- for (int i = 0; i < GNRC_NETIF_NUMOF; ++i) {
|
||||
+ for (int i = 0; i < MAX_GNRC_NETIFS; ++i) {
|
||||
if (_netif_table[i].iface == iface)
|
||||
return &_netif_table[i];
|
||||
}
|
||||
diff --git a/netif.h b/netif.h
|
||||
index 1e7fbdc..2175858 100644
|
||||
--- a/netif.h
|
||||
+++ b/netif.h
|
||||
@@ -24,6 +24,13 @@
|
||||
|
||||
#include "encoding/block.h"
|
||||
|
||||
+/**
|
||||
+ * @brief Max number of GNRC network interfaces
|
||||
+ */
|
||||
+#ifndef MAX_GNRC_NETIFS
|
||||
+#define MAX_GNRC_NETIFS (1)
|
||||
+#endif
|
||||
+
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
--
|
||||
2.25.0
|
||||
|
||||
@ -1,140 +0,0 @@
|
||||
From 17b6e4d2da20af995e914c8650ee825d052c5bc6 Mon Sep 17 00:00:00 2001
|
||||
From: Kaspar Schleiser <kaspar@schleiser.de>
|
||||
Date: Mon, 23 Nov 2020 12:44:54 +0100
|
||||
Subject: [PATCH] adapt to moved kernel_pid_t location
|
||||
|
||||
---
|
||||
app.h | 2 +-
|
||||
cs.h | 1 -
|
||||
face-table.h | 2 +-
|
||||
fib.h | 2 +-
|
||||
forwarding-strategy.h | 2 +-
|
||||
l2.h | 2 +-
|
||||
ndn.h | 2 +-
|
||||
netif.h | 2 +-
|
||||
pit.h | 2 +-
|
||||
9 files changed, 8 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/app.h b/app.h
|
||||
index 6428921acf..c357692a38 100644
|
||||
--- a/app.h
|
||||
+++ b/app.h
|
||||
@@ -23,9 +23,9 @@
|
||||
#include "encoding/name.h"
|
||||
#include "forwarding-strategy.h"
|
||||
|
||||
-#include <kernel_types.h>
|
||||
#include <xtimer.h>
|
||||
#include <net/gnrc/pktbuf.h>
|
||||
+#include "sched.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
diff --git a/cs.h b/cs.h
|
||||
index 36bf38d82a..01edf2bbc1 100644
|
||||
--- a/cs.h
|
||||
+++ b/cs.h
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
#include "encoding/shared-block.h"
|
||||
|
||||
-#include <kernel_types.h>
|
||||
//#include <xtimer.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
diff --git a/face-table.h b/face-table.h
|
||||
index 28b44a5c02..fb0c39b083 100644
|
||||
--- a/face-table.h
|
||||
+++ b/face-table.h
|
||||
@@ -20,7 +20,7 @@
|
||||
#ifndef NDN_FACE_TABLE_H_
|
||||
#define NDN_FACE_TABLE_H_
|
||||
|
||||
-#include <kernel_types.h>
|
||||
+#include "sched.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
diff --git a/fib.h b/fib.h
|
||||
index 8d5f01ab79..5e190d283a 100644
|
||||
--- a/fib.h
|
||||
+++ b/fib.h
|
||||
@@ -23,8 +23,8 @@
|
||||
#include "encoding/shared-block.h"
|
||||
#include "face-table.h"
|
||||
|
||||
-#include <kernel_types.h>
|
||||
#include <xtimer.h>
|
||||
+#include "sched.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
diff --git a/forwarding-strategy.h b/forwarding-strategy.h
|
||||
index 43ad66c276..15fdc5b8c7 100644
|
||||
--- a/forwarding-strategy.h
|
||||
+++ b/forwarding-strategy.h
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "encoding/shared-block.h"
|
||||
|
||||
-#include <kernel_types.h>
|
||||
+#include "sched.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
diff --git a/l2.h b/l2.h
|
||||
index 2dc1dad986..6322276f10 100644
|
||||
--- a/l2.h
|
||||
+++ b/l2.h
|
||||
@@ -22,8 +22,8 @@
|
||||
|
||||
#include "encoding/shared-block.h"
|
||||
|
||||
-#include <kernel_types.h>
|
||||
#include <net/gnrc/pktbuf.h>
|
||||
+#include "sched.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
diff --git a/ndn.h b/ndn.h
|
||||
index d8d148c7f7..47d2032301 100644
|
||||
--- a/ndn.h
|
||||
+++ b/ndn.h
|
||||
@@ -20,7 +20,7 @@
|
||||
#ifndef NDN_H_
|
||||
#define NDN_H_
|
||||
|
||||
-#include <kernel_types.h>
|
||||
+#include "sched.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
diff --git a/netif.h b/netif.h
|
||||
index 2175858fbd..4cf3c9bd54 100644
|
||||
--- a/netif.h
|
||||
+++ b/netif.h
|
||||
@@ -20,7 +20,7 @@
|
||||
#ifndef NDN_NETIF_H_
|
||||
#define NDN_NETIF_H_
|
||||
|
||||
-#include <kernel_types.h>
|
||||
+#include "sched.h"
|
||||
|
||||
#include "encoding/block.h"
|
||||
|
||||
diff --git a/pit.h b/pit.h
|
||||
index dbe433eeda..3384a4c887 100644
|
||||
--- a/pit.h
|
||||
+++ b/pit.h
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "encoding/shared-block.h"
|
||||
#include "face-table.h"
|
||||
|
||||
-#include <kernel_types.h>
|
||||
+#include "sched.h"
|
||||
#include <xtimer.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
--
|
||||
2.29.2
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
From ea398bfa1e15313860cf170c280932361c256449 Mon Sep 17 00:00:00 2001
|
||||
From: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
|
||||
Date: Thu, 25 Feb 2021 11:17:54 +0100
|
||||
Subject: [PATCH] replace use of deprecated netopt
|
||||
|
||||
Use NETOPT_MAX_PDU_SIZE instead of NETOPT_MAX_PACKET_SIZE
|
||||
---
|
||||
netif.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/netif.c b/netif.c
|
||||
index 5e24c6d..ed1e973 100644
|
||||
--- a/netif.c
|
||||
+++ b/netif.c
|
||||
@@ -55,7 +55,7 @@ void ndn_netif_auto_add(void)
|
||||
gnrc_nettype_t proto;
|
||||
|
||||
// get device mtu
|
||||
- if (gnrc_netapi_get(iface, NETOPT_MAX_PACKET_SIZE, 0,
|
||||
+ if (gnrc_netapi_get(iface, NETOPT_MAX_PDU_SIZE, 0,
|
||||
&_netif_table[i].mtu,
|
||||
sizeof(uint16_t)) < 0) {
|
||||
DEBUG("ndn: cannot get device mtu (pid=%"
|
||||
--
|
||||
2.30.1
|
||||
|
||||
@ -1,256 +0,0 @@
|
||||
From b5cf1b1f24584666df472166104139f7627424e9 Mon Sep 17 00:00:00 2001
|
||||
From: Francisco Molina <femolina@uc.cl>
|
||||
Date: Thu, 9 Dec 2021 15:17:13 +0100
|
||||
Subject: [PATCH] use ztimer_msec instead of xtimer
|
||||
|
||||
---
|
||||
app.c | 12 ++++++------
|
||||
app.h | 4 ++--
|
||||
cs.h | 2 --
|
||||
fib.h | 1 -
|
||||
l2.c | 13 +++++++------
|
||||
ndn.c | 1 -
|
||||
pit.c | 12 +++++++-----
|
||||
pit.h | 4 ++--
|
||||
8 files changed, 24 insertions(+), 25 deletions(-)
|
||||
|
||||
diff --git a/app.c b/app.c
|
||||
index bc4718d..8e5598a 100644
|
||||
--- a/app.c
|
||||
+++ b/app.c
|
||||
@@ -225,8 +225,8 @@ int ndn_app_run(ndn_app_t* handle)
|
||||
msg.sender_pid, handle->id);
|
||||
return NDN_APP_STOP;
|
||||
|
||||
- case MSG_XTIMER:
|
||||
- DEBUG("ndn_app: XTIMER msg received from thread %"
|
||||
+ case MSG_ZTIMER:
|
||||
+ DEBUG("ndn_app: ZTIMER msg received from thread %"
|
||||
PRIkernel_pid " (pid=%" PRIkernel_pid ")\n",
|
||||
msg.sender_pid, handle->id);
|
||||
|
||||
@@ -299,7 +299,7 @@ static inline void _release_sched_cb_table(ndn_app_t* handle)
|
||||
DEBUG("ndn_app: remove scheduler cb entry (pid=%"
|
||||
PRIkernel_pid ")\n", handle->id);
|
||||
DL_DELETE(handle->_scb_table, entry);
|
||||
- xtimer_remove(&entry->timer);
|
||||
+ ztimer_remove(ZTIMER_USEC, &entry->timer);
|
||||
free(entry);
|
||||
}
|
||||
}
|
||||
@@ -380,14 +380,14 @@ int ndn_app_schedule(ndn_app_t* handle, ndn_app_sched_cb_t cb, void* context,
|
||||
if (entry == NULL) return -1;
|
||||
|
||||
// initialize the timer
|
||||
- entry->timer = (xtimer_t) {0};
|
||||
+ entry->timer = (ztimer_t) {0};
|
||||
|
||||
// initialize the msg struct
|
||||
- entry->timer_msg.type = MSG_XTIMER;
|
||||
+ entry->timer_msg.type = MSG_ZTIMER;
|
||||
entry->timer_msg.content.ptr = (char*)(&entry->timer_msg);
|
||||
|
||||
// set a timer to send a message to the app thread
|
||||
- xtimer_set_msg(&entry->timer, timeout, &entry->timer_msg, handle->id);
|
||||
+ ztimer_set_msg(ZTIMER_USEC, &entry->timer, timeout, &entry->timer_msg, handle->id);
|
||||
|
||||
return 0;
|
||||
}
|
||||
diff --git a/app.h b/app.h
|
||||
index c357692..21666d9 100644
|
||||
--- a/app.h
|
||||
+++ b/app.h
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "encoding/name.h"
|
||||
#include "forwarding-strategy.h"
|
||||
|
||||
-#include <xtimer.h>
|
||||
+#include <ztimer.h>
|
||||
#include <net/gnrc/pktbuf.h>
|
||||
#include "sched.h"
|
||||
|
||||
@@ -95,7 +95,7 @@ typedef struct _sched_cb_entry {
|
||||
struct _sched_cb_entry *next;
|
||||
ndn_app_sched_cb_t cb;
|
||||
void* context;
|
||||
- xtimer_t timer;
|
||||
+ ztimer_t timer;
|
||||
msg_t timer_msg;
|
||||
} _sched_cb_entry_t;
|
||||
|
||||
diff --git a/cs.h b/cs.h
|
||||
index 01edf2b..c544cf8 100644
|
||||
--- a/cs.h
|
||||
+++ b/cs.h
|
||||
@@ -22,8 +22,6 @@
|
||||
|
||||
#include "encoding/shared-block.h"
|
||||
|
||||
-//#include <xtimer.h>
|
||||
-
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
diff --git a/fib.h b/fib.h
|
||||
index 5e190d2..cdf70aa 100644
|
||||
--- a/fib.h
|
||||
+++ b/fib.h
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "encoding/shared-block.h"
|
||||
#include "face-table.h"
|
||||
|
||||
-#include <xtimer.h>
|
||||
#include "sched.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
diff --git a/l2.c b/l2.c
|
||||
index a0546b5..817c210 100644
|
||||
--- a/l2.c
|
||||
+++ b/l2.c
|
||||
@@ -20,7 +20,8 @@
|
||||
#include "encoding/shared-block.h"
|
||||
#include "ndn.h"
|
||||
|
||||
-#include <xtimer.h>
|
||||
+#include <timex.h>
|
||||
+#include <ztimer.h>
|
||||
#include <net/gnrc/netif/hdr.h>
|
||||
#include <debug.h>
|
||||
|
||||
@@ -59,7 +60,7 @@ typedef struct _l2_frag_block {
|
||||
typedef struct _l2_frag_entry {
|
||||
struct _l2_frag_entry* prev;
|
||||
struct _l2_frag_entry* next;
|
||||
- xtimer_t timer;
|
||||
+ ztimer_t timer;
|
||||
msg_t timer_msg;
|
||||
uint8_t* netif_hdr;
|
||||
size_t netif_hdr_len;
|
||||
@@ -69,13 +70,13 @@ typedef struct _l2_frag_entry {
|
||||
} _l2_frag_entry_t;
|
||||
|
||||
//TODO: use larger timeout value in non-test environment
|
||||
-#define NDN_L2_FRAG_MAX_LIFETIME (10U * US_PER_SEC)
|
||||
+#define NDN_L2_FRAG_MAX_LIFETIME (10U * MS_PER_SEC)
|
||||
|
||||
static _l2_frag_entry_t* _l2_frag_list;
|
||||
|
||||
static void _release_l2_frag_entry(_l2_frag_entry_t* entry) {
|
||||
DL_DELETE(_l2_frag_list, entry);
|
||||
- xtimer_remove(&entry->timer);
|
||||
+ ztimer_remove(ZTIMER_USEC, &entry->timer);
|
||||
_l2_frag_block_t *blk, *tmp;
|
||||
LL_FOREACH_SAFE(entry->frags, blk, tmp) {
|
||||
free(blk->data);
|
||||
@@ -155,7 +156,7 @@ ndn_shared_block_t* ndn_l2_frag_receive(kernel_pid_t iface,
|
||||
entry->id = id;
|
||||
|
||||
// initialize timer
|
||||
- entry->timer = (xtimer_t) {0};
|
||||
+ entry->timer = (ztimer_t) {0};
|
||||
entry->timer_msg.type = NDN_L2_FRAG_MSG_TYPE_TIMEOUT;
|
||||
entry->timer_msg.content.ptr = (char*)(&entry->timer_msg);
|
||||
|
||||
@@ -166,7 +167,7 @@ ndn_shared_block_t* ndn_l2_frag_receive(kernel_pid_t iface,
|
||||
assert(entry != NULL);
|
||||
|
||||
// set (reset) timer
|
||||
- xtimer_set_msg(&entry->timer, NDN_L2_FRAG_MAX_LIFETIME,
|
||||
+ ztimer_set_msg(ZTIMER_USEC, &entry->timer, NDN_L2_FRAG_MAX_LIFETIME,
|
||||
&entry->timer_msg, ndn_pid);
|
||||
|
||||
if ((entry->frags_map & seq_map) != 0) {
|
||||
diff --git a/ndn.c b/ndn.c
|
||||
index 3db7411..d370d0b 100644
|
||||
--- a/ndn.c
|
||||
+++ b/ndn.c
|
||||
@@ -36,7 +36,6 @@
|
||||
#include <net/gnrc/netreg.h>
|
||||
#include <thread.h>
|
||||
#include <timex.h>
|
||||
-#include <xtimer.h>
|
||||
|
||||
#define GNRC_NDN_STACK_SIZE (THREAD_STACKSIZE_DEFAULT)
|
||||
#define GNRC_NDN_PRIO (THREAD_PRIORITY_MAIN - 3)
|
||||
diff --git a/pit.c b/pit.c
|
||||
index 692105e..dc1698c 100644
|
||||
--- a/pit.c
|
||||
+++ b/pit.c
|
||||
@@ -28,6 +28,8 @@
|
||||
#define ENABLE_DEBUG 1
|
||||
#include <debug.h>
|
||||
#include <utlist.h>
|
||||
+#include <timex.h>
|
||||
+#include <ztimer.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
@@ -120,7 +122,7 @@ int ndn_pit_add(kernel_pid_t face_id, int face_type, ndn_shared_block_t* si,
|
||||
DEBUG("ndn: add to existing pit entry (face=%"
|
||||
PRIkernel_pid ")\n", face_id);
|
||||
/* reset timer */
|
||||
- xtimer_set_msg(&entry->timer, lifetime, &entry->timer_msg,
|
||||
+ ztimer_set_msg(ZTIMER_USEC, &entry->timer, lifetime, &entry->timer_msg,
|
||||
ndn_pid);
|
||||
// overwrite forwarding strategy
|
||||
entry->forwarding_strategy = strategy;
|
||||
@@ -155,14 +157,14 @@ int ndn_pit_add(kernel_pid_t face_id, int face_type, ndn_shared_block_t* si,
|
||||
*pit_entry = entry;
|
||||
|
||||
/* initialize the timer */
|
||||
- entry->timer = (xtimer_t) {0};
|
||||
+ entry->timer = (ztimer_t) {0};
|
||||
|
||||
/* initialize the msg struct */
|
||||
entry->timer_msg.type = NDN_PIT_MSG_TYPE_TIMEOUT;
|
||||
entry->timer_msg.content.ptr = (char*)(&entry->timer_msg);
|
||||
|
||||
/* set a timer to send a message to ndn thread */
|
||||
- xtimer_set_msg(&entry->timer, lifetime, &entry->timer_msg, ndn_pid);
|
||||
+ ztimer_set_msg(ZTIMER_USEC, &entry->timer, lifetime, &entry->timer_msg, ndn_pid);
|
||||
|
||||
// set forwarding strategy
|
||||
entry->forwarding_strategy = strategy;
|
||||
@@ -175,7 +177,7 @@ void ndn_pit_release(ndn_pit_entry_t *entry)
|
||||
{
|
||||
assert(_pit != NULL);
|
||||
DL_DELETE(_pit, entry);
|
||||
- xtimer_remove(&entry->timer);
|
||||
+ ztimer_remove(ZTIMER_USEC, &entry->timer);
|
||||
ndn_shared_block_release(entry->shared_pi);
|
||||
free(entry->face_list);
|
||||
free(entry);
|
||||
@@ -253,7 +255,7 @@ int ndn_pit_match_data(ndn_shared_block_t* sd, kernel_pid_t iface)
|
||||
DEBUG("ndn: found matching pit entry for data\n");
|
||||
|
||||
DL_DELETE(_pit, entry);
|
||||
- xtimer_remove(&entry->timer);
|
||||
+ ztimer_remove(ZTIMER_USEC, &entry->timer);
|
||||
|
||||
// invoke forwarding strategy trigger if available
|
||||
if (entry->forwarding_strategy->before_satisfy_interest) {
|
||||
diff --git a/pit.h b/pit.h
|
||||
index 3384a4c..91664e0 100644
|
||||
--- a/pit.h
|
||||
+++ b/pit.h
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "face-table.h"
|
||||
|
||||
#include "sched.h"
|
||||
-#include <xtimer.h>
|
||||
+#include <ztimer.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -39,7 +39,7 @@ typedef struct ndn_pit_entry {
|
||||
struct ndn_pit_entry *prev;
|
||||
struct ndn_pit_entry *next;
|
||||
ndn_shared_block_t *shared_pi; /**< shared TLV block of the pending interest */
|
||||
- xtimer_t timer; /**< xtimer struct */
|
||||
+ ztimer_t timer; /**< ztimer struct */
|
||||
msg_t timer_msg; /**< special message to indicate timeout event */
|
||||
|
||||
// List of incoming faces
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@ -1,34 +0,0 @@
|
||||
From a69fe71eb8e915db21bda6879ce0f8b768e5982d Mon Sep 17 00:00:00 2001
|
||||
From: Alexandre Abadie <alexandre.abadie@inria.fr>
|
||||
Date: Fri, 7 Jan 2022 17:20:46 +0100
|
||||
Subject: [PATCH] replace deprecated CIPHER_AES_128 by CIPHER_AES
|
||||
|
||||
---
|
||||
encoding/data.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/encoding/data.c b/encoding/data.c
|
||||
index 6abf186..afebde4 100644
|
||||
--- a/encoding/data.c
|
||||
+++ b/encoding/data.c
|
||||
@@ -437,7 +437,7 @@ ndn_shared_block_t* ndn_data_encrypt_with_ccm(ndn_block_t* name,
|
||||
|
||||
// Initiate cipher
|
||||
cipher_t cipher;
|
||||
- if (cipher_init(&cipher, CIPHER_AES_128, key, key_len) < 0) {
|
||||
+ if (cipher_init(&cipher, CIPHER_AES, key, key_len) < 0) {
|
||||
DEBUG("ndn_encoding: cannot init ccm cipher for encryption\n");
|
||||
return NULL;
|
||||
}
|
||||
@@ -1027,7 +1027,7 @@ ndn_shared_block_t* ndn_data_decrypt_with_ccm(ndn_block_t* block,
|
||||
|
||||
// Initiate cipher
|
||||
cipher_t cipher;
|
||||
- if (cipher_init(&cipher, CIPHER_AES_128, key, key_len) < 0) {
|
||||
+ if (cipher_init(&cipher, CIPHER_AES, key, key_len) < 0) {
|
||||
DEBUG("ndn_encoding: cannot init ccm cipher for decryption\n");
|
||||
return NULL;
|
||||
}
|
||||
--
|
||||
2.32.0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user