34 , m_keyChain(keyChain)
39 Controller::startCommand(
const shared_ptr<ControlCommand>& command,
41 const CommandSucceedCallback& onSuccess,
42 const CommandFailCallback& onFailure,
45 Name requestName = command->getRequestName(options.
getPrefix(), parameters);
47 interest.setInterestLifetime(options.
getTimeout());
51 bind(&Controller::processCommandResponse,
this, _2,
52 command, onSuccess, onFailure),
57 Controller::processCommandResponse(
const Data& data,
58 const shared_ptr<ControlCommand>& command,
59 const CommandSucceedCallback& onSuccess,
60 const CommandFailCallback& onFailure)
68 catch (tlv::Error& e) {
69 if (static_cast<bool>(onFailure))
74 uint32_t code = response.getCode();
76 if (static_cast<bool>(onFailure))
77 onFailure(code, response.getText());
85 catch (tlv::Error& e) {
86 if (static_cast<bool>(onFailure))
92 command->validateResponse(parameters);
94 catch (ControlCommand::ArgumentError& e) {
95 if (static_cast<bool>(onFailure))
100 if (static_cast<bool>(onSuccess))
101 onSuccess(parameters);
virtual void wireDecode(const Block &wire) final
Copyright (c) 2011-2015 Regents of the University of California.
represents parameters in a ControlCommand request or response
const Block & getContent() const
Get content Block.
const security::SigningInfo & getSigningInfo() const
The packet signing interface.
const time::milliseconds & getTimeout() const
represents an Interest packet
void sign(Data &data, const SigningInfo ¶ms=DEFAULT_SIGNING_INFO)
Sign data according to the supplied signing information.
static const uint32_t ERROR_TIMEOUT
error code for timeout
static const uint32_t ERROR_LBOUND
inclusive lower bound of error codes
ndn::mgmt::ControlResponse ControlResponse
contains options for ControlCommand execution
Copyright (c) 2011-2015 Regents of the University of California.
Abstraction to communicate with local or remote NDN forwarder.
Name abstraction to represent an absolute name.
const PendingInterestId * expressInterest(const Interest &interest, const OnData &onData, const OnTimeout &onTimeout=OnTimeout())
Express Interest.
const Name & getPrefix() const
void wireDecode(const Block &block)
Block blockFromValue() const
Controller(Face &face, KeyChain &keyChain)
construct a Controller that uses face for transport, and uses the passed KeyChain to sign commands ...
static const uint32_t ERROR_SERVER
error code for server error