moved rime initialization into rime router so it is easier to switch IPv6 routing module

This commit is contained in:
nifi 2009-11-18 13:51:55 +00:00
parent 2640f9bf26
commit bb0ffe0478
2 changed files with 8 additions and 6 deletions

View File

@ -32,7 +32,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: rimeroute.c,v 1.3 2009/11/08 19:40:18 adamdunkels Exp $ * $Id: rimeroute.c,v 1.4 2009/11/18 13:51:56 nifi Exp $
*/ */
/** /**
* \file * \file
@ -49,6 +49,7 @@
#include "net/rime.h" #include "net/rime.h"
#include "net/sicslowpan.h" #include "net/sicslowpan.h"
#include "net/rime/route.h" #include "net/rime/route.h"
#include "net/rime/rime-udp.h"
#define DEBUG 0 #define DEBUG 0
#if DEBUG #if DEBUG
@ -105,6 +106,10 @@ PROCESS_THREAD(rimeroute_process, ev, data)
rimeroute_event = process_alloc_event(); rimeroute_event = process_alloc_event();
rime_init(rime_udp_init(NULL));
/* Cache routes for 10 minutes */
route_set_lifetime(600);
route_discovery_open(&route_discovery_conn, route_discovery_open(&route_discovery_conn,
CLOCK_SECOND * 10, CLOCK_SECOND * 10,
ROUTE_DISCOVERY_CHANNEL, ROUTE_DISCOVERY_CHANNEL,
@ -137,8 +142,7 @@ static int
activate(void) activate(void)
{ {
PRINTF("Rimeroute started\n"); PRINTF("Rimeroute started\n");
/* Cache routes for 10 minutes */
route_set_lifetime(600);
process_start(&rimeroute_process, NULL); process_start(&rimeroute_process, NULL);
return 0; return 0;

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)$Id: contiki-sky-main.c,v 1.58 2009/10/29 22:10:59 adamdunkels Exp $ * @(#)$Id: contiki-sky-main.c,v 1.59 2009/11/18 13:51:55 nifi Exp $
*/ */
#include <signal.h> #include <signal.h>
@ -61,7 +61,6 @@
#include "net/mac/sicslowmac.h" #include "net/mac/sicslowmac.h"
#if UIP_CONF_ROUTER #if UIP_CONF_ROUTER
#include "net/routing/rimeroute.h" #include "net/routing/rimeroute.h"
#include "net/rime/rime-udp.h"
#endif /* UIP_CONF_ROUTER*/ #endif /* UIP_CONF_ROUTER*/
#endif /* WITH_UIP6 */ #endif /* WITH_UIP6 */
@ -302,7 +301,6 @@ main(int argc, char **argv)
} }
#if UIP_CONF_ROUTER #if UIP_CONF_ROUTER
rime_init(rime_udp_init(NULL));
uip_router_register(&rimeroute); uip_router_register(&rimeroute);
#endif /* UIP_CONF_ROUTER */ #endif /* UIP_CONF_ROUTER */
#else /* WITH_UIP6 */ #else /* WITH_UIP6 */