sync-logic-handler.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NLSR_SYNC_LOGIC_HANDLER_HPP
23 #define NLSR_SYNC_LOGIC_HANDLER_HPP
24 
25 #include "conf-parameter.hpp"
26 #include "test-access-control.hpp"
27 #include "signals.hpp"
28 #include "lsa.hpp"
30 
31 #include <ndn-cxx/face.hpp>
32 #include <ndn-cxx/util/signal.hpp>
33 #include <boost/throw_exception.hpp>
34 
35 class InterestManager;
36 
37 namespace nlsr {
38 
39 class ConfParameter;
40 
50 {
51 public:
52  using IsLsaNew =
53  std::function<bool(const ndn::Name&, const Lsa::Type& lsaType, const uint64_t&)>;
54 
55  class Error : public std::runtime_error
56  {
57  public:
58  explicit
59  Error(const std::string& what)
60  : std::runtime_error(what)
61  {
62  }
63  };
64 
65  SyncLogicHandler(ndn::Face& face, const IsLsaNew& isLsaNew, const ConfParameter& conf);
66 
76  void
77  publishRoutingUpdate(const Lsa::Type& type, const uint64_t& seqNo);
78 
86  void
87  processUpdate(const ndn::Name& updateName, uint64_t highSeq);
88 
97  void
98  processUpdateFromSync(const ndn::Name& originRouter,
99  const ndn::Name& updateName, uint64_t seqNo);
100 
101 public:
102  std::unique_ptr<OnNewLsa> onNewLsa;
103 
104 private:
105  ndn::Face& m_syncFace;
106  IsLsaNew m_isLsaNew;
107  const ConfParameter& m_confParam;
108 
110  ndn::Name m_nameLsaUserPrefix;
111  ndn::Name m_adjLsaUserPrefix;
112  ndn::Name m_coorLsaUserPrefix;
113 
114  SyncProtocolAdapter m_syncLogic;
115 
116 private:
117  static const std::string NLSR_COMPONENT;
118  static const std::string LSA_COMPONENT;
119 };
120 
121 } // namespace nlsr
122 
123 #endif // NLSR_SYNC_LOGIC_HANDLER_HPP
const std::string NLSR_COMPONENT
A class to house all the configuration parameters for NLSR.
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
std::unique_ptr< OnNewLsa > onNewLsa
STL namespace.
std::function< bool(const ndn::Name &, const Lsa::Type &lsaType, const uint64_t &)> IsLsaNew
NLSR-to-ChronoSync interaction point.
Error(const std::string &what)
Copyright (c) 2014-2019, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
const std::string LSA_COMPONENT
SyncLogicHandler(ndn::Face &face, const IsLsaNew &isLsaNew, const ConfParameter &conf)
void publishRoutingUpdate(const Lsa::Type &type, const uint64_t &seqNo)
Instruct ChronoSync to publish an update.