mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #516 from mehlis/rpl-fixes
first set of rpl demo related fixes
This commit is contained in:
commit
638bb4ce51
@ -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;
|
||||
|
@ -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.");
|
||||
|
@ -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}
|
||||
};
|
||||
|
||||
|
@ -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");
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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));
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user