prefix-update-processor.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NLSR_UPDATE_PREFIX_UPDATE_PROCESSOR_HPP
23 #define NLSR_UPDATE_PREFIX_UPDATE_PROCESSOR_HPP
24 
25 #include "manager-base.hpp"
27 #include <ndn-cxx/util/io.hpp>
28 #include <ndn-cxx/security/key-chain.hpp>
29 #include <ndn-cxx/util/io.hpp>
30 #include <boost/property_tree/ptree.hpp>
31 #include <boost/property_tree/info_parser.hpp>
32 
33 namespace nlsr {
34 namespace update {
35 
36 typedef boost::property_tree::ptree ConfigSection;
37 
39 {
40 public:
41  PrefixUpdateProcessor(ndn::mgmt::Dispatcher& dispatcher,
42  ndn::security::ValidatorConfig& validator,
43  NamePrefixList& namePrefixList,
44  Lsdb& lsdb, const std::string& configFileName);
45 
57  void
58  loadValidator(ConfigSection section, const std::string& filename);
59 
63  bool
64  addOrDeletePrefix(const ndn::Name& prefix, bool addPrefix);
65 
66  ndn::optional<bool>
67  afterAdvertise(const ndn::Name& prefix);
68 
69  ndn::optional<bool>
70  afterWithdraw(const ndn::Name& prefix);
71 
73  bool
74  checkForPrefixInFile(const std::string prefix);
75 
76  ndn::security::ValidatorConfig&
78  {
79  return m_validator;
80  }
81 
82 private:
89  ndn::mgmt::Authorization
90  makeAuthorization();
91 
92 private:
93  ndn::security::ValidatorConfig& m_validator;
94  const std::string& m_confFileNameDynamic;
95 };
96 
97 } // namespace update
98 } // namespace nlsr
99 
100 #endif // NLSR_UPDATE_PREFIX_UPDATE_PROCESSOR_HPP
void loadValidator(ConfigSection section, const std::string &filename)
Load the validator&#39;s configuration from a section of a configuration file.
Copyright (c) 2014-2017, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
ndn::optional< bool > afterAdvertise(const ndn::Name &prefix)
save an advertised prefix to the nlsr configuration file returns bool from the overridden function wh...
PrefixUpdateProcessor(ndn::mgmt::Dispatcher &dispatcher, ndn::security::ValidatorConfig &validator, NamePrefixList &namePrefixList, Lsdb &lsdb, const std::string &configFileName)
ndn::optional< bool > afterWithdraw(const ndn::Name &prefix)
save an advertised prefix to the nlsr configuration file returns bool from the overridden function wh...
ndn::security::ValidatorConfig & getValidator()
bool addOrDeletePrefix(const ndn::Name &prefix, bool addPrefix)
Add or delete an advertise or withdrawn prefix to the nlsr configuration file.
Copyright (c) 2014-2019, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
bool checkForPrefixInFile(const std::string prefix)
Check if a prefix exists in the nlsr configuration file.
boost::property_tree::ptree ConfigSection