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

Class implementing UDP-based channel to create faces. More...

#include <udp-channel.hpp>

Inheritance diagram for nfd::UdpChannel:
Collaboration diagram for nfd::UdpChannel:

Public Member Functions

 UdpChannel (const udp::Endpoint &localEndpoint, const time::seconds &timeout)
 Create UDP channel for the local endpoint. More...
 
size_t size () const
 Get number of faces in the channel. More...
 
void connect (const udp::Endpoint &remoteEndpoint, ndn::nfd::FacePersistency persistency, const FaceCreatedCallback &onFaceCreated, const FaceCreationFailedCallback &onConnectFailed)
 Create a face by establishing connection to remote endpoint. More...
 
void listen (const FaceCreatedCallback &onFaceCreated, const FaceCreationFailedCallback &onReceiveFailed)
 Enable listening on the local endpoint, accept connections, and create faces when remote host makes a connection. More...
 
bool isListening () const
 
- Public Member Functions inherited from nfd::Channel
virtual ~Channel ()
 
const FaceUrigetUri () const
 

Additional Inherited Members

- Protected Member Functions inherited from nfd::Channel
void setUri (const FaceUri &uri)
 

Detailed Description

Class implementing UDP-based channel to create faces.

Definition at line 40 of file udp-channel.hpp.

Constructor & Destructor Documentation

◆ UdpChannel()

nfd::UdpChannel::UdpChannel ( const udp::Endpoint localEndpoint,
const time::seconds &  timeout 
)

Create UDP channel for the local endpoint.

To enable creation of faces upon incoming connections, one needs to explicitly call UdpChannel::listen method. The created socket is bound to the localEndpoint. reuse_address option is set

Exceptions
UdpChannel::Errorif bind on the socket fails

Definition at line 37 of file udp-channel.cpp.

References nfd::Channel::setUri().

Member Function Documentation

◆ size()

size_t nfd::UdpChannel::size ( ) const

Get number of faces in the channel.

Definition at line 47 of file udp-channel.cpp.

◆ connect()

void nfd::UdpChannel::connect ( const udp::Endpoint remoteEndpoint,
ndn::nfd::FacePersistency  persistency,
const FaceCreatedCallback onFaceCreated,
const FaceCreationFailedCallback onConnectFailed 
)

Create a face by establishing connection to remote endpoint.

Exceptions
UdpChannel::Errorif bind or connect on the socket fail

Definition at line 53 of file udp-channel.cpp.

References NFD_LOG_WARN.

◆ listen()

void nfd::UdpChannel::listen ( const FaceCreatedCallback onFaceCreated,
const FaceCreationFailedCallback onReceiveFailed 
)

Enable listening on the local endpoint, accept connections, and create faces when remote host makes a connection.

Parameters
onFaceCreatedCallback to notify successful creation of the face
onReceiveFailedCallback to notify when channel fails

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 functionality has to be implemented
Exceptions
UdpChannel::Errorif called multiple times

Definition at line 75 of file udp-channel.cpp.

References nfd::connectFaceClosedSignal(), ndn::nfd::FACE_PERSISTENCY_ON_DEMAND, ndn::nfd::FACE_PERSISTENCY_PERMANENT, nfd::getGlobalIoService(), isListening(), ndn::MAX_NDN_PACKET_SIZE, NFD_LOG_DEBUG, NFD_LOG_TRACE, and NFD_LOG_WARN.

◆ isListening()

bool nfd::UdpChannel::isListening ( ) const
inline

Definition at line 134 of file udp-channel.hpp.

Referenced by listen().


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