|
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.
28 #include <boost/range/adaptor/map.hpp>
29 #include <boost/range/algorithm/copy.hpp>
34 ProtocolFactory::Registry&
35 ProtocolFactory::getRegistry()
37 static Registry registry;
41 unique_ptr<ProtocolFactory>
44 Registry& registry = getRegistry();
45 auto found = registry.find(
id);
46 if (found == registry.end()) {
50 return found->second(params);
56 std::set<std::string> factoryIds;
57 boost::copy(getRegistry() | boost::adaptors::map_keys,
58 std::inserter(factoryIds, factoryIds.end()));
63 : addFace(params.addFace)
64 , netmon(params.netmon)
66 BOOST_ASSERT(
addFace !=
nullptr);
67 BOOST_ASSERT(
netmon !=
nullptr);
76 doProcessConfig(configSection, context);
94 doCreateFace(req, onCreated, onFailure);
98 ProtocolFactory::doCreateFace(
const CreateFaceRequest&,
102 onFailure(406,
"Unsupported protocol");
107 const shared_ptr<const ndn::net::NetworkInterface>& netif)
110 return doCreateNetdevBoundFace(remote, netif);
114 ProtocolFactory::doCreateNetdevBoundFace(
const FaceUri&,
115 const shared_ptr<const ndn::net::NetworkInterface>&)
117 NDN_THROW(Error(
"This protocol factory does not support netdev-bound faces"));
120 std::vector<shared_ptr<const Channel>>
123 return doGetChannels();
126 std::vector<shared_ptr<const Channel>>
127 ProtocolFactory::doGetChannels()
const
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
optional< FaceUri > localUri
ProtocolFactory(const CtorParams ¶ms)
void processConfig(OptionalConfigSection configSection, FaceSystem::ConfigContext &context)
Process face_system subsection that corresponds to this protocol factory id.
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
Parameters to ProtocolFactory constructor.
Encapsulates a face creation request and all its parameters.
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...
static bool canCanonize(const std::string &scheme)
shared_ptr< Face > createNetdevBoundFace(const FaceUri &remote, const shared_ptr< const ndn::net::NetworkInterface > &netdev)
Create a netdev-bound face.
bool isCanonical() const
determine whether this FaceUri is in canonical form
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)
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.
const std::string & getScheme() const
get scheme (protocol)
context for processing a config section in ProtocolFactory