blob: 49a8a4dd6f8b9efd3aab77f1859cda30c5bc2d7b [file] [log] [blame]
akmhoquefdbddb12014-05-02 18:35:19 -05001#ifndef CONF_PARAMETER_HPP
2#define CONF_PARAMETER_HPP
akmhoque53353462014-04-22 08:43:45 -05003
4#include <iostream>
akmhoquefdbddb12014-05-02 18:35:19 -05005#include <boost/cstdint.hpp>
akmhoque53353462014-04-22 08:43:45 -05006
7namespace nlsr {
8class ConfParameter
9{
10
11public:
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
akmhoquefdbddb12014-05-02 18:35:19 -050038 const std::string&
akmhoque53353462014-04-22 08:43:45 -050039 getRouterName()
40 {
41 return m_routerName;
42 }
43
44 void
45 setSiteName(const std::string& sn)
46 {
47 m_siteName = sn;
48 }
49
akmhoquefdbddb12014-05-02 18:35:19 -050050 const std::string&
akmhoque53353462014-04-22 08:43:45 -050051 getSiteName()
52 {
53 return m_siteName;
54 }
55
56 void
57 setNetwork(const std::string& nn)
58 {
59 m_network = nn;
60 }
61
akmhoquefdbddb12014-05-02 18:35:19 -050062 const std::string&
akmhoque53353462014-04-22 08:43:45 -050063 getNetwork()
64 {
65 return m_network;
66 }
67
68 void
69 buildRouterPrefix()
70 {
71 m_routerPrefix = "/" + m_network + "/" + m_siteName + "/" + m_routerName;
72 }
73
akmhoquefdbddb12014-05-02 18:35:19 -050074 const std::string&
akmhoque53353462014-04-22 08:43:45 -050075 getRouterPrefix()
76 {
77 return m_routerPrefix;
78 }
79
akmhoquefdbddb12014-05-02 18:35:19 -050080 const std::string&
akmhoque53353462014-04-22 08:43:45 -050081 getRootKeyPrefix()
82 {
83 return m_rootKeyPrefix;
84 }
85
86 void
87 setRootKeyPrefix(std::string rkp)
88 {
89 m_rootKeyPrefix = rkp;
90 }
91
92 void
akmhoquefdbddb12014-05-02 18:35:19 -050093 setInterestRetryNumber(uint32_t irn)
akmhoque53353462014-04-22 08:43:45 -050094 {
95 m_interestRetryNumber = irn;
96 }
97
akmhoquefdbddb12014-05-02 18:35:19 -050098 uint32_t
akmhoque53353462014-04-22 08:43:45 -050099 getInterestRetryNumber()
100 {
101 return m_interestRetryNumber;
102 }
103
104 void
akmhoquefdbddb12014-05-02 18:35:19 -0500105 setInterestResendTime(int32_t irt)
akmhoque53353462014-04-22 08:43:45 -0500106 {
107 m_interestResendTime = irt;
108 }
109
akmhoquefdbddb12014-05-02 18:35:19 -0500110 int32_t
akmhoque53353462014-04-22 08:43:45 -0500111 getInterestResendTime()
112 {
113 return m_interestResendTime;
114 }
115
116 void
akmhoquefdbddb12014-05-02 18:35:19 -0500117 setLsaRefreshTime(int32_t lrt)
akmhoque53353462014-04-22 08:43:45 -0500118 {
119 m_lsaRefreshTime = lrt;
120 m_routerDeadInterval = 2 * m_lsaRefreshTime;
121 }
122
akmhoquefdbddb12014-05-02 18:35:19 -0500123 int32_t
akmhoque53353462014-04-22 08:43:45 -0500124 getLsaRefreshTime()
125 {
126 return m_lsaRefreshTime;
127 }
128
129 void
akmhoquefdbddb12014-05-02 18:35:19 -0500130 setRouterDeadInterval(int64_t rdt)
akmhoque53353462014-04-22 08:43:45 -0500131 {
132 m_routerDeadInterval = rdt;
133 }
134
akmhoquefdbddb12014-05-02 18:35:19 -0500135 int64_t
akmhoque53353462014-04-22 08:43:45 -0500136 getRouterDeadInterval()
137 {
138 return m_routerDeadInterval;
139 }
140
141 void
akmhoquefdbddb12014-05-02 18:35:19 -0500142 setMaxFacesPerPrefix(int32_t mfpp)
akmhoque53353462014-04-22 08:43:45 -0500143 {
144 m_maxFacesPerPrefix = mfpp;
145 }
146
akmhoquefdbddb12014-05-02 18:35:19 -0500147 int32_t
akmhoque53353462014-04-22 08:43:45 -0500148 getMaxFacesPerPrefix()
149 {
150 return m_maxFacesPerPrefix;
151 }
152
153 void
akmhoquefdbddb12014-05-02 18:35:19 -0500154 setLogDir(const std::string& ld)
akmhoque53353462014-04-22 08:43:45 -0500155 {
156 m_logDir = ld;
157 }
158
159 std::string
160 getLogDir()
161 {
162 return m_logDir;
163 }
164
165 void
akmhoquefdbddb12014-05-02 18:35:19 -0500166 setCertDir(const std::string& cd)
akmhoque53353462014-04-22 08:43:45 -0500167 {
168 m_certDir = cd;
169 }
170
akmhoquefdbddb12014-05-02 18:35:19 -0500171 const std::string&
akmhoque53353462014-04-22 08:43:45 -0500172 getCertDir()
173 {
174 return m_certDir;
175 }
176
177 void
akmhoquefdbddb12014-05-02 18:35:19 -0500178 setSeqFileDir(const std::string& ssfd)
akmhoque53353462014-04-22 08:43:45 -0500179 {
180 m_seqFileDir = ssfd;
181 }
182
akmhoquefdbddb12014-05-02 18:35:19 -0500183 const std::string&
akmhoque53353462014-04-22 08:43:45 -0500184 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
akmhoquefdbddb12014-05-02 18:35:19 -0500202 setDebugging(int32_t d)
akmhoque53353462014-04-22 08:43:45 -0500203 {
204 m_debugging = d;
205 }
206
akmhoquefdbddb12014-05-02 18:35:19 -0500207 int32_t
akmhoque53353462014-04-22 08:43:45 -0500208 getDebugging()
209 {
210 return m_debugging;
211 }
212
213 void
akmhoquefdbddb12014-05-02 18:35:19 -0500214 setIsHyperbolicCalc(int32_t ihc)
akmhoque53353462014-04-22 08:43:45 -0500215 {
216 m_isHyperbolicCalc = ihc;
217 }
218
akmhoquefdbddb12014-05-02 18:35:19 -0500219 int32_t
akmhoque53353462014-04-22 08:43:45 -0500220 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
akmhoquefdbddb12014-05-02 18:35:19 -0500255 int32_t
akmhoque53353462014-04-22 08:43:45 -0500256 getTunnelType()
257 {
258 return m_tunnelType;
259 }
260
261 void
262 setChronosyncSyncPrefix(const std::string& csp)
263 {
264 m_chronosyncSyncPrefix = csp;
265 }
266
akmhoquefdbddb12014-05-02 18:35:19 -0500267 const std::string&
akmhoque53353462014-04-22 08:43:45 -0500268 getChronosyncSyncPrefix()
269 {
270 return m_chronosyncSyncPrefix;
271 }
272
273 void
akmhoquefdbddb12014-05-02 18:35:19 -0500274 setChronosyncLsaPrefix(const std::string& clp)
akmhoque53353462014-04-22 08:43:45 -0500275 {
276 m_chronosyncLsaPrefix = clp;
277 }
278
akmhoquefdbddb12014-05-02 18:35:19 -0500279 const std::string&
akmhoque53353462014-04-22 08:43:45 -0500280 getChronosyncLsaPrefix()
281 {
282 return m_chronosyncLsaPrefix;
283 }
284
akmhoquefdbddb12014-05-02 18:35:19 -0500285 int32_t
akmhoque53353462014-04-22 08:43:45 -0500286 getInfoInterestInterval()
287 {
288 return m_infoInterestInterval;
289 }
290
291 void
akmhoquefdbddb12014-05-02 18:35:19 -0500292 setInfoInterestInterval(int32_t iii)
akmhoque53353462014-04-22 08:43:45 -0500293 {
294 m_infoInterestInterval = iii;
295 }
296
297private:
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
akmhoquefdbddb12014-05-02 18:35:19 -0500309 uint32_t m_interestRetryNumber;
310 int32_t m_interestResendTime;
311 int32_t m_infoInterestInterval;
312 int32_t m_lsaRefreshTime;
313 int64_t m_routerDeadInterval;
akmhoque53353462014-04-22 08:43:45 -0500314
akmhoquefdbddb12014-05-02 18:35:19 -0500315 int32_t m_maxFacesPerPrefix;
316 int32_t m_tunnelType;
317 int32_t m_detailedLogging;
akmhoque53353462014-04-22 08:43:45 -0500318
319 std::string m_certDir;
akmhoquefdbddb12014-05-02 18:35:19 -0500320 int32_t m_debugging;
akmhoque53353462014-04-22 08:43:45 -0500321 std::string m_seqFileDir;
322
akmhoquefdbddb12014-05-02 18:35:19 -0500323 int32_t m_isHyperbolicCalc;
akmhoque53353462014-04-22 08:43:45 -0500324 double m_corR;
325 double m_corTheta;
326
327 std::string m_logFile;
328 std::string m_logDir;
329
330};
331
332std::ostream&
333operator<<(std::ostream& os, ConfParameter& cfp);
334
335} // namespace nlsr
336
akmhoquefdbddb12014-05-02 18:35:19 -0500337#endif //CONF_PARAMETER_HPP