NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
nfd::UdpFactory Class Reference

#include <udp-factory.hpp>

Inheritance diagram for nfd::UdpFactory:
Collaboration diagram for nfd::UdpFactory:

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< UdpChannelcreateChannel (const udp::Endpoint &localEndpoint, const time::seconds &timeout=time::seconds(600))
 Create UDP-based channel using udp::Endpoint. More...
 
shared_ptr< UdpChannelcreateChannel (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< MulticastUdpFacecreateMulticastFace (const udp::Endpoint &localEndpoint, const udp::Endpoint &multicastEndpoint, const std::string &networkInterfaceName="")
 Create MulticastUdpFace using udp::Endpoint. More...
 
shared_ptr< MulticastUdpFacecreateMulticastFace (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 MulticastFaceMapgetMulticastFaces () const
 Get map of configured multicast faces. More...
 

Detailed Description

Todo:
IPv6 multicast support not implemented

Definition at line 37 of file udp-factory.hpp.

Member Typedef Documentation

◆ MulticastFaceMap

Definition at line 53 of file udp-factory.hpp.

Constructor & Destructor Documentation

◆ UdpFactory()

nfd::UdpFactory::UdpFactory ( const std::string &  defaultPort = "6363")
explicit

Definition at line 48 of file udp-factory.cpp.

Member Function Documentation

◆ createChannel() [1/2]

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

Todo:
this funcionality has to be implemented
Returns
always a valid pointer to a UdpChannel object, an exception is thrown if it cannot be created.
Exceptions
UdpFactory::Error
See also
http://www.boost.org/doc/libs/1_42_0/doc/html/boost_asio/reference/ip__udp/endpoint.html for details on ways to create udp::Endpoint

Definition at line 111 of file udp-factory.cpp.

References NFD_LOG_DEBUG.

Referenced by createChannel().

◆ createChannel() [2/2]

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 ::

Exceptions
UdpChannel::Errorif the bind on the socket fails
UdpFactory::Error

Definition at line 140 of file udp-factory.cpp.

References createChannel().

◆ createMulticastFace() [1/2]

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

Parameters
networkInterfaceNamename 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
Returns
always a valid pointer to a MulticastUdpFace object, an exception is thrown if it cannot be created.
Exceptions
UdpFactory::Error
See also
http://www.boost.org/doc/libs/1_42_0/doc/html/boost_asio/reference/ip__udp/endpoint.html for details on ways to create udp::Endpoint

Definition at line 150 of file udp-factory.cpp.

References nfd::ALL_V4_ENDPOINT(), and nfd::getGlobalIoService().

Referenced by createMulticastFace().

◆ createMulticastFace() [2/2]

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().

◆ createFace()

void nfd::UdpFactory::createFace ( const FaceUri uri,
ndn::nfd::FacePersistency  persistency,
const FaceCreatedCallback onCreated,
const FaceConnectFailedCallback onConnectFailed 
)
virtual

Try to create Face using the supplied FaceUri.

This method should automatically choose channel, based on supplied FaceUri and create face.

Exceptions
ErrorFactory does not support connect operation
Errorspecified 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().

◆ getChannels()

std::list< shared_ptr< const Channel > > nfd::UdpFactory::getChannels ( ) const
virtual

Implements nfd::ProtocolFactory.

Definition at line 316 of file udp-factory.cpp.

◆ getMulticastFaces()

const UdpFactory::MulticastFaceMap & nfd::UdpFactory::getMulticastFaces ( ) const
inline

Get map of configured multicast faces.

Definition at line 207 of file udp-factory.hpp.


The documentation for this class was generated from the following files: