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