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 | /* |
Davide Pesavento | d90338d | 2021-01-07 17:50:05 -0500 | [diff] [blame] | 3 | * Copyright (c) 2014-2021, 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 | 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" |
Ashlesh Gawande | 3909aa1 | 2017-07-28 16:01:35 -0500 | [diff] [blame] | 30 | |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 31 | #include <ndn-cxx/face.hpp> |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 32 | #include <ndn-cxx/security/validator-config.hpp> |
Alexander Afanasyev | 0ad01f3 | 2020-06-03 14:12:58 -0400 | [diff] [blame] | 33 | #include <ndn-cxx/security/certificate-fetcher-direct-fetch.hpp> |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 34 | |
| 35 | namespace nlsr { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 36 | |
| 37 | enum { |
| 38 | LSA_REFRESH_TIME_MIN = 240, |
| 39 | LSA_REFRESH_TIME_DEFAULT = 1800, |
| 40 | LSA_REFRESH_TIME_MAX = 7200 |
| 41 | }; |
| 42 | |
| 43 | enum { |
Ashlesh Gawande | 32ec3fd | 2018-07-18 13:42:32 -0500 | [diff] [blame] | 44 | SYNC_PROTOCOL_CHRONOSYNC = 0, |
| 45 | SYNC_PROTOCOL_PSYNC = 1 |
| 46 | }; |
| 47 | |
| 48 | enum { |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 49 | LSA_INTEREST_LIFETIME_MIN = 1, |
| 50 | LSA_INTEREST_LIFETIME_DEFAULT = 4, |
| 51 | LSA_INTEREST_LIFETIME_MAX = 60 |
| 52 | }; |
| 53 | |
| 54 | enum { |
Ashlesh Gawande | 6b388fc | 2019-09-30 10:14:41 -0500 | [diff] [blame] | 55 | ADJ_LSA_BUILD_INTERVAL_MIN = 5, |
| 56 | ADJ_LSA_BUILD_INTERVAL_DEFAULT = 10, |
| 57 | ADJ_LSA_BUILD_INTERVAL_MAX = 30 |
Vince Lehman | 7b61658 | 2014-10-17 16:25:39 -0500 | [diff] [blame] | 58 | }; |
| 59 | |
| 60 | enum { |
| 61 | ROUTING_CALC_INTERVAL_MIN = 0, |
| 62 | ROUTING_CALC_INTERVAL_DEFAULT = 15, |
| 63 | ROUTING_CALC_INTERVAL_MAX = 15 |
| 64 | }; |
| 65 | |
Nick Gordon | d5c1a37 | 2016-10-31 13:56:23 -0500 | [diff] [blame] | 66 | |
| 67 | enum { |
| 68 | FACE_DATASET_FETCH_TRIES_MIN = 1, |
| 69 | FACE_DATASET_FETCH_TRIES_MAX = 10, |
| 70 | FACE_DATASET_FETCH_TRIES_DEFAULT = 3 |
| 71 | }; |
| 72 | |
| 73 | enum { |
| 74 | FACE_DATASET_FETCH_INTERVAL_MIN = 1800, |
| 75 | FACE_DATASET_FETCH_INTERVAL_MAX = 5400, |
| 76 | FACE_DATASET_FETCH_INTERVAL_DEFAULT = 3600 |
| 77 | }; |
| 78 | |
Vince Lehman | 7b61658 | 2014-10-17 16:25:39 -0500 | [diff] [blame] | 79 | enum { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 80 | HELLO_RETRIES_MIN = 1, |
| 81 | HELLO_RETRIES_DEFAULT = 3, |
| 82 | HELLO_RETRIES_MAX = 15 |
| 83 | }; |
| 84 | |
| 85 | enum { |
| 86 | HELLO_TIMEOUT_MIN = 1, |
Ashlesh Gawande | 6b388fc | 2019-09-30 10:14:41 -0500 | [diff] [blame] | 87 | HELLO_TIMEOUT_DEFAULT = 1, |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 88 | HELLO_TIMEOUT_MAX = 15 |
| 89 | }; |
| 90 | |
| 91 | enum { |
| 92 | HELLO_INTERVAL_MIN = 30, |
| 93 | HELLO_INTERVAL_DEFAULT = 60, |
| 94 | HELLO_INTERVAL_MAX =90 |
| 95 | }; |
| 96 | |
| 97 | enum { |
| 98 | MAX_FACES_PER_PREFIX_MIN = 0, |
alvy | a2228c6 | 2014-12-09 10:25:11 -0600 | [diff] [blame] | 99 | MAX_FACES_PER_PREFIX_DEFAULT = 0, |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 100 | MAX_FACES_PER_PREFIX_MAX = 60 |
| 101 | }; |
| 102 | |
Nick Gordon | 5c467f0 | 2016-07-13 13:40:10 -0500 | [diff] [blame] | 103 | enum HyperbolicState { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 104 | HYPERBOLIC_STATE_OFF = 0, |
| 105 | HYPERBOLIC_STATE_ON = 1, |
alvy | a2228c6 | 2014-12-09 10:25:11 -0600 | [diff] [blame] | 106 | HYPERBOLIC_STATE_DRY_RUN = 2, |
| 107 | HYPERBOLIC_STATE_DEFAULT = 0 |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 108 | }; |
| 109 | |
Ashlesh Gawande | f7da9c5 | 2018-02-06 17:36:46 -0600 | [diff] [blame] | 110 | enum { |
| 111 | SYNC_INTEREST_LIFETIME_MIN = 1000, |
| 112 | SYNC_INTEREST_LIFETIME_DEFAULT = 60000, |
| 113 | SYNC_INTEREST_LIFETIME_MAX = 120000, |
| 114 | }; |
| 115 | |
Nick Gordon | d0a7df3 | 2017-05-30 16:44:34 -0500 | [diff] [blame] | 116 | /*! \brief A class to house all the configuration parameters for NLSR. |
| 117 | * |
| 118 | * This class is conceptually a singleton (but not mechanically) which |
| 119 | * is just a collection of attributes that serve as a |
| 120 | * separation-of-data for NLSR's configuration variables. NLSR refers |
| 121 | * to an instance of this class for all its configuration |
| 122 | * parameters. This object is typically populated by a |
| 123 | * ConfFileProcessor reading a configuration file. |
| 124 | * |
| 125 | * \sa nlsr::ConfFileProcessor |
| 126 | */ |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 127 | class ConfParameter |
| 128 | { |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 129 | public: |
Davide Pesavento | d90338d | 2021-01-07 17:50:05 -0500 | [diff] [blame] | 130 | ConfParameter(ndn::Face& face, ndn::KeyChain& keyChain, |
Saurab Dulal | 427e012 | 2019-11-28 11:58:02 -0600 | [diff] [blame] | 131 | const std::string& confFileName = "nlsr.conf"); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 132 | |
| 133 | const std::string& |
| 134 | getConfFileName() |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 135 | { |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 136 | return m_confFileName; |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 137 | } |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 138 | |
| 139 | void |
Ashlesh Gawande | 982a58f | 2018-02-14 17:39:12 -0600 | [diff] [blame] | 140 | setNetwork(const ndn::Name& networkName); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 141 | |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 142 | const ndn::Name& |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 143 | getNetwork() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 144 | { |
| 145 | return m_network; |
| 146 | } |
| 147 | |
| 148 | void |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 149 | setRouterName(const ndn::Name& routerName) |
| 150 | { |
| 151 | m_routerName = routerName; |
| 152 | } |
| 153 | |
| 154 | const ndn::Name& |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 155 | getRouterName() const |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 156 | { |
| 157 | return m_routerName; |
| 158 | } |
| 159 | |
| 160 | void |
| 161 | setSiteName(const ndn::Name& siteName) |
| 162 | { |
| 163 | m_siteName = siteName; |
| 164 | } |
| 165 | |
| 166 | const ndn::Name& |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 167 | getSiteName() const |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 168 | { |
| 169 | return m_siteName; |
| 170 | } |
| 171 | |
| 172 | void |
Ashlesh Gawande | 6b388fc | 2019-09-30 10:14:41 -0500 | [diff] [blame] | 173 | buildRouterAndSyncUserPrefix() |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 174 | { |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 175 | m_routerPrefix = m_network; |
| 176 | m_routerPrefix.append(m_siteName); |
| 177 | m_routerPrefix.append(m_routerName); |
Ashlesh Gawande | 6b388fc | 2019-09-30 10:14:41 -0500 | [diff] [blame] | 178 | |
| 179 | m_syncUserPrefix = m_lsaPrefix; |
| 180 | m_syncUserPrefix.append(m_siteName); |
| 181 | m_syncUserPrefix.append(m_routerName); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 182 | } |
| 183 | |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 184 | const ndn::Name& |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 185 | getRouterPrefix() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 186 | { |
| 187 | return m_routerPrefix; |
| 188 | } |
| 189 | |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 190 | const ndn::Name& |
Ashlesh Gawande | 6b388fc | 2019-09-30 10:14:41 -0500 | [diff] [blame] | 191 | getSyncUserPrefix() const |
| 192 | { |
| 193 | return m_syncUserPrefix; |
| 194 | } |
| 195 | |
| 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 |
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 |
| 343 | setHyperbolicState(int32_t ihc) |
| 344 | { |
| 345 | m_hyperbolicState = ihc; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 346 | } |
| 347 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 348 | int32_t |
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 | d90338d | 2021-01-07 17:50:05 -0500 | [diff] [blame] | 478 | std::shared_ptr<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 | |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 520 | int32_t 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 | |
Ashlesh Gawande | 32ec3fd | 2018-07-18 13:42:32 -0500 | [diff] [blame] | 530 | int32_t m_syncProtocol; |
| 531 | |
Ashlesh Gawande | 982a58f | 2018-02-14 17:39:12 -0600 | [diff] [blame] | 532 | PUBLIC_WITH_TESTS_ELSE_PRIVATE: |
| 533 | static const uint64_t SYNC_VERSION; |
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 |