akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 1 | #ifndef CONF_PARAMETER_HPP |
| 2 | #define CONF_PARAMETER_HPP |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 3 | |
| 4 | #include <iostream> |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 5 | #include <boost/cstdint.hpp> |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 6 | #include <ndn-cxx/common.hpp> |
| 7 | #include <ndn-cxx/face.hpp> |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 8 | |
| 9 | namespace nlsr { |
| 10 | class ConfParameter |
| 11 | { |
| 12 | |
| 13 | public: |
| 14 | ConfParameter() |
| 15 | : m_chronosyncSyncPrefix("ndn/nlsr/sync") |
| 16 | , m_chronosyncLsaPrefix("/ndn/nlsr/LSA") |
| 17 | , m_rootKeyPrefix("/ndn/keys") |
| 18 | , m_interestRetryNumber(3) |
| 19 | , m_interestResendTime(5) |
| 20 | , m_infoInterestInterval(60) |
| 21 | , m_lsaRefreshTime(1800) |
| 22 | , m_routerDeadInterval(3600) |
| 23 | , m_maxFacesPerPrefix(0) |
| 24 | , m_tunnelType(0) |
| 25 | , m_detailedLogging(0) |
| 26 | , m_certDir() |
| 27 | , m_debugging(0) |
| 28 | , m_seqFileDir() |
| 29 | , m_isHyperbolicCalc(0) |
| 30 | , m_corR(0) |
| 31 | , m_corTheta(0) |
| 32 | {} |
| 33 | |
| 34 | void |
| 35 | setRouterName(const std::string& rn) |
| 36 | { |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 37 | m_routerName = ndn::Name(rn); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 38 | } |
| 39 | |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 40 | const ndn::Name& |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 41 | getRouterName() |
| 42 | { |
| 43 | return m_routerName; |
| 44 | } |
| 45 | |
| 46 | void |
| 47 | setSiteName(const std::string& sn) |
| 48 | { |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 49 | m_siteName = ndn::Name(sn); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 50 | } |
| 51 | |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 52 | const ndn::Name& |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 53 | getSiteName() |
| 54 | { |
| 55 | return m_siteName; |
| 56 | } |
| 57 | |
| 58 | void |
| 59 | setNetwork(const std::string& nn) |
| 60 | { |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 61 | m_network = ndn::Name(nn); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 62 | } |
| 63 | |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 64 | const ndn::Name& |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 65 | getNetwork() |
| 66 | { |
| 67 | return m_network; |
| 68 | } |
| 69 | |
| 70 | void |
| 71 | buildRouterPrefix() |
| 72 | { |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 73 | //m_routerPrefix = "/" + m_network + "/" + m_siteName + "/" + m_routerName; |
| 74 | m_routerPrefix = m_network; |
| 75 | m_routerPrefix.append(m_siteName); |
| 76 | m_routerPrefix.append(m_routerName); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 77 | } |
| 78 | |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 79 | const ndn::Name& |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 80 | getRouterPrefix() |
| 81 | { |
| 82 | return m_routerPrefix; |
| 83 | } |
| 84 | |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 85 | const ndn::Name& |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 86 | getRootKeyPrefix() |
| 87 | { |
| 88 | return m_rootKeyPrefix; |
| 89 | } |
| 90 | |
| 91 | void |
| 92 | setRootKeyPrefix(std::string rkp) |
| 93 | { |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 94 | m_rootKeyPrefix = ndn::Name(rkp); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 95 | } |
| 96 | |
| 97 | void |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 98 | setInterestRetryNumber(uint32_t irn) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 99 | { |
| 100 | m_interestRetryNumber = irn; |
| 101 | } |
| 102 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 103 | uint32_t |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 104 | getInterestRetryNumber() |
| 105 | { |
| 106 | return m_interestRetryNumber; |
| 107 | } |
| 108 | |
| 109 | void |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 110 | setInterestResendTime(int32_t irt) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 111 | { |
| 112 | m_interestResendTime = irt; |
| 113 | } |
| 114 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 115 | int32_t |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 116 | getInterestResendTime() |
| 117 | { |
| 118 | return m_interestResendTime; |
| 119 | } |
| 120 | |
| 121 | void |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 122 | setLsaRefreshTime(int32_t lrt) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 123 | { |
| 124 | m_lsaRefreshTime = lrt; |
| 125 | m_routerDeadInterval = 2 * m_lsaRefreshTime; |
| 126 | } |
| 127 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 128 | int32_t |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 129 | getLsaRefreshTime() |
| 130 | { |
| 131 | return m_lsaRefreshTime; |
| 132 | } |
| 133 | |
| 134 | void |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 135 | setRouterDeadInterval(int64_t rdt) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 136 | { |
| 137 | m_routerDeadInterval = rdt; |
| 138 | } |
| 139 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 140 | int64_t |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 141 | getRouterDeadInterval() |
| 142 | { |
| 143 | return m_routerDeadInterval; |
| 144 | } |
| 145 | |
| 146 | void |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 147 | setMaxFacesPerPrefix(int32_t mfpp) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 148 | { |
| 149 | m_maxFacesPerPrefix = mfpp; |
| 150 | } |
| 151 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 152 | int32_t |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 153 | getMaxFacesPerPrefix() |
| 154 | { |
| 155 | return m_maxFacesPerPrefix; |
| 156 | } |
| 157 | |
| 158 | void |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 159 | setLogDir(const std::string& ld) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 160 | { |
| 161 | m_logDir = ld; |
| 162 | } |
| 163 | |
| 164 | std::string |
| 165 | getLogDir() |
| 166 | { |
| 167 | return m_logDir; |
| 168 | } |
| 169 | |
| 170 | void |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 171 | setCertDir(const std::string& cd) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 172 | { |
| 173 | m_certDir = cd; |
| 174 | } |
| 175 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 176 | const std::string& |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 177 | getCertDir() |
| 178 | { |
| 179 | return m_certDir; |
| 180 | } |
| 181 | |
| 182 | void |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 183 | setSeqFileDir(const std::string& ssfd) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 184 | { |
| 185 | m_seqFileDir = ssfd; |
| 186 | } |
| 187 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 188 | const std::string& |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 189 | getSeqFileDir() |
| 190 | { |
| 191 | return m_seqFileDir; |
| 192 | } |
| 193 | |
| 194 | void |
| 195 | setDetailedLogging(int dl) |
| 196 | { |
| 197 | m_detailedLogging = dl; |
| 198 | } |
| 199 | |
| 200 | int |
| 201 | getDetailedLogging() |
| 202 | { |
| 203 | return m_detailedLogging; |
| 204 | } |
| 205 | |
| 206 | void |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 207 | setDebugging(int32_t d) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 208 | { |
| 209 | m_debugging = d; |
| 210 | } |
| 211 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 212 | int32_t |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 213 | getDebugging() |
| 214 | { |
| 215 | return m_debugging; |
| 216 | } |
| 217 | |
| 218 | void |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 219 | setIsHyperbolicCalc(int32_t ihc) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 220 | { |
| 221 | m_isHyperbolicCalc = ihc; |
| 222 | } |
| 223 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 224 | int32_t |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 225 | getIsHyperbolicCalc() |
| 226 | { |
| 227 | return m_isHyperbolicCalc; |
| 228 | } |
| 229 | |
| 230 | void |
| 231 | setCorR(double cr) |
| 232 | { |
| 233 | m_corR = cr; |
| 234 | } |
| 235 | |
| 236 | double |
| 237 | getCorR() |
| 238 | { |
| 239 | return m_corR; |
| 240 | } |
| 241 | |
| 242 | void |
| 243 | setCorTheta(double ct) |
| 244 | { |
| 245 | m_corTheta = ct; |
| 246 | } |
| 247 | |
| 248 | double |
| 249 | getCorTheta() |
| 250 | { |
| 251 | return m_corTheta; |
| 252 | } |
| 253 | |
| 254 | void |
| 255 | setTunnelType(int tt) |
| 256 | { |
| 257 | m_tunnelType = tt; |
| 258 | } |
| 259 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 260 | int32_t |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 261 | getTunnelType() |
| 262 | { |
| 263 | return m_tunnelType; |
| 264 | } |
| 265 | |
| 266 | void |
| 267 | setChronosyncSyncPrefix(const std::string& csp) |
| 268 | { |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 269 | m_chronosyncSyncPrefix = ndn::Name(csp); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 270 | } |
| 271 | |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 272 | const ndn::Name& |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 273 | getChronosyncSyncPrefix() |
| 274 | { |
| 275 | return m_chronosyncSyncPrefix; |
| 276 | } |
| 277 | |
| 278 | void |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 279 | setChronosyncLsaPrefix(const std::string& clp) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 280 | { |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 281 | m_chronosyncLsaPrefix = ndn::Name(clp); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 282 | } |
| 283 | |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 284 | const ndn::Name& |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 285 | getChronosyncLsaPrefix() |
| 286 | { |
| 287 | return m_chronosyncLsaPrefix; |
| 288 | } |
| 289 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 290 | int32_t |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 291 | getInfoInterestInterval() |
| 292 | { |
| 293 | return m_infoInterestInterval; |
| 294 | } |
| 295 | |
| 296 | void |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 297 | setInfoInterestInterval(int32_t iii) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 298 | { |
| 299 | m_infoInterestInterval = iii; |
| 300 | } |
| 301 | |
| 302 | private: |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 303 | ndn::Name m_routerName; |
| 304 | ndn::Name m_siteName; |
| 305 | ndn::Name m_network; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 306 | |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 307 | ndn::Name m_routerPrefix; |
| 308 | ndn::Name m_lsaRouterPrefix; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 309 | |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 310 | ndn::Name m_chronosyncSyncPrefix; |
| 311 | ndn::Name m_chronosyncLsaPrefix; |
| 312 | ndn::Name m_rootKeyPrefix; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 313 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 314 | uint32_t m_interestRetryNumber; |
| 315 | int32_t m_interestResendTime; |
| 316 | int32_t m_infoInterestInterval; |
| 317 | int32_t m_lsaRefreshTime; |
| 318 | int64_t m_routerDeadInterval; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 319 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 320 | int32_t m_maxFacesPerPrefix; |
| 321 | int32_t m_tunnelType; |
| 322 | int32_t m_detailedLogging; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 323 | |
| 324 | std::string m_certDir; |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 325 | int32_t m_debugging; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 326 | std::string m_seqFileDir; |
| 327 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 328 | int32_t m_isHyperbolicCalc; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 329 | double m_corR; |
| 330 | double m_corTheta; |
| 331 | |
| 332 | std::string m_logFile; |
| 333 | std::string m_logDir; |
| 334 | |
| 335 | }; |
| 336 | |
| 337 | std::ostream& |
| 338 | operator<<(std::ostream& os, ConfParameter& cfp); |
| 339 | |
| 340 | } // namespace nlsr |
| 341 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 342 | #endif //CONF_PARAMETER_HPP |