akmhoque | 87347a3 | 2014-01-31 11:00:44 -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 | |
akmhoque | 204e754 | 2014-01-31 16:08:25 -0600 | [diff] [blame] | 8 | #include "nlsr_conf_param.hpp" |
| 9 | #include "nlsr_adl.hpp" |
| 10 | #include "nlsr_npl.hpp" |
akmhoque | 147f499 | 2014-01-31 15:52:49 -0600 | [diff] [blame] | 11 | #include "nlsr_im.hpp" |
| 12 | #include "nlsr_dm.hpp" |
akmhoque | bd7c8e6 | 2014-02-01 14:57:40 -0600 | [diff] [blame] | 13 | #include "nlsr_lsdb.hpp" |
akmhoque | dfa4a5b | 2014-02-03 20:12:29 -0600 | [diff] [blame] | 14 | #include "nlsr_sm.hpp" |
| 15 | #include "nlsr_rt.hpp" |
| 16 | //testing |
| 17 | #include "nlsr_test.hpp" |
| 18 | |
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 19 | |
| 20 | |
| 21 | using namespace ndn; |
| 22 | using namespace std; |
| 23 | |
| 24 | class nlsr |
| 25 | { |
akmhoque | 147f499 | 2014-01-31 15:52:49 -0600 | [diff] [blame] | 26 | public: |
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 27 | nlsr() |
| 28 | : io(ndn::make_shared<boost::asio::io_service>()) |
akmhoque | 147f499 | 2014-01-31 15:52:49 -0600 | [diff] [blame] | 29 | , nlsrFace(io) |
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 30 | , scheduler(*io) |
| 31 | , configFileName() |
| 32 | , confParam() |
| 33 | , adl() |
| 34 | , npl() |
akmhoque | 147f499 | 2014-01-31 15:52:49 -0600 | [diff] [blame] | 35 | , im() |
| 36 | , dm() |
akmhoque | dfa4a5b | 2014-02-03 20:12:29 -0600 | [diff] [blame] | 37 | , sm() |
akmhoque | bd7c8e6 | 2014-02-01 14:57:40 -0600 | [diff] [blame] | 38 | , nlsrLsdb() |
akmhoque | cd55247 | 2014-02-01 21:22:16 -0600 | [diff] [blame] | 39 | , adjBuildCount(0) |
| 40 | , isBuildAdjLsaSheduled(0) |
| 41 | , isRouteCalculationScheduled(0) |
| 42 | , isRoutingTableCalculating(0) |
akmhoque | dfa4a5b | 2014-02-03 20:12:29 -0600 | [diff] [blame] | 43 | , routingTable() |
| 44 | , nlsrTesting() |
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 45 | { |
| 46 | isDaemonProcess=false; |
| 47 | configFileName="nlsr.conf"; |
| 48 | } |
| 49 | |
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 50 | void nlsrRegistrationFailed(const ptr_lib::shared_ptr<const Name>&); |
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 51 | |
| 52 | void setInterestFilterNlsr(const string& name); |
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 53 | void startEventLoop(); |
| 54 | |
| 55 | int usage(const string& progname); |
| 56 | |
akmhoque | 147f499 | 2014-01-31 15:52:49 -0600 | [diff] [blame] | 57 | string getConfFileName() |
| 58 | { |
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 59 | return configFileName; |
| 60 | } |
| 61 | |
akmhoque | 147f499 | 2014-01-31 15:52:49 -0600 | [diff] [blame] | 62 | void setConfFileName(const string& fileName) |
| 63 | { |
| 64 | configFileName=fileName; |
| 65 | } |
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 66 | |
akmhoque | 147f499 | 2014-01-31 15:52:49 -0600 | [diff] [blame] | 67 | bool isSetDaemonProcess() |
| 68 | { |
| 69 | return isDaemonProcess; |
| 70 | } |
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 71 | |
akmhoque | 147f499 | 2014-01-31 15:52:49 -0600 | [diff] [blame] | 72 | void setIsDaemonProcess(bool value) |
| 73 | { |
| 74 | isDaemonProcess=value; |
| 75 | } |
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 76 | |
akmhoque | a8cd6b9 | 2014-01-31 20:13:26 -0600 | [diff] [blame] | 77 | 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 | } |
akmhoque | bd7c8e6 | 2014-02-01 14:57:40 -0600 | [diff] [blame] | 113 | |
akmhoque | dfa4a5b | 2014-02-03 20:12:29 -0600 | [diff] [blame] | 114 | SequencingManager& getSm(){ |
| 115 | return sm; |
| 116 | } |
| 117 | |
akmhoque | bd7c8e6 | 2014-02-01 14:57:40 -0600 | [diff] [blame] | 118 | Lsdb& getLsdb(){ |
| 119 | return nlsrLsdb; |
| 120 | } |
| 121 | |
akmhoque | dfa4a5b | 2014-02-03 20:12:29 -0600 | [diff] [blame] | 122 | RoutingTable& getRoutingTable(){ |
| 123 | return routingTable; |
akmhoque | bd7c8e6 | 2014-02-01 14:57:40 -0600 | [diff] [blame] | 124 | } |
akmhoque | cd55247 | 2014-02-01 21:22:16 -0600 | [diff] [blame] | 125 | |
| 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 | } |
akmhoque | dfa4a5b | 2014-02-03 20:12:29 -0600 | [diff] [blame] | 150 | |
| 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 | } |
akmhoque | 79d355f | 2014-02-04 15:11:16 -0600 | [diff] [blame^] | 165 | |
| 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 | } |
akmhoque | cd55247 | 2014-02-01 21:22:16 -0600 | [diff] [blame] | 185 | |
akmhoque | a8cd6b9 | 2014-01-31 20:13:26 -0600 | [diff] [blame] | 186 | private: |
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 187 | ConfParameter confParam; |
| 188 | Adl adl; |
| 189 | Npl npl; |
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 190 | ndn::shared_ptr<boost::asio::io_service> io; |
| 191 | ndn::Scheduler scheduler; |
| 192 | ndn::Face nlsrFace; |
| 193 | ndn::KeyChain kChain; |
akmhoque | 147f499 | 2014-01-31 15:52:49 -0600 | [diff] [blame] | 194 | interestManager im; |
| 195 | DataManager dm; |
akmhoque | dfa4a5b | 2014-02-03 20:12:29 -0600 | [diff] [blame] | 196 | SequencingManager sm; |
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 197 | bool isDaemonProcess; |
| 198 | string configFileName; |
akmhoque | dfa4a5b | 2014-02-03 20:12:29 -0600 | [diff] [blame] | 199 | int apiPort; |
| 200 | |
akmhoque | bd7c8e6 | 2014-02-01 14:57:40 -0600 | [diff] [blame] | 201 | Lsdb nlsrLsdb; |
akmhoque | dfa4a5b | 2014-02-03 20:12:29 -0600 | [diff] [blame] | 202 | RoutingTable routingTable; |
| 203 | |
| 204 | |
akmhoque | cd55247 | 2014-02-01 21:22:16 -0600 | [diff] [blame] | 205 | |
| 206 | long int adjBuildCount; |
| 207 | int isBuildAdjLsaSheduled; |
| 208 | int isRouteCalculationScheduled; |
| 209 | int isRoutingTableCalculating; |
akmhoque | dfa4a5b | 2014-02-03 20:12:29 -0600 | [diff] [blame] | 210 | |
| 211 | nlsrTest nlsrTesting; |
akmhoque | bd7c8e6 | 2014-02-01 14:57:40 -0600 | [diff] [blame] | 212 | |
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 213 | |
| 214 | }; |
| 215 | |
| 216 | #endif |