akmhoque | 3d06e79 | 2014-05-27 16:23:20 -0500 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Nick Gordon | c6a8522 | 2017-01-03 16:54:34 -0600 | [diff] [blame] | 3 | * Copyright (c) 2014-2017, The University of Memphis, |
Vince Lehman | c2e51f6 | 2015-01-20 15:03:11 -0600 | [diff] [blame] | 4 | * Regents of the University of California, |
| 5 | * Arizona Board of Regents. |
akmhoque | 3d06e79 | 2014-05-27 16:23:20 -0500 | [diff] [blame] | 6 | * |
| 7 | * This file is part of NLSR (Named-data Link State Routing). |
| 8 | * See AUTHORS.md for complete list of NLSR authors and contributors. |
| 9 | * |
| 10 | * NLSR is free software: you can redistribute it and/or modify it under the terms |
| 11 | * of the GNU General Public License as published by the Free Software Foundation, |
| 12 | * either version 3 of the License, or (at your option) any later version. |
| 13 | * |
| 14 | * NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 15 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 16 | * PURPOSE. See the GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License along with |
| 19 | * NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
akmhoque | 3d06e79 | 2014-05-27 16:23:20 -0500 | [diff] [blame] | 20 | **/ |
Vince Lehman | c2e51f6 | 2015-01-20 15:03:11 -0600 | [diff] [blame] | 21 | |
dmcoomes | e689dd6 | 2017-03-29 11:05:12 -0500 | [diff] [blame] | 22 | #ifndef NLSR_CONF_PARAMETER_HPP |
| 23 | #define NLSR_CONF_PARAMETER_HPP |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 24 | |
Ashlesh Gawande | 3909aa1 | 2017-07-28 16:01:35 -0500 | [diff] [blame] | 25 | #include "logger.hpp" |
| 26 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 27 | #include <iostream> |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 28 | #include <boost/cstdint.hpp> |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 29 | #include <ndn-cxx/common.hpp> |
| 30 | #include <ndn-cxx/face.hpp> |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 31 | #include <ndn-cxx/util/time.hpp> |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 32 | |
| 33 | namespace nlsr { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 34 | |
| 35 | enum { |
| 36 | LSA_REFRESH_TIME_MIN = 240, |
| 37 | LSA_REFRESH_TIME_DEFAULT = 1800, |
| 38 | LSA_REFRESH_TIME_MAX = 7200 |
| 39 | }; |
| 40 | |
| 41 | enum { |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 42 | LSA_INTEREST_LIFETIME_MIN = 1, |
| 43 | LSA_INTEREST_LIFETIME_DEFAULT = 4, |
| 44 | LSA_INTEREST_LIFETIME_MAX = 60 |
| 45 | }; |
| 46 | |
| 47 | enum { |
Vince Lehman | 7b61658 | 2014-10-17 16:25:39 -0500 | [diff] [blame] | 48 | ADJ_LSA_BUILD_INTERVAL_MIN = 0, |
| 49 | ADJ_LSA_BUILD_INTERVAL_DEFAULT = 5, |
| 50 | ADJ_LSA_BUILD_INTERVAL_MAX = 5 |
| 51 | }; |
| 52 | |
| 53 | enum { |
| 54 | FIRST_HELLO_INTERVAL_MIN = 0, |
| 55 | FIRST_HELLO_INTERVAL_DEFAULT = 10, |
| 56 | FIRST_HELLO_INTERVAL_MAX = 10 |
| 57 | }; |
| 58 | |
| 59 | enum { |
| 60 | ROUTING_CALC_INTERVAL_MIN = 0, |
| 61 | ROUTING_CALC_INTERVAL_DEFAULT = 15, |
| 62 | ROUTING_CALC_INTERVAL_MAX = 15 |
| 63 | }; |
| 64 | |
Nick Gordon | d5c1a37 | 2016-10-31 13:56:23 -0500 | [diff] [blame] | 65 | |
| 66 | enum { |
| 67 | FACE_DATASET_FETCH_TRIES_MIN = 1, |
| 68 | FACE_DATASET_FETCH_TRIES_MAX = 10, |
| 69 | FACE_DATASET_FETCH_TRIES_DEFAULT = 3 |
| 70 | }; |
| 71 | |
| 72 | enum { |
| 73 | FACE_DATASET_FETCH_INTERVAL_MIN = 1800, |
| 74 | FACE_DATASET_FETCH_INTERVAL_MAX = 5400, |
| 75 | FACE_DATASET_FETCH_INTERVAL_DEFAULT = 3600 |
| 76 | }; |
| 77 | |
Vince Lehman | 7b61658 | 2014-10-17 16:25:39 -0500 | [diff] [blame] | 78 | enum { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 79 | HELLO_RETRIES_MIN = 1, |
| 80 | HELLO_RETRIES_DEFAULT = 3, |
| 81 | HELLO_RETRIES_MAX = 15 |
| 82 | }; |
| 83 | |
| 84 | enum { |
| 85 | HELLO_TIMEOUT_MIN = 1, |
| 86 | HELLO_TIMEOUT_DEFAULT = 3, |
| 87 | HELLO_TIMEOUT_MAX = 15 |
| 88 | }; |
| 89 | |
| 90 | enum { |
| 91 | HELLO_INTERVAL_MIN = 30, |
| 92 | HELLO_INTERVAL_DEFAULT = 60, |
| 93 | HELLO_INTERVAL_MAX =90 |
| 94 | }; |
| 95 | |
| 96 | enum { |
| 97 | MAX_FACES_PER_PREFIX_MIN = 0, |
alvy | a2228c6 | 2014-12-09 10:25:11 -0600 | [diff] [blame] | 98 | MAX_FACES_PER_PREFIX_DEFAULT = 0, |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 99 | MAX_FACES_PER_PREFIX_MAX = 60 |
| 100 | }; |
| 101 | |
Nick Gordon | 5c467f0 | 2016-07-13 13:40:10 -0500 | [diff] [blame] | 102 | enum HyperbolicState { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 103 | HYPERBOLIC_STATE_OFF = 0, |
| 104 | HYPERBOLIC_STATE_ON = 1, |
alvy | a2228c6 | 2014-12-09 10:25:11 -0600 | [diff] [blame] | 105 | HYPERBOLIC_STATE_DRY_RUN = 2, |
| 106 | HYPERBOLIC_STATE_DEFAULT = 0 |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 107 | }; |
| 108 | |
Nick Gordon | d0a7df3 | 2017-05-30 16:44:34 -0500 | [diff] [blame^] | 109 | /*! \brief A class to house all the configuration parameters for NLSR. |
| 110 | * |
| 111 | * This class is conceptually a singleton (but not mechanically) which |
| 112 | * is just a collection of attributes that serve as a |
| 113 | * separation-of-data for NLSR's configuration variables. NLSR refers |
| 114 | * to an instance of this class for all its configuration |
| 115 | * parameters. This object is typically populated by a |
| 116 | * ConfFileProcessor reading a configuration file. |
| 117 | * |
| 118 | * \sa nlsr::ConfFileProcessor |
| 119 | */ |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 120 | class ConfParameter |
| 121 | { |
| 122 | |
| 123 | public: |
| 124 | ConfParameter() |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 125 | : m_lsaRefreshTime(LSA_REFRESH_TIME_DEFAULT) |
Vince Lehman | 7b61658 | 2014-10-17 16:25:39 -0500 | [diff] [blame] | 126 | , m_adjLsaBuildInterval(ADJ_LSA_BUILD_INTERVAL_DEFAULT) |
| 127 | , m_firstHelloInterval(FIRST_HELLO_INTERVAL_DEFAULT) |
| 128 | , m_routingCalcInterval(ROUTING_CALC_INTERVAL_DEFAULT) |
Ashlesh Gawande | 3909aa1 | 2017-07-28 16:01:35 -0500 | [diff] [blame] | 129 | , m_faceDatasetFetchInterval(ndn::time::seconds(static_cast<int>(FACE_DATASET_FETCH_INTERVAL_DEFAULT))) |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 130 | , m_lsaInterestLifetime(ndn::time::seconds(static_cast<int>(LSA_INTEREST_LIFETIME_DEFAULT))) |
Alexander Afanasyev | 1cf1e10 | 2014-08-17 19:47:57 -0700 | [diff] [blame] | 131 | , m_routerDeadInterval(2 * LSA_REFRESH_TIME_DEFAULT) |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 132 | , m_logLevel("INFO") |
| 133 | , m_interestRetryNumber(HELLO_RETRIES_DEFAULT) |
| 134 | , m_interestResendTime(HELLO_TIMEOUT_DEFAULT) |
| 135 | , m_infoInterestInterval(HELLO_INTERVAL_DEFAULT) |
| 136 | , m_hyperbolicState(HYPERBOLIC_STATE_OFF) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 137 | , m_corR(0) |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 138 | , m_maxFacesPerPrefix(MAX_FACES_PER_PREFIX_MIN) |
Muktadir R Chowdhury | bfa2760 | 2014-10-31 10:57:41 -0500 | [diff] [blame] | 139 | , m_isLog4cxxConfAvailable(false) |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 140 | { |
| 141 | } |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 142 | |
| 143 | void |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 144 | setNetwork(const ndn::Name& networkName) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 145 | { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 146 | m_network = networkName; |
Ashlesh Gawande | 4439523 | 2016-12-13 14:35:29 -0600 | [diff] [blame] | 147 | |
| 148 | m_chronosyncPrefix.append("localhop"); |
Ashlesh Gawande | 8bfd124 | 2017-06-21 14:55:27 -0500 | [diff] [blame] | 149 | m_chronosyncPrefix.append(m_network); |
akmhoque | a816bee | 2014-06-24 14:37:40 -0500 | [diff] [blame] | 150 | m_chronosyncPrefix.append("NLSR"); |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 151 | m_chronosyncPrefix.append("sync"); |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 152 | |
Ashlesh Gawande | 6077ea9 | 2017-01-19 11:48:29 -0600 | [diff] [blame] | 153 | m_lsaPrefix.append("localhop"); |
| 154 | m_lsaPrefix.append(m_network); |
akmhoque | a816bee | 2014-06-24 14:37:40 -0500 | [diff] [blame] | 155 | m_lsaPrefix.append("NLSR"); |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 156 | m_lsaPrefix.append("LSA"); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 157 | } |
| 158 | |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 159 | const ndn::Name& |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 160 | getNetwork() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 161 | { |
| 162 | return m_network; |
| 163 | } |
| 164 | |
| 165 | void |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 166 | setRouterName(const ndn::Name& routerName) |
| 167 | { |
| 168 | m_routerName = routerName; |
| 169 | } |
| 170 | |
| 171 | const ndn::Name& |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 172 | getRouterName() const |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 173 | { |
| 174 | return m_routerName; |
| 175 | } |
| 176 | |
| 177 | void |
| 178 | setSiteName(const ndn::Name& siteName) |
| 179 | { |
| 180 | m_siteName = siteName; |
| 181 | } |
| 182 | |
| 183 | const ndn::Name& |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 184 | getSiteName() const |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 185 | { |
| 186 | return m_siteName; |
| 187 | } |
| 188 | |
| 189 | void |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 190 | buildRouterPrefix() |
| 191 | { |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 192 | m_routerPrefix = m_network; |
| 193 | m_routerPrefix.append(m_siteName); |
| 194 | m_routerPrefix.append(m_routerName); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 195 | } |
| 196 | |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 197 | const ndn::Name& |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 198 | getRouterPrefix() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 199 | { |
| 200 | return m_routerPrefix; |
| 201 | } |
| 202 | |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 203 | |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 204 | const ndn::Name& |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 205 | getChronosyncPrefix() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 206 | { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 207 | return m_chronosyncPrefix; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 208 | } |
| 209 | |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 210 | const ndn::Name& |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 211 | getLsaPrefix() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 212 | { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 213 | return m_lsaPrefix; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 214 | } |
| 215 | |
| 216 | void |
alvy | 5a45495 | 2014-12-15 12:49:54 -0600 | [diff] [blame] | 217 | setLsaRefreshTime(uint32_t lrt) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 218 | { |
| 219 | m_lsaRefreshTime = lrt; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 220 | } |
| 221 | |
alvy | 5a45495 | 2014-12-15 12:49:54 -0600 | [diff] [blame] | 222 | uint32_t |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 223 | getLsaRefreshTime() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 224 | { |
| 225 | return m_lsaRefreshTime; |
| 226 | } |
| 227 | |
| 228 | void |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 229 | setLsaInterestLifetime(const ndn::time::seconds& lifetime) |
| 230 | { |
| 231 | m_lsaInterestLifetime = lifetime; |
| 232 | } |
| 233 | |
| 234 | const ndn::time::seconds& |
| 235 | getLsaInterestLifetime() const |
| 236 | { |
| 237 | return m_lsaInterestLifetime; |
| 238 | } |
| 239 | |
| 240 | void |
Vince Lehman | 7b61658 | 2014-10-17 16:25:39 -0500 | [diff] [blame] | 241 | setAdjLsaBuildInterval(uint32_t interval) |
| 242 | { |
| 243 | m_adjLsaBuildInterval = interval; |
| 244 | } |
| 245 | |
| 246 | uint32_t |
| 247 | getAdjLsaBuildInterval() const |
| 248 | { |
| 249 | return m_adjLsaBuildInterval; |
| 250 | } |
| 251 | |
| 252 | void |
| 253 | setFirstHelloInterval(uint32_t interval) |
| 254 | { |
| 255 | m_firstHelloInterval = interval; |
| 256 | } |
| 257 | |
| 258 | uint32_t |
| 259 | getFirstHelloInterval() const |
| 260 | { |
| 261 | return m_firstHelloInterval; |
| 262 | } |
| 263 | |
| 264 | void |
| 265 | setRoutingCalcInterval(uint32_t interval) |
| 266 | { |
| 267 | m_routingCalcInterval = interval; |
| 268 | } |
| 269 | |
| 270 | uint32_t |
| 271 | getRoutingCalcInterval() const |
| 272 | { |
| 273 | return m_routingCalcInterval; |
| 274 | } |
| 275 | |
| 276 | void |
alvy | 5a45495 | 2014-12-15 12:49:54 -0600 | [diff] [blame] | 277 | setRouterDeadInterval(uint32_t rdt) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 278 | { |
| 279 | m_routerDeadInterval = rdt; |
| 280 | } |
| 281 | |
alvy | 5a45495 | 2014-12-15 12:49:54 -0600 | [diff] [blame] | 282 | uint32_t |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 283 | getRouterDeadInterval() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 284 | { |
| 285 | return m_routerDeadInterval; |
| 286 | } |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 287 | |
| 288 | void |
Nick Gordon | d5c1a37 | 2016-10-31 13:56:23 -0500 | [diff] [blame] | 289 | setFaceDatasetFetchTries(uint32_t count) |
| 290 | { |
| 291 | m_faceDatasetFetchTries = count; |
| 292 | } |
| 293 | |
| 294 | uint32_t |
| 295 | getFaceDatasetFetchTries() const |
| 296 | { |
| 297 | return m_faceDatasetFetchTries; |
| 298 | } |
| 299 | |
| 300 | void |
Ashlesh Gawande | 3909aa1 | 2017-07-28 16:01:35 -0500 | [diff] [blame] | 301 | setFaceDatasetFetchInterval(uint32_t interval) |
Nick Gordon | d5c1a37 | 2016-10-31 13:56:23 -0500 | [diff] [blame] | 302 | { |
Ashlesh Gawande | 3909aa1 | 2017-07-28 16:01:35 -0500 | [diff] [blame] | 303 | m_faceDatasetFetchInterval = ndn::time::seconds(interval); |
Nick Gordon | d5c1a37 | 2016-10-31 13:56:23 -0500 | [diff] [blame] | 304 | } |
| 305 | |
| 306 | const ndn::time::seconds |
| 307 | getFaceDatasetFetchInterval() const |
| 308 | { |
| 309 | return m_faceDatasetFetchInterval; |
| 310 | } |
| 311 | |
| 312 | void |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 313 | setLogLevel(const std::string& logLevel) |
| 314 | { |
| 315 | m_logLevel = logLevel; |
| 316 | } |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 317 | |
| 318 | const std::string& |
| 319 | getLogLevel() const |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 320 | { |
| 321 | return m_logLevel; |
| 322 | } |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 323 | |
| 324 | void |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 325 | setInterestRetryNumber(uint32_t irn) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 326 | { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 327 | m_interestRetryNumber = irn; |
| 328 | } |
| 329 | |
| 330 | uint32_t |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 331 | getInterestRetryNumber() const |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 332 | { |
| 333 | return m_interestRetryNumber; |
| 334 | } |
| 335 | |
| 336 | void |
alvy | 5a45495 | 2014-12-15 12:49:54 -0600 | [diff] [blame] | 337 | setInterestResendTime(uint32_t irt) |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 338 | { |
| 339 | m_interestResendTime = irt; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 340 | } |
| 341 | |
alvy | 5a45495 | 2014-12-15 12:49:54 -0600 | [diff] [blame] | 342 | uint32_t |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 343 | getInterestResendTime() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 344 | { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 345 | return m_interestResendTime; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 346 | } |
| 347 | |
alvy | 5a45495 | 2014-12-15 12:49:54 -0600 | [diff] [blame] | 348 | uint32_t |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 349 | getInfoInterestInterval() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 350 | { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 351 | return m_infoInterestInterval; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 352 | } |
| 353 | |
| 354 | void |
alvy | 5a45495 | 2014-12-15 12:49:54 -0600 | [diff] [blame] | 355 | setInfoInterestInterval(uint32_t iii) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 356 | { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 357 | m_infoInterestInterval = iii; |
| 358 | } |
| 359 | |
| 360 | void |
| 361 | setHyperbolicState(int32_t ihc) |
| 362 | { |
| 363 | m_hyperbolicState = ihc; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 364 | } |
| 365 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 366 | int32_t |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 367 | getHyperbolicState() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 368 | { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 369 | return m_hyperbolicState; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 370 | } |
| 371 | |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 372 | bool |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 373 | setCorR(double cr) |
| 374 | { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 375 | if ( cr >= 0 ) { |
| 376 | m_corR = cr; |
| 377 | return true; |
| 378 | } |
| 379 | return false; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 380 | } |
| 381 | |
| 382 | double |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 383 | getCorR() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 384 | { |
| 385 | return m_corR; |
| 386 | } |
| 387 | |
| 388 | void |
Muktadir R Chowdhury | b00dc2a | 2016-11-05 10:48:58 -0600 | [diff] [blame] | 389 | setCorTheta(const std::vector<double>& ct) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 390 | { |
| 391 | m_corTheta = ct; |
| 392 | } |
| 393 | |
Muktadir R Chowdhury | b00dc2a | 2016-11-05 10:48:58 -0600 | [diff] [blame] | 394 | std::vector<double> |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 395 | getCorTheta() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 396 | { |
| 397 | return m_corTheta; |
| 398 | } |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 399 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 400 | void |
Vince Lehman | 942eb7b | 2014-10-02 10:09:27 -0500 | [diff] [blame] | 401 | setMaxFacesPerPrefix(uint32_t mfpp) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 402 | { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 403 | m_maxFacesPerPrefix = mfpp; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 404 | } |
| 405 | |
Vince Lehman | 942eb7b | 2014-10-02 10:09:27 -0500 | [diff] [blame] | 406 | uint32_t |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 407 | getMaxFacesPerPrefix() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 408 | { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 409 | return m_maxFacesPerPrefix; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 410 | } |
| 411 | |
| 412 | void |
akmhoque | 674b0b1 | 2014-05-20 14:33:28 -0500 | [diff] [blame] | 413 | setLogDir(const std::string& logDir) |
| 414 | { |
| 415 | m_logDir = logDir; |
| 416 | } |
| 417 | |
| 418 | const std::string& |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 419 | getLogDir() const |
akmhoque | 674b0b1 | 2014-05-20 14:33:28 -0500 | [diff] [blame] | 420 | { |
| 421 | return m_logDir; |
| 422 | } |
| 423 | |
| 424 | void |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 425 | setSeqFileDir(const std::string& ssfd) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 426 | { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 427 | m_seqFileDir = ssfd; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 428 | } |
| 429 | |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 430 | const std::string& |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 431 | getSeqFileDir() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 432 | { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 433 | return m_seqFileDir; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 434 | } |
| 435 | |
Muktadir R Chowdhury | bfa2760 | 2014-10-31 10:57:41 -0500 | [diff] [blame] | 436 | bool |
| 437 | isLog4CxxConfAvailable() const |
| 438 | { |
| 439 | return m_isLog4cxxConfAvailable; |
| 440 | } |
| 441 | |
| 442 | void |
| 443 | setLog4CxxConfPath(const std::string& path) |
| 444 | { |
| 445 | m_log4CxxConfPath = path; |
| 446 | m_isLog4cxxConfAvailable = true; |
| 447 | } |
| 448 | |
| 449 | const std::string& |
| 450 | getLog4CxxConfPath() const |
| 451 | { |
| 452 | return m_log4CxxConfPath; |
| 453 | } |
| 454 | |
Nick Gordon | d0a7df3 | 2017-05-30 16:44:34 -0500 | [diff] [blame^] | 455 | /*! \brief Dump the current state of all attributes to the log. |
| 456 | */ |
akmhoque | 674b0b1 | 2014-05-20 14:33:28 -0500 | [diff] [blame] | 457 | void |
| 458 | writeLog(); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 459 | |
| 460 | private: |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 461 | ndn::Name m_routerName; |
| 462 | ndn::Name m_siteName; |
| 463 | ndn::Name m_network; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 464 | |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 465 | ndn::Name m_routerPrefix; |
| 466 | ndn::Name m_lsaRouterPrefix; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 467 | |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 468 | ndn::Name m_chronosyncPrefix; |
| 469 | ndn::Name m_lsaPrefix; |
| 470 | |
alvy | 5a45495 | 2014-12-15 12:49:54 -0600 | [diff] [blame] | 471 | uint32_t m_lsaRefreshTime; |
Vince Lehman | 7b61658 | 2014-10-17 16:25:39 -0500 | [diff] [blame] | 472 | |
| 473 | uint32_t m_adjLsaBuildInterval; |
| 474 | uint32_t m_firstHelloInterval; |
| 475 | uint32_t m_routingCalcInterval; |
| 476 | |
Nick Gordon | d5c1a37 | 2016-10-31 13:56:23 -0500 | [diff] [blame] | 477 | uint32_t m_faceDatasetFetchTries; |
| 478 | ndn::time::seconds m_faceDatasetFetchInterval; |
| 479 | |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 480 | ndn::time::seconds m_lsaInterestLifetime; |
alvy | 5a45495 | 2014-12-15 12:49:54 -0600 | [diff] [blame] | 481 | uint32_t m_routerDeadInterval; |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 482 | std::string m_logLevel; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 483 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 484 | uint32_t m_interestRetryNumber; |
alvy | 5a45495 | 2014-12-15 12:49:54 -0600 | [diff] [blame] | 485 | uint32_t m_interestResendTime; |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 486 | |
alvy | 5a45495 | 2014-12-15 12:49:54 -0600 | [diff] [blame] | 487 | uint32_t m_infoInterestInterval; |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 488 | |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 489 | int32_t m_hyperbolicState; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 490 | double m_corR; |
Muktadir R Chowdhury | b00dc2a | 2016-11-05 10:48:58 -0600 | [diff] [blame] | 491 | std::vector<double> m_corTheta; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 492 | |
Vince Lehman | 942eb7b | 2014-10-02 10:09:27 -0500 | [diff] [blame] | 493 | uint32_t m_maxFacesPerPrefix; |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 494 | |
akmhoque | 674b0b1 | 2014-05-20 14:33:28 -0500 | [diff] [blame] | 495 | std::string m_logDir; |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 496 | std::string m_seqFileDir; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 497 | |
Muktadir R Chowdhury | bfa2760 | 2014-10-31 10:57:41 -0500 | [diff] [blame] | 498 | bool m_isLog4cxxConfAvailable; |
| 499 | std::string m_log4CxxConfPath; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 500 | }; |
| 501 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 502 | } // namespace nlsr |
| 503 | |
dmcoomes | e689dd6 | 2017-03-29 11:05:12 -0500 | [diff] [blame] | 504 | #endif // NLSR_CONF_PARAMETER_HPP |