#include <udp-factory.hpp>
Classes | |
class | Error |
Exception of UdpFactory. More... | |
Public Types | |
typedef std::map< udp::Endpoint, shared_ptr< MulticastUdpFace > > | MulticastFaceMap |
Public Member Functions | |
UdpFactory (const std::string &defaultPort="6363") | |
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... | |
shared_ptr< MulticastUdpFace > | createMulticastFace (const udp::Endpoint &localEndpoint, const udp::Endpoint &multicastEndpoint, const std::string &networkInterfaceName="") |
Create MulticastUdpFace using udp::Endpoint. More... | |
shared_ptr< MulticastUdpFace > | createMulticastFace (const std::string &localIp, const std::string &multicastIp, const std::string &multicastPort, const std::string &networkInterfaceName="") |
virtual void | createFace (const FaceUri &uri, ndn::nfd::FacePersistency persistency, const FaceCreatedCallback &onCreated, const FaceConnectFailedCallback &onConnectFailed) 1 |
Try to create Face using the supplied FaceUri. More... | |
virtual std::list< shared_ptr< const Channel > > | getChannels () const |
const MulticastFaceMap & | getMulticastFaces () const |
Get map of configured multicast faces. More... | |
Definition at line 37 of file udp-factory.hpp.
typedef std::map<udp::Endpoint, shared_ptr<MulticastUdpFace> > nfd::UdpFactory::MulticastFaceMap |
Definition at line 53 of file udp-factory.hpp.
|
explicit |
Definition at line 48 of file udp-factory.cpp.
shared_ptr< UdpChannel > nfd::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 111 of file udp-factory.cpp.
References NFD_LOG_DEBUG.
Referenced by createChannel().
shared_ptr< UdpChannel > nfd::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 140 of file udp-factory.cpp.
References createChannel().
shared_ptr< MulticastUdpFace > nfd::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
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 150 of file udp-factory.cpp.
References nfd::ALL_V4_ENDPOINT(), and nfd::getGlobalIoService().
Referenced by createMulticastFace().
shared_ptr< MulticastUdpFace > nfd::UdpFactory::createMulticastFace | ( | const std::string & | localIp, |
const std::string & | multicastIp, | ||
const std::string & | multicastPort, | ||
const std::string & | networkInterfaceName = "" |
||
) |
Definition at line 240 of file udp-factory.cpp.
References createMulticastFace().
|
virtual |
Try to create Face using the supplied FaceUri.
This method should automatically choose channel, based on supplied FaceUri and create face.
Error | Factory does not support connect operation |
Error | specified persistency is not supported |
Implements nfd::ProtocolFactory.
Definition at line 253 of file udp-factory.cpp.
References ndn::nfd::FACE_PERSISTENCY_ON_DEMAND, ndn::util::FaceUri::getHost(), ndn::util::FaceUri::getPort(), and ndn::util::FaceUri::isCanonical().
|
virtual |
Implements nfd::ProtocolFactory.
Definition at line 316 of file udp-factory.cpp.
|
inline |
Get map of configured multicast faces.
Definition at line 207 of file udp-factory.hpp.