Simplified configuration of RPL non-storing mode

This commit is contained in:
Simon Duquennoy 2016-04-25 14:51:25 +02:00
parent f26ea34c61
commit 1a7133bbf2
7 changed files with 85 additions and 49 deletions

View file

@ -148,12 +148,25 @@
#endif /* NBR_TABLE_FIND_REMOVABLE */
#endif /* UIP_CONF_IPV6_RPL */
/* RPL_CONF_MOP specifies the RPL mode of operation that will be
* advertised by the RPL root. Possible values: RPL_MOP_NO_DOWNWARD_ROUTES,
* RPL_MOP_NON_STORING, RPL_MOP_STORING_NO_MULTICAST, RPL_MOP_STORING_MULTICAST */
#ifndef RPL_CONF_MOP
#define RPL_CONF_MOP RPL_MOP_STORING_NO_MULTICAST
#endif /* RPL_CONF_MOP */
/* UIP_CONF_MAX_ROUTES specifies the maximum number of routes that each
node will be able to handle. */
#ifndef UIP_CONF_MAX_ROUTES
#define UIP_CONF_MAX_ROUTES 20
#endif /* UIP_CONF_MAX_ROUTES */
/* RPL_NS_CONF_LINK_NUM specifies the maximum number of links a RPL root
* will maintain in non-storing mode. */
#ifndef RPL_NS_CONF_LINK_NUM
#define RPL_NS_CONF_LINK_NUM 20
#endif /* RPL_NS_CONF_LINK_NUM */
/* UIP_CONF_UDP specifies if UDP support should be included or
not. Disabling UDP saves memory but breaks a lot of stuff. */
#ifndef UIP_CONF_UDP

View file

@ -235,27 +235,6 @@
#define RPL_PREFERENCE 0
#endif
/*
* Embed support for storing mode
*/
#ifdef RPL_CONF_WITH_STORING
#define RPL_WITH_STORING RPL_CONF_WITH_STORING
#else /* RPL_CONF_WITH_STORING */
#define RPL_WITH_STORING 1
#endif /* RPL_CONF_WITH_STORING */
/*
* Embed support for non-storing mode
*/
#ifdef RPL_CONF_WITH_NON_STORING
#define RPL_WITH_NON_STORING RPL_CONF_WITH_NON_STORING
#else /* RPL_CONF_WITH_NON_STORING */
#define RPL_WITH_NON_STORING 0
#endif /* RPL_CONF_WITH_NON_STORING */
#define RPL_IS_STORING(instance) (RPL_WITH_STORING && ((instance) != NULL) && ((instance)->mop > RPL_MOP_NON_STORING))
#define RPL_IS_NON_STORING(instance) (RPL_WITH_NON_STORING && ((instance) != NULL) && ((instance)->mop == RPL_MOP_NON_STORING))
/*
* RPL DAO ACK support. When enabled, DAO ACK will be sent and requested.
* This will also enable retransmission of DAO when no ack is received.

View file

@ -44,6 +44,8 @@
#include "sys/clock.h"
#include "sys/ctimer.h"
#include "net/ipv6/uip-ds6.h"
#include "net/ipv6/uip-ds6-route.h"
#include "net/rpl/rpl-ns.h"
#include "net/ipv6/multicast/uip-mcast6.h"
/*---------------------------------------------------------------------------*/
@ -197,6 +199,7 @@
#define RPL_MOP_STORING_NO_MULTICAST 2
#define RPL_MOP_STORING_MULTICAST 3
/* RPL Mode of operation */
#ifdef RPL_CONF_MOP
#define RPL_MOP_DEFAULT RPL_CONF_MOP
#else /* RPL_CONF_MOP */
@ -207,6 +210,43 @@
#endif /* UIP_IPV6_MULTICAST_RPL */
#endif /* RPL_CONF_MOP */
/*
* Embed support for storing mode
*/
#ifdef RPL_CONF_WITH_STORING
#define RPL_WITH_STORING RPL_CONF_WITH_STORING
#else /* RPL_CONF_WITH_STORING */
/* By default: embed support for non-storing if and only if the configured MOP is not non-storing */
#define RPL_WITH_STORING (RPL_MOP_DEFAULT != RPL_MOP_NON_STORING)
#endif /* RPL_CONF_WITH_STORING */
/*
* Embed support for non-storing mode
*/
#ifdef RPL_CONF_WITH_NON_STORING
#define RPL_WITH_NON_STORING RPL_CONF_WITH_NON_STORING
#else /* RPL_CONF_WITH_NON_STORING */
/* By default: embed support for non-storing if and only if the configured MOP is non-storing */
#define RPL_WITH_NON_STORING (RPL_MOP_DEFAULT == RPL_MOP_NON_STORING)
#endif /* RPL_CONF_WITH_NON_STORING */
#if RPL_WITH_STORING && (UIP_DS6_ROUTE_NB == 0)
#error "RPL with storing mode included but #routes == 0. Set UIP_CONF_MAX_ROUTES accordingly."
#if !RPL_WITH_NON_STORING && (RPL_NS_LINK_NUM > 0)
#error "You might also want to set RPL_NS_CONF_LINK_NUM to 0."
#endif
#endif
#if RPL_WITH_NON_STORING && (RPL_NS_LINK_NUM == 0)
#error "RPL with non-storing mode included but #links == 0. Set RPL_NS_CONF_LINK_NUM accordingly."
#if !RPL_WITH_STORING && (UIP_DS6_ROUTE_NB > 0)
#error "You might also want to set UIP_CONF_MAX_ROUTES to 0."
#endif
#endif
#define RPL_IS_STORING(instance) (RPL_WITH_STORING && ((instance) != NULL) && ((instance)->mop > RPL_MOP_NON_STORING))
#define RPL_IS_NON_STORING(instance) (RPL_WITH_NON_STORING && ((instance) != NULL) && ((instance)->mop == RPL_MOP_NON_STORING))
/* Emit a pre-processor error if the user configured multicast with bad MOP */
#if RPL_CONF_MULTICAST && (RPL_MOP_DEFAULT != RPL_MOP_STORING_MULTICAST)
#error "RPL Multicast requires RPL_MOP_DEFAULT==3. Check contiki-conf.h"

