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