-
Notifications
You must be signed in to change notification settings - Fork 86
/
main.c
61 lines (49 loc) · 1.43 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
* Copyright (C) 2015 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
* directory for more details.
*/
/**
* @ingroup examples
* @{
*
* @file
* @brief Basic ccn-lite relay example (produce and consumer via shell)
*
* @author Oliver Hahm <[email protected]>
*
* @}
*/
#include <stdio.h>
#include "tlsf.h"
#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)
static msg_t _main_msg_queue[MAIN_QUEUE_SIZE];
/* 10kB buffer for the heap should be enough for everyone */
#define TLSF_BUFFER (10240 / sizeof(uint32_t))
static uint32_t _tlsf_heap[TLSF_BUFFER];
int main(void)
{
tlsf_create_with_pool(_tlsf_heap, sizeof(_tlsf_heap));
msg_init_queue(_main_msg_queue, MAIN_QUEUE_SIZE);
puts("Basic CCN-Lite example");
ccnl_core_init();
ccnl_start();
/* get the default interface */
gnrc_netif_t *netif = gnrc_netif_iter(NULL);
/* set the relay's PID, configure the interface to interface to use CCN
* nettype */
if ((netif == NULL) || (ccnl_open_netif(netif->pid, 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;
}