34 , m_keyChain(keyChain)
39 Controller::startCommand(
const shared_ptr<ControlCommand>& command,
45 Name requestName = command->getRequestName(options.
getPrefix(), parameters);
51 bind(&Controller::processCommandResponse,
this, _2,
52 command, onSuccess, onFailure),
57 Controller::processCommandResponse(
const Data& data,
58 const shared_ptr<ControlCommand>& command,
69 if (static_cast<bool>(onFailure))
74 uint32_t code = response.
getCode();
76 if (static_cast<bool>(onFailure))
77 onFailure(code, response.
getText());
86 if (static_cast<bool>(onFailure))
92 command->validateResponse(parameters);
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 & getBody() const
represents an Interest packet
const Name & getPrefix() const
const std::string & getText() const
static const uint32_t ERROR_TIMEOUT
error code for timeout
function< void(const ControlParameters &)> CommandSucceedCallback
a callback on command success
static const uint32_t ERROR_LBOUND
inclusive lower bound of error codes
Block blockFromValue() const
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.
void wireDecode(const Block &block)
const Block & getContent() const
Get content Block.
function< void(uint32_t, const std::string &)> CommandFailCallback
a callback on command failure
Controller(Face &face, KeyChain &keyChain)
construct a Controller that uses face for transport, and uses the passed KeyChain to sign commands ...
represents an error in ControlParameters
Interest & setInterestLifetime(const time::milliseconds &interestLifetime)
const time::milliseconds & getTimeout() const
represents an error in TLV encoding or decoding
static const uint32_t ERROR_SERVER
error code for server error
const security::SigningInfo & getSigningInfo() const