blob: 5ff2ef750b915fbc15d4b139bed17dd0235a4192 [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"
18//testing
19#include "nlsr_test.hpp"
20
21
22
23using namespace ndn;
24using namespace std;
25
26class nlsr
27{
28public:
29 nlsr()
30 : io(ndn::make_shared<boost::asio::io_service>())
31 , nlsrFace(io)
32 , scheduler(*io)
33 , configFileName()
34 , confParam()
35 , adl()
36 , npl()
37 , im()
38 , dm()
39 , sm()
40 , nlsrLsdb()
41 , adjBuildCount(0)
42 , isBuildAdjLsaSheduled(0)
43 , isRouteCalculationScheduled(0)
44 , isRoutingTableCalculating(0)
45 , routingTable()
46 , npt()
47 , fib()
48 , nlsrTesting()
49 {
50 isDaemonProcess=false;
51 configFileName="nlsr.conf";
52 }
53
54 void nlsrRegistrationFailed(const ndn::Name& name);
55
56 void setInterestFilterNlsr(const string& name);
57 void startEventLoop();
58
59 int usage(const string& progname);
60
61 string getConfFileName()
62 {
63 return configFileName;
64 }
65
66 void setConfFileName(const string& fileName)
67 {
68 configFileName=fileName;
69 }
70
71 bool isSetDaemonProcess()
72 {
73 return isDaemonProcess;
74 }
75
76 void setIsDaemonProcess(bool value)
77 {
78 isDaemonProcess=value;
79 }
80
81 ConfParameter& getConfParameter(){
82 return confParam;
83 }
84
85 Adl& getAdl(){
86 return adl;
87 }
88
89 Npl& getNpl(){
90 return npl;
91 }
92
93 ndn::shared_ptr<boost::asio::io_service>& getIo()
94 {
95 return io;
96 }
97
98 ndn::Scheduler& getScheduler(){
99 return scheduler;
100 }
101
102 ndn::Face& getNlsrFace(){
103 return nlsrFace;
104 }
105
106 ndn::KeyChain& getKeyChain(){
107 return kChain;
108 }
109
110 interestManager& getIm(){
111 return im;
112 }
113
114 DataManager& getDm(){
115 return dm;
116 }
117
118 SequencingManager& getSm(){
119 return sm;
120 }
121
122 Lsdb& getLsdb(){
123 return nlsrLsdb;
124 }
125
126 RoutingTable& getRoutingTable(){
127 return routingTable;
128 }
129
130 Npt& getNpt()
131 {
132 return npt;
133 }
134
135 Fib& getFib()
136 {
137 return fib;
138 }
139
140 long int getAdjBuildCount()
141 {
142 return adjBuildCount;
143 }
144
145 void incrementAdjBuildCount()
146 {
147 adjBuildCount++;
148 }
149
150 void setAdjBuildCount(long int abc)
151 {
152 adjBuildCount=abc;
153 }
154
155 int getIsBuildAdjLsaSheduled()
156 {
157 return isBuildAdjLsaSheduled;
158 }
159
160 void setIsBuildAdjLsaSheduled(int iabls)
161 {
162 isBuildAdjLsaSheduled=iabls;
163 }
164
165 nlsrTest& getNlsrTesting()
166 {
167 return nlsrTesting;
168 }
169
170 void setApiPort(int ap)
171 {
172 apiPort=ap;
173 }
174
175 int getApiPort()
176 {
177 return apiPort;
178 }
179
180 int getIsRoutingTableCalculating()
181 {
182 return isRoutingTableCalculating;
183 }
184
185 void setIsRoutingTableCalculating(int irtc)
186 {
187 isRoutingTableCalculating=irtc;
188 }
189
190 int getIsRouteCalculationScheduled()
191 {
192 return isRouteCalculationScheduled;
193 }
194
195 void setIsRouteCalculationScheduled(int ircs)
196 {
197 isRouteCalculationScheduled=ircs;
198 }
199
200private:
201 ConfParameter confParam;
202 Adl adl;
203 Npl npl;
204 ndn::shared_ptr<boost::asio::io_service> io;
205 ndn::Scheduler scheduler;
206 ndn::Face nlsrFace;
207 ndn::KeyChain kChain;
208 interestManager im;
209 DataManager dm;
210 SequencingManager sm;
211 bool isDaemonProcess;
212 string configFileName;
213 int apiPort;
214
215 Lsdb nlsrLsdb;
216 RoutingTable routingTable;
217 Npt npt;
218 Fib fib;
219
220
221 long int adjBuildCount;
222 int isBuildAdjLsaSheduled;
223 int isRouteCalculationScheduled;
224 int isRoutingTableCalculating;
225
226 nlsrTest nlsrTesting;
227
228
229};
230
231#endif