26 #include <boost/lexical_cast.hpp>    41   , m_keyChain(keyChain)
    42   , m_validator(validator)
    55 Controller::startCommand(
const shared_ptr<ControlCommand>& command,
    61   Name requestName = command->getRequestName(options.
getPrefix(), parameters);
    67       processCommandResponse(data, command, onSuccess, onFailure);
    71         onFailure(
ControlResponse(Controller::ERROR_NACK, 
"network Nack received"));
    75         onFailure(
ControlResponse(Controller::ERROR_TIMEOUT, 
"request timed out"));
    80 Controller::processCommandResponse(
const Data& data,
    81                                    const shared_ptr<ControlCommand>& command,
    86     [=] (
const Data& data) {
    87       processValidatedCommandResponse(data, command, onSuccess, onFailure);
    89     [=] (
const Data&, 
const auto& error) {
    97 Controller::processValidatedCommandResponse(
const Data& data,
    98                                             const shared_ptr<ControlCommand>& command,
   112   uint32_t code = response.
getCode();
   130     command->validateResponse(parameters);
   139     onSuccess(parameters);
   143 Controller::fetchDataset(
const Name& prefix,
   152   if (processResponse) {
   153     fetcher->onComplete.connect(processResponse);
   156     fetcher->onError.connect([=] (uint32_t code, 
const std::string& msg) {
   157       processDatasetFetchError(onFailure, code, msg);
   163   fetcher->onError.connect([
this, it] (uint32_t, 
const std::string&) { 
m_fetchers.erase(it); });
   168                                      uint32_t code, std::string msg)
   170   BOOST_ASSERT(onFailure);
   172   switch (static_cast<SegmentFetcher::ErrorCode>(code)) {
   176     case SegmentFetcher::ErrorCode::INTEREST_TIMEOUT:
   179     case SegmentFetcher::ErrorCode::DATA_HAS_NO_SEGMENT:
   180     case SegmentFetcher::ErrorCode::FINALBLOCKID_NOT_SEGMENT:
   183     case SegmentFetcher::ErrorCode::SEGMENT_VALIDATION_FAIL:
   188     case SegmentFetcher::ErrorCode::NACK_ERROR:
 void wireDecode(const Block &wire) final
The interface of signing key management. 
represents parameters in a ControlCommand request or response 
const Block & getContent() const
Get Content. 
security::CommandInterestSigner m_signer
const Block & getBody() const
function< void(const ControlResponse &)> CommandFailCallback
a callback on command failure 
const security::SigningInfo & getSigningInfo() const
function< void(uint32_t code, const std::string &reason)> DatasetFailCallback
a callback on dataset retrieval failure 
time::milliseconds maxTimeout
maximum allowed time between successful receipt of segments 
Utility class to fetch the latest version of a segmented object. 
const time::milliseconds & getTimeout() const
Represents an Interest packet. 
static const uint32_t ERROR_TIMEOUT
error code for timeout 
represents a Network Nack 
static const uint32_t ERROR_LBOUND
inclusive lower bound of error codes 
mgmt::ControlResponse ControlResponse
contains options for ControlCommand execution 
static shared_ptr< SegmentFetcher > start(Face &face, const Interest &baseInterest, security::v2::Validator &validator, const Options &options=Options())
Initiates segment fetching. 
void validate(const Data &data, const DataValidationSuccessCallback &successCb, const DataValidationFailureCallback &failureCb)
Asynchronously validate data. 
Provide a communication channel with local or remote NDN forwarder. 
static const uint32_t ERROR_VALIDATION
error code for response validation failure 
Controller(Face &face, KeyChain &keyChain, security::v2::Validator &validator=security::getAcceptAllValidator())
construct a Controller that uses face for transport, and uses the passed KeyChain to sign commands ...
Interest makeCommandInterest(const Name &name, const SigningInfo ¶ms=KeyChain::getDefaultSigningInfo())
Create CommandInterest. 
Represents an absolute name. 
std::set< shared_ptr< util::SegmentFetcher > > m_fetchers
function< void(const ControlParameters &)> CommandSucceedCallback
a callback on command success 
PendingInterestHandle expressInterest(const Interest &interest, const DataCallback &afterSatisfied, const NackCallback &afterNacked, const TimeoutCallback &afterTimeout)
Express Interest. 
const Name & getPrefix() const
void wireDecode(const Block &block)
Block blockFromValue() const
security::v2::Validator & m_validator
Interest & setInterestLifetime(time::milliseconds lifetime)
Set the Interest's lifetime. 
represents an error in ControlParameters 
Represents a Data packet. 
represents an error in TLV encoding or decoding 
Interface for validating data and interest packets. 
static const uint32_t ERROR_SERVER
error code for server error 
static const uint32_t ERROR_NACK
error code for network Nack 
shared_ptr< const Buffer > ConstBufferPtr