dataset-interest-handler.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014-2020, The University of Memphis,
4  * Regents of the University of California,
5  * Arizona Board of Regents.
6  *
7  * This file is part of NLSR (Named-data Link State Routing).
8  * See AUTHORS.md for complete list of NLSR authors and contributors.
9  *
10  * NLSR is free software: you can redistribute it and/or modify it under the terms
11  * of the GNU General Public License as published by the Free Software Foundation,
12  * either version 3 of the License, or (at your option) any later version.
13  *
14  * NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
15  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16  * PURPOSE. See the GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along with
19  * NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
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 <ndn-cxx/mgmt/dispatcher.hpp>
41 #include <ndn-cxx/face.hpp>
42 #include <boost/noncopyable.hpp>
43 
44 namespace nlsr {
45 namespace dataset {
46 const ndn::Name::Component ADJACENCY_COMPONENT = ndn::Name::Component{"adjacencies"};
47 const ndn::Name::Component NAME_COMPONENT = ndn::Name::Component{"names"};
48 const ndn::Name::Component COORDINATE_COMPONENT = ndn::Name::Component{"coordinates"};
49 } // namespace dataset
50 
56 class DatasetInterestHandler : boost::noncopyable
57 {
58 public:
59  class Error : std::runtime_error
60  {
61  public:
62  explicit
63  Error(const std::string& what)
64  : std::runtime_error(what)
65  {
66  }
67  };
68 
69  DatasetInterestHandler(ndn::mgmt::Dispatcher& dispatcher,
70  const Lsdb& lsdb,
71  const RoutingTable& rt);
72 
73 private:
76  void
77  setDispatcher(ndn::mgmt::Dispatcher& dispatcher);
78 
81  void
82  publishRtStatus(const ndn::Name& topPrefix, const ndn::Interest& interest,
83  ndn::mgmt::StatusDatasetContext& context);
84 
87  template <typename T>
88  void
89  publishLsaStatus(const ndn::Name& topPrefix, const ndn::Interest& interest,
90  ndn::mgmt::StatusDatasetContext& context);
91 
92 private:
93  ndn::mgmt::Dispatcher& m_dispatcher;
94  const Lsdb& m_lsdb;
95  const RoutingTable& m_routingTable;
96 };
97 
98 } // namespace nlsr
99 
100 #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-2020, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
const ndn::Name::Component ADJACENCY_COMPONENT