dataset-interest-handler.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
31 #ifndef NLSR_PUBLISHER_DATASET_INTEREST_HANDLER_HPP
32 #define NLSR_PUBLISHER_DATASET_INTEREST_HANDLER_HPP
33 
35 #include "route/routing-table.hpp"
36 #include "route/nexthop-list.hpp"
37 #include "lsdb.hpp"
38 #include "logger.hpp"
39 
40 #include "tlv/adjacency-lsa.hpp"
41 #include "tlv/coordinate-lsa.hpp"
42 #include "tlv/name-lsa.hpp"
45 
46 #include <ndn-cxx/mgmt/dispatcher.hpp>
47 #include <ndn-cxx/face.hpp>
48 #include <boost/noncopyable.hpp>
49 
50 namespace nlsr {
51 namespace dataset {
52 const ndn::Name::Component ADJACENCY_COMPONENT = ndn::Name::Component{"adjacencies"};
53 const ndn::Name::Component NAME_COMPONENT = ndn::Name::Component{"names"};
54 const ndn::Name::Component COORDINATE_COMPONENT = ndn::Name::Component{"coordinates"};
55 } // namespace dataset
56 
62 class DatasetInterestHandler : boost::noncopyable
63 {
64 public:
65  class Error : std::runtime_error
66  {
67  public:
68  explicit
69  Error(const std::string& what)
70  : std::runtime_error(what)
71  {
72  }
73  };
74 
75  DatasetInterestHandler(ndn::mgmt::Dispatcher& dispatcher,
76  const Lsdb& lsdb,
77  const RoutingTable& rt);
78 
79 private:
82  void
83  setDispatcher(ndn::mgmt::Dispatcher& dispatcher);
84 
87  std::vector<tlv::RoutingTable>
88  getTlvRTEntries();
89 
92  void
93  publishRtStatus(const ndn::Name& topPrefix, const ndn::Interest& interest,
94  ndn::mgmt::StatusDatasetContext& context);
95 
98  void
99  publishAdjStatus(const ndn::Name& topPrefix, const ndn::Interest& interest,
100  ndn::mgmt::StatusDatasetContext& context);
101 
104  void
105  publishCoordinateStatus(const ndn::Name& topPrefix, const ndn::Interest& interest,
106  ndn::mgmt::StatusDatasetContext& context);
107 
110  void
111  publishNameStatus(const ndn::Name& topPrefix, const ndn::Interest& interest,
112  ndn::mgmt::StatusDatasetContext& context);
113 
114 private:
115  ndn::mgmt::Dispatcher& m_dispatcher;
116  const Lsdb& m_lsdb;
117 
118  const std::list<RoutingTableEntry>& m_routingTableEntries;
119  const std::list<RoutingTableEntry>& m_dryRoutingTableEntries;
120 };
121 
122 } // namespace nlsr
123 
124 #endif // NLSR_PUBLISHER_DATASET_INTEREST_HANDLER_HPP
Class to publish all dataset.
const ndn::Name::Component COORDINATE_COMPONENT
STL namespace.
Copyright (c) 2014-2018, The University of Memphis, Regents of the University of California.
const ndn::Name::Component NAME_COMPONENT
Copyright (c) 2014-2019, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
const ndn::Name::Component ADJACENCY_COMPONENT