#include <udp-factory.hpp>
Classes | |
class | Error |
Exception of UdpFactory. More... | |
Public Types | |
typedef std::map< udp::Endpoint, shared_ptr< Face > > | MulticastFaceMap |
Public Member Functions | |
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< 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 MulticastFaceMap & | getMulticastFaces () const |
Get map of configured multicast faces. More... | |
virtual 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... | |
virtual std::vector< shared_ptr< const Channel > > | getChannels () const override |
Definition at line 36 of file udp-factory.hpp.
typedef std::map<udp::Endpoint, shared_ptr<Face> > nfd::UdpFactory::MulticastFaceMap |
Definition at line 52 of file udp-factory.hpp.
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 92 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 121 of file udp-factory.cpp.
References createChannel().
shared_ptr< Face > 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
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 130 of file udp-factory.cpp.
References nfd::connectFaceClosedSignal(), and nfd::getGlobalIoService().
Referenced by createMulticastFace().
shared_ptr< Face > nfd::UdpFactory::createMulticastFace | ( | const std::string & | localIp, |
const std::string & | multicastIp, | ||
const std::string & | multicastPort, | ||
const std::string & | networkInterfaceName = "" |
||
) |
Definition at line 221 of file udp-factory.cpp.
References createMulticastFace().
|
inline |
Get map of configured multicast faces.
Definition at line 197 of file udp-factory.hpp.
|
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::ProtocolFactory.
Definition at line 234 of file udp-factory.cpp.
References ndn::nfd::FACE_PERSISTENCY_ON_DEMAND, ndn::util::FaceUri::getHost(), ndn::util::FaceUri::getPort(), ndn::util::FaceUri::isCanonical(), and NFD_LOG_TRACE.
|
overridevirtual |
Implements nfd::ProtocolFactory.
Definition at line 285 of file udp-factory.cpp.