View file

@ -31,16 +31,18 @@
#ifndef PROJECT_ROUTER_CONF_H_
#define PROJECT_ROUTER_CONF_H_
#ifndef RPL_CONF_WITH_NON_STORING
#define RPL_CONF_WITH_NON_STORING 0 /* Set this to run with non-storing mode */
#endif /* RPL_CONF_WITH_NON_STORING */
#ifndef WITH_NON_STORING
#define WITH_NON_STORING 0 /* Set this to run with non-storing mode */
#endif /* WITH_NON_STORING */
#if RPL_CONF_WITH_NON_STORING
#undef RPL_CONF_WITH_STORING
#define RPL_CONF_WITH_STORING 0
#if WITH_NON_STORING
#undef RPL_NS_CONF_LINK_NUM
#define RPL_NS_CONF_LINK_NUM 40 /* Number of links maintained at the root */
#undef UIP_CONF_MAX_ROUTES
#define UIP_CONF_MAX_ROUTES 0 /* No need for routes */
#undef RPL_CONF_MOP
#define RPL_CONF_MOP RPL_MOP_NON_STORING
#endif /* RPL_CONF_WITH_NON_STORING */
#define RPL_CONF_MOP RPL_MOP_NON_STORING /* Mode of operation*/
#endif /* WITH_NON_STORING */
#ifndef UIP_FALLBACK_INTERFACE
#define UIP_FALLBACK_INTERFACE rpl_interface

View file

@ -30,6 +30,10 @@
#ifndef PROJECT_CONF_H_
#define PROJECT_CONF_H_
#ifndef WITH_NON_STORING
#define WITH_NON_STORING 0 /* Set this to run with non-storing mode */
#endif /* WITH_NON_STORING */
#undef NBR_TABLE_CONF_MAX_NEIGHBORS
#undef UIP_CONF_MAX_ROUTES
@ -63,15 +67,13 @@
#undef SICSLOWPAN_CONF_FRAG
#define SICSLOWPAN_CONF_FRAG 0
#ifndef RPL_CONF_WITH_NON_STORING
#define RPL_CONF_WITH_NON_STORING 0 /* Set this to run with non-storing mode */
#endif /* RPL_CONF_WITH_NON_STORING */
#if RPL_CONF_WITH_NON_STORING
#undef RPL_CONF_WITH_STORING
#define RPL_CONF_WITH_STORING 0
#if WITH_NON_STORING
#undef RPL_NS_CONF_LINK_NUM
#define RPL_NS_CONF_LINK_NUM 40 /* Number of links maintained at the root. Can be set to 0 at non-root nodes. */
#undef UIP_CONF_MAX_ROUTES
#define UIP_CONF_MAX_ROUTES 0 /* No need for routes */
#undef RPL_CONF_MOP
#define RPL_CONF_MOP RPL_MOP_NON_STORING
#endif /* RPL_CONF_WITH_NON_STORING */
#define RPL_CONF_MOP RPL_MOP_NON_STORING /* Mode of operation*/
#endif /* WITH_NON_STORING */
#endif /* PROJECT_CONF_H_ */

View file

@ -30,6 +30,10 @@
#ifndef PROJECT_CONF_H_
#define PROJECT_CONF_H_
#ifndef WITH_NON_STORING
#define WITH_NON_STORING 0 /* Set this to run with non-storing mode */
#endif /* WITH_NON_STORING */
#undef NBR_TABLE_CONF_MAX_NEIGHBORS
#undef UIP_CONF_MAX_ROUTES
@ -60,11 +64,13 @@
#define RPL_CONF_WITH_NON_STORING 0 /* Set this to run with non-storing mode */
#endif /* RPL_CONF_WITH_NON_STORING */
#if RPL_CONF_WITH_NON_STORING
#undef RPL_CONF_WITH_STORING
#define RPL_CONF_WITH_STORING 0
#if WITH_NON_STORING
#undef RPL_NS_CONF_LINK_NUM
#define RPL_NS_CONF_LINK_NUM 40 /* Number of links maintained at the root. Can be set to 0 at non-root nodes. */
#undef UIP_CONF_MAX_ROUTES
#define UIP_CONF_MAX_ROUTES 0 /* No need for routes */
#undef RPL_CONF_MOP
#define RPL_CONF_MOP RPL_MOP_NON_STORING
#endif /* RPL_CONF_WITH_NON_STORING */
#define RPL_CONF_MOP RPL_MOP_NON_STORING /* Mode of operation*/
#endif /* WITH_NON_STORING */
#endif

View file

@ -28,12 +28,6 @@
*/
#define TCPIP_CONF_ANNOTATE_TRANSMISSIONS 1
#undef RPL_CONF_WITH_NON_STORING
#define RPL_CONF_WITH_NON_STORING 1
#undef RPL_CONF_WITH_STORING
#define RPL_CONF_WITH_STORING 0
#undef RPL_CONF_MOP
#define RPL_CONF_MOP RPL_MOP_NON_STORING