Provides support for an underlying protocol. More...
#include <protocol-factory.hpp>
Classes | |
struct | CreateFaceParams |
Parameters to ProtocolFactory::createFace. More... | |
class | Error |
Base class for all exceptions thrown by ProtocolFactory subclasses. More... | |
Public Types | |
using | CtorParams = ProtocolFactoryCtorParams |
Public Member Functions | |
virtual | ~ProtocolFactory ()=default |
virtual void | processConfig (OptionalConfigSection configSection, FaceSystem::ConfigContext &context)=0 |
Process face_system subsection that corresponds to this ProtocolFactory type. More... | |
const std::set< std::string > & | getProvidedSchemes () |
Get FaceUri schemes accepted by this ProtocolFactory. More... | |
virtual void | createFace (const CreateFaceParams ¶ms, const FaceCreatedCallback &onCreated, const FaceCreationFailedCallback &onFailure)=0 |
Try to create face using the supplied parameters. More... | |
virtual std::vector< shared_ptr< const Channel > > | getChannels () const =0 |
Static Public Member Functions | |
template<typename PF > | |
static void | registerType (const std::string &id=PF::getId()) |
Register a protocol factory type. More... | |
static unique_ptr< ProtocolFactory > | create (const std::string &id, const CtorParams ¶ms) |
Create a protocol factory instance. More... | |
static std::set< std::string > | listRegistered () |
Get registered protocol factory ids. More... | |
static const std::string & | getId () |
Get id for this ProtocolFactory. More... | |
Protected Member Functions | |
ProtocolFactory (const CtorParams ¶ms) | |
Static Protected Member Functions | |
template<typename ChannelMap > | |
static std::vector< shared_ptr< const Channel > > | getChannelsFromMap (const ChannelMap &channelMap) |
Protected Attributes | |
std::set< std::string > | providedSchemes |
FaceUri schemes provided by this ProtocolFactory. More... | |
FaceCreatedCallback | addFace |
callback when a new face is created More... | |
shared_ptr< ndn::net::NetworkMonitor > | netmon |
NetworkMonitor for listing available network interfaces and monitoring their changes. More... | |
Provides support for an underlying protocol.
A protocol factory provides support for an underlying protocol and owns Channel objects. It can process a subsection of face_system config section and create channels and multicast faces accordingly.
Definition at line 59 of file protocol-factory.hpp.
Definition at line 62 of file protocol-factory.hpp.
|
virtualdefault |
|
explicitprotected |
Definition at line 61 of file protocol-factory.cpp.
|
inlinestatic |
Register a protocol factory type.
S | subclass of ProtocolFactory |
id | factory identifier |
Definition at line 70 of file protocol-factory.hpp.
|
static |
Create a protocol factory instance.
nullptr | if factory with id is not registered |
Definition at line 41 of file protocol-factory.cpp.
References websocketpp::http::status_code::found.
Referenced by nfd::face::FaceSystem::FaceSystem().
|
static |
Get registered protocol factory ids.
Definition at line 53 of file protocol-factory.cpp.
Referenced by nfd::face::FaceSystem::FaceSystem().
|
static |
Get id for this ProtocolFactory.
face_system.factory-id config section is processed by the protocol factory.
|
pure virtual |
Process face_system subsection that corresponds to this ProtocolFactory type.
configSection | the configuration section or boost::null to indicate it is omitted |
context | provides access to data structures and contextual information |
ConfigFile::Error | invalid configuration |
This function updates providedSchemes
Implemented in nfd::face::UdpFactory, nfd::face::EthernetFactory, nfd::face::TcpFactory, nfd::face::UnixStreamFactory, and nfd::face::WebSocketFactory.
Referenced by nfd::face::FaceSystem::setConfigFile().
|
inline |
Get FaceUri schemes accepted by this ProtocolFactory.
Definition at line 127 of file protocol-factory.hpp.
Referenced by nfd::face::FaceSystem::setConfigFile().
|
pure virtual |
Try to create face using the supplied parameters.
params | parameters to create face with |
onCreated | callback if face creation succeeds or face already exists; persistency and local fields settings are not updated on an existing face |
onFailure | callback if face creation fails |
Implemented in nfd::face::UdpFactory, nfd::face::WebSocketFactory, nfd::face::EthernetFactory, nfd::face::TcpFactory, and nfd::face::UnixStreamFactory.
Referenced by nfd::FaceManager::setConfigFile().
|
pure virtual |
|
inlinestaticprotected |
Definition at line 167 of file protocol-factory.hpp.
Referenced by nfd::face::UnixStreamFactory::getChannels(), nfd::face::EthernetFactory::getChannels(), nfd::face::TcpFactory::getChannels(), nfd::face::WebSocketFactory::getChannels(), and nfd::face::UdpFactory::getChannels().
|
protected |
FaceUri schemes provided by this ProtocolFactory.
Definition at line 182 of file protocol-factory.hpp.
Referenced by nfd::face::EthernetFactory::createMulticastFace(), nfd::face::TcpFactory::processConfig(), and nfd::face::UdpFactory::processConfig().
|
protected |
callback when a new face is created
Definition at line 184 of file protocol-factory.hpp.
Referenced by nfd::face::EthernetFactory::createMulticastFace(), nfd::face::getV4Address(), nfd::face::UnixStreamFactory::processConfig(), nfd::face::WebSocketFactory::processConfig(), nfd::face::TcpFactory::processConfig(), nfd::face::UdpFactory::processConfig(), and ProtocolFactory().
|
protected |
NetworkMonitor for listing available network interfaces and monitoring their changes.
ProtocolFactory subclass should check the NetworkMonitor has sufficient capabilities prior to usage.
Definition at line 191 of file protocol-factory.hpp.
Referenced by nfd::face::EthernetFactory::createMulticastFace(), nfd::face::EthernetFactory::EthernetFactory(), nfd::face::getV4Address(), ProtocolFactory(), and nfd::face::UdpFactory::UdpFactory().