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