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