1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/examples/ccn-lite-relay/main.c
Juan Carrano 5dc46eb03e pkg/ccn-lite: remove dependency on tlsf-malloc.
There is no reason why this package would need tlsf. Using tlsf as
system malloc is not known to work in all platforms.

With this patch CCN-Lite will use the default malloc provided by the
target's C library.
2019-08-20 17:47:25 +02:00

63 lines
1.5 KiB
C

/*
* 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 <oliver.hahm@inria.fr>
*
* @}
*/
#include <stdio.h>
#include "msg.h"
#include "shell.h"
#include "ccn-lite-riot.h"
#include "net/gnrc/netif.h"
#include "net/gnrc/pktdump.h"
/* main thread's message queue */
#define MAIN_QUEUE_SIZE (8)
static msg_t _main_msg_queue[MAIN_QUEUE_SIZE];
int main(void)
{
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;
/* set the relay's PID, configure the interface to use CCN nettype */
if (((netif = gnrc_netif_iter(NULL)) == NULL) ||
(ccnl_open_netif(netif->pid, GNRC_NETTYPE_CCN) < 0)) {
puts("Error registering at network interface!");
return -1;
}
#ifdef MODULE_NETIF
gnrc_netreg_entry_t dump = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL,
gnrc_pktdump_pid);
gnrc_netreg_register(GNRC_NETTYPE_CCN_CHUNK, &dump);
#endif
char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);
return 0;
}