blob: ddfa1a0e8a21d22fd457ff141c089e55bc368d6c [file] [log] [blame]
akmhoque298385a2014-02-13 14:13:09 -06001#ifndef CONF_PARAM_HPP
2#define CONF_PARAM_HPP
3
4#include<iostream>
5
akmhoque1fd8c1e2014-02-19 19:41:49 -06006namespace nlsr
7{
akmhoqueb1710aa2014-02-19 17:13:36 -06008
akmhoque5a44dd42014-03-12 18:11:32 -05009 using namespace std;
akmhoque298385a2014-02-13 14:13:09 -060010
akmhoque5a44dd42014-03-12 18:11:32 -050011 class ConfParameter
12 {
13
14 public:
15 ConfParameter()
akmhoque05d5fcf2014-04-15 14:58:45 -050016 : m_chronosyncSyncPrefix("ndn/nlsr/sync")
17 , m_chronosyncLsaPrefix("/ndn/nlsr/LSA")
18 , m_rootKeyPrefix("/ndn/keys")
akmhoque5a44dd42014-03-12 18:11:32 -050019 , isStrictHierchicalKeyCheck(0)
akmhoque05d5fcf2014-04-15 14:58:45 -050020 , m_interestRetryNumber(3)
21 , m_interestResendTime(5)
22 , m_infoInterestInterval(60)
23 , m_lsaRefreshTime(1800)
24 , m_routerDeadInterval(3600)
25 , m_maxFacesPerPrefix(0)
26 , m_tunnelType(0)
27 , m_detailedLogging(0)
28 , m_certDir()
29 , m_debugging(0)
akmhoque5a44dd42014-03-12 18:11:32 -050030 , isHyperbolicCalc(0)
akmhoque05d5fcf2014-04-15 14:58:45 -050031 , m_seqFileDir()
32 , m_corR(0)
33 , m_corTheta(0)
akmhoque5a44dd42014-03-12 18:11:32 -050034 {}
35
36 void setRouterName(const string& rn)
akmhoque1fd8c1e2014-02-19 19:41:49 -060037 {
akmhoque05d5fcf2014-04-15 14:58:45 -050038 m_routerName=rn;
akmhoque5a44dd42014-03-12 18:11:32 -050039 }
akmhoque298385a2014-02-13 14:13:09 -060040
akmhoque5a44dd42014-03-12 18:11:32 -050041 string getRouterName()
42 {
akmhoque05d5fcf2014-04-15 14:58:45 -050043 return m_routerName;
akmhoque5a44dd42014-03-12 18:11:32 -050044 }
akmhoque298385a2014-02-13 14:13:09 -060045
akmhoque5a44dd42014-03-12 18:11:32 -050046 void setSiteName(const string& sn)
47 {
akmhoque05d5fcf2014-04-15 14:58:45 -050048 m_siteName=sn;
akmhoque5a44dd42014-03-12 18:11:32 -050049 }
akmhoque298385a2014-02-13 14:13:09 -060050
akmhoque5a44dd42014-03-12 18:11:32 -050051 string getSiteName()
52 {
akmhoque05d5fcf2014-04-15 14:58:45 -050053 return m_siteName;
akmhoque5a44dd42014-03-12 18:11:32 -050054 }
akmhoque298385a2014-02-13 14:13:09 -060055
akmhoque5a44dd42014-03-12 18:11:32 -050056 void setNetwork(const string& nn)
57 {
akmhoque05d5fcf2014-04-15 14:58:45 -050058 m_network=nn;
akmhoque5a44dd42014-03-12 18:11:32 -050059 }
akmhoque298385a2014-02-13 14:13:09 -060060
akmhoque5a44dd42014-03-12 18:11:32 -050061 string getNetwork()
62 {
akmhoque05d5fcf2014-04-15 14:58:45 -050063 return m_network;
akmhoque5a44dd42014-03-12 18:11:32 -050064 }
akmhoque298385a2014-02-13 14:13:09 -060065
akmhoque5a44dd42014-03-12 18:11:32 -050066 void buildRouterPrefix()
67 {
akmhoque05d5fcf2014-04-15 14:58:45 -050068 m_routerPrefix="/"+m_network+"/"+m_siteName+"/"+m_routerName;
akmhoque5a44dd42014-03-12 18:11:32 -050069 }
akmhoque298385a2014-02-13 14:13:09 -060070
akmhoque5a44dd42014-03-12 18:11:32 -050071 string getRouterPrefix()
72 {
akmhoque05d5fcf2014-04-15 14:58:45 -050073 return m_routerPrefix;
akmhoque5a44dd42014-03-12 18:11:32 -050074 }
akmhoque298385a2014-02-13 14:13:09 -060075
akmhoque5a44dd42014-03-12 18:11:32 -050076 string getRootKeyPrefix()
77 {
akmhoque05d5fcf2014-04-15 14:58:45 -050078 return m_rootKeyPrefix;
akmhoque5a44dd42014-03-12 18:11:32 -050079 }
akmhoque298385a2014-02-13 14:13:09 -060080
akmhoque5a44dd42014-03-12 18:11:32 -050081 void setRootKeyPrefix(string rkp)
82 {
akmhoque05d5fcf2014-04-15 14:58:45 -050083 m_rootKeyPrefix=rkp;
akmhoque5a44dd42014-03-12 18:11:32 -050084 }
akmhoque298385a2014-02-13 14:13:09 -060085
akmhoque5a44dd42014-03-12 18:11:32 -050086 void setInterestRetryNumber(int irn)
87 {
akmhoque05d5fcf2014-04-15 14:58:45 -050088 m_interestRetryNumber=irn;
akmhoque5a44dd42014-03-12 18:11:32 -050089 }
akmhoque2bb198e2014-02-28 11:46:27 -060090
akmhoque5a44dd42014-03-12 18:11:32 -050091 int getInterestRetryNumber()
92 {
akmhoque05d5fcf2014-04-15 14:58:45 -050093 return m_interestRetryNumber;
akmhoque5a44dd42014-03-12 18:11:32 -050094 }
akmhoque2bb198e2014-02-28 11:46:27 -060095
akmhoque5a44dd42014-03-12 18:11:32 -050096 void setInterestResendTime(int irt)
97 {
akmhoque05d5fcf2014-04-15 14:58:45 -050098 m_interestResendTime=irt;
akmhoque5a44dd42014-03-12 18:11:32 -050099 }
akmhoque298385a2014-02-13 14:13:09 -0600100
akmhoque5a44dd42014-03-12 18:11:32 -0500101 int getInterestResendTime()
102 {
akmhoque05d5fcf2014-04-15 14:58:45 -0500103 return m_interestResendTime;
akmhoque5a44dd42014-03-12 18:11:32 -0500104 }
akmhoque298385a2014-02-13 14:13:09 -0600105
akmhoque5a44dd42014-03-12 18:11:32 -0500106 void setLsaRefreshTime(int lrt)
107 {
akmhoque05d5fcf2014-04-15 14:58:45 -0500108 m_lsaRefreshTime=lrt;
109 m_routerDeadInterval=2*m_lsaRefreshTime;
akmhoque5a44dd42014-03-12 18:11:32 -0500110 }
akmhoque298385a2014-02-13 14:13:09 -0600111
akmhoque5a44dd42014-03-12 18:11:32 -0500112 int getLsaRefreshTime()
113 {
akmhoque05d5fcf2014-04-15 14:58:45 -0500114 return m_lsaRefreshTime;
akmhoque5a44dd42014-03-12 18:11:32 -0500115 }
akmhoque298385a2014-02-13 14:13:09 -0600116
akmhoque5a44dd42014-03-12 18:11:32 -0500117 void setRouterDeadInterval(int rdt)
118 {
akmhoque05d5fcf2014-04-15 14:58:45 -0500119 m_routerDeadInterval=rdt;
akmhoque5a44dd42014-03-12 18:11:32 -0500120 }
akmhoque298385a2014-02-13 14:13:09 -0600121
akmhoque5a44dd42014-03-12 18:11:32 -0500122 long int getRouterDeadInterval()
123 {
akmhoque05d5fcf2014-04-15 14:58:45 -0500124 return m_routerDeadInterval;
akmhoque5a44dd42014-03-12 18:11:32 -0500125 }
akmhoque298385a2014-02-13 14:13:09 -0600126
akmhoque5a44dd42014-03-12 18:11:32 -0500127 void setMaxFacesPerPrefix(int mfpp)
128 {
akmhoque05d5fcf2014-04-15 14:58:45 -0500129 m_maxFacesPerPrefix=mfpp;
akmhoque5a44dd42014-03-12 18:11:32 -0500130 }
akmhoque298385a2014-02-13 14:13:09 -0600131
akmhoque5a44dd42014-03-12 18:11:32 -0500132 int getMaxFacesPerPrefix()
133 {
akmhoque05d5fcf2014-04-15 14:58:45 -0500134 return m_maxFacesPerPrefix;
akmhoque5a44dd42014-03-12 18:11:32 -0500135 }
akmhoque298385a2014-02-13 14:13:09 -0600136
akmhoque5a44dd42014-03-12 18:11:32 -0500137 void setLogDir(string ld)
138 {
akmhoque05d5fcf2014-04-15 14:58:45 -0500139 m_logDir=ld;
akmhoque5a44dd42014-03-12 18:11:32 -0500140 }
akmhoque298385a2014-02-13 14:13:09 -0600141
akmhoque5a44dd42014-03-12 18:11:32 -0500142 string getLogDir()
143 {
akmhoque05d5fcf2014-04-15 14:58:45 -0500144 return m_logDir;
akmhoque5a44dd42014-03-12 18:11:32 -0500145 }
akmhoque298385a2014-02-13 14:13:09 -0600146
akmhoque5a44dd42014-03-12 18:11:32 -0500147 void setCertDir(std::string cd)
148 {
akmhoque05d5fcf2014-04-15 14:58:45 -0500149 m_certDir=cd;
akmhoque5a44dd42014-03-12 18:11:32 -0500150 }
akmhoque298385a2014-02-13 14:13:09 -0600151
akmhoque5a44dd42014-03-12 18:11:32 -0500152 std::string getCertDir()
153 {
akmhoque05d5fcf2014-04-15 14:58:45 -0500154 return m_certDir;
akmhoque5a44dd42014-03-12 18:11:32 -0500155 }
akmhoque298385a2014-02-13 14:13:09 -0600156
akmhoque5a44dd42014-03-12 18:11:32 -0500157 void setSeqFileDir(string ssfd)
158 {
akmhoque05d5fcf2014-04-15 14:58:45 -0500159 m_seqFileDir=ssfd;
akmhoque5a44dd42014-03-12 18:11:32 -0500160 }
akmhoque2bb198e2014-02-28 11:46:27 -0600161
akmhoque5a44dd42014-03-12 18:11:32 -0500162 string getSeqFileDir()
163 {
akmhoque05d5fcf2014-04-15 14:58:45 -0500164 return m_seqFileDir;
akmhoque5a44dd42014-03-12 18:11:32 -0500165 }
akmhoque2bb198e2014-02-28 11:46:27 -0600166
akmhoque5a44dd42014-03-12 18:11:32 -0500167 void setDetailedLogging(int dl)
168 {
akmhoque05d5fcf2014-04-15 14:58:45 -0500169 m_detailedLogging=dl;
akmhoque5a44dd42014-03-12 18:11:32 -0500170 }
akmhoque298385a2014-02-13 14:13:09 -0600171
akmhoque5a44dd42014-03-12 18:11:32 -0500172 int getDetailedLogging()
173 {
akmhoque05d5fcf2014-04-15 14:58:45 -0500174 return m_detailedLogging;
akmhoque5a44dd42014-03-12 18:11:32 -0500175 }
akmhoque298385a2014-02-13 14:13:09 -0600176
akmhoque5a44dd42014-03-12 18:11:32 -0500177 void setDebugging(int d)
178 {
akmhoque05d5fcf2014-04-15 14:58:45 -0500179 m_debugging=d;
akmhoque5a44dd42014-03-12 18:11:32 -0500180 }
akmhoque298385a2014-02-13 14:13:09 -0600181
akmhoque5a44dd42014-03-12 18:11:32 -0500182 int getDebugging()
183 {
akmhoque05d5fcf2014-04-15 14:58:45 -0500184 return m_debugging;
akmhoque5a44dd42014-03-12 18:11:32 -0500185 }
akmhoque298385a2014-02-13 14:13:09 -0600186
akmhoque05d5fcf2014-04-15 14:58:45 -0500187 void setIsHyperbolicCalc(bool ihc)
akmhoque5a44dd42014-03-12 18:11:32 -0500188 {
189 isHyperbolicCalc=ihc;
190 }
akmhoque298385a2014-02-13 14:13:09 -0600191
akmhoque05d5fcf2014-04-15 14:58:45 -0500192 bool getIsHyperbolicCalc()
akmhoque5a44dd42014-03-12 18:11:32 -0500193 {
194 return isHyperbolicCalc;
195 }
akmhoque298385a2014-02-13 14:13:09 -0600196
akmhoque5a44dd42014-03-12 18:11:32 -0500197 void setCorR(double cr)
198 {
akmhoque05d5fcf2014-04-15 14:58:45 -0500199 m_corR=cr;
akmhoque5a44dd42014-03-12 18:11:32 -0500200 }
akmhoque298385a2014-02-13 14:13:09 -0600201
akmhoque5a44dd42014-03-12 18:11:32 -0500202 double getCorR()
203 {
akmhoque05d5fcf2014-04-15 14:58:45 -0500204 return m_corR;
akmhoque5a44dd42014-03-12 18:11:32 -0500205 }
akmhoque298385a2014-02-13 14:13:09 -0600206
akmhoque5a44dd42014-03-12 18:11:32 -0500207 void setCorTheta(double ct)
208 {
akmhoque05d5fcf2014-04-15 14:58:45 -0500209 m_corTheta=ct;
akmhoque5a44dd42014-03-12 18:11:32 -0500210 }
akmhoque298385a2014-02-13 14:13:09 -0600211
akmhoque5a44dd42014-03-12 18:11:32 -0500212 double getCorTheta()
213 {
akmhoque05d5fcf2014-04-15 14:58:45 -0500214 return m_corTheta;
akmhoque5a44dd42014-03-12 18:11:32 -0500215 }
akmhoque298385a2014-02-13 14:13:09 -0600216
akmhoque5a44dd42014-03-12 18:11:32 -0500217 void setTunnelType(int tt)
218 {
akmhoque05d5fcf2014-04-15 14:58:45 -0500219 m_tunnelType=tt;
akmhoque5a44dd42014-03-12 18:11:32 -0500220 }
akmhoque298385a2014-02-13 14:13:09 -0600221
akmhoque5a44dd42014-03-12 18:11:32 -0500222 int getTunnelType()
223 {
akmhoque05d5fcf2014-04-15 14:58:45 -0500224 return m_tunnelType;
akmhoque5a44dd42014-03-12 18:11:32 -0500225 }
akmhoque298385a2014-02-13 14:13:09 -0600226
akmhoque5a44dd42014-03-12 18:11:32 -0500227 void setChronosyncSyncPrefix(const string& csp)
228 {
akmhoque05d5fcf2014-04-15 14:58:45 -0500229 m_chronosyncSyncPrefix=csp;
akmhoque5a44dd42014-03-12 18:11:32 -0500230 }
akmhoque298385a2014-02-13 14:13:09 -0600231
akmhoque5a44dd42014-03-12 18:11:32 -0500232 string getChronosyncSyncPrefix()
233 {
akmhoque05d5fcf2014-04-15 14:58:45 -0500234 return m_chronosyncSyncPrefix;
akmhoque5a44dd42014-03-12 18:11:32 -0500235 }
akmhoque298385a2014-02-13 14:13:09 -0600236
akmhoque5a44dd42014-03-12 18:11:32 -0500237 void setChronosyncLsaPrefix(string clp)
238 {
akmhoque05d5fcf2014-04-15 14:58:45 -0500239 m_chronosyncLsaPrefix=clp;
akmhoque5a44dd42014-03-12 18:11:32 -0500240 }
akmhoque2bb198e2014-02-28 11:46:27 -0600241
akmhoque5a44dd42014-03-12 18:11:32 -0500242 string getChronosyncLsaPrefix()
243 {
akmhoque05d5fcf2014-04-15 14:58:45 -0500244 return m_chronosyncLsaPrefix;
akmhoque5a44dd42014-03-12 18:11:32 -0500245 }
akmhoque2bb198e2014-02-28 11:46:27 -0600246
akmhoque5a44dd42014-03-12 18:11:32 -0500247 int getInfoInterestInterval()
248 {
akmhoque05d5fcf2014-04-15 14:58:45 -0500249 return m_infoInterestInterval;
akmhoque5a44dd42014-03-12 18:11:32 -0500250 }
akmhoque298385a2014-02-13 14:13:09 -0600251
akmhoque5a44dd42014-03-12 18:11:32 -0500252 void setInfoInterestInterval(int iii)
253 {
akmhoque05d5fcf2014-04-15 14:58:45 -0500254 m_infoInterestInterval=iii;
akmhoque5a44dd42014-03-12 18:11:32 -0500255 }
akmhoque298385a2014-02-13 14:13:09 -0600256
akmhoque5a44dd42014-03-12 18:11:32 -0500257 private:
akmhoque05d5fcf2014-04-15 14:58:45 -0500258 string m_routerName;
259 string m_siteName;
260 string m_network;
akmhoque298385a2014-02-13 14:13:09 -0600261
akmhoque05d5fcf2014-04-15 14:58:45 -0500262 string m_routerPrefix;
263 string m_lsaRouterPrefix;
akmhoque298385a2014-02-13 14:13:09 -0600264
akmhoque05d5fcf2014-04-15 14:58:45 -0500265 string m_chronosyncSyncPrefix;
266 string m_chronosyncLsaPrefix;
akmhoque298385a2014-02-13 14:13:09 -0600267
akmhoque05d5fcf2014-04-15 14:58:45 -0500268 string m_rootKeyPrefix;
akmhoque2bb198e2014-02-28 11:46:27 -0600269
akmhoque05d5fcf2014-04-15 14:58:45 -0500270 int m_interestRetryNumber;
271 int m_interestResendTime;
272 int m_infoInterestInterval;
273 int m_lsaRefreshTime;
274 int m_routerDeadInterval;
akmhoque1fd8c1e2014-02-19 19:41:49 -0600275
akmhoque05d5fcf2014-04-15 14:58:45 -0500276 int m_maxFacesPerPrefix;
277 string m_logDir;
278 string m_certDir;
279 string m_seqFileDir;
280 string m_logFile;
281 int m_detailedLogging;
282 int m_debugging;
akmhoque1fd8c1e2014-02-19 19:41:49 -0600283
akmhoque05d5fcf2014-04-15 14:58:45 -0500284 bool isHyperbolicCalc;
285 double m_corR;
286 double m_corTheta;
akmhoque1fd8c1e2014-02-19 19:41:49 -0600287
akmhoque05d5fcf2014-04-15 14:58:45 -0500288 int m_tunnelType;
289 bool isStrictHierchicalKeyCheck;
akmhoque1fd8c1e2014-02-19 19:41:49 -0600290
akmhoque5a44dd42014-03-12 18:11:32 -0500291 };
akmhoque1fd8c1e2014-02-19 19:41:49 -0600292
akmhoque5a44dd42014-03-12 18:11:32 -0500293 std::ostream&
akmhoque05d5fcf2014-04-15 14:58:45 -0500294 operator << (std::ostream& os, ConfParameter& cfp);
akmhoque298385a2014-02-13 14:13:09 -0600295
akmhoqueb1710aa2014-02-19 17:13:36 -0600296} // namespace nlsr
297
akmhoque298385a2014-02-13 14:13:09 -0600298#endif