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