22 #ifndef NDN_CXX_MGMT_NFD_CONTROLLER_HPP 23 #define NDN_CXX_MGMT_NFD_CONTROLLER_HPP 76 template<
typename Command>
83 startCommand(make_shared<Command>(), parameters, onSuccess, onFailure, options);
88 template<
typename Dataset>
90 fetch(
const std::function<
void(
typename Dataset::ResultType)>& onSuccess,
94 fetchDataset(make_shared<Dataset>(), onSuccess, onFailure, options);
99 template<
typename Dataset,
typename ParamType =
typename Dataset::ParamType>
102 const std::function<
void(
typename Dataset::ResultType)>& onSuccess,
106 fetchDataset(make_shared<Dataset>(param), onSuccess, onFailure, options);
111 startCommand(
const shared_ptr<ControlCommand>& command,
118 processCommandResponse(
const Data& data,
119 const shared_ptr<ControlCommand>& command,
124 processValidatedCommandResponse(
const Data& data,
125 const shared_ptr<ControlCommand>& command,
129 template<
typename Dataset>
131 fetchDataset(shared_ptr<Dataset> dataset,
132 const std::function<
void(
typename Dataset::ResultType)>& onSuccess,
137 fetchDataset(
const Name& prefix,
142 template<
typename Dataset>
144 processDatasetResponse(shared_ptr<Dataset> dataset,
145 const std::function<
void(
typename Dataset::ResultType)>& onSuccess,
150 processDatasetFetchError(
const DatasetFailCallback& onFailure, uint32_t code, std::string msg);
180 std::set<shared_ptr<util::SegmentFetcher>> m_fetchers;
183 template<
typename Dataset>
185 Controller::fetchDataset(shared_ptr<Dataset> dataset,
186 const std::function<
void(
typename Dataset::ResultType)>& onSuccess,
190 Name prefix = dataset->getDatasetPrefix(options.
getPrefix());
198 template<
typename Dataset>
200 Controller::processDatasetResponse(shared_ptr<Dataset> dataset,
201 const std::function<
void(
typename Dataset::ResultType)>& onSuccess,
205 typename Dataset::ResultType result;
208 result = dataset->parseResult(
std::move(payload));
223 #endif // NDN_CXX_MGMT_NFD_CONTROLLER_HPP void start(const ControlParameters ¶meters, const CommandSucceedCallback &onSuccess, const CommandFailCallback &onFailure, const CommandOptions &options=CommandOptions())
start command execution
Copyright (c) 2011-2015 Regents of the University of California.
represents parameters in a ControlCommand request or response
function< void(const ControlResponse &)> CommandFailCallback
a callback on command failure
security::InterestSigner m_signer
Controller(Face &face, KeyChain &keyChain, security::Validator &validator=security::getAcceptAllValidator())
construct a Controller that uses face for transport, and uses the passed KeyChain to sign commands ...
function< void(uint32_t code, const std::string &reason)> DatasetFailCallback
a callback on dataset retrieval failure
std::enable_if_t< std::is_default_constructible< Dataset >::value > fetch(const std::function< void(typename Dataset::ResultType)> &onSuccess, const DatasetFailCallback &onFailure, const CommandOptions &options=CommandOptions())
start dataset fetching
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED
static const uint32_t ERROR_TIMEOUT
error code for timeout
Helper class to create signed Interests.
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.
Provide a communication channel with local or remote NDN forwarder.
NFD Management protocol client.
static const uint32_t ERROR_VALIDATION
error code for response validation failure
Represents an absolute name.
function< void(const ControlParameters &)> CommandSucceedCallback
a callback on command success
const Name & getPrefix() const
security::Validator & m_validator
Validator & getAcceptAllValidator()
Represents a Data packet.
void fetch(const ParamType ¶m, const std::function< void(typename Dataset::ResultType)> &onSuccess, const DatasetFailCallback &onFailure, const CommandOptions &options=CommandOptions())
start dataset fetching
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
shared_ptr< const Buffer > ConstBufferPtr