constants.hh

Go to the documentation of this file.
00001 // Copyright (C) 2003-2006 Laboratoire de Recherche en Informatique
00002 
00003 // This file is part of Qolyester.
00004 
00005 // Qolyester is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU General Public License
00007 // as published by the Free Software Foundation; either version 2
00008 // of the License, or (at your option) any later version.
00009 
00010 // Qolyester is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018 // Boston, MA  02110-1301, USA.
00019 
00020 #ifndef QOLYESTER_CST_CONSTANTS_HH
00021 # define QOLYESTER_CST_CONSTANTS_HH 1
00022 
00023 # include "config.hh"
00024 # include "utl/timeval.hh"
00025 
00026 namespace olsr {
00027 
00028   namespace cst {
00029 
00030 # define OLSR_PORT_NUMBER       698
00031 # define C_CONSTANT             .0625f
00032 
00033 // Protocol constant for rtnetlink, should be standardized
00034 # define RTPROT_OLSR            15
00035 
00036 // MPR Willingness
00037 # define WILL_NEVER     0
00038 # define WILL_LOW       1
00039 # define WILL_DEFAULT   3
00040 # define WILL_HIGH      6
00041 # define WILL_ALWAYS    7
00042 
00043 // Link status
00044 # define UNSPEC_LINK    0
00045 # define ASYM_LINK      1
00046 # define SYM_LINK       2
00047 # define LOST_LINK      3
00048 # define LOWEST_LINK    UNSPEC_LINK
00049 # define HIGHEST_LINK   LOST_LINK
00050 
00051 // Neighbor status
00052 # define NOT_NEIGH      0
00053 # define SYM_NEIGH      1
00054 # define MPR_NEIGH      2
00055 # define LOWEST_NEIGH   NOT_NEIGH
00056 # define HIGHEST_NEIGH  MPR_NEIGH
00057 
00058 // Message types
00059 # define HELLO_MESSAGE  1
00060 # define TC_MESSAGE     2
00061 # define MID_MESSAGE    3
00062 # define HNA_MESSAGE    4
00063 
00064 # ifdef QOLYESTER_ENABLE_LINKHYS
00065 // Link hysteresis
00066 #  ifdef QOLYESTER_HYST_THRESHOLD_HIGH
00067     const float def_hyst_threshold_high = QOLYESTER_HYST_THRESHOLD_HIGH;
00068 #  else
00069     const float def_hyst_threshold_high = 0.8;
00070 #  endif
00071 
00072 #  ifdef QOLYESTER_HYST_THRESHOLD_LOW
00073     const float def_hyst_threshold_low  = QOLYESTER_HYST_THRESHOLD_LOW;
00074 #  else
00075     const float def_hyst_threshold_low  = 0.3;
00076 #  endif
00077 
00078 #  ifdef QOLYESTER_HYST_SCALING
00079     const float def_hyst_scaling        = QOLYESTER_HYST_SCALING;
00080 #  else
00081     const float def_hyst_scaling        = 0.5;
00082 #  endif
00083 
00084 # endif
00085 
00086 // Virtual interface
00087 # define VIRTUAL_MTU            1500
00088 # define VIRTUAL_SOCKNAME       "/tmp/qolsrd.switch"
00089 
00090     // Constants definitions.  See the OLSR draft for more
00091     // information.
00092 
00093 # ifdef QOLYESTER_HELLO_INTERVAL
00094     const timeval_t     def_hello_interval   = QOLYESTER_HELLO_INTERVAL;
00095 # else
00096     const timeval_t     def_hello_interval   = 2000;
00097 # endif
00098 
00099 # ifdef QOLYESTER_REFRESH_INTERVAL
00100     const timeval_t     def_refresh_interval = QOLYESTER_REFRESH_INTERVAL;
00101 # else
00102     const timeval_t     def_refresh_interval = 2000;
00103 # endif
00104 
00105 # ifdef QOLYESTER_TC_INTERVAL
00106     const timeval_t     def_tc_interval      = QOLYESTER_TC_INTERVAL;
00107 # else
00108     const timeval_t     def_tc_interval      = 5000;
00109 # endif
00110 
00111 # ifdef QOLYESTER_HELLO_GRACE
00112     const float         def_hello_grace      = QOLYESTER_HELLO_GRACE;
00113 # else
00114     const float         def_hello_grace      = 1.2;
00115 # endif
00116 
00117 # ifdef QOLYESTER_ENABLE_MID
00118 #  ifdef QOLYESTER_MID_INTERVAL
00119     const timeval_t     def_mid_interval     = QOLYESTER_MID_INTERVAL;
00120 #  else
00121     const timeval_t     def_mid_interval     = def_tc_interval;
00122 #  endif
00123 
00124 #  ifdef QOLYESTER_MID_HOLD_TIME
00125     const timeval_t     def_mid_hold_time    = QOLYESTER_MID_HOLD_TIME;
00126 #  else
00127     const timeval_t     def_mid_hold_time    = def_mid_interval * 3;
00128 #  endif
00129 # endif
00130 
00131 # ifdef QOLYESTER_ENABLE_HNA
00132 #  ifdef QOLYESTER_HNA_INTERVAL
00133     const timeval_t     def_hna_interval     = QOLYESTER_HNA_INTERVAL;
00134 #  else
00135     const timeval_t     def_hna_interval     = def_tc_interval;
00136 #  endif
00137 
00138 #  ifdef QOLYESTER_HNA_HOLD_TIME
00139     const timeval_t     def_hna_hold_time    = QOLYESTER_HNA_HOLD_TIME;
00140 #  else
00141     const timeval_t     def_hna_hold_time    = def_hna_interval * 3;
00142 #  endif
00143 # endif
00144 
00145 # ifdef QOLYESTER_NEIGHB_HOLD_TIME
00146     const timeval_t     def_neighb_hold_time = QOLYESTER_NEIGHB_HOLD_TIME;
00147 # else
00148     const timeval_t     def_neighb_hold_time = def_refresh_interval * 3;
00149 # endif
00150 
00151 # ifdef QOLYESTER_TOP_HOLD_TIME
00152     const timeval_t     def_top_hold_time    = QOLYESTER_TOP_HOLD_TIME;
00153 # else
00154     const timeval_t     def_top_hold_time    = def_tc_interval * 3;
00155 # endif
00156 
00157 # ifdef QOLYESTER_DUP_HOLD_TIME
00158     const timeval_t     def_dup_hold_time    = QOLYESTER_DUP_HOLD_TIME;
00159 # else
00160     const timeval_t     def_dup_hold_time    = 30000;
00161 # endif
00162 
00163 # ifdef QOLYESTER_MAX_JITTER_TIME
00164     const timeval_t     def_maxjitter        = QOLYESTER_MAX_JITTER_TIME;
00165 # else
00166     const timeval_t     def_maxjitter        = def_hello_interval / 4;
00167 # endif
00168 
00169 # ifdef QOLYESTER_DUMP_INTERVAL
00170     const timeval_t     def_dump_interval    = QOLYESTER_DUMP_INTERVAL;
00171 # else
00172     const timeval_t     def_dump_interval    = 1000;
00173 # endif
00174 
00175 # ifdef QOLYESTER_QUEUE_SIZE
00176     const unsigned      def_queue_size       = QOLYESTER_QUEUE_SIZE;
00177 # else
00178     const unsigned      def_queue_size       = 10;
00179 # endif
00180 
00181   } // namespace cst
00182 
00183 # ifdef QOLYESTER_ENABLE_TCRED
00184   enum TCRedundancy {
00185     mprselset        = 0,
00186     mprselset_mprset = 1,
00187     wholeset         = 2
00188   };
00189 
00190   const TCRedundancy    def_tc_redundancy = QOLYESTER_TC_DEFAULT_REDUNDANCY;
00191 # endif
00192 
00193   const unsigned        def_willingness = QOLYESTER_DEFAULT_WILLINGNESS;
00194 
00195 # ifdef QOLYESTER_ENABLE_MPRRED
00196   const unsigned        def_mprcoverage = QOLYESTER_MPR_DEFAULT_COVERAGE;
00197 # endif
00198 
00199 } // namespace olsr
00200 
00201 # include "cst/params.hh"
00202 
00203 #endif // ! QOLYESTER_CST_CONSTANTS_HH

Generated on Mon Sep 10 17:02:11 2007 for Qolyester daemon by  doxygen 1.5.1