NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
command-authenticator.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #ifndef NFD_DAEMON_MGMT_COMMAND_AUTHENTICATOR_HPP
27 #define NFD_DAEMON_MGMT_COMMAND_AUTHENTICATOR_HPP
28 
29 #include "core/config-file.hpp"
30 #include <ndn-cxx/mgmt/dispatcher.hpp>
31 #include <ndn-cxx/security/command-interest-validator.hpp>
32 #include <ndn-cxx/security/public-key.hpp>
33 
34 namespace nfd {
35 
38 class CommandAuthenticator : public enable_shared_from_this<CommandAuthenticator>, noncopyable
39 {
40 public:
41  static shared_ptr<CommandAuthenticator>
42  create();
43 
44  void
45  setConfigFile(ConfigFile& configFile);
46 
53  makeAuthorization(const std::string& module, const std::string& verb);
54 
55 private:
57 
61  void
62  processConfig(const ConfigSection& section, bool isDryRun, const std::string& filename);
63 
64  static std::pair<bool, Name>
65  extractKeyName(const Interest& interest);
66 
67 private:
68  struct AuthorizedCerts
69  {
70  bool allowAny = false;
71  std::unordered_map<Name, ndn::PublicKey> certs;
72  };
73  std::unordered_map<std::string, AuthorizedCerts> m_moduleAuth;
74 
76 };
77 
78 } // namespace nfd
79 
80 #endif // NFD_DAEMON_MGMT_COMMAND_AUTHENTICATOR_HPP
configuration file parsing utility
Definition: config-file.hpp:50
represents an Interest packet
Definition: interest.hpp:42
void setConfigFile(ConfigFile &configFile)
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
ndn::mgmt::Authorization makeAuthorization(const std::string &module, const std::string &verb)
boost::property_tree::ptree ConfigSection
provides ControlCommand authorization according to NFD configuration file
static shared_ptr< CommandAuthenticator > create()
a validator for stop-and-wait command Interests
std::function< void(const Name &prefix, const Interest &interest, const ControlParameters *params, const AcceptContinuation &accept, const RejectContinuation &reject)> Authorization
a function that performs authorization
Definition: dispatcher.hpp:77