nfd::face::UdpChannel Class Referencefinal

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

#include <daemon/face/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, bool wantCongestionMarking, size_t defaultMtu)
 Create a UDP channel on the given localEndpoint. More...
 
void connect (const udp::Endpoint &remoteEndpoint, const FaceParams &params, const FaceCreatedCallback &onFaceCreated, const FaceCreationFailedCallback &onConnectFailed)
 Create a unicast UDP face toward remoteEndpoint. More...
 
size_t getDefaultMtu () const noexcept
 Returns the default MTU for all faces created by this channel. More...
 
const FaceUri & getUri () const noexcept
 
bool isListening () const final
 Returns whether the channel is listening. More...
 
void listen (const FaceCreatedCallback &onFaceCreated, const FaceCreationFailedCallback &onFaceCreationFailed)
 Start listening. More...
 
size_t size () const final
 Returns the number of faces in the channel. More...
 

Protected Member Functions

void setDefaultMtu (size_t mtu) noexcept
 
void setUri (const FaceUri &uri) noexcept
 

Detailed Description

Class implementing a UDP-based channel to create faces.

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

Constructor & Destructor Documentation

◆ UdpChannel()

nfd::face::UdpChannel::UdpChannel ( const udp::Endpoint localEndpoint,
time::nanoseconds  idleTimeout,
bool  wantCongestionMarking,
size_t  defaultMtu 
)

Create a UDP channel on the given localEndpoint.

To enable the creation of faces upon incoming connections, one needs to explicitly call listen(). The created socket is bound to localEndpoint.

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

Member Function Documentation

◆ connect()

void nfd::face::UdpChannel::connect ( const udp::Endpoint remoteEndpoint,
const FaceParams params,
const FaceCreatedCallback onFaceCreated,
const FaceCreationFailedCallback onConnectFailed 
)

Create a unicast UDP face toward remoteEndpoint.

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

◆ getDefaultMtu()

size_t nfd::face::Channel::getDefaultMtu ( ) const
inlinenoexceptinherited

Returns the default MTU for all faces created by this channel.

Definition at line 58 of file channel.hpp.

◆ getUri()

const FaceUri& nfd::face::Channel::getUri ( ) const
inlinenoexceptinherited

Definition at line 49 of file channel.hpp.

◆ isListening()

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

Returns whether the channel is listening.

Implements nfd::face::Channel.

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

◆ listen()

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 77 of file udp-channel.cpp.

◆ setDefaultMtu()

void nfd::face::Channel::setDefaultMtu ( size_t  mtu)
protectednoexceptinherited

Definition at line 40 of file channel.cpp.

◆ setUri()

void nfd::face::Channel::setUri ( const FaceUri &  uri)
protectednoexceptinherited

Definition at line 34 of file channel.cpp.

◆ size()

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

Returns the number of faces in the channel.

Implements nfd::face::Channel.

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