|
NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
|
API Documentation
|
Go to the documentation of this file.
26 #ifndef NFD_DAEMON_FACE_PROTOCOL_FACTORY_HPP
27 #define NFD_DAEMON_FACE_PROTOCOL_FACTORY_HPP
33 #include <boost/range/adaptor/map.hpp>
34 #include <boost/range/algorithm/copy.hpp>
49 shared_ptr<ndn::net::NetworkMonitor>
netmon;
72 Registry& registry = getRegistry();
73 BOOST_ASSERT(registry.count(
id) == 0);
74 registry[id] = [] (
const CtorParams& p) {
return make_unique<PF>(p); };
80 static unique_ptr<ProtocolFactory>
85 static std::set<std::string>
91 class Error :
public std::runtime_error
94 using std::runtime_error::runtime_error;
108 static const std::string&
114 const std::set<std::string>&
161 const shared_ptr<const ndn::net::NetworkInterface>& netdev);
165 std::vector<shared_ptr<const Channel>>
169 template<
typename ChannelMap>
170 static std::vector<shared_ptr<const Channel>>
173 std::vector<shared_ptr<const Channel>> channels;
174 boost::copy(channelMap | boost::adaptors::map_values, std::back_inserter(channels));
199 doCreateFace(
const CreateFaceRequest& req,
218 virtual shared_ptr<Face>
219 doCreateNetdevBoundFace(
const FaceUri& remote,
220 const shared_ptr<const ndn::net::NetworkInterface>& netif);
227 virtual std::vector<shared_ptr<const Channel>>
228 doGetChannels()
const;
231 using CreateFunc = std::function<unique_ptr<ProtocolFactory>(
const CtorParams&)>;
232 using Registry = std::map<std::string, CreateFunc>;
246 shared_ptr<ndn::net::NetworkMonitor>
netmon;
256 #define NFD_REGISTER_PROTOCOL_FACTORY(PF) \
257 static class NfdAuto ## PF ## ProtocolFactoryRegistrationClass \
260 NfdAuto ## PF ## ProtocolFactoryRegistrationClass() \
262 ::nfd::face::ProtocolFactory::registerType<PF>(); \
264 } g_nfdAuto ## PF ## ProtocolFactoryRegistrationVariable
266 #endif // NFD_DAEMON_FACE_PROTOCOL_FACTORY_HPP
shared_ptr< ndn::net::NetworkMonitor > netmon
NetworkMonitor for listing available network interfaces and monitoring their changes.
void createFace(const CreateFaceRequest &req, const FaceCreatedCallback &onCreated, const FaceCreationFailedCallback &onFailure)
Create a unicast face.
represents the underlying protocol and address used by a Face
std::set< std::string > providedSchemes
FaceUri schemes provided by this protocol factory.
optional< FaceUri > localUri
FaceCreatedCallback addFace
ProtocolFactory(const CtorParams ¶ms)
Provides support for an underlying protocol.
void processConfig(OptionalConfigSection configSection, FaceSystem::ConfigContext &context)
Process face_system subsection that corresponds to this protocol factory id.
static void registerType(const std::string &id=PF::getId())
Register a protocol factory type.
boost::optional< const ConfigSection & > OptionalConfigSection
an optional config file section
Copyright (c) 2011-2015 Regents of the University of California.
FaceCreatedCallback addFace
callback when a new face is created
static unique_ptr< ProtocolFactory > create(const std::string &id, const CtorParams ¶ms)
Create a protocol factory instance.
virtual ~ProtocolFactory()=0
const std::set< std::string > & getProvidedSchemes() const
Get FaceUri schemes accepted by this protocol factory.
Parameters to ProtocolFactory constructor.
Encapsulates a face creation request and all its parameters.
shared_ptr< ndn::net::NetworkMonitor > netmon
Base class for all exceptions thrown by ProtocolFactory subclasses.
static const std::string & getId() noexcept
Get id for this protocol factory.
std::function< void(const shared_ptr< Face > &)> FaceCreatedCallback
Prototype for the callback that is invoked when a face is created (in response to an incoming connect...
ProtocolFactoryCtorParams CtorParams
shared_ptr< Face > createNetdevBoundFace(const FaceUri &remote, const shared_ptr< const ndn::net::NetworkInterface > &netdev)
Create a netdev-bound face.
Parameters used to set Transport properties or LinkService options on a newly created face.
static std::set< std::string > listRegistered()
Get all registered protocol factory ids.
std::vector< shared_ptr< const Channel > > getChannels() const
Get list of open channels (listening + non-listening)
static std::vector< shared_ptr< const Channel > > getChannelsFromMap(const ChannelMap &channelMap)
std::function< void(uint32_t status, const std::string &reason)> FaceCreationFailedCallback
Prototype for the callback that is invoked when a face fails to be created.
context for processing a config section in ProtocolFactory