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 | /* |
Saurab Dulal | 427e012 | 2019-11-28 11:58:02 -0600 | [diff] [blame] | 3 | * Copyright (c) 2014-2020, 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 | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 31 | #include <boost/cstdint.hpp> |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 32 | #include <ndn-cxx/face.hpp> |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 33 | #include <ndn-cxx/security/validator-config.hpp> |
Alexander Afanasyev | 0ad01f3 | 2020-06-03 14:12:58 -0400 | [diff] [blame^] | 34 | #include <ndn-cxx/security/certificate-fetcher-direct-fetch.hpp> |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 35 | #include <ndn-cxx/util/time.hpp> |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 36 | |
| 37 | namespace nlsr { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 38 | |
| 39 | enum { |
| 40 | LSA_REFRESH_TIME_MIN = 240, |
| 41 | LSA_REFRESH_TIME_DEFAULT = 1800, |
| 42 | LSA_REFRESH_TIME_MAX = 7200 |
| 43 | }; |
| 44 | |
| 45 | enum { |
Ashlesh Gawande | 32ec3fd | 2018-07-18 13:42:32 -0500 | [diff] [blame] | 46 | SYNC_PROTOCOL_CHRONOSYNC = 0, |
| 47 | SYNC_PROTOCOL_PSYNC = 1 |
| 48 | }; |
| 49 | |
| 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 | { |
| 131 | |
| 132 | public: |
Saurab Dulal | 427e012 | 2019-11-28 11:58:02 -0600 | [diff] [blame] | 133 | ConfParameter(ndn::Face& face, ndn::KeyChain& keyChain, |
| 134 | const std::string& confFileName = "nlsr.conf"); |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 135 | |
| 136 | const std::string& |
| 137 | getConfFileName() |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 138 | { |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 139 | return m_confFileName; |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 140 | } |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 141 | |
| 142 | void |
Ashlesh Gawande | 982a58f | 2018-02-14 17:39:12 -0600 | [diff] [blame] | 143 | setNetwork(const ndn::Name& networkName); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 144 | |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 145 | const ndn::Name& |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 146 | getNetwork() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 147 | { |
| 148 | return m_network; |
| 149 | } |
| 150 | |
| 151 | void |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 152 | setRouterName(const ndn::Name& routerName) |
| 153 | { |
| 154 | m_routerName = routerName; |
| 155 | } |
| 156 | |
| 157 | const ndn::Name& |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 158 | getRouterName() const |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 159 | { |
| 160 | return m_routerName; |
| 161 | } |
| 162 | |
| 163 | void |
| 164 | setSiteName(const ndn::Name& siteName) |
| 165 | { |
| 166 | m_siteName = siteName; |
| 167 | } |
| 168 | |
| 169 | const ndn::Name& |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 170 | getSiteName() const |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 171 | { |
| 172 | return m_siteName; |
| 173 | } |
| 174 | |
| 175 | void |
Ashlesh Gawande | 6b388fc | 2019-09-30 10:14:41 -0500 | [diff] [blame] | 176 | buildRouterAndSyncUserPrefix() |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 177 | { |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 178 | m_routerPrefix = m_network; |
| 179 | m_routerPrefix.append(m_siteName); |
| 180 | m_routerPrefix.append(m_routerName); |
Ashlesh Gawande | 6b388fc | 2019-09-30 10:14:41 -0500 | [diff] [blame] | 181 | |
| 182 | m_syncUserPrefix = m_lsaPrefix; |
| 183 | m_syncUserPrefix.append(m_siteName); |
| 184 | m_syncUserPrefix.append(m_routerName); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 185 | } |
| 186 | |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 187 | const ndn::Name& |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 188 | getRouterPrefix() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 189 | { |
| 190 | return m_routerPrefix; |
| 191 | } |
| 192 | |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 193 | const ndn::Name& |
Ashlesh Gawande | 6b388fc | 2019-09-30 10:14:41 -0500 | [diff] [blame] | 194 | getSyncUserPrefix() const |
| 195 | { |
| 196 | return m_syncUserPrefix; |
| 197 | } |
| 198 | |
| 199 | const ndn::Name& |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 200 | getSyncPrefix() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 201 | { |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 202 | return m_syncPrefix; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 203 | } |
| 204 | |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 205 | const ndn::Name& |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 206 | getLsaPrefix() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 207 | { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 208 | return m_lsaPrefix; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 209 | } |
| 210 | |
| 211 | void |
alvy | 5a45495 | 2014-12-15 12:49:54 -0600 | [diff] [blame] | 212 | setLsaRefreshTime(uint32_t lrt) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 213 | { |
| 214 | m_lsaRefreshTime = lrt; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 215 | } |
| 216 | |
alvy | 5a45495 | 2014-12-15 12:49:54 -0600 | [diff] [blame] | 217 | uint32_t |
Ashlesh Gawande | 32ec3fd | 2018-07-18 13:42:32 -0500 | [diff] [blame] | 218 | getSyncProtocol() const |
| 219 | { |
| 220 | return m_syncProtocol; |
| 221 | } |
| 222 | |
| 223 | void |
| 224 | setSyncProtocol(int32_t syncProtocol) |
| 225 | { |
| 226 | if (syncProtocol == SYNC_PROTOCOL_CHRONOSYNC || syncProtocol == SYNC_PROTOCOL_PSYNC) { |
| 227 | m_syncProtocol = syncProtocol; |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | uint32_t |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 232 | getLsaRefreshTime() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 233 | { |
| 234 | return m_lsaRefreshTime; |
| 235 | } |
| 236 | |
| 237 | void |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 238 | setLsaInterestLifetime(const ndn::time::seconds& lifetime) |
| 239 | { |
| 240 | m_lsaInterestLifetime = lifetime; |
| 241 | } |
| 242 | |
| 243 | const ndn::time::seconds& |
| 244 | getLsaInterestLifetime() const |
| 245 | { |
| 246 | return m_lsaInterestLifetime; |
| 247 | } |
| 248 | |
| 249 | void |
Vince Lehman | 7b61658 | 2014-10-17 16:25:39 -0500 | [diff] [blame] | 250 | setAdjLsaBuildInterval(uint32_t interval) |
| 251 | { |
| 252 | m_adjLsaBuildInterval = interval; |
| 253 | } |
| 254 | |
| 255 | uint32_t |
| 256 | getAdjLsaBuildInterval() const |
| 257 | { |
| 258 | return m_adjLsaBuildInterval; |
| 259 | } |
| 260 | |
| 261 | void |
Vince Lehman | 7b61658 | 2014-10-17 16:25:39 -0500 | [diff] [blame] | 262 | setRoutingCalcInterval(uint32_t interval) |
| 263 | { |
| 264 | m_routingCalcInterval = interval; |
| 265 | } |
| 266 | |
| 267 | uint32_t |
| 268 | getRoutingCalcInterval() const |
| 269 | { |
| 270 | return m_routingCalcInterval; |
| 271 | } |
| 272 | |
| 273 | void |
alvy | 5a45495 | 2014-12-15 12:49:54 -0600 | [diff] [blame] | 274 | setRouterDeadInterval(uint32_t rdt) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 275 | { |
| 276 | m_routerDeadInterval = rdt; |
| 277 | } |
| 278 | |
alvy | 5a45495 | 2014-12-15 12:49:54 -0600 | [diff] [blame] | 279 | uint32_t |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 280 | getRouterDeadInterval() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 281 | { |
| 282 | return m_routerDeadInterval; |
| 283 | } |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 284 | |
| 285 | void |
Nick Gordon | d5c1a37 | 2016-10-31 13:56:23 -0500 | [diff] [blame] | 286 | setFaceDatasetFetchTries(uint32_t count) |
| 287 | { |
| 288 | m_faceDatasetFetchTries = count; |
| 289 | } |
| 290 | |
| 291 | uint32_t |
| 292 | getFaceDatasetFetchTries() const |
| 293 | { |
| 294 | return m_faceDatasetFetchTries; |
| 295 | } |
| 296 | |
| 297 | void |
Ashlesh Gawande | 3909aa1 | 2017-07-28 16:01:35 -0500 | [diff] [blame] | 298 | setFaceDatasetFetchInterval(uint32_t interval) |
Nick Gordon | d5c1a37 | 2016-10-31 13:56:23 -0500 | [diff] [blame] | 299 | { |
Ashlesh Gawande | 3909aa1 | 2017-07-28 16:01:35 -0500 | [diff] [blame] | 300 | m_faceDatasetFetchInterval = ndn::time::seconds(interval); |
Nick Gordon | d5c1a37 | 2016-10-31 13:56:23 -0500 | [diff] [blame] | 301 | } |
| 302 | |
| 303 | const ndn::time::seconds |
| 304 | getFaceDatasetFetchInterval() const |
| 305 | { |
| 306 | return m_faceDatasetFetchInterval; |
| 307 | } |
| 308 | |
| 309 | void |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 310 | setInterestRetryNumber(uint32_t irn) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 311 | { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 312 | m_interestRetryNumber = irn; |
| 313 | } |
| 314 | |
| 315 | uint32_t |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 316 | getInterestRetryNumber() const |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 317 | { |
| 318 | return m_interestRetryNumber; |
| 319 | } |
| 320 | |
| 321 | void |
alvy | 5a45495 | 2014-12-15 12:49:54 -0600 | [diff] [blame] | 322 | setInterestResendTime(uint32_t irt) |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 323 | { |
| 324 | m_interestResendTime = irt; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 325 | } |
| 326 | |
alvy | 5a45495 | 2014-12-15 12:49:54 -0600 | [diff] [blame] | 327 | uint32_t |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 328 | getInterestResendTime() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 329 | { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 330 | return m_interestResendTime; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 331 | } |
| 332 | |
alvy | 5a45495 | 2014-12-15 12:49:54 -0600 | [diff] [blame] | 333 | uint32_t |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 334 | getInfoInterestInterval() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 335 | { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 336 | return m_infoInterestInterval; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 337 | } |
| 338 | |
| 339 | void |
alvy | 5a45495 | 2014-12-15 12:49:54 -0600 | [diff] [blame] | 340 | setInfoInterestInterval(uint32_t iii) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 341 | { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 342 | m_infoInterestInterval = iii; |
| 343 | } |
| 344 | |
| 345 | void |
| 346 | setHyperbolicState(int32_t ihc) |
| 347 | { |
| 348 | m_hyperbolicState = ihc; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 349 | } |
| 350 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 351 | int32_t |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 352 | getHyperbolicState() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 353 | { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 354 | return m_hyperbolicState; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 355 | } |
| 356 | |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 357 | bool |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 358 | setCorR(double cr) |
| 359 | { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 360 | if ( cr >= 0 ) { |
| 361 | m_corR = cr; |
| 362 | return true; |
| 363 | } |
| 364 | return false; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 365 | } |
| 366 | |
| 367 | double |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 368 | getCorR() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 369 | { |
| 370 | return m_corR; |
| 371 | } |
| 372 | |
| 373 | void |
Muktadir R Chowdhury | b00dc2a | 2016-11-05 10:48:58 -0600 | [diff] [blame] | 374 | setCorTheta(const std::vector<double>& ct) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 375 | { |
| 376 | m_corTheta = ct; |
| 377 | } |
| 378 | |
Muktadir R Chowdhury | b00dc2a | 2016-11-05 10:48:58 -0600 | [diff] [blame] | 379 | std::vector<double> |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 380 | getCorTheta() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 381 | { |
| 382 | return m_corTheta; |
| 383 | } |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 384 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 385 | void |
Vince Lehman | 942eb7b | 2014-10-02 10:09:27 -0500 | [diff] [blame] | 386 | setMaxFacesPerPrefix(uint32_t mfpp) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 387 | { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 388 | m_maxFacesPerPrefix = mfpp; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 389 | } |
| 390 | |
Vince Lehman | 942eb7b | 2014-10-02 10:09:27 -0500 | [diff] [blame] | 391 | uint32_t |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 392 | getMaxFacesPerPrefix() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 393 | { |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 394 | return m_maxFacesPerPrefix; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 395 | } |
| 396 | |
| 397 | void |
dulalsaurab | 82a34c2 | 2019-02-04 17:31:21 +0000 | [diff] [blame] | 398 | setStateFileDir(const std::string& ssfd) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 399 | { |
dulalsaurab | 82a34c2 | 2019-02-04 17:31:21 +0000 | [diff] [blame] | 400 | m_stateFileDir = ssfd; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 401 | } |
| 402 | |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 403 | const std::string& |
dulalsaurab | 82a34c2 | 2019-02-04 17:31:21 +0000 | [diff] [blame] | 404 | getStateFileDir() const |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 405 | { |
dulalsaurab | 82a34c2 | 2019-02-04 17:31:21 +0000 | [diff] [blame] | 406 | return m_stateFileDir; |
| 407 | } |
| 408 | |
dulalsaurab | d0816a3 | 2019-07-26 13:11:24 +0000 | [diff] [blame] | 409 | void |
| 410 | setConfFileNameDynamic(const std::string& confFileDynamic) |
dulalsaurab | 82a34c2 | 2019-02-04 17:31:21 +0000 | [diff] [blame] | 411 | { |
| 412 | m_confFileNameDynamic = confFileDynamic; |
| 413 | } |
| 414 | |
| 415 | const std::string& |
| 416 | getConfFileNameDynamic() const |
| 417 | { |
| 418 | return m_confFileNameDynamic; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 419 | } |
| 420 | |
akmhoque | 674b0b1 | 2014-05-20 14:33:28 -0500 | [diff] [blame] | 421 | void |
Ashlesh Gawande | f7da9c5 | 2018-02-06 17:36:46 -0600 | [diff] [blame] | 422 | setSyncInterestLifetime(uint32_t syncInterestLifetime) |
| 423 | { |
| 424 | m_syncInterestLifetime = ndn::time::milliseconds(syncInterestLifetime); |
| 425 | } |
| 426 | |
| 427 | const ndn::time::milliseconds& |
| 428 | getSyncInterestLifetime() const |
| 429 | { |
| 430 | return m_syncInterestLifetime; |
| 431 | } |
| 432 | |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 433 | AdjacencyList& |
| 434 | getAdjacencyList() |
| 435 | { |
| 436 | return m_adjl; |
| 437 | } |
| 438 | |
| 439 | NamePrefixList& |
| 440 | getNamePrefixList() |
| 441 | { |
| 442 | return m_npl; |
| 443 | } |
| 444 | |
| 445 | ndn::security::ValidatorConfig& |
| 446 | getValidator() |
| 447 | { |
| 448 | return m_validator; |
| 449 | } |
| 450 | |
| 451 | ndn::security::ValidatorConfig& |
| 452 | getPrefixUpdateValidator() |
| 453 | { |
| 454 | return m_prefixUpdateValidator; |
| 455 | } |
| 456 | |
Saurab Dulal | 427e012 | 2019-11-28 11:58:02 -0600 | [diff] [blame] | 457 | const ndn::security::SigningInfo& |
| 458 | getSigningInfo() const |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 459 | { |
Saurab Dulal | 427e012 | 2019-11-28 11:58:02 -0600 | [diff] [blame] | 460 | return m_signingInfo; |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 461 | } |
| 462 | |
Saurab Dulal | 427e012 | 2019-11-28 11:58:02 -0600 | [diff] [blame] | 463 | void |
| 464 | addCertPath(const std::string& certPath) |
| 465 | { |
| 466 | m_certs.insert(certPath); |
| 467 | } |
| 468 | |
| 469 | const std::unordered_set<std::string>& |
| 470 | getIdCerts() const |
| 471 | { |
| 472 | return m_certs; |
| 473 | } |
| 474 | |
| 475 | const ndn::KeyChain& |
| 476 | getKeyChain() const |
| 477 | { |
| 478 | return m_keyChain; |
| 479 | } |
| 480 | |
Alexander Afanasyev | 0ad01f3 | 2020-06-03 14:12:58 -0400 | [diff] [blame^] | 481 | shared_ptr<ndn::security::Certificate> |
Saurab Dulal | 427e012 | 2019-11-28 11:58:02 -0600 | [diff] [blame] | 482 | initializeKey(); |
| 483 | |
| 484 | void |
Alexander Afanasyev | 0ad01f3 | 2020-06-03 14:12:58 -0400 | [diff] [blame^] | 485 | loadCertToValidator(const ndn::security::Certificate& cert); |
Saurab Dulal | 427e012 | 2019-11-28 11:58:02 -0600 | [diff] [blame] | 486 | |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 487 | /*! \brief Dump the current state of all attributes to the log. |
| 488 | */ |
Ashlesh Gawande | f7da9c5 | 2018-02-06 17:36:46 -0600 | [diff] [blame] | 489 | void |
akmhoque | 674b0b1 | 2014-05-20 14:33:28 -0500 | [diff] [blame] | 490 | writeLog(); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 491 | |
Ashlesh Gawande | 328fc11 | 2019-12-12 17:06:44 -0600 | [diff] [blame] | 492 | PUBLIC_WITH_TESTS_ELSE_PRIVATE: |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 493 | std::string m_confFileName; |
Ashlesh Gawande | 328fc11 | 2019-12-12 17:06:44 -0600 | [diff] [blame] | 494 | std::string m_confFileNameDynamic; |
| 495 | private: |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 496 | ndn::Name m_routerName; |
| 497 | ndn::Name m_siteName; |
| 498 | ndn::Name m_network; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 499 | |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 500 | ndn::Name m_routerPrefix; |
Ashlesh Gawande | 6b388fc | 2019-09-30 10:14:41 -0500 | [diff] [blame] | 501 | ndn::Name m_syncUserPrefix; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 502 | |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 503 | ndn::Name m_syncPrefix; |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 504 | ndn::Name m_lsaPrefix; |
| 505 | |
alvy | 5a45495 | 2014-12-15 12:49:54 -0600 | [diff] [blame] | 506 | uint32_t m_lsaRefreshTime; |
Vince Lehman | 7b61658 | 2014-10-17 16:25:39 -0500 | [diff] [blame] | 507 | |
| 508 | uint32_t m_adjLsaBuildInterval; |
Vince Lehman | 7b61658 | 2014-10-17 16:25:39 -0500 | [diff] [blame] | 509 | uint32_t m_routingCalcInterval; |
| 510 | |
Nick Gordon | d5c1a37 | 2016-10-31 13:56:23 -0500 | [diff] [blame] | 511 | uint32_t m_faceDatasetFetchTries; |
| 512 | ndn::time::seconds m_faceDatasetFetchInterval; |
| 513 | |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 514 | ndn::time::seconds m_lsaInterestLifetime; |
alvy | 5a45495 | 2014-12-15 12:49:54 -0600 | [diff] [blame] | 515 | uint32_t m_routerDeadInterval; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 516 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 517 | uint32_t m_interestRetryNumber; |
alvy | 5a45495 | 2014-12-15 12:49:54 -0600 | [diff] [blame] | 518 | uint32_t m_interestResendTime; |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 519 | |
alvy | 5a45495 | 2014-12-15 12:49:54 -0600 | [diff] [blame] | 520 | uint32_t m_infoInterestInterval; |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 521 | |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 522 | int32_t m_hyperbolicState; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 523 | double m_corR; |
Muktadir R Chowdhury | b00dc2a | 2016-11-05 10:48:58 -0600 | [diff] [blame] | 524 | std::vector<double> m_corTheta; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 525 | |
Vince Lehman | 942eb7b | 2014-10-02 10:09:27 -0500 | [diff] [blame] | 526 | uint32_t m_maxFacesPerPrefix; |
Alexander Afanasyev | 411ee4b | 2014-08-16 23:17:03 -0700 | [diff] [blame] | 527 | |
dulalsaurab | 82a34c2 | 2019-02-04 17:31:21 +0000 | [diff] [blame] | 528 | std::string m_stateFileDir; |
| 529 | |
Ashlesh Gawande | f7da9c5 | 2018-02-06 17:36:46 -0600 | [diff] [blame] | 530 | ndn::time::milliseconds m_syncInterestLifetime; |
Ashlesh Gawande | 982a58f | 2018-02-14 17:39:12 -0600 | [diff] [blame] | 531 | |
Ashlesh Gawande | 32ec3fd | 2018-07-18 13:42:32 -0500 | [diff] [blame] | 532 | int32_t m_syncProtocol; |
| 533 | |
Ashlesh Gawande | 982a58f | 2018-02-14 17:39:12 -0600 | [diff] [blame] | 534 | PUBLIC_WITH_TESTS_ELSE_PRIVATE: |
| 535 | static const uint64_t SYNC_VERSION; |
Ashlesh Gawande | 85998a1 | 2017-12-07 22:22:13 -0600 | [diff] [blame] | 536 | |
| 537 | AdjacencyList m_adjl; |
| 538 | NamePrefixList m_npl; |
| 539 | ndn::security::ValidatorConfig m_validator; |
| 540 | ndn::security::ValidatorConfig m_prefixUpdateValidator; |
Saurab Dulal | 427e012 | 2019-11-28 11:58:02 -0600 | [diff] [blame] | 541 | ndn::security::SigningInfo m_signingInfo; |
| 542 | std::unordered_set<std::string> m_certs; |
| 543 | ndn::KeyChain& m_keyChain; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 544 | }; |
| 545 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 546 | } // namespace nlsr |
| 547 | |
dmcoomes | e689dd6 | 2017-03-29 11:05:12 -0500 | [diff] [blame] | 548 | #endif // NLSR_CONF_PARAMETER_HPP |