Skip to content

Commit 66c011d

Browse files
committed
Merge pull request RIOT-OS#5148 from OlegHahm/ccnl_update
pkg ccn-lite: update version
2 parents 9dcb5cc + 8204615 commit 66c011d

File tree

7 files changed

+238
-53
lines changed

7 files changed

+238
-53
lines changed

Makefile.dep

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ ifneq (,$(filter libcoap,$(USEPKG)))
66
USEMODULE += gnrc_conn_udp
77
endif
88

9+
ifneq (,$(filter ccn-lite,$(USEPKG)))
10+
export CFLAGS += -DCCNL_RIOT
11+
endif
12+
13+
914
ifneq (,$(filter nhdp,$(USEMODULE)))
1015
USEMODULE += conn_udp
1116
USEMODULE += xtimer

examples/ccn-lite-relay/Makefile

-2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@ RIOTBASE ?= $(CURDIR)/../..
1111

1212
CFLAGS += -DDEVELHELP
1313
CFLAGS += -DUSE_LINKLAYER
14-
CFLAGS += -DUSE_IPV6
1514
CFLAGS += -DCCNL_UAPI_H_
1615
CFLAGS += -DUSE_SUITE_NDNTLV
1716
CFLAGS += -DNEEDS_PREFIX_MATCHING
1817
CFLAGS += -DNEEDS_PACKET_CRAFTING
19-
CFLAGS += -DUSE_HMAC256
2018

2119
# Change this to 0 show compiler invocation lines by default:
2220
QUIET ?= 1

examples/ccn-lite-relay/README.md

+49-16
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,31 @@ RIOT provides three shell to interact with the CCN-Lite stack:
1616
incorrect ID, you should get an error message.) You have to
1717
call this command, before you can actually send or receive
1818
anything.
19-
* `ccnl_int` - generates and sends out an Interest. The command expects one
20-
mandatory and one optional parameter. The first parameter
21-
specifies the exact name (or a prefix) to request, the second
22-
parameter specifies the link-layer address of the relay to use.
23-
If the second parameter is omitted, the Interest will be
24-
broadcasted. You may call it like this:
25-
`ccnl_int /riot/peter/schmerzl b6:e5:94:26:ab:da`
26-
* `ccnl_cont` - generates and populates Content. The command expects one
27-
mandatory and one optional parameter. The first parameter
28-
specifies the name of the content to be created, the second
29-
parameter specifies the content itself. The second parameter may
30-
include spaces, e.g. you can call:
31-
`ccnl_cont /riot/peter/schmerzl Hello World! Hello RIOT!`
19+
* `ccnl_int` - generates and sends out an Interest. The command expects one
20+
mandatory and one optional parameter. The first parameter
21+
specifies the exact name (or a prefix) to request, the second
22+
parameter specifies the link-layer address of the relay to use.
23+
If the second parameter is omitted, the Interest will be
24+
broadcasted. You may call it like this:
25+
`ccnl_int /riot/peter/schmerzl b6:e5:94:26:ab:da`
26+
* `ccnl_cont` - generates and populates content. The command expects one
27+
mandatory and one optional parameter. The first parameter
28+
specifies the name of the content to be created, the second
29+
parameter specifies the content itself. The second parameter
30+
may include spaces, e.g. you can call:
31+
`ccnl_cont /riot/peter/schmerzl Hello World! Hello RIOT!`
32+
* `ccnl_fib` - modifies the FIB or shows its current state. If the command is
33+
called without parameters, it will print the current state of
34+
the FIB. It can also be called with the action parameters `add`
35+
or `del` to add or delete an entry from the FIB, e.g.
36+
`ccnl_fib add /riot/peter/schmerzl ab:cd:ef:01:23:45:67:89`
37+
will add an entry for `/riot/peter/schmerzl` with
38+
`ab:cd:ef:01:23:45:67:89` as a next hop and
39+
`ccnl_fib del /riot/peter/schmerzl`
40+
will remove the entry for `/riot/peter/schmerzl` and
41+
`ccnl_fib del ab:cd:ef:01:23:45:67:89`
42+
will remove all entries with `ab:cd:ef:01:23:45:67:89` as a
43+
next hop.
3244

3345
## Example setup
3446

@@ -39,11 +51,32 @@ An example usage of this application could be setup like this:
3951
windows.
4052
3. Call `make -B clean all term` in the first terminal and `PORT=tap1 make
4153
term` in the second one.
42-
4. Enter `open 3` in both terminals.
54+
4. Enter `ccnl_open 3` in both terminals.
4355
5. Enter `ccnl_cont /riot/peter/schmerzl Hello World! Hello RIOT!` on the first
4456
terminal.
45-
6. Enter `ccnl_int /riot/peter/schmerzl` in the second terminal.
46-
7. See the content being displayed. Be happy!
57+
6. Add a FIB entry for this prefix on the second node, e.g. using the broadcast
58+
address: `ccnl_fib add /riot/peter/schmerzl ff:ff:ff:ff:ff:ff`
59+
7. Enter `ccnl_int /riot/peter/schmerzl` in the second terminal.
60+
8. See the content being displayed. Be happy!
61+
62+
## Makefile configuration
63+
64+
The ccn-lite package provides several configuration options through defines
65+
that can be set in the application Makefile. The following options are
66+
mandatory for now:
67+
* `CFLAGS += -DUSE_LINKLAYER` - use CCN directly over the link layer
68+
* `CFLAGS += -DCCNL_UAPI_H_` - tell ccn-lite to use the UAPI
69+
* `CFLAGS += -DUSE_SUITE_NDNTLV` - use NDNTLV packet format
70+
* `CFLAGS += -DNEEDS_PREFIX_MATCHING` - enables prefix matching
71+
* `CFLAGS += -DNEEDS_PACKET_CRAFTING` - enable userspace packet creation
72+
Here's a list of some additional interesting options:
73+
* `CFLAGS += -DUSE_RONR` - enable Reactive Optimistic Name-based
74+
Routing (RONR)
75+
* `CFLAGS += -DUSE_STATS` - enable statistics
76+
* `CFLAGS += -DUSE_DUP_CHECK` - enable duplicate checks when forwarding
77+
* `CFLAGS += -DUSE_HMAC256` - HMAC256 signed packets for CCNx1.0
78+
encoding
79+
4780

