akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 1 | #ifndef NLSR_SLH_HPP |
| 2 | #define NLSR_SLH_HPP |
| 3 | |
| 4 | #include <iostream> |
| 5 | |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame^] | 6 | #include <ndn-cxx/face.hpp> |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 7 | #include <nsync/sync-socket.h> |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame^] | 8 | #include <ndn-cxx/security/validator-null.hpp> |
| 9 | #include <ndn-cxx/util/scheduler.hpp> |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 10 | |
| 11 | #include "sequencing-manager.hpp" |
| 12 | |
Yingdi Yu | 0c21782 | 2014-04-24 14:22:42 -0700 | [diff] [blame] | 13 | // class KeyManager; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 14 | |
| 15 | extern "C" { |
| 16 | #include <unistd.h> |
| 17 | } |
| 18 | |
| 19 | class InterestManager; |
| 20 | class ConfParameter; |
| 21 | |
| 22 | namespace nlsr { |
| 23 | |
| 24 | class SyncLogicHandler |
| 25 | { |
| 26 | public: |
| 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 Yu | 0c21782 | 2014-04-24 14:22:42 -0700 | [diff] [blame] | 49 | // void |
| 50 | // publishKeyUpdate(KeyManager& km); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 51 | |
| 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 | |
| 62 | private: |
| 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 Yu | 0c21782 | 2014-04-24 14:22:42 -0700 | [diff] [blame] | 70 | // void |
| 71 | // processKeysUpdateFromSync(std::string certName, uint64_t seqNo, Nlsr& pnlsr); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 72 | |
| 73 | void |
| 74 | publishSyncUpdate(string updatePrefix, uint64_t seqNo); |
| 75 | |
| 76 | private: |
| 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 |