diff --git a/examples/ccn-lite-relay/Makefile b/examples/ccn-lite-relay/Makefile index 9345072a94210b614c022796dc1f6df68f99641d..016787f2fe469ebcd07d68f7338b6891ef11d7bc 100644 --- a/examples/ccn-lite-relay/Makefile +++ b/examples/ccn-lite-relay/Makefile @@ -27,8 +27,6 @@ USEMODULE += shell_commands # NOTE: 6LoWPAN will be included if IEEE802.15.4 devices are present USEMODULE += gnrc_netdev_default USEMODULE += auto_init_gnrc_netif -# This application dumps received packets to STDIO using the pktdump module -USEMODULE += gnrc_pktdump USEMODULE += timex USEMODULE += xtimer USEMODULE += random diff --git a/examples/ccn-lite-relay/main.c b/examples/ccn-lite-relay/main.c index 175e02910816b765ba2345a902bc2afee73236ed..21bce50537daa3eba9109b0f7954db960a4a9b8e 100644 --- a/examples/ccn-lite-relay/main.c +++ b/examples/ccn-lite-relay/main.c @@ -25,7 +25,6 @@ #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) @@ -55,12 +54,6 @@ int main(void) 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; diff --git a/sys/net/gnrc/pktdump/gnrc_pktdump.c b/sys/net/gnrc/pktdump/gnrc_pktdump.c index cc1ecef1c182231bf2cec7c7b02243dde0a85931..811aee30774793327e42e3fac15f3cdb76f4fcbf 100644 --- a/sys/net/gnrc/pktdump/gnrc_pktdump.c +++ b/sys/net/gnrc/pktdump/gnrc_pktdump.c @@ -88,12 +88,6 @@ static void _dump_snip(gnrc_pktsnip_t *pkt) udp_hdr_print(pkt->data); break; #endif -#ifdef MODULE_CCN_LITE_UTILS - case GNRC_NETTYPE_CCN_CHUNK: - printf("GNRC_NETTYPE_CCN_CHUNK (%i)\n", pkt->type); - printf("Content is: %.*s\n", pkt->size, (char*)pkt->data); - break; -#endif #ifdef TEST_SUITES case GNRC_NETTYPE_TEST: printf("NETTYPE_TEST (%i)\n", pkt->type); diff --git a/sys/shell/commands/sc_ccnl.c b/sys/shell/commands/sc_ccnl.c index 513d4a17899d67586ea81a01f042a509a19f01dc..cd35b3839633a3e4b7a3a76fa1a7886ceb8da421 100644 --- a/sys/shell/commands/sc_ccnl.c +++ b/sys/shell/commands/sc_ccnl.c @@ -29,6 +29,7 @@ #define MAX_ADDR_LEN (8U) static unsigned char _int_buf[BUF_SIZE]; +static unsigned char _cont_buf[BUF_SIZE]; static const char *_default_content = "Start the RIOT!"; static unsigned char _out[CCNL_MAX_PACKET_SIZE]; @@ -205,10 +206,26 @@ int _ccnl_interest(int argc, char **argv) } memset(_int_buf, '\0', BUF_SIZE); + memset(_cont_buf, '\0', BUF_SIZE); + + gnrc_netreg_entry_t _ne = + GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL, + sched_active_pid); + /* register for content chunks */ + gnrc_netreg_register(GNRC_NETTYPE_CCN_CHUNK, &_ne); struct ccnl_prefix_s *prefix = ccnl_URItoPrefix(argv[1], CCNL_SUITE_NDNTLV, NULL, 0); - int res = ccnl_send_interest(prefix, _int_buf, BUF_SIZE); + ccnl_send_interest(prefix, _int_buf, BUF_SIZE); + int res = 0; + if (ccnl_wait_for_chunk(_cont_buf, BUF_SIZE, 0) > 0) { + printf("Content received: %s\n", _cont_buf); + } + else { + printf("Timeout! No content received in response to the Interest for %s.\n", argv[1]); + res = -1; + } free_prefix(prefix); + gnrc_netreg_unregister(GNRC_NETTYPE_CCN_CHUNK, &_ne); return res; }