NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
nfd::ManagerBase Class Reference

A collection of common functions shared by all NFD managers, such as communicating with the dispatcher and command validator. More...

#include <manager-base.hpp>

Inheritance diagram for nfd::ManagerBase:
Collaboration diagram for nfd::ManagerBase:

Classes

class  Error
 

Public Member Functions

virtual ~ManagerBase ()
 
const std::string & getModule () const
 

Protected Member Functions

 ManagerBase (const std::string &module, Dispatcher &dispatcher)
 
 ManagerBase (const std::string &module, Dispatcher &dispatcher, CommandAuthenticator &authenticator)
 
template<typename Command >
void registerCommandHandler (const std::string &verb, const ControlCommandHandler &handler)
 
void registerStatusDatasetHandler (const std::string &verb, const ndn::mgmt::StatusDatasetHandler &handler)
 
ndn::mgmt::PostNotification registerNotificationStream (const std::string &verb)
 
PartialName makeRelPrefix (const std::string &verb)
 Generates the relative prefix for a handler by appending the verb name to the module name. More...
 

Static Protected Member Functions

static bool validateParameters (const ControlCommand &command, const ndn::mgmt::ControlParameters &parameters)
 Validates the parameters for a given command. More...
 
static void handleCommand (shared_ptr< ControlCommand > command, const ControlCommandHandler &handler, const Name &prefix, const Interest &interest, const ndn::mgmt::ControlParameters &params, const ndn::mgmt::CommandContinuation &done)
 Handles a control command. More...
 

Protected Attributes

NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED __pad0__: using ControlCommandHandler = std::function<void(const ControlCommand& command
 
NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED const Nameprefix
 
NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED const Name const Interestinterest
 
NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED const Name const Interest const ControlParametersparameters
 
NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED const Name const Interest const ControlParameters const ndn::mgmt::CommandContinuation done
 
NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED __pad1__: static void extractRequester(const Interest& interest
 
NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED const ndn::mgmt::AcceptContinuationaccept
 
NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE __pad2__: virtual ndn::mgmt::Authorization makeAuthorization(const std::string& verb)
 

Detailed Description

A collection of common functions shared by all NFD managers, such as communicating with the dispatcher and command validator.

Definition at line 47 of file manager-base.hpp.

Constructor & Destructor Documentation

◆ ~ManagerBase()

nfd::ManagerBase::~ManagerBase ( )
virtualdefault

Referenced by ManagerBase().

◆ ManagerBase() [1/2]

nfd::ManagerBase::ManagerBase ( const std::string &  module,
Dispatcher dispatcher 
)
protected
Warning
if you use this constructor, you MUST override makeAuthorization()

Definition at line 30 of file manager-base.cpp.

Referenced by getModule().

◆ ManagerBase() [2/2]

nfd::ManagerBase::ManagerBase ( const std::string &  module,
Dispatcher dispatcher,
CommandAuthenticator authenticator 
)
protected

Definition at line 36 of file manager-base.cpp.

References ~ManagerBase().

Member Function Documentation

◆ getModule()

const std::string& nfd::ManagerBase::getModule ( ) const
inline

Definition at line 60 of file manager-base.hpp.

References ManagerBase(), and NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED.

◆ registerCommandHandler()

template<typename Command >
void nfd::ManagerBase::registerCommandHandler ( const std::string &  verb,
const ControlCommandHandler &  handler 
)
protected

Definition at line 152 of file manager-base.hpp.

References handleCommand(), makeRelPrefix(), and validateParameters().

◆ registerStatusDatasetHandler()

void nfd::ManagerBase::registerStatusDatasetHandler ( const std::string &  verb,
const ndn::mgmt::StatusDatasetHandler handler 
)
protected

◆ registerNotificationStream()

◆ validateParameters()

bool nfd::ManagerBase::validateParameters ( const ControlCommand command,
const ndn::mgmt::ControlParameters parameters 
)
staticprotected

Validates the parameters for a given command.

Parameters
parametersthe original ControlParameters
Returns
whether the original ControlParameters can be validated

Definition at line 88 of file manager-base.cpp.

References ndn::nfd::ControlCommand::validateRequest().

Referenced by registerCommandHandler().

◆ handleCommand()

void nfd::ManagerBase::handleCommand ( shared_ptr< ControlCommand command,
const ControlCommandHandler &  handler,
const Name prefix,
const Interest interest,
const ndn::mgmt::ControlParameters params,
const ndn::mgmt::CommandContinuation done 
)
staticprotected

Handles a control command.

Definition at line 103 of file manager-base.cpp.

References parameters.

Referenced by registerCommandHandler().

◆ makeRelPrefix()

PartialName nfd::ManagerBase::makeRelPrefix ( const std::string &  verb)
inlineprotected

Generates the relative prefix for a handler by appending the verb name to the module name.

Parameters
verbthe verb name
Returns
the generated relative prefix

Definition at line 139 of file manager-base.hpp.

References ndn::Name::append().

Referenced by registerCommandHandler(), registerNotificationStream(), and registerStatusDatasetHandler().

Member Data Documentation

◆ __pad0__

NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED nfd::ManagerBase::__pad0__
protected

Definition at line 76 of file manager-base.hpp.

◆ prefix

NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED const Name& nfd::ManagerBase::prefix
protected

◆ interest

◆ parameters

◆ done

◆ __pad1__

NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED nfd::ManagerBase::__pad1__
protected

Definition at line 103 of file manager-base.hpp.

◆ accept

◆ __pad2__

NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE nfd::ManagerBase::__pad2__
protected

Definition at line 110 of file manager-base.hpp.


The documentation for this class was generated from the following files: