ndn::nfd::Controller Class Reference

NFD Management protocol client. More...

#include <ndn-cxx/mgmt/nfd/controller.hpp>

+ Inheritance diagram for ndn::nfd::Controller:
+ Collaboration diagram for ndn::nfd::Controller:

Public Types

using CommandFailCallback = function< void(const ControlResponse &)>
 Callback on command failure. More...
 
using CommandSucceedCallback = function< void(const ControlParameters &)>
 Callback on command success. More...
 
using DatasetFailCallback = function< void(uint32_t code, const std::string &reason)>
 Callback on dataset retrieval failure. More...
 

Public Member Functions

 Controller (Face &face, KeyChain &keyChain, security::Validator &validator=security::getAcceptAllValidator())
 Construct a Controller that uses face as transport and keyChain to sign commands. More...
 
 ~Controller ()
 
template<typename Dataset , typename ParamType = typename Dataset::ParamType>
void fetch (const ParamType &param, const std::function< void(typename Dataset::ResultType)> &onSuccess, const DatasetFailCallback &onFailure, const CommandOptions &options=CommandOptions())
 Start dataset fetching. More...
 
template<typename Dataset >
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. More...
 
template<typename Command >
void start (const ControlParameters &parameters, const CommandSucceedCallback &onSuccess, const CommandFailCallback &onFailure, const CommandOptions &options=CommandOptions())
 Start command execution. More...
 

Static Public Attributes

static const uint32_t ERROR_LBOUND = 400
 Inclusive lower bound of error codes. More...
 
static const uint32_t ERROR_NACK = 10800
 Error code for network Nack. More...
 
static const uint32_t ERROR_SERVER = 500
 Error code for server error. More...
 
static const uint32_t ERROR_TIMEOUT = 10060
 Error code for timeout. More...
 
static const uint32_t ERROR_VALIDATION = 10021
 Error code for response validation failure. More...
 

Protected Attributes

Facem_face
 
std::set< shared_ptr< util::SegmentFetcher > > m_fetchers
 
KeyChain & m_keyChain
 
security::InterestSigner m_signer
 
security::Validatorm_validator
 

Detailed Description

NFD Management protocol client.

See also
https://redmine.named-data.net/projects/nfd/wiki/Management

Definition at line 51 of file controller.hpp.

Member Typedef Documentation

◆ CommandFailCallback

Callback on command failure.

Definition at line 62 of file controller.hpp.

◆ CommandSucceedCallback

Callback on command success.

Definition at line 57 of file controller.hpp.

◆ DatasetFailCallback

using ndn::nfd::Controller::DatasetFailCallback = function<void(uint32_t code, const std::string& reason)>

Callback on dataset retrieval failure.

Definition at line 67 of file controller.hpp.

Constructor & Destructor Documentation

◆ Controller()

ndn::nfd::Controller::Controller ( Face face,
KeyChain &  keyChain,
security::Validator validator = security::getAcceptAllValidator() 
)

Construct a Controller that uses face as transport and keyChain to sign commands.

Definition at line 39 of file controller.cpp.

◆ ~Controller()

ndn::nfd::Controller::~Controller ( )

Definition at line 47 of file controller.cpp.

Member Function Documentation

◆ fetch() [1/2]

template<typename Dataset , typename ParamType = typename Dataset::ParamType>
void ndn::nfd::Controller::fetch ( const ParamType &  param,
const std::function< void(typename Dataset::ResultType)> &  onSuccess,
const DatasetFailCallback onFailure,
const CommandOptions options = CommandOptions() 
)
inline

Start dataset fetching.

Definition at line 104 of file controller.hpp.

◆ fetch() [2/2]

template<typename Dataset >
std::enable_if_t<std::is_default_constructible<Dataset>::value> ndn::nfd::Controller::fetch ( const std::function< void(typename Dataset::ResultType)> &  onSuccess,
const DatasetFailCallback onFailure,
const CommandOptions options = CommandOptions() 
)
inline

Start dataset fetching.

Definition at line 93 of file controller.hpp.

◆ start()

template<typename Command >
void ndn::nfd::Controller::start ( const ControlParameters parameters,
const CommandSucceedCallback onSuccess,
const CommandFailCallback onFailure,
const CommandOptions options = CommandOptions() 
)
inline

Start command execution.

Definition at line 81 of file controller.hpp.

Member Data Documentation

◆ ERROR_LBOUND

const uint32_t ndn::nfd::Controller::ERROR_LBOUND = 400
static

Inclusive lower bound of error codes.

Definition at line 169 of file controller.hpp.

◆ ERROR_NACK

const uint32_t ndn::nfd::Controller::ERROR_NACK = 10800
static

Error code for network Nack.

Definition at line 160 of file controller.hpp.

◆ ERROR_SERVER

const uint32_t ndn::nfd::Controller::ERROR_SERVER = 500
static

Error code for server error.

Definition at line 166 of file controller.hpp.

◆ ERROR_TIMEOUT

const uint32_t ndn::nfd::Controller::ERROR_TIMEOUT = 10060
static

Error code for timeout.

Definition at line 157 of file controller.hpp.

◆ ERROR_VALIDATION

const uint32_t ndn::nfd::Controller::ERROR_VALIDATION = 10021
static

Error code for response validation failure.

Definition at line 163 of file controller.hpp.

◆ m_face

Face& ndn::nfd::Controller::m_face
protected

Definition at line 172 of file controller.hpp.

◆ m_fetchers

std::set<shared_ptr<util::SegmentFetcher> > ndn::nfd::Controller::m_fetchers
protected

Definition at line 178 of file controller.hpp.

◆ m_keyChain

KeyChain& ndn::nfd::Controller::m_keyChain
protected

Definition at line 173 of file controller.hpp.

◆ m_signer

security::InterestSigner ndn::nfd::Controller::m_signer
protected

Definition at line 175 of file controller.hpp.

◆ m_validator

security::Validator& ndn::nfd::Controller::m_validator
protected

Definition at line 174 of file controller.hpp.