Separated configuration into a new file called rpl-conf.h. Improved the documentation.

This commit is contained in:
nvt 2012-04-22 00:17:10 +02:00
parent 845d684c66
commit e94718f95c
3 changed files with 164 additions and 86 deletions

157
core/net/rpl/rpl-conf.h Normal file
View file

@ -0,0 +1,157 @@
/*
* Copyright (c) 2010, Swedish Institute of Computer Science.
* 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.
*
* \file
* Public configuration and API declarations for ContikiRPL.
* \author
* Joakim Eriksson <joakime@sics.se> & Nicolas Tsiftes <nvt@sics.se>
*
*/
#ifndef RPL_CONF_H
#define RPL_CONF_H
/* Set to 1 to enable RPL statistics */
#ifndef RPL_CONF_STATS
#define RPL_CONF_STATS 0
#endif /* RPL_CONF_STATS */
/*
* Select routing metric supported at runtime. This must be a valid
* DAG Metric Container Object Type (see below). Currently, we only
* support RPL_DAG_MC_ETX and RPL_DAG_MC_ENERGY.
*/
#ifdef RPL_CONF_DAG_MC
#define RPL_DAG_MC RPL_CONF_DAG_MC
#else
#define RPL_DAG_MC RPL_DAG_MC_ETX
#endif /* RPL_CONF_DAG_MC */
/*
* The objective function used by RPL is configurable through the
* RPL_CONF_OF parameter. This should be defined to be the name of an
* rpl_of_t object linked into the system image, e.g., rpl_of0.
*/
#ifdef RPL_CONF_OF
#define RPL_OF RPL_CONF_OF
#else
/* ETX is the default objective function. */
#define RPL_OF rpl_of_etx
#endif /* RPL_CONF_OF */
/* This value decides which DAG instance we should participate in by default. */
#ifdef RPL_CONF_DEFAULT_INSTANCE
#define RPL_DEFAULT_INSTANCE RPL_CONF_DEFAULT_INSTANCE
#else
#define RPL_DEFAULT_INSTANCE 0x1e
#endif /* RPL_CONF_DEFAULT_INSTANCE */
/*
* This value decides if this node must stay as a leaf or not
* as allowed by draft-ietf-roll-rpl-19#section-8.5
*/
#ifdef RPL_CONF_LEAF_ONLY
#define RPL_LEAF_ONLY RPL_CONF_LEAF_ONLY
#else
#define RPL_LEAF_ONLY 0
#endif
/*
* Maximum of concurent RPL instances.
*/
#ifdef RPL_CONF_MAX_INSTANCES
#define RPL_MAX_INSTANCES RPL_CONF_MAX_INSTANCES
#else
#define RPL_MAX_INSTANCES 1
#endif /* RPL_CONF_MAX_INSTANCES */
/*
* Maximum number of DAGs within an instance.
*/
#ifdef RPL_CONF_MAX_DAG_PER_INSTANCE
#define RPL_MAX_DAG_PER_INSTANCE RPL_CONF_MAX_DAG_PER_INSTANCE
#else
#define RPL_MAX_DAG_PER_INSTANCE 2
#endif /* RPL_CONF_MAX_DAG_PER_INSTANCE */
/*
*
*/
#ifndef RPL_CONF_DAO_SPECIFY_DAG
#if RPL_MAX_DAG_PER_INSTANCE > 1
#define RPL_DAO_SPECIFY_DAG 1
#else
#define RPL_DAO_SPECIFY_DAG 0
#endif /* RPL_MAX_DAG_PER_INSTANCE > 1 */
#else
#define RPL_DAO_SPECIFY_DAG RPL_CONF_DAO_SPECIFY_DAG
#endif /* RPL_CONF_DAO_SPECIFY_DAG */
/*
* The DIO interval (n) represents 2^n ms.
*
* According to the specification, the default value is 3 which
* means 8 milliseconds. That is far too low when using duty cycling
* with wake-up intervals that are typically hundreds of milliseconds.
* ContikiRPL thus sets the default to 2^12 ms = 4.096 s.
*/
#ifdef RPL_CONF_DIO_INTERVAL_MIN
#define RPL_DIO_INTERVAL_MIN RPL_CONF_DIO_INTERVAL_MIN
#else
#define RPL_DIO_INTERVAL_MIN 12
#endif
/*
* Maximum amount of timer doublings.
*
* The maximum interval will by default be 2^(12+8) ms = 1048.576 s.
* RFC 6550 suggests a default value of 20, which of course would be
* unsuitable when we start with a minimum interval of 2^12.
*/
#ifdef RPL_CONF_DIO_INTERVAL_DOUBLINGS
#define RPL_DIO_INTERVAL_DOUBLINGS RPL_CONF_DIO_INTERVAL_DOUBLINGS
#else
#define RPL_DIO_INTERVAL_DOUBLINGS 8
#endif
/*
* DIO redundancy. To learn more about this, see RFC 6206.
*
* RFC 6550 suggests a default value of 10. It is unclear what the basis
* of this suggestion is. Network operators might attain more efficient
* operation by tuning this parameter for specific deployments.
*/
#ifdef RPL_CONF_DIO_REDUNDANCY
#define RPL_DIO_REDUNDANCY RPL_CONF_DIO_REDUNDANCY
#else
#define RPL_DIO_REDUNDANCY 10
#endif
#endif /* RPL_CONF_H */

