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-2022, 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 
39 #include <ndn-cxx/face.hpp>
40 #include <ndn-cxx/mgmt/dispatcher.hpp>
41 #include <boost/noncopyable.hpp>
42 
43 namespace nlsr {
44 
45 namespace dataset {
46 inline const ndn::Name::Component ADJACENCY_COMPONENT{"adjacencies"};
47 inline const ndn::Name::Component NAME_COMPONENT{"names"};
48 inline const ndn::Name::Component COORDINATE_COMPONENT{"coordinates"};
49 } // namespace dataset
50 
56 class DatasetInterestHandler : boost::noncopyable
57 {
58 public:
59  class Error : std::runtime_error
60  {
61  public:
62  using std::runtime_error::runtime_error;
63  };
64 
65  DatasetInterestHandler(ndn::mgmt::Dispatcher& dispatcher,
66  const Lsdb& lsdb,
67  const RoutingTable& rt);
68 
69 private:
72  void
73  publishRtStatus(const ndn::Name& topPrefix, const ndn::Interest& interest,
74  ndn::mgmt::StatusDatasetContext& context);
75 
78  template<typename T>
79  void
80  publishLsaStatus(const ndn::Name& topPrefix, const ndn::Interest& interest,
81  ndn::mgmt::StatusDatasetContext& context);
82 
83 private:
84  const Lsdb& m_lsdb;
85  const RoutingTable& m_routingTable;
86 };
87 
88 } // namespace nlsr
89 
90 #endif // NLSR_PUBLISHER_DATASET_INTEREST_HANDLER_HPP
Class to publish all dataset.
DatasetInterestHandler(ndn::mgmt::Dispatcher &dispatcher, const Lsdb &lsdb, const RoutingTable &rt)
const ndn::Name::Component NAME_COMPONENT
const ndn::Name::Component COORDINATE_COMPONENT
const ndn::Name::Component ADJACENCY_COMPONENT
Copyright (c) 2014-2020, The University of Memphis, Regents of the University of California.