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