The friendly Operating System for the Internet of Things
CCN-Lite stack

Provides a NDN implementation. More...

Detailed Description

This package provides the CCN-Lite stack as a port of NDN for RIOT.

Data Structures

struct  ccnl_interest_t
 Data structure for interest packet. More...
 

Macros

#define LOG_LEVEL   LOG_DEBUG
 Define the log level of the CCN-Lite stack.
 
#define ccnl_close_socket(s)   close(s)
 Closing an interface or socket from CCN-Lite.
 
#define free_prefix(p)
 Frees all memory directly and indirectly allocated for prefix information. More...
 
#define CONSTSTR(s)   s
 Constant string.
 
#define CCNL_STACK_SIZE   (THREAD_STACKSIZE_MAIN)
 Stack size for CCN-Lite event loop.
 
#define CCNL_QUEUE_SIZE   (8)
 Size of the message queue of CCN-Lite's event loop.
 
#define CCNL_PREFIX_BUFSIZE   (50)
 Maximum string length for prefix representation.
 
#define CCNL_MSG_TIMEOUT   (0x1701)
 Message type for signalling a timeout while waiting for a content chunk.
 
#define CCNL_MSG_AGEING   (0x1702)
 Message type for advancing the ageing timer.
 
#define CCNL_CACHE_SIZE   (5)
 Maximum number of elements that can be cached.
 
#define CCNL_CACHE_SIZE
 Maximum number of elements that can be cached.
 

Typedefs

typedef int(* ccnl_producer_func) (struct ccnl_relay_s *relay, struct ccnl_face_s *from, struct ccnl_pkt_s *pkt)
 Function pointer type for local producer function.
 
typedef int(* ccnl_cache_strategy_func) (struct ccnl_relay_s *relay, struct ccnl_content_s *c)
 Function pointer type for caching strategy function.
 

Functions

kernel_pid_t ccnl_start (void)
 Start the main CCN-Lite event-loop. More...
 
int ccnl_open_netif (kernel_pid_t if_pid, gnrc_nettype_t netreg_type)
 Opens a Network interfaces device for use with CCN-Lite. More...
 
struct ccnl_interest_s * ccnl_send_interest (struct ccnl_prefix_s *prefix, unsigned char *buf, size_t buf_len)
 Sends out an Interest. More...
 
int ccnl_wait_for_chunk (void *buf, size_t buf_len, uint64_t timeout)
 Wait for incoming content chunk. More...
 
int ccnl_fib_add_entry (struct ccnl_relay_s *relay, struct ccnl_prefix_s *pfx, struct ccnl_face_s *face)
 Add entry to the CCN-Lite FIB. More...
 
int ccnl_fib_rem_entry (struct ccnl_relay_s *relay, struct ccnl_prefix_s *pfx, struct ccnl_face_s *face)
 Remove entry from the CCN-Lite FIB. More...
 
void ccnl_fib_show (struct ccnl_relay_s *relay)
 Prints the current CCN-Lite FIB. More...
 
void ccnl_set_local_producer (ccnl_producer_func func)
 Set a local producer function. More...
 
void ccnl_set_cache_strategy_remove (ccnl_cache_strategy_func func)
 Set a function to control the caching strategy. More...
 

Variables

struct ccnl_relay_s ccnl_relay
 Struct holding CCN-Lite's central relay information.
 

Dynamic memory allocation used in CCN-Lite

#define ccnl_malloc(s)   malloc(s)
 
#define ccnl_calloc(n, s)   calloc(n,s)
 
#define ccnl_realloc(p, s)   realloc(p,s)
 
#define ccnl_free(p)   free(p)
 

Log levels used by CCN-Lite debugging

#define FATAL   LOG_ERROR
 
#define ERROR   LOG_ERROR
 
#define WARNING   LOG_WARNING
 
#define INFO   LOG_INFO
 
#define DEBUG   LOG_DEBUG
 
#define TRACE   LOG_DEBUG
 
#define VERBOSE   LOG_ALL
 

CCN-Lite's debugging macros

#define DEBUGMSG(LVL, ...)
 
#define DEBUGMSG_CORE(...)   DEBUGMSG(__VA_ARGS__)
 
#define DEBUGMSG_CFWD(...)   DEBUGMSG(__VA_ARGS__)
 
