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 | |||||
8 | #include "conf_param.hpp" | ||||
9 | #include "adl.hpp" | ||||
10 | #include "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 | |
63 | ConfParameter confParam; | ||||
64 | Adl adl; | ||||
65 | Npl npl; | ||||
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 66 | ndn::shared_ptr<boost::asio::io_service> io; |
67 | ndn::Scheduler scheduler; | ||||
68 | ndn::Face nlsrFace; | ||||
69 | ndn::KeyChain kChain; | ||||
akmhoque | 147f499 | 2014-01-31 15:52:49 -0600 | [diff] [blame] | 70 | interestManager im; |
71 | DataManager dm; | ||||
72 | |||||
73 | private: | ||||
74 | |||||
akmhoque | 87347a3 | 2014-01-31 11:00:44 -0600 | [diff] [blame] | 75 | bool isDaemonProcess; |
76 | string configFileName; | ||||
77 | |||||
78 | }; | ||||
79 | |||||
80 | #endif |