Added NETSTACK_ROUTING for routing protocol selection. Only used for init() so far.
This commit is contained in:
parent
7ddee2c66a
commit
4c9f62ebe4
@ -153,13 +153,17 @@ endif
|
||||
ifeq ($(MAKE_ROUTING),MAKE_ROUTING_RPL_CLASSIC)
|
||||
CFLAGS += -DUIP_CONF_IPV6_RPL=1
|
||||
CFLAGS += -DUIP_CONF_IPV6_RPL_CLASSIC=1
|
||||
CFLAGS += -DNETSTACK_ROUTING=rpl_classic_driver
|
||||
MODULES += os/net/routing/rpl-classic
|
||||
else ifeq ($(MAKE_ROUTING),MAKE_ROUTING_RPL_LITE)
|
||||
CFLAGS += -DUIP_CONF_IPV6_RPL=1
|
||||
CFLAGS += -DUIP_CONF_IPV6_RPL_LITE=1
|
||||
CFLAGS += -DNETSTACK_ROUTING=rpl_lite_driver
|
||||
MODULES += os/net/routing/rpl-lite
|
||||
else
|
||||
CFLAGS += -DUIP_CONF_IPV6_RPL=0
|
||||
CFLAGS += -DNETSTACK_ROUTING=nullrouting_driver
|
||||
MODULES += os/net/routing/nullrouting
|
||||
endif
|
||||
|
||||
MODULEDIRS = $(MODULES_REL) ${wildcard ${addprefix $(CONTIKI)/, $(MODULES)}}
|
||||
|
@ -847,10 +847,8 @@ PROCESS_THREAD(tcpip_process, ev, data)
|
||||
#ifdef UIP_FALLBACK_INTERFACE
|
||||
UIP_FALLBACK_INTERFACE.init();
|
||||
#endif
|
||||
/* initialize RPL if configured for using RPL */
|
||||
#if UIP_CONF_IPV6_RPL
|
||||
rpl_init();
|
||||
#endif /* UIP_CONF_IPV6_RPL */
|
||||
/* Initialize routing protocol */
|
||||
NETSTACK_ROUTING.init();
|
||||
|
||||
while(1) {
|
||||
PROCESS_YIELD();
|
||||
|
@ -110,6 +110,7 @@ struct network_driver {
|
||||
|
||||
};
|
||||
|
||||
extern const struct routing_driver NETSTACK_ROUTING;
|
||||
extern const struct network_driver NETSTACK_NETWORK;
|
||||
extern const struct mac_driver NETSTACK_MAC;
|
||||
extern const struct radio_driver NETSTACK_RADIO;
|
||||
|
56
os/net/routing/nullrouting/nullrouting.c
Normal file
56
os/net/routing/nullrouting/nullrouting.c
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) 2017, RISE SICS.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \addtogroup null-routing
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* A routing protocol that does nothing
|
||||
*
|
||||
* \author Simon Duquennoy <simon.duquennoy@ri.se>
|
||||
*/
|
||||
|
||||
#include "net/routing/routing.h"
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
init(void)
|
||||
{
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
const struct routing_driver nullrouting_driver = {
|
||||
"Null Routing",
|
||||
init,
|
||||
};
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/** @}*/
|
@ -41,12 +41,9 @@
|
||||
#define ROUTING_H_
|
||||
|
||||
#include "contiki.h"
|
||||
|
||||
#include "rpl.h"
|
||||
#include "rpl-dag-root.h"
|
||||
#if UIP_CONF_IPV6_RPL_LITE == 0
|
||||
#include "rpl-private.h"
|
||||
#endif /* UIP_CONF_IPV6_RPL_LITE == 0 */
|
||||
#include "net/ipv6/uip.h"
|
||||
#include "net/ipv6/uip-ds6-route.h"
|
||||
#include "net/linkaddr.h"
|
||||
|
||||
/**
|
||||
* The structure of a routing protocol driver.
|
||||
|
@ -46,8 +46,10 @@
|
||||
#include "net/ipv6/tcpip.h"
|
||||
#include "net/ipv6/uip-ds6.h"
|
||||
#include "net/ipv6/uip-icmp6.h"
|
||||
#include "net/routing/routing.h"
|
||||
#include "net/routing/rpl-classic/rpl-private.h"
|
||||
#include "net/routing/rpl-classic/rpl-ns.h"
|
||||
#include "net/routing/rpl-classic/rpl-dag-root.h"
|
||||
#include "net/ipv6/multicast/uip-mcast6.h"
|
||||
|
||||
#define DEBUG DEBUG_NONE
|
||||
@ -327,7 +329,7 @@ rpl_purge_dags(void)
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
static void
|
||||
rpl_init(void)
|
||||
{
|
||||
uip_ipaddr_t rplmaddr;
|
||||
@ -351,5 +353,10 @@ rpl_init(void)
|
||||
#endif /* RPL_WITH_NON_STORING */
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
const struct routing_driver rpl_classic_driver = {
|
||||
"RPL Classic",
|
||||
rpl_init,
|
||||
};
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/** @}*/
|
||||
|
@ -266,7 +266,6 @@ struct rpl_instance {
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Public RPL functions. */
|
||||
void rpl_init(void);
|
||||
void uip_rpl_input(void);
|
||||
rpl_dag_t *rpl_set_root(uint8_t instance_id, uip_ipaddr_t *dag_id);
|
||||
int rpl_set_prefix(rpl_dag_t *dag, uip_ipaddr_t *prefix, unsigned len);
|
||||
|
@ -42,6 +42,7 @@
|
||||
*/
|
||||
|
||||
#include "net/routing/rpl-lite/rpl.h"
|
||||
#include "net/routing/routing.h"
|
||||
|
||||
/* Log configuration */
|
||||
#include "sys/log.h"
|
||||
@ -175,7 +176,7 @@ rpl_set_prefix(rpl_prefix_t *prefix)
|
||||
return 0;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
static void
|
||||
rpl_init(void)
|
||||
{
|
||||
LOG_INFO("initializing\n");
|
||||
@ -192,5 +193,10 @@ rpl_init(void)
|
||||
rpl_ns_init();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
const struct routing_driver rpl_lite_driver = {
|
||||
"RPL Lite",
|
||||
rpl_init,
|
||||
};
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/** @}*/
|
||||
|
@ -127,11 +127,6 @@ int rpl_is_reachable(void);
|
||||
*/
|
||||
int rpl_lollipop_greater_than(int a, int b);
|
||||
|
||||
/**
|
||||
* Initialize RPL main module
|
||||
*/
|
||||
void rpl_init(void);
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* RPL_H */
|
||||
|
@ -82,7 +82,7 @@ border_router_set_mac(const uint8_t *data)
|
||||
add them back again - a bit messy... ?*/
|
||||
PROCESS_CONTEXT_BEGIN(&tcpip_process);
|
||||
uip_ds6_init();
|
||||
rpl_init();
|
||||
NETSTACK_ROUTING.init();
|
||||
PROCESS_CONTEXT_END(&tcpip_process);
|
||||
|
||||
mac_set = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user