Provides support for an underlying protocol. More...
#include <protocol-factory.hpp>
Classes | |
struct | CreateFaceRequest |
Encapsulates a face creation request and all its parameters. 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 CreateFaceRequest &req, const FaceCreatedCallback &onCreated, const FaceCreationFailedCallback &onFailure)=0 |
Try to create a unicast 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.
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.
|
inline |
Get FaceUri schemes accepted by this ProtocolFactory.
Definition at line 127 of file protocol-factory.hpp.
References providedSchemes.
|
pure virtual |
Try to create a unicast face using the supplied parameters.
req | request object containing the face creation parameters |
onCreated | callback if face creation succeeds or face already exists; the settings of an existing face are not updated if they differ from the request |
onFailure | callback if face creation fails |
Implemented in nfd::face::UdpFactory, nfd::face::WebSocketFactory, nfd::face::EthernetFactory, nfd::face::TcpFactory, and nfd::face::UnixStreamFactory.
|
pure virtual |
|
inlinestaticprotected |
Definition at line 165 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 180 of file protocol-factory.hpp.
Referenced by getProvidedSchemes(), nfd::face::TcpFactory::processConfig(), and nfd::face::UdpFactory::processConfig().
|
protected |
callback when a new face is created
Definition at line 181 of file protocol-factory.hpp.
Referenced by nfd::face::TcpFactory::processConfig(), nfd::face::WebSocketFactory::processConfig(), nfd::face::UnixStreamFactory::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 188 of file protocol-factory.hpp.
Referenced by nfd::face::EthernetFactory::EthernetFactory(), ProtocolFactory(), and nfd::face::UdpFactory::UdpFactory().