4881
## Wireshark dissector
4982

pkg/ccn-lite/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
PKG_NAME=ccn-lite
2-
PKG_URL=https://github.com/OlegHahm/ccn-lite/
3-
PKG_VERSION=39b1406c11de9de364220909488eebabe7e81613
2+
PKG_URL=https://github.com/cn-uofbasel/ccn-lite/
3+
PKG_VERSION=9e48d328e162e97f091d913ada0bf50f58d1d3d7
44

55
.PHONY: all
66

pkg/ccn-lite/ccn-lite-riot.h

+51-13
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@
1919
* @{
2020
*/
2121

22-
/**
23-
* Use RIOT specific configuration in CCN-Lite
24-
*/
25-
#define CCNL_RIOT
26-
2722
#include <unistd.h>
2823
#include "kernel_types.h"
2924
#include "arpa/inet.h"
@@ -105,6 +100,22 @@ extern "C" {
105100
* @}
106101
*/
107102

103+
/**
104+
* @brief Some macro definitions
105+
* @{
106+
*/
107+
#define free_2ptr_list(a,b) ccnl_free(a), ccnl_free(b)
108+
#define free_3ptr_list(a,b,c) ccnl_free(a), ccnl_free(b), ccnl_free(c)
109+
#define free_4ptr_list(a,b,c,d) ccnl_free(a), ccnl_free(b), ccnl_free(c), ccnl_free(d);
110+
#define free_5ptr_list(a,b,c,d,e) ccnl_free(a), ccnl_free(b), ccnl_free(c), ccnl_free(d), ccnl_free(e);
111+
112+
/**
113+
* Frees all memory directly and indirectly allocated for prefix information
114+
*/
115+
#define free_prefix(p) do{ if(p) \
116+
free_5ptr_list(p->bytes,p->comp,p->complen,p->chunknum,p); } while(0)
117+
118+
108119
/**
109120
* Constant string
110121
*/
@@ -123,7 +134,7 @@ extern "C" {
123134
/**
124135
* Struct holding CCN-Lite's central relay information
125136
*/
126-
extern struct ccnl_relay_s theRelay;
137+
extern struct ccnl_relay_s ccnl_relay;
127138

128139
/**
129140
* @brief Start the main CCN-Lite event-loop
@@ -149,26 +160,53 @@ int ccnl_open_netif(kernel_pid_t if_pid, gnrc_nettype_t netreg_type);
149160
*
150161
* @param[in] suite CCN packet format
151162
* @param[in] name The name that is requested
152-
* @param[in] addr The relay's address to send to
153-
* @param[in] addr_len Length of @p addr
154163
* @param[in] chunknum Number of the requested content chunk
155164
* @param[out] buf Buffer to write the content chunk to
156165
* @param[in] buf_len Size of @p buf
157166
*
158167
* @return 0 on successfully sent Interest
159168
* @return -1 if Interested couldn't be sent
160169
*/
161-
int ccnl_send_interest(int suite, char *name, uint8_t *addr, size_t addr_len,
162-
unsigned int *chunknum, unsigned char *buf,
163-
size_t buf_len);
170+
int ccnl_send_interest(int suite, char *name, unsigned int *chunknum,
171+
unsigned char *buf, size_t buf_len);
164172

165173
/**
166-
* @brief Waits for incoming content chunk
174+
* @brief Wait for incoming content chunk
175+
*
176+
* @pre The thread has to register for CCNL_CONT_CHUNK in @ref netreg first
177+
*
178+
* @post The thread should unregister from @ref netreg after this function returns
179+
*
180+
* @param[out] buf Buffer to stores the received content
181+
* @param[in] buf_len Size of @p buf
182+
* @param[in] timeout Maximum to wait for the chunk, set to a default value if 0
167183
*
168184
* @return 0 if a content was received
169185
* @return -ETIMEDOUT if no chunk was received until timeout
170186
*/
171-
int ccnl_wait_for_chunk(void *buf, size_t buf_len);
187+
int ccnl_wait_for_chunk(void *buf, size_t buf_len, uint64_t timeout);
188+
189+
/**
190+
* @brief Add entry to the CCN-Lite FIB
191+
*
192+
* @par[in] relay Local relay struct
193+
* @par[in] pfx Prefix of the FIB entry
194+
* @par[in] face Face for the FIB entry
195+
*
196+
* @return 0 on success
197+
* @return -1 on error
198+
*/
199+
int ccnl_fib_add_entry(struct ccnl_relay_s *relay, struct ccnl_prefix_s *pfx,
200+
struct ccnl_face_s *face);
201+
202+
int ccnl_fib_rem_entry(struct ccnl_relay_s *relay, struct ccnl_prefix_s *pfx, struct ccnl_face_s *face);
203+
204+
/**
205+
* @brief Prints the current CCN-Lite FIB
206+
*
207+
* @par[in] relay Local relay struct
208+
*/
209+
void ccnl_fib_show(struct ccnl_relay_s *relay);
172210

173211
#ifdef __cplusplus
174212
}

0 commit comments

Comments
 (0)