protocol factory for UDP over IPv4 and IPv6 More...
#include <udp-factory.hpp>
Classes | |
class | Error |
Exception of UdpFactory. More... | |
Public Member Functions | |
void | processConfig (OptionalConfigSection configSection, FaceSystem::ConfigContext &context) override |
process face_system.udp config section More... | |
void | createFace (const FaceUri &uri, ndn::nfd::FacePersistency persistency, bool wantLocalFieldsEnabled, const FaceCreatedCallback &onCreated, const FaceCreationFailedCallback &onFailure) override |
Try to create Face using the supplied FaceUri. More... | |
shared_ptr< UdpChannel > | createChannel (const udp::Endpoint &localEndpoint, const time::seconds &timeout=time::seconds(600)) |
Create UDP-based channel using udp::Endpoint. More... | |
shared_ptr< UdpChannel > | createChannel (const std::string &localIp, const std::string &localPort, const time::seconds &timeout=time::seconds(600)) |
Create UDP-based channel using specified IP address and port number. More... | |
std::vector< shared_ptr< const Channel > > | getChannels () const override |
shared_ptr< Face > | createMulticastFace (const udp::Endpoint &localEndpoint, const udp::Endpoint &multicastEndpoint, const std::string &networkInterfaceName="") |
Create MulticastUdpFace using udp::Endpoint. More... | |
shared_ptr< Face > | createMulticastFace (const std::string &localIp, const std::string &multicastIp, const std::string &multicastPort, const std::string &networkInterfaceName="") |
const std::set< std::string > & | getProvidedSchemes () |
Static Public Member Functions | |
static const std::string & | getId () |
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) |
static std::set< std::string > | listRegistered () |
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... | |
protocol factory for UDP over IPv4 and IPv6
UDP unicast is available over both IPv4 and IPv6. UDP multicast is available over IPv4 only.
Definition at line 40 of file udp-factory.hpp.
|
staticinherited |
nullptr | if factory with id is not registered |
Definition at line 41 of file protocol-factory.cpp.
shared_ptr< UdpChannel > nfd::face::UdpFactory::createChannel | ( | const udp::Endpoint & | localEndpoint, |
const time::seconds & | timeout = time::seconds(600) |
||
) |
Create UDP-based channel using udp::Endpoint.
udp::Endpoint is really an alias for boost::asio::ip::udp::endpoint.
If this method called twice with the same endpoint, only one channel will be created. The second call will just retrieve the existing channel.
If a multicast face is already active on the same local endpoint, the creation fails and an exception is thrown
Once a face is created, if it doesn't send/receive anything for a period of time equal to timeout, it will be destroyed
UdpFactory::Error |
Definition at line 295 of file udp-factory.cpp.
shared_ptr< UdpChannel > nfd::face::UdpFactory::createChannel | ( | const std::string & | localIp, |
const std::string & | localPort, | ||
const time::seconds & | timeout = time::seconds(600) |
||
) |
Create UDP-based channel using specified IP address and port number.
This method is just a helper that converts a string representation of localIp and port to udp::Endpoint and calls the other createChannel overload.
If localHost is a IPv6 address of a specific device, it must be in the form: ip addressinterface name Example: fe80::5e96:9dff:fe7d:9c8den1 Otherwise, you can use ::
UdpChannel::Error | if the bind on the socket fails |
UdpFactory::Error |
Definition at line 324 of file udp-factory.cpp.
|
overridevirtual |
Try to create Face using the supplied FaceUri.
This method should automatically choose channel, based on supplied FaceUri and create face.
uri | remote URI of the new face |
persistency | persistency of the new face |
wantLocalFieldsEnabled | whether local fields should be enabled on the face |
onCreated | callback if face creation succeeds If a face with the same remote URI already exists, its persistency and LocalFieldsEnabled setting will not be modified. |
onFailure | callback if face creation fails |
Implements nfd::face::ProtocolFactory.
Definition at line 197 of file udp-factory.cpp.
shared_ptr< Face > nfd::face::UdpFactory::createMulticastFace | ( | const udp::Endpoint & | localEndpoint, |
const udp::Endpoint & | multicastEndpoint, | ||
const std::string & | networkInterfaceName = "" |
||
) |
Create MulticastUdpFace using udp::Endpoint.
udp::Endpoint is really an alias for boost::asio::ip::udp::endpoint.
The face will join the multicast group
If this method called twice with the same endpoint and group, only one face will be created. The second call will just retrieve the existing channel.
If an unicast face is already active on the same local NIC and port, the creation fails and an exception is thrown
localEndpoint | local endpoint |
multicastEndpoint | multicast endpoint |
networkInterfaceName | name of the network interface on which the face will be bound (Used only on multihomed linux machine with more than one MulticastUdpFace for the same multicast group. If specified, will requires CAP_NET_RAW capability) An empty string can be provided in other system or in linux machine with only one MulticastUdpFace per multicast group |
UdpFactory::Error |
Definition at line 349 of file udp-factory.cpp.
shared_ptr< Face > nfd::face::UdpFactory::createMulticastFace | ( | const std::string & | localIp, |
const std::string & | multicastIp, | ||
const std::string & | multicastPort, | ||
const std::string & | networkInterfaceName = "" |
||
) |
Definition at line 440 of file udp-factory.cpp.
|
overridevirtual |
Implements nfd::face::ProtocolFactory.
Definition at line 333 of file udp-factory.cpp.
|
inlinestaticprotectedinherited |
Definition at line 147 of file protocol-factory.hpp.
|
static |
Definition at line 48 of file udp-factory.cpp.
|
inlineinherited |
Definition at line 116 of file protocol-factory.hpp.
|
staticinherited |
Definition at line 49 of file protocol-factory.cpp.
|
overridevirtual |
process face_system.udp config section
Reimplemented from nfd::face::ProtocolFactory.
Definition at line 56 of file udp-factory.cpp.
|
inlinestaticinherited |
register a protocol factory type
S | subclass of ProtocolFactory |
id | factory identifier |
Definition at line 54 of file protocol-factory.hpp.
|
protectedinherited |
FaceUri schemes provided by this ProtocolFactory.
Definition at line 164 of file protocol-factory.hpp.