From f2c9b3e8132555401077cffb40fcc56f23458c02 Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Fri, 19 Mar 2010 13:20:40 +0000 Subject: [PATCH] Remove old neighbor.h inclusion --- apps/shell/shell-rime-debug-runicast.c | 3 +-- apps/shell/shell-rime-debug.c | 3 +-- apps/shell/shell-rime-netcmd.c | 7 +++---- apps/shell/shell-rime-unicast.c | 3 +-- apps/shell/shell-rime.c | 5 ++--- core/net/rime.h | 3 +-- core/net/rime/neighbor-discovery.c | 16 ++++++++++------ core/net/rime/runicast.c | 12 ++++++------ core/net/rime/runicast.h | 9 ++++++--- examples/rime/example-collect.c | 12 +++++++++--- 10 files changed, 40 insertions(+), 33 deletions(-) diff --git a/apps/shell/shell-rime-debug-runicast.c b/apps/shell/shell-rime-debug-runicast.c index 583feea39..1a792c599 100644 --- a/apps/shell/shell-rime-debug-runicast.c +++ b/apps/shell/shell-rime-debug-runicast.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: shell-rime-debug-runicast.c,v 1.2 2010/02/23 18:22:44 adamdunkels Exp $ + * $Id: shell-rime-debug-runicast.c,v 1.3 2010/03/19 13:24:26 adamdunkels Exp $ */ /** @@ -47,7 +47,6 @@ #include "lib/random.h" #include "net/rime.h" -#include "net/rime/neighbor.h" #include "net/rime/route.h" #include "net/rime/trickle.h" diff --git a/apps/shell/shell-rime-debug.c b/apps/shell/shell-rime-debug.c index 3dc101d15..688bf8e45 100644 --- a/apps/shell/shell-rime-debug.c +++ b/apps/shell/shell-rime-debug.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: shell-rime-debug.c,v 1.4 2009/11/08 19:43:00 adamdunkels Exp $ + * $Id: shell-rime-debug.c,v 1.5 2010/03/19 13:24:26 adamdunkels Exp $ */ /** @@ -47,7 +47,6 @@ #include "lib/random.h" #include "net/rime.h" -#include "net/rime/neighbor.h" #include "net/rime/route.h" #include "net/rime/trickle.h" diff --git a/apps/shell/shell-rime-netcmd.c b/apps/shell/shell-rime-netcmd.c index 60c5065e8..404d9383f 100644 --- a/apps/shell/shell-rime-netcmd.c +++ b/apps/shell/shell-rime-netcmd.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: shell-rime-netcmd.c,v 1.8 2009/04/06 23:29:31 adamdunkels Exp $ + * $Id: shell-rime-netcmd.c,v 1.9 2010/03/19 13:24:26 adamdunkels Exp $ */ /** @@ -48,7 +48,6 @@ #include "lib/random.h" #include "net/rime.h" -#include "net/rime/neighbor.h" #include "net/rime/route.h" #include "net/rime/trickle.h" @@ -90,7 +89,7 @@ PROCESS_THREAD(shell_netcmd_server_process, ev, data) PROCESS_BEGIN(); /* XXX: direct output to null. */ - /* printf("netcmd server got command string '%s'\n", (char *)data);*/ + printf("netcmd server got command string '%s'\n", (char *)data); err = shell_start_command(data, strlen((char * )data), NULL, &child_command); if(err == SHELL_FOREGROUND && process_is_running(child_command)) { PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_EXIT || @@ -132,7 +131,7 @@ PROCESS_THREAD(shell_netcmd_process, ev, data) /* Terminate the string with a NUL character. */ msg->netcmd[len] = 0; msg->crc = crc16_data(msg->netcmd, len, 0); - /* printf("netcmd sending '%s'\n", msg->netcmd);*/ + printf("netcmd sending '%s'\n", msg->netcmd); trickle_send(&trickle); } diff --git a/apps/shell/shell-rime-unicast.c b/apps/shell/shell-rime-unicast.c index c3da35289..f9db35a1c 100644 --- a/apps/shell/shell-rime-unicast.c +++ b/apps/shell/shell-rime-unicast.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: shell-rime-unicast.c,v 1.3 2009/11/08 19:43:00 adamdunkels Exp $ + * $Id: shell-rime-unicast.c,v 1.4 2010/03/19 13:24:26 adamdunkels Exp $ */ /** @@ -47,7 +47,6 @@ #include "lib/random.h" #include "net/rime.h" -#include "net/rime/neighbor.h" #include "net/rime/route.h" #include "net/rime/trickle.h" diff --git a/apps/shell/shell-rime.c b/apps/shell/shell-rime.c index fcdc326ab..7c4c8f119 100644 --- a/apps/shell/shell-rime.c +++ b/apps/shell/shell-rime.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: shell-rime.c,v 1.17 2010/02/28 14:16:19 adamdunkels Exp $ + * $Id: shell-rime.c,v 1.18 2010/03/19 13:24:26 adamdunkels Exp $ */ /** @@ -48,7 +48,6 @@ #include "lib/random.h" #include "net/rime.h" -#include "net/rime/neighbor.h" #include "net/rime/route.h" #include "net/rime/timesynch.h" @@ -64,7 +63,7 @@ int snprintf(char *str, size_t size, const char *format, ...); #include -#define COLLECT_REXMITS 8 +#define COLLECT_REXMITS 4 #define COLLECT_MSG_HDRSIZE 4 struct collect_msg { diff --git a/core/net/rime.h b/core/net/rime.h index bfc862039..d52721094 100644 --- a/core/net/rime.h +++ b/core/net/rime.h @@ -33,7 +33,7 @@ * * This file is part of the Contiki operating system. * - * $Id: rime.h,v 1.27 2010/02/23 20:09:11 nifi Exp $ + * $Id: rime.h,v 1.28 2010/03/19 13:20:40 adamdunkels Exp $ */ /** @@ -53,7 +53,6 @@ #include "net/rime/mesh.h" #include "net/rime/multihop.h" #include "net/rime/neighbor-discovery.h" -#include "net/rime/neighbor.h" #include "net/rime/netflood.h" #include "net/rime/polite-announcement.h" #include "net/rime/polite.h" diff --git a/core/net/rime/neighbor-discovery.c b/core/net/rime/neighbor-discovery.c index c3167332a..f9691b1d8 100644 --- a/core/net/rime/neighbor-discovery.c +++ b/core/net/rime/neighbor-discovery.c @@ -33,7 +33,7 @@ * * This file is part of the Contiki operating system. * - * $Id: neighbor-discovery.c,v 1.18 2010/03/17 14:36:46 fros4943 Exp $ + * $Id: neighbor-discovery.c,v 1.19 2010/03/19 13:21:48 adamdunkels Exp $ */ /** @@ -46,7 +46,6 @@ #include "contiki.h" #include "net/rime.h" -#include "net/rime/neighbor.h" #include "net/rime/neighbor-discovery.h" #include "dev/radio-sensor.h" @@ -100,11 +99,11 @@ adv_packet_received(struct broadcast_conn *ibc, const rimeaddr_t *from) struct adv_msg *msg = packetbuf_dataptr(); uint16_t val; + memcpy(&val, &msg->val, sizeof(val)); + PRINTF("%d.%d: adv_packet_received from %d.%d with val %d\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], - from->u8[0], from->u8[1], msg->val); - - memcpy(&val, &msg->val, sizeof(val)); + from->u8[0], from->u8[1], val); /* If we receive an announcement with a lower value than ours, we cancel our own announcement. */ @@ -145,10 +144,12 @@ send_timer(void *ptr) interval = c->max_interval; } - c->current_interval = interval; + /* printf("current_interval %lu\n", (long unsigned int) interval);*/ + PRINTF("current_interval %lu\n", (long unsigned int) interval); + set_timers(c); } /*---------------------------------------------------------------------------*/ @@ -162,6 +163,9 @@ neighbor_discovery_open(struct neighbor_discovery_conn *c, uint16_t channel, clock_time_t max, const struct neighbor_discovery_callbacks *cb) { + PRINTF("%d.%d: neighbor discovery open channel %d\n", + rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], + channel); broadcast_open(&c->c, channel, &broadcast_callbacks); c->u = cb; c->initial_interval = initial; diff --git a/core/net/rime/runicast.c b/core/net/rime/runicast.c index 5604f27b0..153a768ad 100644 --- a/core/net/rime/runicast.c +++ b/core/net/rime/runicast.c @@ -34,7 +34,7 @@ * * This file is part of the Contiki operating system. * - * $Id: runicast.c,v 1.10 2010/02/23 18:38:05 adamdunkels Exp $ + * $Id: runicast.c,v 1.11 2010/03/19 13:21:59 adamdunkels Exp $ */ /** @@ -45,11 +45,9 @@ */ #include "net/rime/runicast.h" -#include "net/rime/neighbor.h" #include "net/rime.h" #include -#define RUNICAST_PACKET_ID_BITS 2 #ifdef RUNICAST_CONF_REXMIT_TIME #define REXMIT_TIME RUNICAST_CONF_REXMIT_TIME @@ -83,13 +81,14 @@ sent_by_stunicast(struct stunicast_conn *stunicast, int status, int num_tx) /* Only process data packets, not ACKs. */ if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) == PACKETBUF_ATTR_PACKET_TYPE_DATA) { - c->rxmit += num_tx; + c->rxmit += 1; if(c->rxmit != 0) { RIMESTATS_ADD(rexmit); - PRINTF("%d.%d: runicast: packet %u resent %u\n", + PRINTF("%d.%d: runicast: sent_by_stunicast packet %u (%u) resent %u\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], - packetbuf_attr(PACKETBUF_ATTR_PACKET_ID), c->rxmit); + packetbuf_attr(PACKETBUF_ATTR_PACKET_ID), + c->sndnxt, c->rxmit); } if(c->rxmit >= c->max_rxmit) { RIMESTATS_ADD(timedout); @@ -234,6 +233,7 @@ runicast_send(struct runicast_conn *c, const rimeaddr_t *receiver, packetbuf_set_attr(PACKETBUF_ATTR_RELIABLE, 1); packetbuf_set_attr(PACKETBUF_ATTR_PACKET_TYPE, PACKETBUF_ATTR_PACKET_TYPE_DATA); packetbuf_set_attr(PACKETBUF_ATTR_PACKET_ID, c->sndnxt); + packetbuf_set_attr(PACKETBUF_ATTR_MAX_MAC_REXMIT, 2); c->max_rxmit = max_retransmissions; c->rxmit = 0; c->is_tx = 1; diff --git a/core/net/rime/runicast.h b/core/net/rime/runicast.h index 85b4db5d5..b691ca798 100644 --- a/core/net/rime/runicast.h +++ b/core/net/rime/runicast.h @@ -66,7 +66,7 @@ * * This file is part of the Contiki operating system. * - * $Id: runicast.h,v 1.6 2009/11/08 19:40:18 adamdunkels Exp $ + * $Id: runicast.h,v 1.7 2010/03/19 13:22:08 adamdunkels Exp $ */ /** @@ -83,9 +83,12 @@ struct runicast_conn; + +#define RUNICAST_PACKET_ID_BITS 2 + #define RUNICAST_ATTRIBUTES { PACKETBUF_ATTR_PACKET_TYPE, PACKETBUF_ATTR_BIT }, \ - { PACKETBUF_ATTR_PACKET_ID, PACKETBUF_ATTR_BIT * 2 }, \ - STUNICAST_ATTRIBUTES + { PACKETBUF_ATTR_PACKET_ID, PACKETBUF_ATTR_BIT * RUNICAST_PACKET_ID_BITS }, \ + STUNICAST_ATTRIBUTES struct runicast_callbacks { void (* recv)(struct runicast_conn *c, const rimeaddr_t *from, uint8_t seqno); void (* sent)(struct runicast_conn *c, const rimeaddr_t *to, uint8_t retransmissions); diff --git a/examples/rime/example-collect.c b/examples/rime/example-collect.c index 7a33dbc37..c7b71d1ca 100644 --- a/examples/rime/example-collect.c +++ b/examples/rime/example-collect.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: example-collect.c,v 1.10 2010/02/03 21:11:33 adamdunkels Exp $ + * $Id: example-collect.c,v 1.11 2010/03/19 13:26:27 adamdunkels Exp $ */ /** @@ -42,7 +42,6 @@ #include "lib/random.h" #include "net/rime.h" #include "net/rime/collect.h" -#include "net/rime/neighbor.h" #include "dev/leds.h" #include "dev/button-sensor.h" @@ -75,6 +74,13 @@ PROCESS_THREAD(example_collect_process, ev, data) collect_open(&tc, 130, &callbacks); + if(rimeaddr_node_addr.u8[0] == 1 && + rimeaddr_node_addr.u8[1] == 1) { + printf("I am sink\n"); + collect_set_sink(&tc, 1); + + } + while(1) { static struct etimer et; @@ -85,7 +91,7 @@ PROCESS_THREAD(example_collect_process, ev, data) PROCESS_WAIT_EVENT(); if(etimer_expired(&et)) { - while(tc.forwarding) { + while(tc.sending) { PROCESS_PAUSE(); } printf("Sending\n");