akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 1 | #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" |
akmhoque | 85d8833 | 2014-02-17 21:11:21 -0600 | [diff] [blame] | 18 | #include "nlsr_logger.hpp" |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 19 | //testing |
| 20 | #include "nlsr_test.hpp" |
| 21 | |
| 22 | |
| 23 | |
| 24 | using namespace ndn; |
| 25 | using namespace std; |
| 26 | |
akmhoque | 1a48109 | 2014-02-19 16:34:22 -0600 | [diff] [blame^] | 27 | class Nlsr |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 28 | { |
| 29 | public: |
akmhoque | 1a48109 | 2014-02-19 16:34:22 -0600 | [diff] [blame^] | 30 | Nlsr() |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 31 | : 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() |
akmhoque | 85d8833 | 2014-02-17 21:11:21 -0600 | [diff] [blame] | 49 | , nlsrLogger() |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 50 | , 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 | |
akmhoque | 1a48109 | 2014-02-19 16:34:22 -0600 | [diff] [blame^] | 167 | NlsrTest& getNlsrTesting() |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 168 | { |
| 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 | } |
akmhoque | 85d8833 | 2014-02-17 21:11:21 -0600 | [diff] [blame] | 201 | |
| 202 | NlsrLogger& getNlsrLogger() |
| 203 | { |
| 204 | return nlsrLogger; |
| 205 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 206 | |
| 207 | private: |
| 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; |
akmhoque | 85d8833 | 2014-02-17 21:11:21 -0600 | [diff] [blame] | 226 | NlsrLogger nlsrLogger; |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 227 | |
| 228 | long int adjBuildCount; |
| 229 | int isBuildAdjLsaSheduled; |
| 230 | int isRouteCalculationScheduled; |
| 231 | int isRoutingTableCalculating; |
| 232 | |
akmhoque | 1a48109 | 2014-02-19 16:34:22 -0600 | [diff] [blame^] | 233 | NlsrTest nlsrTesting; |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 234 | |
| 235 | |
| 236 | }; |
| 237 | |
| 238 | #endif |