blob: 5b5b560b6b8e29628b9d4ad1bc3f2f9eda825fe4 [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>
akmhoque31d1d4b2014-05-05 22:08:14 -05006#include <ndn-cxx/common.hpp>
7#include <ndn-cxx/face.hpp>
akmhoque53353462014-04-22 08:43:45 -05008
9namespace nlsr {
10class ConfParameter
11{
12
13public:
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 {
akmhoque31d1d4b2014-05-05 22:08:14 -050037 m_routerName = ndn::Name(rn);
akmhoque53353462014-04-22 08:43:45 -050038 }
39
akmhoque31d1d4b2014-05-05 22:08:14 -050040 const ndn::Name&
akmhoque53353462014-04-22 08:43:45 -050041 getRouterName()
42 {
43 return m_routerName;
44 }
45
46 void
47 setSiteName(const std::string& sn)
48 {
akmhoque31d1d4b2014-05-05 22:08:14 -050049 m_siteName = ndn::Name(sn);
akmhoque53353462014-04-22 08:43:45 -050050 }
51
akmhoque31d1d4b2014-05-05 22:08:14 -050052 const ndn::Name&
akmhoque53353462014-04-22 08:43:45 -050053 getSiteName()
54 {
55 return m_siteName;
56 }
57
58 void
59 setNetwork(const std::string& nn)
60 {
akmhoque31d1d4b2014-05-05 22:08:14 -050061 m_network = ndn::Name(nn);
akmhoque53353462014-04-22 08:43:45 -050062 }
63
akmhoque31d1d4b2014-05-05 22:08:14 -050064 const ndn::Name&
akmhoque53353462014-04-22 08:43:45 -050065 getNetwork()
66 {
67 return m_network;
68 }
69
70 void
71 buildRouterPrefix()
72 {
akmhoque31d1d4b2014-05-05 22:08:14 -050073 //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);
akmhoque53353462014-04-22 08:43:45 -050077 }
78
akmhoque31d1d4b2014-05-05 22:08:14 -050079 const ndn::Name&
akmhoque53353462014-04-22 08:43:45 -050080 getRouterPrefix()
81 {
82 return m_routerPrefix;
83 }
84
akmhoque31d1d4b2014-05-05 22:08:14 -050085 const ndn::Name&
akmhoque53353462014-04-22 08:43:45 -050086 getRootKeyPrefix()
87 {
88 return m_rootKeyPrefix;
89 }
90
91 void
92 setRootKeyPrefix(std::string rkp)
93 {
akmhoque31d1d4b2014-05-05 22:08:14 -050094 m_rootKeyPrefix = ndn::Name(rkp);
akmhoque53353462014-04-22 08:43:45 -050095 }
96
97 void
akmhoquefdbddb12014-05-02 18:35:19 -050098 setInterestRetryNumber(uint32_t irn)
akmhoque53353462014-04-22 08:43:45 -050099 {
100 m_interestRetryNumber = irn;
101 }
102
akmhoquefdbddb12014-05-02 18:35:19 -0500103 uint32_t
akmhoque53353462014-04-22 08:43:45 -0500104 getInterestRetryNumber()
105 {
106 return m_interestRetryNumber;
107 }
108
109 void
akmhoquefdbddb12014-05-02 18:35:19 -0500110 setInterestResendTime(int32_t irt)
akmhoque53353462014-04-22 08:43:45 -0500111 {
112 m_interestResendTime = irt;
113 }
114
akmhoquefdbddb12014-05-02 18:35:19 -0500115 int32_t
akmhoque53353462014-04-22 08:43:45 -0500116 getInterestResendTime()
117 {
118 return m_interestResendTime;
119 }
120
121 void
akmhoquefdbddb12014-05-02 18:35:19 -0500122 setLsaRefreshTime(int32_t lrt)
akmhoque53353462014-04-22 08:43:45 -0500123 {
124 m_lsaRefreshTime = lrt;
125 m_routerDeadInterval = 2 * m_lsaRefreshTime;
126 }
127
akmhoquefdbddb12014-05-02 18:35:19 -0500128 int32_t
akmhoque53353462014-04-22 08:43:45 -0500129 getLsaRefreshTime()
130 {
131 return m_lsaRefreshTime;
132 }
133
134 void
akmhoquefdbddb12014-05-02 18:35:19 -0500135 setRouterDeadInterval(int64_t rdt)
akmhoque53353462014-04-22 08:43:45 -0500136 {
137 m_routerDeadInterval = rdt;
138 }
139
akmhoquefdbddb12014-05-02 18:35:19 -0500140 int64_t
akmhoque53353462014-04-22 08:43:45 -0500141 getRouterDeadInterval()
142 {
143 return m_routerDeadInterval;
144 }
145
146 void
akmhoquefdbddb12014-05-02 18:35:19 -0500147 setMaxFacesPerPrefix(int32_t mfpp)
akmhoque53353462014-04-22 08:43:45 -0500148 {
149 m_maxFacesPerPrefix = mfpp;
150 }
151
akmhoquefdbddb12014-05-02 18:35:19 -0500152 int32_t
akmhoque53353462014-04-22 08:43:45 -0500153 getMaxFacesPerPrefix()
154 {
155 return m_maxFacesPerPrefix;
156 }
157
158 void
akmhoquefdbddb12014-05-02 18:35:19 -0500159 setLogDir(const std::string& ld)
akmhoque53353462014-04-22 08:43:45 -0500160 {
161 m_logDir = ld;
162 }
163
164 std::string
165 getLogDir()
166 {
167 return m_logDir;
168 }
169
170 void
akmhoquefdbddb12014-05-02 18:35:19 -0500171 setCertDir(const std::string& cd)
akmhoque53353462014-04-22 08:43:45 -0500172 {
173 m_certDir = cd;
174 }
175
akmhoquefdbddb12014-05-02 18:35:19 -0500176 const std::string&
akmhoque53353462014-04-22 08:43:45 -0500177 getCertDir()
178 {
179 return m_certDir;
180 }
181
182 void
akmhoquefdbddb12014-05-02 18:35:19 -0500183 setSeqFileDir(const std::string& ssfd)
akmhoque53353462014-04-22 08:43:45 -0500184 {
185 m_seqFileDir = ssfd;
186 }
187
akmhoquefdbddb12014-05-02 18:35:19 -0500188 const std::string&
akmhoque53353462014-04-22 08:43:45 -0500189 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
akmhoquefdbddb12014-05-02 18:35:19 -0500207 setDebugging(int32_t d)
akmhoque53353462014-04-22 08:43:45 -0500208 {
209 m_debugging = d;
210 }
211
akmhoquefdbddb12014-05-02 18:35:19 -0500212 int32_t
akmhoque53353462014-04-22 08:43:45 -0500213 getDebugging()
214 {
215 return m_debugging;
216 }
217
218 void
akmhoquefdbddb12014-05-02 18:35:19 -0500219 setIsHyperbolicCalc(int32_t ihc)
akmhoque53353462014-04-22 08:43:45 -0500220 {
221 m_isHyperbolicCalc = ihc;
222 }
223
akmhoquefdbddb12014-05-02 18:35:19 -0500224 int32_t
akmhoque53353462014-04-22 08:43:45 -0500225 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
akmhoquefdbddb12014-05-02 18:35:19 -0500260 int32_t
akmhoque53353462014-04-22 08:43:45 -0500261 getTunnelType()
262 {
263 return m_tunnelType;
264 }
265
266 void
267 setChronosyncSyncPrefix(const std::string& csp)
268 {
akmhoque31d1d4b2014-05-05 22:08:14 -0500269 m_chronosyncSyncPrefix = ndn::Name(csp);
akmhoque53353462014-04-22 08:43:45 -0500270 }
271
akmhoque31d1d4b2014-05-05 22:08:14 -0500272 const ndn::Name&
akmhoque53353462014-04-22 08:43:45 -0500273 getChronosyncSyncPrefix()
274 {
275 return m_chronosyncSyncPrefix;
276 }
277
278 void
akmhoquefdbddb12014-05-02 18:35:19 -0500279 setChronosyncLsaPrefix(const std::string& clp)
akmhoque53353462014-04-22 08:43:45 -0500280 {
akmhoque31d1d4b2014-05-05 22:08:14 -0500281 m_chronosyncLsaPrefix = ndn::Name(clp);
akmhoque53353462014-04-22 08:43:45 -0500282 }
283
akmhoque31d1d4b2014-05-05 22:08:14 -0500284 const ndn::Name&
akmhoque53353462014-04-22 08:43:45 -0500285 getChronosyncLsaPrefix()
286 {
287 return m_chronosyncLsaPrefix;
288 }
289
akmhoquefdbddb12014-05-02 18:35:19 -0500290 int32_t
akmhoque53353462014-04-22 08:43:45 -0500291 getInfoInterestInterval()
292 {
293 return m_infoInterestInterval;
294 }
295
296 void
akmhoquefdbddb12014-05-02 18:35:19 -0500297 setInfoInterestInterval(int32_t iii)
akmhoque53353462014-04-22 08:43:45 -0500298 {
299 m_infoInterestInterval = iii;
300 }
301
302private:
akmhoque31d1d4b2014-05-05 22:08:14 -0500303 ndn::Name m_routerName;
304 ndn::Name m_siteName;
305 ndn::Name m_network;
akmhoque53353462014-04-22 08:43:45 -0500306
akmhoque31d1d4b2014-05-05 22:08:14 -0500307 ndn::Name m_routerPrefix;
308 ndn::Name m_lsaRouterPrefix;
akmhoque53353462014-04-22 08:43:45 -0500309
akmhoque31d1d4b2014-05-05 22:08:14 -0500310 ndn::Name m_chronosyncSyncPrefix;
311 ndn::Name m_chronosyncLsaPrefix;
312 ndn::Name m_rootKeyPrefix;
akmhoque53353462014-04-22 08:43:45 -0500313
akmhoquefdbddb12014-05-02 18:35:19 -0500314 uint32_t m_interestRetryNumber;
315 int32_t m_interestResendTime;
316 int32_t m_infoInterestInterval;
317 int32_t m_lsaRefreshTime;
318 int64_t m_routerDeadInterval;
akmhoque53353462014-04-22 08:43:45 -0500319
akmhoquefdbddb12014-05-02 18:35:19 -0500320 int32_t m_maxFacesPerPrefix;
321 int32_t m_tunnelType;
322 int32_t m_detailedLogging;
akmhoque53353462014-04-22 08:43:45 -0500323
324 std::string m_certDir;
akmhoquefdbddb12014-05-02 18:35:19 -0500325 int32_t m_debugging;
akmhoque53353462014-04-22 08:43:45 -0500326 std::string m_seqFileDir;
327
akmhoquefdbddb12014-05-02 18:35:19 -0500328 int32_t m_isHyperbolicCalc;
akmhoque53353462014-04-22 08:43:45 -0500329 double m_corR;
330 double m_corTheta;
331
332 std::string m_logFile;
333 std::string m_logDir;
334
335};
336
337std::ostream&
338operator<<(std::ostream& os, ConfParameter& cfp);
339
340} // namespace nlsr
341
akmhoquefdbddb12014-05-02 18:35:19 -0500342#endif //CONF_PARAMETER_HPP