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; }
int _ccnl_open(int argc, char **argv) { /* check if parameter is given */ if (argc != 2) { _open_usage(); return -1; } /* check if given number is a valid netif PID */ int pid = atoi(argv[1]); if (!gnrc_netif_exist(pid)) { printf("%i is not a valid interface!\n", pid); return -1; } if(!started) ccnl_start(); /* set the relay's PID, configure the interface to interface to use CCN * nettype */ if (ccnl_open_netif(pid, GNRC_NETTYPE_CCN) < 0) { puts("Error registering at network interface!"); return -1; } started = true; return 0; }