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 | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 13 | |
14 | |||||
15 | using namespace ndn; | ||||
16 | using namespace std; | ||||
17 | |||||
18 | class nlsr | ||||
19 | { | ||||
akmhoque | 147f499 | 2014-01-31 15:52:49 -0600 | [diff] [blame] | 20 | public: |
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 21 | nlsr() |
22 | : io(ndn::make_shared<boost::asio::io_service>()) | ||||
akmhoque | 147f499 | 2014-01-31 15:52:49 -0600 | [diff] [blame] | 23 | , nlsrFace(io) |
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 24 | , scheduler(*io) |
25 | , configFileName() | ||||
26 | , confParam() | ||||
27 | , adl() | ||||
28 | , npl() | ||||
akmhoque | 147f499 | 2014-01-31 15:52:49 -0600 | [diff] [blame] | 29 | , im() |
30 | , dm() | ||||
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 31 | { |
32 | isDaemonProcess=false; | ||||
33 | configFileName="nlsr.conf"; | ||||
34 | } | ||||
35 | |||||
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 36 | void nlsrRegistrationFailed(const ptr_lib::shared_ptr<const Name>&); |
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 37 | |
38 | void setInterestFilterNlsr(const string& name); | ||||
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 39 | void startEventLoop(); |
40 | |||||
41 | int usage(const string& progname); | ||||
42 | |||||
akmhoque | 147f499 | 2014-01-31 15:52:49 -0600 | [diff] [blame] | 43 | string getConfFileName() |
44 | { | ||||
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 45 | return configFileName; |
46 | } | ||||
47 | |||||
akmhoque | 147f499 | 2014-01-31 15:52:49 -0600 | [diff] [blame] | 48 | void setConfFileName(const string& fileName) |
49 | { | ||||
50 | configFileName=fileName; | ||||
51 | } | ||||
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 52 | |
akmhoque | 147f499 | 2014-01-31 15:52:49 -0600 | [diff] [blame] | 53 | bool isSetDaemonProcess() |
54 | { | ||||
55 | return isDaemonProcess; | ||||
56 | } | ||||
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 57 | |
akmhoque | 147f499 | 2014-01-31 15:52:49 -0600 | [diff] [blame] | 58 | void setIsDaemonProcess(bool value) |
59 | { | ||||
60 | isDaemonProcess=value; | ||||
61 | } | ||||
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 62 | |
akmhoque | a8cd6b9 | 2014-01-31 20:13:26 -0600 | [diff] [blame] | 63 | 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 | |||||
100 | private: | ||||
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 101 | ConfParameter confParam; |
102 | Adl adl; | ||||
103 | Npl npl; | ||||
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 104 | ndn::shared_ptr<boost::asio::io_service> io; |
105 | ndn::Scheduler scheduler; | ||||
106 | ndn::Face nlsrFace; | ||||
107 | ndn::KeyChain kChain; | ||||
akmhoque | 147f499 | 2014-01-31 15:52:49 -0600 | [diff] [blame] | 108 | interestManager im; |
109 | DataManager dm; | ||||
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 110 | bool isDaemonProcess; |
111 | string configFileName; | ||||
112 | |||||
113 | }; | ||||
114 | |||||
115 | #endif |