#define DEBUGMSG_CUTL(...)   DEBUGMSG(__VA_ARGS__)
 
#define DEBUGMSG_PIOT(...)   DEBUGMSG(__VA_ARGS__)
 
#define DEBUGSTMT(LVL, ...)
 
#define TRACEIN(...)   do {} while(0)
 
#define TRACEOUT(...)   do {} while(0)
 
#define free_2ptr_list(a, b)   ccnl_free(a), ccnl_free(b)
 Some macro definitions.
 
#define free_3ptr_list(a, b, c)   ccnl_free(a), ccnl_free(b), ccnl_free(c)
 
#define free_4ptr_list(a, b, c, d)   ccnl_free(a), ccnl_free(b), ccnl_free(c), ccnl_free(d);
 
#define free_5ptr_list(a, b, c, d, e)   ccnl_free(a), ccnl_free(b), ccnl_free(c), ccnl_free(d), ccnl_free(e);
 

Macro Definition Documentation

#define DEBUGMSG (   LVL,
  ... 
)
Value:
do { \
if ((LVL)>debug_level) break; \
LOG(LVL, __VA_ARGS__); \
} while (0)
#define LOG(level,...)
Log message if level <= LOG_LEVEL.
Definition: log.h:83

Definition at line 82 of file ccn-lite-riot.h.

#define DEBUGSTMT (   LVL,
  ... 
)
Value:
do { \
if ((LVL)>debug_level) break; \
__VA_ARGS__; \
} while (0)

Definition at line 92 of file ccn-lite-riot.h.

#define free_prefix (   p)
Value:
do{ if(p) \
free_5ptr_list(p->bytes,p->comp,p->complen,p->chunknum,p); } while(0)

Definition at line 118 of file ccn-lite-riot.h.

Function Documentation

int ccnl_fib_add_entry ( struct ccnl_relay_s *  relay,
struct ccnl_prefix_s *  pfx,
struct ccnl_face_s *  face 
)
[in] relay Local relay struct
[in] pfx Prefix of the FIB entry
[in] face Face for the FIB entry
Returns
0 on success
-1 on error
int ccnl_fib_rem_entry ( struct ccnl_relay_s *  relay,
struct ccnl_prefix_s *  pfx,
struct ccnl_face_s *  face 
)
[in] relay Local relay struct
[in] pfx Prefix of the FIB entry, may be NULL
[in] face Face for the FIB entry, may be NULL
Returns
0 on success
-1 on error
void ccnl_fib_show ( struct ccnl_relay_s *  relay)
[in] relay Local relay struct
int ccnl_open_netif ( kernel_pid_t  if_pid,
gnrc_nettype_t  netreg_type 
)
Parameters
[in]if_pidThe pid of the Network interfaces device driver
[in]netreg_typeThe Protocol type if_pid should be configured to use
Returns
0 on success,
-EINVAL if eventloop could not be registered for netreg_type
struct ccnl_interest_s* ccnl_send_interest ( struct ccnl_prefix_s *  prefix,
unsigned char *  buf,
size_t  buf_len 
)
Parameters
[in]prefixThe name that is requested
[out]bufBuffer to write the content chunk to
[in]buf_lenSize of buf
Returns
pointer to the successfully sent Interest
NULL if Interest couldn't be sent
void ccnl_set_cache_strategy_remove ( ccnl_cache_strategy_func  func)

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 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.

Parameters
[in]funcThe function to be called for an incoming content chunk if the cache is full.
void ccnl_set_local_producer ( ccnl_producer_func  func)

Setting a local producer function allows to generate content on the fly or react otherwise on any kind of incoming interest.

Parameters
[in]funcThe function to be called first for any incoming interest
kernel_pid_t ccnl_start ( void  )
Returns
The PID of the event-loop's thread
int ccnl_wait_for_chunk ( void *  buf,
size_t  buf_len,
uint64_t  timeout 
)
Precondition
The thread has to register for CCNL_CONT_CHUNK in Network protocol registry first
Postcondition
The thread should unregister from Network protocol registry after this function returns
Parameters
[out]bufBuffer to stores the received content
[in]buf_lenSize of buf
[in]timeoutMaximum to wait for the chunk, set to a default value if 0
Returns
0 if a content was received
-ETIMEDOUT if no chunk was received until timeout