diff --git a/examples/rpl_udp/demo.h b/examples/rpl_udp/demo.h index dff1e93e2d..2b831011b4 100644 --- a/examples/rpl_udp/demo.h +++ b/examples/rpl_udp/demo.h @@ -16,47 +16,47 @@ * * @param[in] str Shell input */ -void init(char *str); +void rpl_udp_init(char *str); /** * @brief Shell command to set node's ID * * @param[in] str Shell input */ -void set_id(char *id); +void rpl_udp_set_id(char *id); /** * @brief Loops through the routing table * * @param[in] unused Guess what */ -void loop(char *unused); +void rpl_udp_loop(char *unused); /** * @brief Shows the routing table * * @param[in] unused Guess what */ -void table(char *unused); +void rpl_udp_table(char *unused); /** * @brief Shows the dodag * * @param[in] unused Guess what */ -void dodag(char *unused); +void rpl_udp_dodag(char *unused); /* UDP shell command handlers */ void udp_server(char *unused); void udp_send(char *str); /* helper command handlers */ -void ip(char *unused); +void rpl_udp_ip(char *unused); -void ignore(char *addr); +void rpl_udp_ignore(char *addr); /* monitoring thread */ -void monitor(void); +void rpl_udp_monitor(void); extern radio_address_t id; extern ipv6_addr_t std_addr; diff --git a/examples/rpl_udp/helper.c b/examples/rpl_udp/helper.c index e055c2abc8..e1b3e92ccc 100644 --- a/examples/rpl_udp/helper.c +++ b/examples/rpl_udp/helper.c @@ -20,13 +20,13 @@ extern uint8_t ipv6_ext_hdr_len; msg_t msg_q[RCV_BUFFER_SIZE]; /* prints current IPv6 adresses */ -void ip(char *unused) +void rpl_udp_ip(char *unused) { (void) unused; ipv6_iface_print_addrs(); } -void set_id(char *id_str) +void rpl_udp_set_id(char *id_str) { int res = sscanf(id_str, "set %hu", &id); @@ -40,7 +40,7 @@ void set_id(char *id_str) printf("Set node ID to %u\n", id); } -void monitor(void) +void rpl_udp_monitor(void) { msg_t m; radio_packet_t *p; @@ -70,7 +70,7 @@ void monitor(void) } else if (m.type == IPV6_PACKET_RECEIVED) { ipv6_buf = (ipv6_hdr_t*) m.content.ptr; - printf("IPv& datagram received (next header: %02X)", ipv6_buf->nextheader); + printf("IPv6 datagram received (next header: %02X)", ipv6_buf->nextheader); printf(" from %s ", ipv6_addr_to_str(addr_str, &ipv6_buf->srcaddr)); if (ipv6_buf->nextheader == IPV6_PROTO_NUM_ICMPV6) { icmpv6_buf = (icmpv6_hdr_t*) &ipv6_buf[(LL_HDR_LEN + IPV6_HDR_LEN) + ipv6_ext_hdr_len]; @@ -95,7 +95,7 @@ void monitor(void) transceiver_command_t tcmd; -void ignore(char *addr) { +void rpl_udp_ignore(char *addr) { uint16_t a; if (transceiver_pid < 0) { puts("Transceiver not runnning."); diff --git a/examples/rpl_udp/main.c b/examples/rpl_udp/main.c index 641abd6942..c276e49ecd 100644 --- a/examples/rpl_udp/main.c +++ b/examples/rpl_udp/main.c @@ -10,15 +10,15 @@ #include "demo.h" const shell_command_t shell_commands[] = { - {"init", "Initialize network", init}, - {"set", "Set ID", set_id}, - {"table", "", table}, - {"dodag", "", dodag}, - {"loop", "", loop}, + {"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}, - {"ip", "Print all assigned IP addresses", ip}, - {"ign", "ignore node", ignore}, + {"ip", "Print all assigned IP addresses", rpl_udp_ip}, + {"ign", "ignore node", rpl_udp_ignore}, {NULL, NULL, NULL} }; diff --git a/examples/rpl_udp/rpl.c b/examples/rpl_udp/rpl.c index e9f2f7e216..a956d4b9ab 100644 --- a/examples/rpl_udp/rpl.c +++ b/examples/rpl_udp/rpl.c @@ -20,21 +20,21 @@ ipv6_addr_t std_addr; uint8_t is_root = 0; -void init(char *str) +void rpl_udp_init(char *str) { transceiver_command_t tcmd; msg_t m; uint8_t chan = RADIO_CHANNEL; - char command; - - int res = sscanf(str, "init %c", &command); - - if (res < 1) { + char *toc_str = strtok(str, " "); + toc_str = strtok(NULL, " "); + if (!toc_str) { printf("Usage: init (r|n)\n"); printf("\tr\tinitialize as root\n"); printf("\tn\tinitialize as node router\n"); + return; } + char command = *toc_str; uint8_t state; @@ -61,7 +61,7 @@ void init(char *str) else { ipv6_iface_set_routing_provider(rpl_get_next_hop); } - int monitor_pid = thread_create(monitor_stack_buffer, MONITOR_STACK_SIZE, PRIORITY_MAIN-2, CREATE_STACKTEST, monitor, "monitor"); + int monitor_pid = thread_create(monitor_stack_buffer, MONITOR_STACK_SIZE, PRIORITY_MAIN-2, CREATE_STACKTEST, rpl_udp_monitor, "monitor"); transceiver_register(TRANSCEIVER, monitor_pid); ipv6_register_packet_handler(monitor_pid); //sixlowpan_lowpan_register(monitor_pid); @@ -94,7 +94,7 @@ void init(char *str) /* start transceiver watchdog */ } -void loop(char *unused) +void rpl_udp_loop(char *unused) { (void) unused; @@ -135,7 +135,7 @@ void loop(char *unused) printf("########################\n"); } -void table(char *unused) +void rpl_udp_table(char *unused) { (void) unused; @@ -161,7 +161,7 @@ void table(char *unused) printf("$\n"); } -void dodag(char *unused) +void rpl_udp_dodag(char *unused) { (void) unused; @@ -170,7 +170,7 @@ void dodag(char *unused) if (mydodag == NULL) { printf("Not part of a dodag\n"); - printf("---------------------------$\n"); + printf("---------------------------\n"); return; } @@ -181,5 +181,5 @@ void dodag(char *unused) printf("my preferred parent:\n"); printf("%s\n", ipv6_addr_to_str(addr_str, (&mydodag->my_preferred_parent->addr))); } - printf("---------------------------$\n"); + printf("---------------------------\n"); } diff --git a/examples/rpl_udp/udp.c b/examples/rpl_udp/udp.c index c6f9bb4bfb..bcbc83f322 100644 --- a/examples/rpl_udp/udp.c +++ b/examples/rpl_udp/udp.c @@ -25,7 +25,7 @@ void udp_server(char *unused) { (void) unused; int udp_server_thread_pid = thread_create(udp_server_stack_buffer, KERNEL_CONF_STACKSIZE_MAIN, PRIORITY_MAIN, CREATE_STACKTEST, init_udp_server, "init_udp_server"); - printf("UDP SERVER THREAD PID: %i\n", udp_server_thread_pid); + printf("UDP SERVER ON PORT %d (THREAD PID: %d)\n", HTONS(SERVER_PORT), udp_server_thread_pid); } void init_udp_server(void) diff --git a/sys/net/network_layer/sixlowpan/icmp.c b/sys/net/network_layer/sixlowpan/icmp.c index faaac7fb64..99b5722ca7 100644 --- a/sys/net/network_layer/sixlowpan/icmp.c +++ b/sys/net/network_layer/sixlowpan/icmp.c @@ -1368,6 +1368,9 @@ uint8_t nbr_cache_add(ipv6_addr_t *ipaddr, ieee_802154_long_t *laddr, ndp_nce_type_t type, uint16_t ltime, ieee_802154_short_t *saddr) { + (void) ltime; + (void) saddr; + if (nbr_count == NBR_CACHE_SIZE) { printf("ERROR: neighbor cache full\n"); return NDP_OPT_ARO_STATE_NBR_CACHE_FULL; diff --git a/sys/net/network_layer/sixlowpan/lowpan.c b/sys/net/network_layer/sixlowpan/lowpan.c index e3faf88a30..30b254efc4 100644 --- a/sys/net/network_layer/sixlowpan/lowpan.c +++ b/sys/net/network_layer/sixlowpan/lowpan.c @@ -641,7 +641,7 @@ void check_timeout(void) while (temp_buf != NULL) { if ((timex_uint64(now) - timex_uint64(temp_buf->timestamp)) >= LOWPAN_REAS_BUF_TIMEOUT) { - printf("TIMEOUT!cur_time: %lu, temp_buf: %lu\n", timex_uint64(now), + printf("TIMEOUT!cur_time: %" PRIu64 ", temp_buf: %" PRIu64 "\n", timex_uint64(now), timex_uint64(temp_buf->timestamp)); temp_buf = collect_garbage(temp_buf); } diff --git a/sys/net/transport_layer/destiny/destiny.c b/sys/net/transport_layer/destiny/destiny.c index 3f434c8f29..906219b66c 100644 --- a/sys/net/transport_layer/destiny/destiny.c +++ b/sys/net/transport_layer/destiny/destiny.c @@ -36,7 +36,7 @@ char tcp_timer_stack[TCP_TIMER_STACKSIZE]; int destiny_init_transport_layer(void) { - printf("Initializing transport layer packages. Size of socket_type: %u\n", + printf("Initializing transport layer packages. Size of socket_type: %zu\n", sizeof(socket_internal_t)); /* SOCKETS */ memset(sockets, 0, MAX_SOCKETS * sizeof(socket_internal_t)); diff --git a/sys/net/transport_layer/destiny/socket.c b/sys/net/transport_layer/destiny/socket.c index f5937431cd..54edb69085 100644 --- a/sys/net/transport_layer/destiny/socket.c +++ b/sys/net/transport_layer/destiny/socket.c @@ -770,7 +770,7 @@ int32_t destiny_socket_send(int s, const void *buf, uint32_t len, int flags) } else { memcpy(&send_buffer[IPV6_HDR_LEN + TCP_HDR_LEN], - buf + total_sent_bytes, len - total_sent_bytes); + (uint8_t *) buf + total_sent_bytes, len - total_sent_bytes); sent_bytes = len - total_sent_bytes; total_sent_bytes = len; } @@ -785,7 +785,7 @@ int32_t destiny_socket_send(int s, const void *buf, uint32_t len, int flags) } else { memcpy(&send_buffer[IPV6_HDR_LEN + TCP_HDR_LEN], - buf + total_sent_bytes, len - total_sent_bytes); + (uint8_t *) buf + total_sent_bytes, len - total_sent_bytes); sent_bytes = len - total_sent_bytes; total_sent_bytes = len; } diff --git a/sys/net/transport_layer/destiny/tcp_timer.c b/sys/net/transport_layer/destiny/tcp_timer.c index dc07474b15..d2da0b9d8f 100644 --- a/sys/net/transport_layer/destiny/tcp_timer.c +++ b/sys/net/transport_layer/destiny/tcp_timer.c @@ -149,8 +149,10 @@ void tcp_general_timer(void) while (1) { inc_global_variables(); check_sockets(); - vtimer_remove(&tcp_vtimer); + vtimer_set_wakeup(&tcp_vtimer, interval, thread_getpid()); thread_sleep(); + + vtimer_remove(&tcp_vtimer); } }