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