View file

@ -28,22 +28,15 @@
*
* This file is part of the Contiki operating system.
*
* Author: Joakim Eriksson, Nicolas Tsiftes
* \file
* Private declarations for ContikiRPL.
* \author
* Joakim Eriksson <joakime@sics.se>, Nicolas Tsiftes <nvt@sics.se>
*/
#ifndef RPL_PRIVATE_H
#define RPL_PRIVATE_H
/*
* ContikiRPL - an implementation of the routing protocol for low power and
* lossy networks. See: draft-ietf-roll-rpl-17.
*
* --
* The DIOs handle prefix information option for setting global IP addresses
* on the nodes, but the current handling is not awaiting the join of the DAG
* so it does not currently support multiple DAGs.
*/
#include "net/rpl/rpl.h"
#include "lib/list.h"

View file

@ -29,8 +29,7 @@
* This file is part of the Contiki operating system.
*
* \file
* ContikiRPL - an implementation of the routing protocol for low
* power and lossy networks. See: draft-ietf-roll-rpl-17.
* Public API declarations for ContikiRPL.
* \author
* Joakim Eriksson <joakime@sics.se> & Nicolas Tsiftes <nvt@sics.se>
*
@ -39,84 +38,13 @@
#ifndef RPL_H
#define RPL_H
#include "rpl-conf.h"
#include "lib/list.h"
#include "net/uip.h"
#include "net/uip-ds6.h"
#include "sys/ctimer.h"
/* set to 1 for some statistics on trickle / DIO */
#ifndef RPL_CONF_STATS
#define RPL_CONF_STATS 0
#endif /* RPL_CONF_STATS */
/*
* Select routing metric supported at runtime. This must be a valid
* DAG Metric Container Object Type (see below). Currently, we only
* support RPL_DAG_MC_ETX and RPL_DAG_MC_ENERGY.
*/
#ifdef RPL_CONF_DAG_MC
#define RPL_DAG_MC RPL_CONF_DAG_MC
#else
#define RPL_DAG_MC RPL_DAG_MC_ETX
#endif /* RPL_CONF_DAG_MC */
/*
* The objective function used by RPL is configurable through the
* RPL_CONF_OF parameter. This should be defined to be the name of an
* rpl_of_t object linked into the system image, e.g., rpl_of0.
*/
#ifdef RPL_CONF_OF
#define RPL_OF RPL_CONF_OF
#else
/* ETX is the default objective function. */
#define RPL_OF rpl_of_etx
#endif /* RPL_CONF_OF */
/* This value decides which DAG instance we should participate in by default. */
#define RPL_DEFAULT_INSTANCE 0x1e
/*
* This value decides if this node must stay as a leaf or not
* as allowed by draft-ietf-roll-rpl-19#section-8.5
*/
#ifdef RPL_CONF_LEAF_ONLY
#define RPL_LEAF_ONLY RPL_CONF_LEAF_ONLY
#else
#define RPL_LEAF_ONLY 0
#endif
/*
* Maximum of concurent rpl-instances
*/
#ifndef RPL_CONF_MAX_INSTANCES
#define RPL_MAX_INSTANCES 1
#else
#define RPL_MAX_INSTANCES RPL_CONF_MAX_INSTANCES
#endif /* !RPL_CONF_MAX_INSTANCES */
/*
* Maximum of concurent dodag inside an instance
*/
#ifndef RPL_CONF_MAX_DAG_PER_INSTANCE
#define RPL_MAX_DAG_PER_INSTANCE 2
#else
#define RPL_MAX_DAG_PER_INSTANCE RPL_CONF_MAX_DAG_PER_INSTANCE
#endif /* !RPL_CONF_MAX_DAG_PER_INSTANCE */
/*
*
*/
#ifndef RPL_CONF_DAO_SPECIFY_DAG
#if RPL_MAX_DAG_PER_INSTANCE > 1
#define RPL_DAO_SPECIFY_DAG 1
#else /* RPL_MAX_DAG_PER_INSTANCE > 1*/
#define RPL_DAO_SPECIFY_DAG 0
#endif /* RPL_MAX_DAG_PER_INSTANCE > 1 */
#else /* RPL_CONF_DAO_SPECIFY_DAG */
#define RPL_DAO_SPECIFY_DAG RPL_CONF_DAO_SPECIFY_DAG
#endif /* RPL_CONF_DAO_SPECIFY_DAG */
/*---------------------------------------------------------------------------*/
/* The amount of parents that this node has in a particular DAG. */
#define RPL_PARENT_COUNT(dag) list_length((dag)->parents)