blob: 52d52779707f3b821c0a756e0c99f7a948202be4 [file] [log] [blame]
akmhoque87347a32014-01-31 11:00:44 -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
akmhoque204e7542014-01-31 16:08:25 -06008#include "nlsr_conf_param.hpp"
9#include "nlsr_adl.hpp"
10#include "nlsr_npl.hpp"
akmhoque147f4992014-01-31 15:52:49 -060011#include "nlsr_im.hpp"
12#include "nlsr_dm.hpp"
akmhoquebd7c8e62014-02-01 14:57:40 -060013#include "nlsr_lsdb.hpp"
akmhoquedfa4a5b2014-02-03 20:12:29 -060014#include "nlsr_sm.hpp"
15#include "nlsr_rt.hpp"
16//testing
17#include "nlsr_test.hpp"
18
akmhoque87347a32014-01-31 11:00:44 -060019
20
21using namespace ndn;
22using namespace std;
23
24class nlsr
25{
akmhoque147f4992014-01-31 15:52:49 -060026public:
akmhoque87347a32014-01-31 11:00:44 -060027 nlsr()
28 : io(ndn::make_shared<boost::asio::io_service>())
akmhoque147f4992014-01-31 15:52:49 -060029 , nlsrFace(io)
akmhoque87347a32014-01-31 11:00:44 -060030 , scheduler(*io)
31 , configFileName()
32 , confParam()
33 , adl()
34 , npl()
akmhoque147f4992014-01-31 15:52:49 -060035 , im()
36 , dm()
akmhoquedfa4a5b2014-02-03 20:12:29 -060037 , sm()
akmhoquebd7c8e62014-02-01 14:57:40 -060038 , nlsrLsdb()
akmhoquecd552472014-02-01 21:22:16 -060039 , adjBuildCount(0)
40 , isBuildAdjLsaSheduled(0)
41 , isRouteCalculationScheduled(0)
42 , isRoutingTableCalculating(0)
akmhoquedfa4a5b2014-02-03 20:12:29 -060043 , routingTable()
44 , nlsrTesting()
akmhoque87347a32014-01-31 11:00:44 -060045 {
46 isDaemonProcess=false;
47 configFileName="nlsr.conf";
48 }
49
akmhoque87347a32014-01-31 11:00:44 -060050 void nlsrRegistrationFailed(const ptr_lib::shared_ptr<const Name>&);
akmhoque87347a32014-01-31 11:00:44 -060051
52 void setInterestFilterNlsr(const string& name);
akmhoque87347a32014-01-31 11:00:44 -060053 void startEventLoop();
54
55 int usage(const string& progname);
56
akmhoque147f4992014-01-31 15:52:49 -060057 string getConfFileName()
58 {
akmhoque87347a32014-01-31 11:00:44 -060059 return configFileName;
60 }
61
akmhoque147f4992014-01-31 15:52:49 -060062 void setConfFileName(const string& fileName)
63 {
64 configFileName=fileName;
65 }
akmhoque87347a32014-01-31 11:00:44 -060066
akmhoque147f4992014-01-31 15:52:49 -060067 bool isSetDaemonProcess()
68 {
69 return isDaemonProcess;
70 }
akmhoque87347a32014-01-31 11:00:44 -060071
akmhoque147f4992014-01-31 15:52:49 -060072 void setIsDaemonProcess(bool value)
73 {
74 isDaemonProcess=value;
75 }
akmhoque87347a32014-01-31 11:00:44 -060076
akmhoquea8cd6b92014-01-31 20:13:26 -060077 ConfParameter& getConfParameter(){
78 return confParam;
79 }
80
81 Adl& getAdl(){
82 return adl;
83 }
84
85 Npl& getNpl(){
86 return npl;
87 }
88
89 ndn::shared_ptr<boost::asio::io_service>& getIo()
90 {
91 return io;
92 }
93
94 ndn::Scheduler& getScheduler(){
95 return scheduler;
96 }
97
98 ndn::Face& getNlsrFace(){
99 return nlsrFace;
100 }
101
102 ndn::KeyChain& getKeyChain(){
103 return kChain;
104 }
105
106 interestManager& getIm(){
107 return im;
108 }
109
110 DataManager& getDm(){
111 return dm;
112 }
akmhoquebd7c8e62014-02-01 14:57:40 -0600113
akmhoquedfa4a5b2014-02-03 20:12:29 -0600114 SequencingManager& getSm(){
115 return sm;
116 }
117
akmhoquebd7c8e62014-02-01 14:57:40 -0600118 Lsdb& getLsdb(){
119 return nlsrLsdb;
120 }
121
akmhoquedfa4a5b2014-02-03 20:12:29 -0600122 RoutingTable& getRoutingTable(){
123 return routingTable;
akmhoquebd7c8e62014-02-01 14:57:40 -0600124 }
akmhoquecd552472014-02-01 21:22:16 -0600125
126 long int getAdjBuildCount()
127 {
128 return adjBuildCount;
129 }
130
131 void incrementAdjBuildCount()
132 {
133 adjBuildCount++;
134 }
135
136 void setAdjBuildCount(long int abc)
137 {
138 adjBuildCount=abc;
139 }
140
141 int getIsBuildAdjLsaSheduled()
142 {
143 return isBuildAdjLsaSheduled;
144 }
145
146 void setIsBuildAdjLsaSheduled(int iabls)
147 {
148 isBuildAdjLsaSheduled=iabls;
149 }
akmhoquedfa4a5b2014-02-03 20:12:29 -0600150
151 nlsrTest& getNlsrTesting()
152 {
153 return nlsrTesting;
154 }
155
156 void setApiPort(int ap)
157 {
158 apiPort=ap;
159 }
160
161 int getApiPort()
162 {
163 return apiPort;
164 }
akmhoque79d355f2014-02-04 15:11:16 -0600165
166 int getIsRoutingTableCalculating()
167 {
168 return isRoutingTableCalculating;
169 }
170
171 void setIsRoutingTableCalculating(int irtc)
172 {
173 isRoutingTableCalculating=irtc;
174 }
175
176 int getIsRouteCalculationScheduled()
177 {
178 return isRouteCalculationScheduled;
179 }
180
181 void setIsRouteCalculationScheduled(int ircs)
182 {
183 isRouteCalculationScheduled=ircs;
184 }
akmhoquecd552472014-02-01 21:22:16 -0600185
akmhoquea8cd6b92014-01-31 20:13:26 -0600186private:
akmhoque87347a32014-01-31 11:00:44 -0600187 ConfParameter confParam;
188 Adl adl;
189 Npl npl;
akmhoque87347a32014-01-31 11:00:44 -0600190 ndn::shared_ptr<boost::asio::io_service> io;
191 ndn::Scheduler scheduler;
192 ndn::Face nlsrFace;
193 ndn::KeyChain kChain;
akmhoque147f4992014-01-31 15:52:49 -0600194 interestManager im;
195 DataManager dm;
akmhoquedfa4a5b2014-02-03 20:12:29 -0600196 SequencingManager sm;
akmhoque87347a32014-01-31 11:00:44 -0600197 bool isDaemonProcess;
198 string configFileName;
akmhoquedfa4a5b2014-02-03 20:12:29 -0600199 int apiPort;
200
akmhoquebd7c8e62014-02-01 14:57:40 -0600201 Lsdb nlsrLsdb;
akmhoquedfa4a5b2014-02-03 20:12:29 -0600202 RoutingTable routingTable;
203
204
akmhoquecd552472014-02-01 21:22:16 -0600205
206 long int adjBuildCount;
207 int isBuildAdjLsaSheduled;
208 int isRouteCalculationScheduled;
209 int isRoutingTableCalculating;
akmhoquedfa4a5b2014-02-03 20:12:29 -0600210
211 nlsrTest nlsrTesting;
akmhoquebd7c8e62014-02-01 14:57:40 -0600212
akmhoque87347a32014-01-31 11:00:44 -0600213
214};
215
216#endif