Merge pull request #5661 from OlegHahm/ccnl_update

pkg: ccn_lite update
pr/spi.typo
Oleg Hahm 7 years ago committed by GitHub
commit 0703d80563

@ -11,6 +11,7 @@ RIOTBASE ?= $(CURDIR)/../..
CFLAGS += -DDEVELHELP
CFLAGS += -DUSE_LINKLAYER
CFLAGS += -DUSE_RONR
CFLAGS += -DCCNL_UAPI_H_
CFLAGS += -DUSE_SUITE_NDNTLV
CFLAGS += -DNEEDS_PREFIX_MATCHING

@ -8,14 +8,6 @@ use only one packet format, `ndn2013`, and only relay over the link-layer
## The shell commands
RIOT provides three shell to interact with the CCN-Lite stack:
* `ccnl_open` - opens and configures a network device to be used for CCN-Lite.
It expects one parameter specifying the PID of the network
device. (You can figure out the PID of your network device(s)
by calling `ifconfig`.) In this example, this should always be
3, hence, calling `ccnl_open 3` should work. (If you specify an
incorrect ID, you should get an error message.) You have to
call this command, before you can actually send or receive
anything.
* `ccnl_int` - generates and sends out an Interest. The command expects one
mandatory and one optional parameter. The first parameter
specifies the exact name (or a prefix) to request, the second
@ -51,13 +43,12 @@ An example usage of this application could be setup like this:
windows.
3. Call `make -B clean all term` in the first terminal and `PORT=tap1 make
term` in the second one.
4. Enter `ccnl_open 3` in both terminals.
5. Enter `ccnl_cont /riot/peter/schmerzl Hello World! Hello RIOT!` on the first
4. Enter `ccnl_cont /riot/peter/schmerzl Hello World! Hello RIOT!` on the first
terminal.
6. Add a FIB entry for this prefix on the second node, e.g. using the broadcast
5. Add a FIB entry for this prefix on the second node, e.g. using the broadcast
address: `ccnl_fib add /riot/peter/schmerzl ff:ff:ff:ff:ff:ff`
7. Enter `ccnl_int /riot/peter/schmerzl` in the second terminal.
8. See the content being displayed. Be happy!
6. Enter `ccnl_int /riot/peter/schmerzl` in the second terminal.
7. See the content being displayed. Be happy!
## Makefile configuration
@ -90,5 +81,5 @@ CCN-Lite upstream configuration - a different Ethertype (`0x0801` instead of
The simplest way to get this working is to copy the `ndn.lua` file into your
local Wireshark plugin directory (e.g. `$HOME/.wireshark/plugins`) and update
https://github.com/named-data/ndn-tools/blob/master/tools/dissect-wireshark/ndn.lua#L408
https://github.com/named-data/ndn-tools/blob/master/tools/dissect-wireshark/ndn.lua#L424
to `0x0801).

@ -24,6 +24,7 @@
#include "msg.h"
#include "shell.h"
#include "ccn-lite-riot.h"
#include "net/gnrc/netif.h"
/* main thread's message queue */
#define MAIN_QUEUE_SIZE (8)
@ -42,6 +43,19 @@ int main(void)
ccnl_core_init();
ccnl_start();
/* get the default interface */
kernel_pid_t ifs[GNRC_NETIF_NUMOF];
size_t ifnum = gnrc_netif_get(ifs);
/* set the relay's PID, configure the interface to interface to use CCN
* nettype */
if ((ifnum <= 0) || (ccnl_open_netif(ifs[0], GNRC_NETTYPE_CCN) < 0)) {
puts("Error registering at network interface!");
return -1;
}
char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);
return 0;

@ -1,6 +1,6 @@
PKG_NAME=ccn-lite
PKG_URL=https://github.com/cn-uofbasel/ccn-lite/
PKG_VERSION=1ae5bddc68334bc062c148b877894ba8155112c4
PKG_VERSION=0b1de2da1ef407ee5793c0e7eda420391ae056dc
.PHONY: all

@ -1,5 +1,5 @@
/*
* Copyright (C) 2015 INRIA
* Copyright (C) 2015, 2016 INRIA
*
* 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
@ -131,6 +131,38 @@ extern "C" {
*/
#define CCNL_QUEUE_SIZE (8)
typedef struct {
struct ccnl_prefix_s *prefix;
unsigned char *buf;
size_t buflen;
} ccnl_interest_t;
/**
* Maximum string length for prefix representation
*/
#define CCNL_PREFIX_BUFSIZE (50)
/**
* Message type for signalling a timeout while waiting for a content chunk
*/
#define CCNL_MSG_TIMEOUT (0x1701)
/**
* Message type for advancing the ageing timer
*/
#define CCNL_MSG_AGEING (0x1702)
/**
* Maximum number of elements that can be cached
*/
#ifndef CCNL_CACHE_SIZE
#define CCNL_CACHE_SIZE (5)
#endif
#ifdef DOXYGEN
#define CCNL_CACHE_SIZE
#endif
/**
* Struct holding CCN-Lite's central relay information
*/
@ -139,8 +171,15 @@ extern struct ccnl_relay_s ccnl_relay;
/**
* @brief Function pointer type for local producer function
*/
typedef int (*ccnl_producer_func)(struct ccnl_relay_s *relay, struct
ccnl_face_s *from, struct ccnl_pkt_s *pkt);
typedef int (*ccnl_producer_func)(struct ccnl_relay_s *relay,
struct ccnl_face_s *from,
struct ccnl_pkt_s *pkt);
/**
* @brief Function pointer type for caching strategy function
*/
typedef int (*ccnl_cache_strategy_func)(struct ccnl_relay_s *relay,
struct ccnl_content_s *c);
/**
* @brief Start the main CCN-Lite event-loop
@ -164,17 +203,15 @@ int ccnl_open_netif(kernel_pid_t if_pid, gnrc_nettype_t netreg_type);
/**
* @brief Sends out an Interest
*
* @param[in] suite CCN packet format
* @param[in] name The name that is requested
* @param[in] chunknum Number of the requested content chunk
* @param[in] prefix The name that is requested
* @param[out] buf Buffer to write the content chunk to
* @param[in] buf_len Size of @p buf
*
* @return 0 on successfully sent Interest
* @return -1 if Interested couldn't be sent
* @return pointer to the successfully sent Interest
* @return NULL if Interest couldn't be sent
*/
int ccnl_send_interest(int suite, char *name, unsigned int *chunknum,
unsigned char *buf, size_t buf_len);
struct ccnl_interest_s *ccnl_send_interest(struct ccnl_prefix_s *prefix,
unsigned char *buf, size_t buf_len);
/**
* @brief Wait for incoming content chunk
@ -224,6 +261,21 @@ void ccnl_fib_show(struct ccnl_relay_s *relay);
*/
void ccnl_set_local_producer(ccnl_producer_func func);
/**
* @brief Set a function to control the caching strategy
*
* The given function will be called if the cache is full and a new content
* chunk arrives. It shall remove (at least) one entry from the cache.
*
* If the return value of @p func is 0, the default caching strategy will be
* applied by the CCN-lite stack. If the return value is 1, it is assumed that
* (at least) one entry has been removed from the cache.
*
* @param[in] func The function to be called for an incoming content chunk if
* the cache is full.
*/
void ccnl_set_cache_strategy_remove(ccnl_cache_strategy_func func);
#ifdef __cplusplus
}
#endif

@ -39,9 +39,6 @@ static unsigned char _cont_buf[BUF_SIZE];
static const char *_default_content = "Start the RIOT!";
static unsigned char _out[CCNL_MAX_PACKET_SIZE];
/* check for one-time initialization */
static bool started = false;
/* usage for open command */
static void _open_usage(void)
{
@ -51,8 +48,8 @@ static void _open_usage(void)
int _ccnl_open(int argc, char **argv)
{
/* check if already running */
if (started) {
puts("Already opened an interface for CCN!");
if (ccnl_relay.ifcount >= CCNL_MAX_INTERFACES) {
puts("Already opened max. number of interfaces for CCN!");
return -1;
}
@ -78,8 +75,6 @@ int _ccnl_open(int argc, char **argv)
return -1;
}
started = true;
return 0;
}
@ -223,12 +218,14 @@ int _ccnl_interest(int argc, char **argv)
_ne.pid = sched_active_pid;
gnrc_netreg_register(GNRC_NETTYPE_CCN_CHUNK, &_ne);
ccnl_send_interest(CCNL_SUITE_NDNTLV, argv[1], NULL, _int_buf, BUF_SIZE);
struct ccnl_prefix_s *prefix = ccnl_URItoPrefix(argv[1], CCNL_SUITE_NDNTLV, NULL, 0);
ccnl_send_interest(prefix, _int_buf, BUF_SIZE);
if (ccnl_wait_for_chunk(_cont_buf, BUF_SIZE, 0) > 0) {
gnrc_netreg_unregister(GNRC_NETTYPE_CCN_CHUNK, &_ne);
printf("Content received: %s\n", _cont_buf);
return 0;
}
ccnl_free(prefix);
gnrc_netreg_unregister(GNRC_NETTYPE_CCN_CHUNK, &_ne);
}
printf("Timeout! No content received in response to the Interest for %s.\n", argv[1]);

Loading…
Cancel
Save