blob: cbf2af984899c8e1604ea375991a2de2bd794068 [file] [log] [blame]
akmhoque298385a2014-02-13 14:13:09 -06001#ifndef NLSR_HPP
2#define NLSR_HPP
3
4#include <ndn-cpp-dev/face.hpp>
5#include <ndn-cpp-dev/security/key-chain.hpp>
6#include <ndn-cpp-dev/util/scheduler.hpp>
7
8#include "nlsr_conf_param.hpp"
9#include "nlsr_adl.hpp"
10#include "nlsr_npl.hpp"
11#include "nlsr_im.hpp"
12#include "nlsr_dm.hpp"
13#include "nlsr_lsdb.hpp"
14#include "nlsr_sm.hpp"
15#include "nlsr_rt.hpp"
16#include "nlsr_npt.hpp"
17#include "nlsr_fib.hpp"
akmhoque85d88332014-02-17 21:11:21 -060018#include "nlsr_logger.hpp"
akmhoque66e66182014-02-21 17:56:03 -060019#include "nlsr_km.hpp"
akmhoque298385a2014-02-13 14:13:09 -060020//testing
21#include "nlsr_test.hpp"
22
akmhoque1fd8c1e2014-02-19 19:41:49 -060023namespace nlsr
akmhoque298385a2014-02-13 14:13:09 -060024{
akmhoque298385a2014-02-13 14:13:09 -060025
akmhoque1fd8c1e2014-02-19 19:41:49 -060026 using namespace ndn;
27 using namespace std;
akmhoque298385a2014-02-13 14:13:09 -060028
akmhoque1fd8c1e2014-02-19 19:41:49 -060029 class Nlsr
30 {
31 public:
32 Nlsr()
33 : io(ndn::make_shared<boost::asio::io_service>())
34 , nlsrFace(io)
35 , scheduler(*io)
36 , configFileName()
37 , confParam()
38 , adl()
39 , npl()
40 , im()
41 , dm()
42 , sm()
akmhoque66e66182014-02-21 17:56:03 -060043 , km()
akmhoque1fd8c1e2014-02-19 19:41:49 -060044 , nlsrLsdb()
45 , adjBuildCount(0)
46 , isBuildAdjLsaSheduled(0)
47 , isRouteCalculationScheduled(0)
48 , isRoutingTableCalculating(0)
49 , routingTable()
50 , npt()
51 , fib()
52 , nlsrLogger()
53 , nlsrTesting()
54 {
55 isDaemonProcess=false;
56 configFileName="nlsr.conf";
57 }
akmhoque298385a2014-02-13 14:13:09 -060058
akmhoque1fd8c1e2014-02-19 19:41:49 -060059 void nlsrRegistrationFailed(const ndn::Name& name);
akmhoque298385a2014-02-13 14:13:09 -060060
akmhoque1fd8c1e2014-02-19 19:41:49 -060061 void setInterestFilterNlsr(const string& name);
62 void startEventLoop();
akmhoque298385a2014-02-13 14:13:09 -060063
akmhoque1fd8c1e2014-02-19 19:41:49 -060064 int usage(const string& progname);
akmhoque298385a2014-02-13 14:13:09 -060065
akmhoque1fd8c1e2014-02-19 19:41:49 -060066 string getConfFileName()
67 {
68 return configFileName;
69 }
akmhoque298385a2014-02-13 14:13:09 -060070
akmhoque1fd8c1e2014-02-19 19:41:49 -060071 void setConfFileName(const string& fileName)
72 {
73 configFileName=fileName;
74 }
akmhoque298385a2014-02-13 14:13:09 -060075
akmhoque1fd8c1e2014-02-19 19:41:49 -060076 bool isSetDaemonProcess()
77 {
78 return isDaemonProcess;
79 }
akmhoque298385a2014-02-13 14:13:09 -060080
akmhoque1fd8c1e2014-02-19 19:41:49 -060081 void setIsDaemonProcess(bool value)
82 {
83 isDaemonProcess=value;
84 }
akmhoque298385a2014-02-13 14:13:09 -060085
akmhoque1fd8c1e2014-02-19 19:41:49 -060086 ConfParameter& getConfParameter()
87 {
88 return confParam;
89 }
akmhoque298385a2014-02-13 14:13:09 -060090
akmhoque1fd8c1e2014-02-19 19:41:49 -060091 Adl& getAdl()
92 {
93 return adl;
94 }
akmhoque298385a2014-02-13 14:13:09 -060095
akmhoque1fd8c1e2014-02-19 19:41:49 -060096 Npl& getNpl()
97 {
98 return npl;
99 }
akmhoque298385a2014-02-13 14:13:09 -0600100
akmhoque1fd8c1e2014-02-19 19:41:49 -0600101 ndn::shared_ptr<boost::asio::io_service>& getIo()
102 {
103 return io;
104 }
akmhoque298385a2014-02-13 14:13:09 -0600105
akmhoque1fd8c1e2014-02-19 19:41:49 -0600106 ndn::Scheduler& getScheduler()
107 {
108 return scheduler;
109 }
akmhoque298385a2014-02-13 14:13:09 -0600110
akmhoque1fd8c1e2014-02-19 19:41:49 -0600111 ndn::Face& getNlsrFace()
112 {
113 return nlsrFace;
114 }
akmhoque298385a2014-02-13 14:13:09 -0600115
akmhoque66e66182014-02-21 17:56:03 -0600116 KeyManager& getKeyManager()
akmhoque1fd8c1e2014-02-19 19:41:49 -0600117 {
akmhoque66e66182014-02-21 17:56:03 -0600118 return km;
akmhoque1fd8c1e2014-02-19 19:41:49 -0600119 }
akmhoque298385a2014-02-13 14:13:09 -0600120
akmhoque66e66182014-02-21 17:56:03 -0600121// ndn::KeyChain& getKeyChain()
122// {
123// return kChain;
124// }
125
akmhoque1fd8c1e2014-02-19 19:41:49 -0600126 interestManager& getIm()
127 {
128 return im;
129 }
akmhoque298385a2014-02-13 14:13:09 -0600130
akmhoque1fd8c1e2014-02-19 19:41:49 -0600131 DataManager& getDm()
132 {
133 return dm;
134 }
akmhoque298385a2014-02-13 14:13:09 -0600135
akmhoque1fd8c1e2014-02-19 19:41:49 -0600136 SequencingManager& getSm()
137 {
138 return sm;
139 }
akmhoque298385a2014-02-13 14:13:09 -0600140
akmhoque1fd8c1e2014-02-19 19:41:49 -0600141 Lsdb& getLsdb()
142 {
143 return nlsrLsdb;
144 }
akmhoque298385a2014-02-13 14:13:09 -0600145
akmhoque1fd8c1e2014-02-19 19:41:49 -0600146 RoutingTable& getRoutingTable()
147 {
148 return routingTable;
149 }
akmhoque298385a2014-02-13 14:13:09 -0600150
akmhoque1fd8c1e2014-02-19 19:41:49 -0600151 Npt& getNpt()
152 {
153 return npt;
154 }
akmhoque298385a2014-02-13 14:13:09 -0600155
akmhoque1fd8c1e2014-02-19 19:41:49 -0600156 Fib& getFib()
157 {
158 return fib;
159 }
akmhoque298385a2014-02-13 14:13:09 -0600160
akmhoque1fd8c1e2014-02-19 19:41:49 -0600161 long int getAdjBuildCount()
162 {
163 return adjBuildCount;
164 }
akmhoque298385a2014-02-13 14:13:09 -0600165
akmhoque1fd8c1e2014-02-19 19:41:49 -0600166 void incrementAdjBuildCount()
167 {
168 adjBuildCount++;
169 }
akmhoque298385a2014-02-13 14:13:09 -0600170
akmhoque1fd8c1e2014-02-19 19:41:49 -0600171 void setAdjBuildCount(long int abc)
172 {
173 adjBuildCount=abc;
174 }
akmhoque298385a2014-02-13 14:13:09 -0600175
akmhoque1fd8c1e2014-02-19 19:41:49 -0600176 int getIsBuildAdjLsaSheduled()
177 {
178 return isBuildAdjLsaSheduled;
179 }
akmhoque298385a2014-02-13 14:13:09 -0600180
akmhoque1fd8c1e2014-02-19 19:41:49 -0600181 void setIsBuildAdjLsaSheduled(int iabls)
182 {
183 isBuildAdjLsaSheduled=iabls;
184 }
akmhoque298385a2014-02-13 14:13:09 -0600185
akmhoque1fd8c1e2014-02-19 19:41:49 -0600186 NlsrTest& getNlsrTesting()
187 {
188 return nlsrTesting;
189 }
akmhoque298385a2014-02-13 14:13:09 -0600190
akmhoque1fd8c1e2014-02-19 19:41:49 -0600191 void setApiPort(int ap)
192 {
193 apiPort=ap;
194 }
akmhoque298385a2014-02-13 14:13:09 -0600195
akmhoque1fd8c1e2014-02-19 19:41:49 -0600196 int getApiPort()
197 {
198 return apiPort;
199 }
akmhoque298385a2014-02-13 14:13:09 -0600200
akmhoque1fd8c1e2014-02-19 19:41:49 -0600201 int getIsRoutingTableCalculating()
202 {
203 return isRoutingTableCalculating;
204 }
akmhoque85d88332014-02-17 21:11:21 -0600205
akmhoque1fd8c1e2014-02-19 19:41:49 -0600206 void setIsRoutingTableCalculating(int irtc)
207 {
208 isRoutingTableCalculating=irtc;
209 }
akmhoque298385a2014-02-13 14:13:09 -0600210
akmhoque1fd8c1e2014-02-19 19:41:49 -0600211 int getIsRouteCalculationScheduled()
212 {
213 return isRouteCalculationScheduled;
214 }
akmhoque298385a2014-02-13 14:13:09 -0600215
akmhoque1fd8c1e2014-02-19 19:41:49 -0600216 void setIsRouteCalculationScheduled(int ircs)
217 {
218 isRouteCalculationScheduled=ircs;
219 }
akmhoque298385a2014-02-13 14:13:09 -0600220
akmhoque1fd8c1e2014-02-19 19:41:49 -0600221 NlsrLogger& getNlsrLogger()
222 {
223 return nlsrLogger;
224 }
225
226 private:
227 ConfParameter confParam;
228 Adl adl;
229 Npl npl;
230 ndn::shared_ptr<boost::asio::io_service> io;
231 ndn::Scheduler scheduler;
232 ndn::Face nlsrFace;
akmhoque66e66182014-02-21 17:56:03 -0600233// ndn::KeyChain kChain;
akmhoque1fd8c1e2014-02-19 19:41:49 -0600234 interestManager im;
235 DataManager dm;
236 SequencingManager sm;
akmhoque66e66182014-02-21 17:56:03 -0600237 KeyManager km;
akmhoque1fd8c1e2014-02-19 19:41:49 -0600238 bool isDaemonProcess;
239 string configFileName;
240 int apiPort;
241
242 Lsdb nlsrLsdb;
243 RoutingTable routingTable;
244 Npt npt;
245 Fib fib;
246 NlsrLogger nlsrLogger;
247
248 long int adjBuildCount;
249 int isBuildAdjLsaSheduled;
250 int isRouteCalculationScheduled;
251 int isRoutingTableCalculating;
252
253 NlsrTest nlsrTesting;
254
255
256 };
akmhoque298385a2014-02-13 14:13:09 -0600257
akmhoqueb1710aa2014-02-19 17:13:36 -0600258} //namespace nlsr
259
akmhoque298385a2014-02-13 14:13:09 -0600260#endif