blob: c78caac88ba89a20162ce815b689ed6112dc8e50 [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"
akmhoque87347a32014-01-31 11:00:44 -060014
15
16using namespace ndn;
17using namespace std;
18
19class nlsr
20{
akmhoque147f4992014-01-31 15:52:49 -060021public:
akmhoque87347a32014-01-31 11:00:44 -060022 nlsr()
23 : io(ndn::make_shared<boost::asio::io_service>())
akmhoque147f4992014-01-31 15:52:49 -060024 , nlsrFace(io)
akmhoque87347a32014-01-31 11:00:44 -060025 , scheduler(*io)
26 , configFileName()
27 , confParam()
28 , adl()
29 , npl()
akmhoque147f4992014-01-31 15:52:49 -060030 , im()
31 , dm()
akmhoquebd7c8e62014-02-01 14:57:40 -060032 , nlsrLsdb()
33 , nameLsaSeq(0)
34 , adjLsaSeq(0)
35 , corLsaSeq(0)
akmhoque87347a32014-01-31 11:00:44 -060036 {
37 isDaemonProcess=false;
38 configFileName="nlsr.conf";
39 }
40
akmhoquebd7c8e62014-02-01 14:57:40 -060041 nlsr(string confFile, uint32_t nlsn, uint32_t alsn, uint32_t clsn)
42 : io(ndn::make_shared<boost::asio::io_service>())
43 , nlsrFace(io)
44 , scheduler(*io)
45 , configFileName()
46 , confParam()
47 , adl()
48 , npl()
49 , im()
50 , dm()
51 , nlsrLsdb()
52 {
53 isDaemonProcess=false;
54 configFileName=confFile;
55 nameLsaSeq=nlsn;
56 adjLsaSeq=alsn;
57 corLsaSeq=clsn;
58 }
59
akmhoque87347a32014-01-31 11:00:44 -060060 void nlsrRegistrationFailed(const ptr_lib::shared_ptr<const Name>&);
akmhoque87347a32014-01-31 11:00:44 -060061
62 void setInterestFilterNlsr(const string& name);
akmhoque87347a32014-01-31 11:00:44 -060063 void startEventLoop();
64
65 int usage(const string& progname);
66
akmhoque147f4992014-01-31 15:52:49 -060067 string getConfFileName()
68 {
akmhoque87347a32014-01-31 11:00:44 -060069 return configFileName;
70 }
71
akmhoque147f4992014-01-31 15:52:49 -060072 void setConfFileName(const string& fileName)
73 {
74 configFileName=fileName;
75 }
akmhoque87347a32014-01-31 11:00:44 -060076
akmhoque147f4992014-01-31 15:52:49 -060077 bool isSetDaemonProcess()
78 {
79 return isDaemonProcess;
80 }
akmhoque87347a32014-01-31 11:00:44 -060081
akmhoque147f4992014-01-31 15:52:49 -060082 void setIsDaemonProcess(bool value)
83 {
84 isDaemonProcess=value;
85 }
akmhoque87347a32014-01-31 11:00:44 -060086
akmhoquea8cd6b92014-01-31 20:13:26 -060087 ConfParameter& getConfParameter(){
88 return confParam;
89 }
90
91 Adl& getAdl(){
92 return adl;
93 }
94
95 Npl& getNpl(){
96 return npl;
97 }
98
99 ndn::shared_ptr<boost::asio::io_service>& getIo()
100 {
101 return io;
102 }
103
104 ndn::Scheduler& getScheduler(){
105 return scheduler;
106 }
107
108 ndn::Face& getNlsrFace(){
109 return nlsrFace;
110 }
111
112 ndn::KeyChain& getKeyChain(){
113 return kChain;
114 }
115
116 interestManager& getIm(){
117 return im;
118 }
119
120 DataManager& getDm(){
121 return dm;
122 }
akmhoquebd7c8e62014-02-01 14:57:40 -0600123
124 Lsdb& getLsdb(){
125 return nlsrLsdb;
126 }
127
128 uint32_t getNameLsaSeq()
129 {
130 return nameLsaSeq;
131 }
132
133 void setNameLsaSeq(uint32_t nlsn){
134 nameLsaSeq=nlsn;
135 }
136
137 uint32_t getAdjLsaSeq()
138 {
139 return adjLsaSeq;
140 }
141
142 void setAdjLsaSeq(uint32_t alsn){
143 adjLsaSeq=alsn;
144 }
145
146 uint32_t getCorLsaSeq()
147 {
148 return corLsaSeq;
149 }
150
151 void setCorLsaSeq(uint32_t clsn){
152 corLsaSeq=clsn;
153 }
akmhoquea8cd6b92014-01-31 20:13:26 -0600154
155private:
akmhoque87347a32014-01-31 11:00:44 -0600156 ConfParameter confParam;
157 Adl adl;
158 Npl npl;
akmhoque87347a32014-01-31 11:00:44 -0600159 ndn::shared_ptr<boost::asio::io_service> io;
160 ndn::Scheduler scheduler;
161 ndn::Face nlsrFace;
162 ndn::KeyChain kChain;
akmhoque147f4992014-01-31 15:52:49 -0600163 interestManager im;
164 DataManager dm;
akmhoque87347a32014-01-31 11:00:44 -0600165 bool isDaemonProcess;
166 string configFileName;
akmhoquebd7c8e62014-02-01 14:57:40 -0600167 Lsdb nlsrLsdb;
168 uint32_t nameLsaSeq;
169 uint32_t adjLsaSeq;
170 uint32_t corLsaSeq;
171
akmhoque87347a32014-01-31 11:00:44 -0600172
173};
174
175#endif