blob: a041738c6cb1aecaf3c16f4b677b8411a6269164 [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"
akmhoque87347a32014-01-31 11:00:44 -060013
14
15using namespace ndn;
16using namespace std;
17
18class nlsr
19{
akmhoque147f4992014-01-31 15:52:49 -060020public:
akmhoque87347a32014-01-31 11:00:44 -060021 nlsr()
22 : io(ndn::make_shared<boost::asio::io_service>())
akmhoque147f4992014-01-31 15:52:49 -060023 , nlsrFace(io)
akmhoque87347a32014-01-31 11:00:44 -060024 , scheduler(*io)
25 , configFileName()
26 , confParam()
27 , adl()
28 , npl()
akmhoque147f4992014-01-31 15:52:49 -060029 , im()
30 , dm()
akmhoque87347a32014-01-31 11:00:44 -060031 {
32 isDaemonProcess=false;
33 configFileName="nlsr.conf";
34 }
35
akmhoque87347a32014-01-31 11:00:44 -060036 void nlsrRegistrationFailed(const ptr_lib::shared_ptr<const Name>&);
akmhoque87347a32014-01-31 11:00:44 -060037
38 void setInterestFilterNlsr(const string& name);
akmhoque87347a32014-01-31 11:00:44 -060039 void startEventLoop();
40
41 int usage(const string& progname);
42
akmhoque147f4992014-01-31 15:52:49 -060043 string getConfFileName()
44 {
akmhoque87347a32014-01-31 11:00:44 -060045 return configFileName;
46 }
47
akmhoque147f4992014-01-31 15:52:49 -060048 void setConfFileName(const string& fileName)
49 {
50 configFileName=fileName;
51 }
akmhoque87347a32014-01-31 11:00:44 -060052
akmhoque147f4992014-01-31 15:52:49 -060053 bool isSetDaemonProcess()
54 {
55 return isDaemonProcess;
56 }
akmhoque87347a32014-01-31 11:00:44 -060057
akmhoque147f4992014-01-31 15:52:49 -060058 void setIsDaemonProcess(bool value)
59 {
60 isDaemonProcess=value;
61 }
akmhoque87347a32014-01-31 11:00:44 -060062
akmhoquea8cd6b92014-01-31 20:13:26 -060063 ConfParameter& getConfParameter(){
64 return confParam;
65 }
66
67 Adl& getAdl(){
68 return adl;
69 }
70
71 Npl& getNpl(){
72 return npl;
73 }
74
75 ndn::shared_ptr<boost::asio::io_service>& getIo()
76 {
77 return io;
78 }
79
80 ndn::Scheduler& getScheduler(){
81 return scheduler;
82 }
83
84 ndn::Face& getNlsrFace(){
85 return nlsrFace;
86 }
87
88 ndn::KeyChain& getKeyChain(){
89 return kChain;
90 }
91
92 interestManager& getIm(){
93 return im;
94 }
95
96 DataManager& getDm(){
97 return dm;
98 }
99
100private:
akmhoque87347a32014-01-31 11:00:44 -0600101 ConfParameter confParam;
102 Adl adl;
103 Npl npl;
akmhoque87347a32014-01-31 11:00:44 -0600104 ndn::shared_ptr<boost::asio::io_service> io;
105 ndn::Scheduler scheduler;
106 ndn::Face nlsrFace;
107 ndn::KeyChain kChain;
akmhoque147f4992014-01-31 15:52:49 -0600108 interestManager im;
109 DataManager dm;
akmhoque87347a32014-01-31 11:00:44 -0600110 bool isDaemonProcess;
111 string configFileName;
112
113};
114
115#endif