blob: c9f10327f95c9e5589f0089fb25afab9bef384aa [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
8#include "conf_param.hpp"
9#include "adl.hpp"
10#include "npl.hpp"
11
12
13using namespace ndn;
14using namespace std;
15
16class nlsr
17{
18 public:
19 nlsr()
20 : io(ndn::make_shared<boost::asio::io_service>())
21 , nlsrFace(io)
22 , scheduler(*io)
23 , configFileName()
24 , confParam()
25 , adl()
26 , npl()
27 {
28 isDaemonProcess=false;
29 configFileName="nlsr.conf";
30 }
31
32 void processInterest(const ptr_lib::shared_ptr<const Name> &name,
33 const ptr_lib::shared_ptr<const Interest> &interest);
34 void processContent(const ndn::ptr_lib::shared_ptr<const ndn::Interest> &interest,
35 const ndn::ptr_lib::shared_ptr<ndn::Data> &data);
36 void nlsrRegistrationFailed(const ptr_lib::shared_ptr<const Name>&);
37 void processInterestTimedOut(const ndn::ptr_lib::shared_ptr<const ndn::Interest> &interest);
38
39 void setInterestFilterNlsr(const string& name);
40
41 void expressInterest(const string& interestNamePrefix, int scope, int seconds);
42
43 //void scheduleSomeInterest(const string& interestName);
44
45 void sendScheduledInfoInterest(int seconds);
46 void scheduleInfoInterest(int seconds);
47
48 void startEventLoop();
49
50 int usage(const string& progname);
51
52 string getConfFileName(){
53 return configFileName;
54 }
55
56 void setConfFileName(const string& fileName){
57 configFileName=fileName;
58 }
59
60 bool isSetDaemonProcess(){
61 return isDaemonProcess;
62 }
63
64 void setIsDaemonProcess(bool value){
65 isDaemonProcess=value;
66 }
67
68 ConfParameter confParam;
69 Adl adl;
70 Npl npl;
71 private:
72 ndn::shared_ptr<boost::asio::io_service> io;
73 ndn::Scheduler scheduler;
74 ndn::Face nlsrFace;
75 ndn::KeyChain kChain;
76 bool isDaemonProcess;
77 string configFileName;
78
79};
80
81#endif