26 #ifndef NFD_DAEMON_MGMT_MANAGER_BASE_HPP
27 #define NFD_DAEMON_MGMT_MANAGER_BASE_HPP
34 #include <ndn-cxx/management/nfd-control-command.hpp>
35 #include <ndn-cxx/management/nfd-control-response.hpp>
36 #include <ndn-cxx/management/nfd-control-parameters.hpp>
40 using ndn::nfd::ControlCommand;
41 using ndn::nfd::ControlResponse;
42 using ndn::nfd::ControlParameters;
50 struct Error :
public std::runtime_error
52 Error(
const std::string& what) : std::runtime_error(what) {}
56 const std::string& privilege,
57 ndn::KeyChain& keyChain);
64 const std::string& error);
70 ControlParameters& extractedParameters);
75 const std::string& text);
79 const std::string& text,
84 const ControlResponse& response);
89 const std::string& text);
94 const std::string& text,
102 ControlParameters& parameters);
107 const ndn::IdentityCertificate& certificate);
112 const ndn::PublicKey& publicKey);
116 const ndn::OnInterestValidated& onValidated,
117 const ndn::OnInterestValidationFailed& onValidationFailed);
127 const std::string& text)
129 response.setCode(code);
130 response.setText(text);
136 const std::string& text,
140 response.setBody(body);
145 const ndn::IdentityCertificate& certificate)
147 m_face->getValidator().addInterestRule(regex, certificate);
153 const ndn::PublicKey& publicKey)
155 m_face->getValidator().addInterestRule(regex, keyName, publicKey);
160 const ndn::OnInterestValidated& onValidated,
161 const ndn::OnInterestValidationFailed& onValidationFailed)
163 m_face->getValidator().validate(interest, onValidated, onValidationFailed);
169 #endif // NFD_DAEMON_MGMT_MANAGER_BASE_HPP
shared_ptr< InternalFace > m_face
ndn::KeyChain & m_keyChain
#define PUBLIC_WITH_TESTS_ELSE_PROTECTED
void sendResponse(const Name &name, const ControlResponse &response)
static bool extractParameters(const Name::Component ¶meterComponent, ControlParameters &extractedParameters)
void onCommandValidationFailed(const shared_ptr< const Interest > &command, const std::string &error)
ManagerBase(shared_ptr< InternalFace > face, const std::string &privilege, ndn::KeyChain &keyChain)
void sendNack(const Name &name)
void addInterestRule(const std::string ®ex, const ndn::IdentityCertificate &certificate)
void setResponse(ControlResponse &response, uint32_t code, const std::string &text)
virtual bool validateParameters(const ControlCommand &command, ControlParameters ¶meters)
void validate(const Interest &interest, const ndn::OnInterestValidated &onValidated, const ndn::OnInterestValidationFailed &onValidationFailed)
Error(const std::string &what)