35 , m_keyChain(keyChain)
40 Controller::startCommand(
const shared_ptr<ControlCommand>& command,
46 Name requestName = command->getRequestName(options.
getPrefix(), parameters);
52 bind(&Controller::processCommandResponse,
this, _2,
53 command, onSuccess, onFailure),
54 bind(onFailure,
ERROR_NACK,
"network Nack received"),
59 Controller::processCommandResponse(
const Data& data,
60 const shared_ptr<ControlCommand>& command,
71 if (static_cast<bool>(onFailure))
76 uint32_t code = response.
getCode();
78 if (static_cast<bool>(onFailure))
79 onFailure(code, response.
getText());
88 if (static_cast<bool>(onFailure))
94 command->validateResponse(parameters);
97 if (static_cast<bool>(onFailure))
102 if (static_cast<bool>(onSuccess))
103 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 Block & getBody() const
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
function< void(const ControlParameters &)> CommandSucceedCallback
a callback on command success
static const uint32_t ERROR_LBOUND
inclusive lower bound of error codes
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 Name & getPrefix() const
void wireDecode(const Block &block)
Block blockFromValue() const
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 ...
const std::string & getText() const
const PendingInterestId * expressInterest(const Interest &interest, const DataCallback &afterSatisfied, const NackCallback &afterNacked, const TimeoutCallback &afterTimeout)
Express Interest.
represents an error in ControlParameters
Interest & setInterestLifetime(const time::milliseconds &interestLifetime)
represents an error in TLV encoding or decoding
static const uint32_t ERROR_SERVER
error code for server error
static const uint32_t ERROR_NACK
error code for network Nack