34 ndn::KeyChain& keyChain)
36 , m_keyChain(keyChain)
38 face->getValidator().addSupportedPrivilege(privilege);
67 const std::string& text)
76 const std::string& text,
80 response.setBody(body);
90 <<
" code: " << response.getCode()
91 <<
" text: " << response.getText());
93 const Block& encodedControl = response.wireEncode();
95 shared_ptr<Data> responseData(make_shared<Data>(name));
96 responseData->setContent(encodedControl);
99 m_face->put(*responseData);
110 shared_ptr<Data> responseData(make_shared<Data>(name));
111 responseData->setMetaInfo(meta);
114 m_face->put(*responseData);
137 const std::string& error)
139 NFD_LOG_DEBUG(
"command result: unauthorized command: " << *command <<
" (" << error <<
")");
140 sendResponse(command->getName(), 403,
"Unauthorized command");
shared_ptr< InternalFace > m_face
virtual void wireDecode(const Block &wire) final
#define NFD_LOG_DEBUG(expression)
indicates a producer generated NACK
represents parameters in a ControlCommand request or response
ndn::KeyChain & m_keyChain
void sendResponse(const Name &name, const ControlResponse &response)
base class of NFD ControlCommand
virtual void validateRequest(const ControlParameters ¶meters) const
validate request parameters
Class representing a wire element of NDN-TLV packet format.
static bool extractParameters(const Name::Component ¶meterComponent, ControlParameters &extractedParameters)
ndn::mgmt::ControlResponse ControlResponse
Block blockFromValue() const
Copyright (c) 2011-2015 Regents of the University of California.
void onCommandValidationFailed(const shared_ptr< const Interest > &command, const std::string &error)
ManagerBase(shared_ptr< InternalFace > face, const std::string &privilege, ndn::KeyChain &keyChain)
Name abstraction to represent an absolute name.
void sendNack(const Name &name)
Component holds a read-only name component value.
#define NFD_LOG_INIT(name)
virtual bool validateParameters(const ControlCommand &command, ControlParameters ¶meters)
virtual void applyDefaultsToRequest(ControlParameters ¶meters) const
apply default values to missing fields in request
represents an error in ControlParameters
represents an error in TLV encoding or decoding