blob: 05123ffb21416c08279b2ad7a779335c41cc3c18 [file] [log] [blame]
akmhoque53353462014-04-22 08:43:45 -05001#ifndef NLSR_SLH_HPP
2#define NLSR_SLH_HPP
3
4#include <iostream>
5
6#include <ndn-cpp-dev/face.hpp>
7#include <nsync/sync-socket.h>
8#include <ndn-cpp-dev/security/validator-null.hpp>
9#include <ndn-cpp-dev/util/scheduler.hpp>
10
11#include "sequencing-manager.hpp"
12
Yingdi Yu0c217822014-04-24 14:22:42 -070013// class KeyManager;
akmhoque53353462014-04-22 08:43:45 -050014
15extern "C" {
16#include <unistd.h>
17}
18
19class InterestManager;
20class ConfParameter;
21
22namespace nlsr {
23
24class SyncLogicHandler
25{
26public:
27 SyncLogicHandler(ndn::shared_ptr<boost::asio::io_service> ioService)
28 : m_validator(new ndn::ValidatorNull())
29 , m_syncFace(new ndn::Face(ioService))
30 {}
31
32
33 void
34 createSyncSocket(Nlsr& pnlsr);
35
36 void
37 nsyncUpdateCallBack(const vector<Sync::MissingDataInfo>& v,
38 Sync::SyncSocket* socket, Nlsr& pnlsr);
39
40 void
41 nsyncRemoveCallBack(const string& prefix, Nlsr& pnlsr);
42
43 void
44 removeRouterFromSyncing(string& routerPrefix);
45
46 void
47 publishRoutingUpdate(SequencingManager& sm, string updatePrefix);
48
Yingdi Yu0c217822014-04-24 14:22:42 -070049 // void
50 // publishKeyUpdate(KeyManager& km);
akmhoque53353462014-04-22 08:43:45 -050051
52 void
53 publishIdentityUpdate(string identityName);
54
55 void
56 setSyncPrefix(string sp)
57 {
58 m_syncPrefix.clear();
59 m_syncPrefix.set(sp);
60 }
61
62private:
63 void
64 processUpdateFromSync(std::string updateName, uint64_t seqNo, Nlsr& pnlsr);
65
66 void
67 processRoutingUpdateFromSync(std::string routerName, uint64_t seqNo,
68 Nlsr& pnlsr);
69
Yingdi Yu0c217822014-04-24 14:22:42 -070070 // void
71 // processKeysUpdateFromSync(std::string certName, uint64_t seqNo, Nlsr& pnlsr);
akmhoque53353462014-04-22 08:43:45 -050072
73 void
74 publishSyncUpdate(string updatePrefix, uint64_t seqNo);
75
76private:
77 ndn::shared_ptr<ndn::ValidatorNull> m_validator;
78 ndn::shared_ptr<ndn::Face> m_syncFace;
79 ndn::shared_ptr<Sync::SyncSocket> m_syncSocket;
80 ndn::Name m_syncPrefix;
81};
82
83} //namespace nlsr
84
85#endif //NLSR_SLH_HPP