diff --git a/examples/rpl_udp/helper.c b/examples/rpl_udp/helper.c index 26e0a245ed..b4885a90b1 100644 --- a/examples/rpl_udp/helper.c +++ b/examples/rpl_udp/helper.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 INRIA + * Copyright (C) 2013, 2014 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 diff --git a/examples/rpl_udp/main.c b/examples/rpl_udp/main.c index 72a2e48065..27001537ba 100644 --- a/examples/rpl_udp/main.c +++ b/examples/rpl_udp/main.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 INRIA + * Copyright (C) 2013. 2014 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 @@ -32,12 +32,10 @@ const shell_command_t shell_commands[] = { {"init", "Initialize network", rpl_udp_init}, {"set", "Set ID", rpl_udp_set_id}, - {"table", "Shows the routing table", rpl_udp_table}, {"dodag", "Shows the dodag", rpl_udp_dodag}, - {"loop", "", rpl_udp_loop}, {"server", "Starts a UDP server", udp_server}, {"send", "Send a UDP datagram", udp_send}, - {"ign", "ignore node", rpl_udp_ignore}, + {"ign", "Ignore a node", rpl_udp_ignore}, {NULL, NULL, NULL} }; diff --git a/examples/rpl_udp/rpl.c b/examples/rpl_udp/rpl.c index fc8e160889..3b5023a8f0 100644 --- a/examples/rpl_udp/rpl.c +++ b/examples/rpl_udp/rpl.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 INRIA + * Copyright (C) 2013, 2014 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 @@ -106,7 +106,7 @@ void rpl_udp_init(int argc, char **argv) /* TODO: check if this works as intended */ ipv6_addr_t prefix, tmp; - ipv6_addr_init(&std_addr, 0xABCD, 0xEF12, 0, 0, 0x1034, 0x00FF, 0xFE00, id); + ipv6_addr_init(&std_addr, 0xabcd, 0x0, 0x0, 0x0, 0x3612, 0x00ff, 0xfe00, id); ipv6_addr_init_prefix(&prefix, &std_addr, 64); ndp_add_prefix_info(0, &prefix, 64, NDP_OPT_PI_VLIFETIME_INFINITE, NDP_OPT_PI_PLIFETIME_INFINITE, 1, @@ -129,81 +129,6 @@ void rpl_udp_init(int argc, char **argv) /* start transceiver watchdog */ } -void rpl_udp_loop(int argc, char **argv) -{ - (void) argc; - (void) argv; - - rpl_routing_entry_t *rtable; - - rtable = rpl_get_routing_table(); - rpl_dodag_t *mydodag = rpl_get_my_dodag(); - - if (mydodag == NULL) { - return; - } - - printf("---------------------------\n"); - printf("OUTPUT\n"); - printf("my rank: %d\n", mydodag->my_rank); - - if (!is_root) { - printf("my preferred parent:\n"); - printf("%s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, - (&mydodag->my_preferred_parent->addr))); - printf("parent lifetime: %d\n", mydodag->my_preferred_parent->lifetime); - } - - printf("---------------------------$\n"); - - for (int i = 0; i < RPL_MAX_ROUTING_ENTRIES; i++) { - if (rtable[i].used) { - printf("%s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, - (&rtable[i].address))); - puts("next hop"); - printf("%s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, - (&rtable[i].next_hop))); - printf("entry %d lifetime %d\n", i, rtable[i].lifetime); - - if (!rpl_equal_id(&rtable[i].address, &rtable[i].next_hop)) { - puts("multi-hop"); - } - - printf("---------------------------$\n"); - } - } - - printf("########################\n"); -} - -void rpl_udp_table(int argc, char **argv) -{ - (void) argc; - (void) argv; - - rpl_routing_entry_t *rtable; - rtable = rpl_get_routing_table(); - printf("---------------------------\n"); - printf("OUTPUT\n"); - printf("---------------------------\n"); - - for (int i = 0; i < RPL_MAX_ROUTING_ENTRIES; i++) { - if (rtable[i].used) { - printf("%s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, - (&rtable[i].address))); - printf("entry %d lifetime %d\n", i, rtable[i].lifetime); - - if (!rpl_equal_id(&rtable[i].address, &rtable[i].next_hop)) { - puts("multi-hop"); - } - - printf("--------------\n"); - } - } - - printf("$\n"); -} - void rpl_udp_dodag(int argc, char **argv) { (void) argc; diff --git a/examples/rpl_udp/rpl_udp.h b/examples/rpl_udp/rpl_udp.h index f09748d2c1..5263364645 100644 --- a/examples/rpl_udp/rpl_udp.h +++ b/examples/rpl_udp/rpl_udp.h @@ -1,7 +1,7 @@ #ifndef RPL_UDP_H #define RPL_UDP_H -#define APP_VERSION "1.1" +#define APP_VERSION "1.2" #define RADIO_CHANNEL (10) @@ -10,43 +10,85 @@ /* RPL shell command handlers */ /** - * @brief Shell command to initializes RPL and Destiny + * @brief Shell command to initializes RPL and UDP + * + * @details Usage: init + * `init r` will initialize the node as a RPL root node, + * `init n` as a RPL node. + * + * @param[in] argc Argument count + * @param[in] argv Arguments */ void rpl_udp_init(int argc, char **argv); /** * @brief Shell command to set node's ID + * + * @details Usage: set + * Set the node address + * + * @param[in] argc Argument count + * @param[in] argv Arguments */ void rpl_udp_set_id(int argc, char **argv); -/** - * @brief Loops through the routing table - */ -void rpl_udp_loop(int argc, char **argv); - -/** - * @brief Shows the routing table - */ -void rpl_udp_table(int argc, char **argv); - /** * @brief Shows the dodag + * + * @details No parameters required + * + * @param[in] argc Argument count + * @param[in] argv Arguments */ void rpl_udp_dodag(int argc, char **argv); -/* UDP shell command handlers */ +/** + * @brief Command handler to start a UDP server + * + * @details No parameters required + * + * @param[in] argc Argument count + * @param[in] argv Arguments + */ void udp_server(int argc, char **argv); + +/** + * @brief Sends a UDP datagram + * + * @details Usage: send + * Sends TEXT to the node with IP address: + * fe80::ff:fe00: + * + * @param[in] argc Argument count + * @param[in] argv Arguments + */ void udp_send(int argc, char **argv); -/* helper command handlers */ -void rpl_udp_ip(int argc, char **argv); - +/** + * @brief Ignore a certain node + * + * @details Usage: ignore + * Ignore the node with IP address: + * fe80::ff:fe00: + * + * @param[in] argc Argument count + * @param[in] argv Arguments + */ void rpl_udp_ignore(int argc, char **argv); -/* monitoring thread */ +/** + * @brief monitoring thread start function + * + * @param arg Unused + */ void *rpl_udp_monitor(void *arg); +/** @brief The nodes radio address */ extern radio_address_t id; + +/** @brief The node's default IP address */ extern ipv6_addr_t std_addr; + +/** @brief Char array for IP address printing */ extern char addr_str[IPV6_MAX_ADDR_STR_LEN]; #endif /* RPL_UDP_H */ diff --git a/examples/rpl_udp/udp.c b/examples/rpl_udp/udp.c index d6f26e316a..598201d8fa 100644 --- a/examples/rpl_udp/udp.c +++ b/examples/rpl_udp/udp.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 INRIA + * Copyright (C) 2013, 2014 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