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