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

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

#include <udp-channel.hpp>

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

Public Member Functions

 UdpChannel (const udp::Endpoint &localEndpoint, time::nanoseconds idleTimeout)
 Create a UDP channel on the given localEndpoint. More...
 
bool isListening () const override
 Returns whether the channel is listening. More...
 
size_t size () const override
 Returns the number of faces in the channel. More...
 
void connect (const udp::Endpoint &remoteEndpoint, ndn::nfd::FacePersistency persistency, bool wantLpReliability, const FaceCreatedCallback &onFaceCreated, const FaceCreationFailedCallback &onConnectFailed)
 Create a unicast UDP face toward remoteEndpoint. More...
 
void listen (const FaceCreatedCallback &onFaceCreated, const FaceCreationFailedCallback &onFaceCreationFailed)
 Start listening. More...
 
- Public Member Functions inherited from nfd::face::Channel
virtual ~Channel ()
 
const FaceUrigetUri () const
 

Additional Inherited Members

- Protected Member Functions inherited from nfd::face::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

nfd::face::UdpChannel::UdpChannel ( const udp::Endpoint localEndpoint,
time::nanoseconds  idleTimeout 
)

Create a UDP channel on the given localEndpoint.

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

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

References NFD_LOG_CHAN_INFO, and nfd::face::Channel::setUri().

Member Function Documentation

bool nfd::face::UdpChannel::isListening ( ) const
inlineoverridevirtual

Returns whether the channel is listening.

Implements nfd::face::Channel.

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

Referenced by listen().

size_t nfd::face::UdpChannel::size ( ) const
inlineoverridevirtual

Returns the number of faces in the channel.

Implements nfd::face::Channel.

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

References connect(), listen(), and websocketpp::transport::asio::socket::error::socket.

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

Create a unicast UDP face toward remoteEndpoint.

Parameters
remoteEndpointThe remote UDP endpoint
persistencyPersistency of the newly created face
wantLpReliabilitywhether LpReliability should be enabled
onFaceCreatedCallback to notify successful creation of the face
onConnectFailedCallback to notify errors

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

References NFD_LOG_CHAN_DEBUG.

Referenced by size().

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

Start listening.

Enable listening on the local endpoint, waiting for incoming datagrams, and creating a face when a datagram is received from a new remote host.

Faces created in this way will have on-demand persistency.

Parameters
onFaceCreatedCallback to notify successful creation of a face
onFaceCreationFailedCallback to notify errors

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

References nfd::face::connectFaceClosedSignal(), ndn::nfd::FACE_PERSISTENCY_ON_DEMAND, nfd::getGlobalIoService(), nfd::face::LpReliability::Options::isEnabled, isListening(), NFD_LOG_CHAN_DEBUG, NFD_LOG_CHAN_TRACE, NFD_LOG_CHAN_WARN, websocketpp::transport::error::operation_aborted, nfd::face::DatagramTransport< Protocol, Addressing >::receiveDatagram(), nfd::face::GenericLinkService::Options::reliabilityOptions, and websocketpp::transport::asio::socket::error::socket.

Referenced by size().


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