Contiki 2.6

rpl-conf.h

00001 /*
00002  * Copyright (c) 2010, Swedish Institute of Computer Science.
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright
00011  *    notice, this list of conditions and the following disclaimer in the
00012  *    documentation and/or other materials provided with the distribution.
00013  * 3. Neither the name of the Institute nor the names of its contributors
00014  *    may be used to endorse or promote products derived from this software
00015  *    without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
00018  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
00021  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00022  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00023  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00024  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00025  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00026  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00027  * SUCH DAMAGE.
00028  *
00029  * This file is part of the Contiki operating system.
00030  *
00031  * \file
00032  *      Public configuration and API declarations for ContikiRPL.
00033  * \author
00034  *      Joakim Eriksson <joakime@sics.se> & Nicolas Tsiftes <nvt@sics.se>
00035  *
00036  */
00037 
00038 #ifndef RPL_CONF_H
00039 #define RPL_CONF_H
00040 
00041 /* Set to 1 to enable RPL statistics */
00042 #ifndef RPL_CONF_STATS
00043 #define RPL_CONF_STATS 0
00044 #endif /* RPL_CONF_STATS */
00045 
00046 /* 
00047  * Select routing metric supported at runtime. This must be a valid
00048  * DAG Metric Container Object Type (see below). Currently, we only 
00049  * support RPL_DAG_MC_ETX and RPL_DAG_MC_ENERGY.
00050  */
00051 #ifdef RPL_CONF_DAG_MC
00052 #define RPL_DAG_MC RPL_CONF_DAG_MC
00053 #else
00054 #define RPL_DAG_MC RPL_DAG_MC_ETX
00055 #endif /* RPL_CONF_DAG_MC */
00056 
00057 /*
00058  * The objective function used by RPL is configurable through the 
00059  * RPL_CONF_OF parameter. This should be defined to be the name of an 
00060  * rpl_of_t object linked into the system image, e.g., rpl_of0.
00061  */
00062 #ifdef RPL_CONF_OF
00063 #define RPL_OF RPL_CONF_OF
00064 #else
00065 /* ETX is the default objective function. */
00066 #define RPL_OF rpl_of_etx
00067 #endif /* RPL_CONF_OF */
00068 
00069 /* This value decides which DAG instance we should participate in by default. */
00070 #ifdef RPL_CONF_DEFAULT_INSTANCE
00071 #define RPL_DEFAULT_INSTANCE RPL_CONF_DEFAULT_INSTANCE
00072 #else
00073 #define RPL_DEFAULT_INSTANCE           0x1e
00074 #endif /* RPL_CONF_DEFAULT_INSTANCE */
00075 
00076 /*
00077  * This value decides if this node must stay as a leaf or not
00078  * as allowed by draft-ietf-roll-rpl-19#section-8.5
00079  */
00080 #ifdef RPL_CONF_LEAF_ONLY
00081 #define RPL_LEAF_ONLY RPL_CONF_LEAF_ONLY
00082 #else
00083 #define RPL_LEAF_ONLY 0
00084 #endif
00085 
00086 /*
00087  * Maximum of concurent RPL instances.
00088  */
00089 #ifdef RPL_CONF_MAX_INSTANCES
00090 #define RPL_MAX_INSTANCES     RPL_CONF_MAX_INSTANCES
00091 #else
00092 #define RPL_MAX_INSTANCES     1
00093 #endif /* RPL_CONF_MAX_INSTANCES */
00094 
00095 /*
00096  * Maximum number of DAGs within an instance.
00097  */
00098 #ifdef RPL_CONF_MAX_DAG_PER_INSTANCE
00099 #define RPL_MAX_DAG_PER_INSTANCE     RPL_CONF_MAX_DAG_PER_INSTANCE
00100 #else
00101 #define RPL_MAX_DAG_PER_INSTANCE     2
00102 #endif /* RPL_CONF_MAX_DAG_PER_INSTANCE */
00103 
00104 /*
00105  * 
00106  */
00107 #ifndef RPL_CONF_DAO_SPECIFY_DAG
00108   #if RPL_MAX_DAG_PER_INSTANCE > 1
00109     #define RPL_DAO_SPECIFY_DAG 1
00110   #else
00111     #define RPL_DAO_SPECIFY_DAG 0
00112   #endif /* RPL_MAX_DAG_PER_INSTANCE > 1 */
00113 #else
00114   #define RPL_DAO_SPECIFY_DAG RPL_CONF_DAO_SPECIFY_DAG
00115 #endif /* RPL_CONF_DAO_SPECIFY_DAG */
00116 
00117 /*
00118  * The DIO interval (n) represents 2^n ms.
00119  *
00120  * According to the specification, the default value is 3 which
00121  * means 8 milliseconds. That is far too low when using duty cycling
00122  * with wake-up intervals that are typically hundreds of milliseconds.
00123  * ContikiRPL thus sets the default to 2^12 ms = 4.096 s.
00124  */
00125 #ifdef RPL_CONF_DIO_INTERVAL_MIN
00126 #define RPL_DIO_INTERVAL_MIN        RPL_CONF_DIO_INTERVAL_MIN
00127 #else
00128 #define RPL_DIO_INTERVAL_MIN        12
00129 #endif
00130 
00131 /*
00132  * Maximum amount of timer doublings.
00133  *
00134  * The maximum interval will by default be 2^(12+8) ms = 1048.576 s.
00135  * RFC 6550 suggests a default value of 20, which of course would be
00136  * unsuitable when we start with a minimum interval of 2^12.
00137  */
00138 #ifdef RPL_CONF_DIO_INTERVAL_DOUBLINGS
00139 #define RPL_DIO_INTERVAL_DOUBLINGS  RPL_CONF_DIO_INTERVAL_DOUBLINGS
00140 #else
00141 #define RPL_DIO_INTERVAL_DOUBLINGS  8
00142 #endif
00143 
00144 /*
00145  * DIO redundancy. To learn more about this, see RFC 6206.
00146  *
00147  * RFC 6550 suggests a default value of 10. It is unclear what the basis
00148  * of this suggestion is. Network operators might attain more efficient
00149  * operation by tuning this parameter for specific deployments.
00150  */
00151 #ifdef RPL_CONF_DIO_REDUNDANCY
00152 #define RPL_DIO_REDUNDANCY          RPL_CONF_DIO_REDUNDANCY
00153 #else
00154 #define RPL_DIO_REDUNDANCY          10
00155 #endif
00156 
00157 #endif /* RPL_CONF_H */