nfd::face::TcpChannel Class Referencefinal

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

#include <daemon/face/tcp-channel.hpp>

+ Inheritance diagram for nfd::face::TcpChannel:
+ Collaboration diagram for nfd::face::TcpChannel:

Public Member Functions

 TcpChannel (const tcp::Endpoint &localEndpoint, bool wantCongestionMarking, DetermineFaceScopeFromAddress determineFaceScope)
 Create TCP channel for the local endpoint. More...
 
void connect (const tcp::Endpoint &remoteEndpoint, const FaceParams &params, const FaceCreatedCallback &onFaceCreated, const FaceCreationFailedCallback &onConnectFailed, time::nanoseconds timeout=8_s)
 Create a face by establishing a TCP connection to remoteEndpoint. More...
 
size_t getDefaultMtu () const
 Returns the default MTU for all faces created by this channel. More...
 
const FaceUri & getUri () const
 
bool isListening () const final
 Returns whether the channel is listening. More...
 
void listen (const FaceCreatedCallback &onFaceCreated, const FaceCreationFailedCallback &onAcceptFailed, int backlog=boost::asio::ip::tcp::acceptor::max_connections)
 Enable listening on the local endpoint, accept connections, and create faces when remote host makes a connection. More...
 
size_t size () const final
 Returns the number of faces in the channel. More...
 

Protected Member Functions

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

Detailed Description

Class implementing TCP-based channel to create faces.

Channel can create faces as a response to incoming TCP connections (TcpChannel::listen needs to be called for that to work) or explicitly after using TcpChannel::connect method.

Definition at line 49 of file tcp-channel.hpp.

Constructor & Destructor Documentation

◆ TcpChannel()

nfd::face::TcpChannel::TcpChannel ( const tcp::Endpoint localEndpoint,
bool  wantCongestionMarking,
DetermineFaceScopeFromAddress  determineFaceScope 
)

Create TCP channel for the local endpoint.

To enable creation faces upon incoming connections, one needs to explicitly call TcpChannel::listen method.

Definition at line 39 of file tcp-channel.cpp.

Member Function Documentation

◆ connect()

void nfd::face::TcpChannel::connect ( const tcp::Endpoint remoteEndpoint,
const FaceParams params,
const FaceCreatedCallback onFaceCreated,
const FaceCreationFailedCallback onConnectFailed,
time::nanoseconds  timeout = 8_s 
)

Create a face by establishing a TCP connection to remoteEndpoint.

Definition at line 74 of file tcp-channel.cpp.

◆ getDefaultMtu()

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

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

Definition at line 56 of file channel.hpp.

◆ getUri()

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

Definition at line 48 of file channel.hpp.

◆ isListening()

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

Returns whether the channel is listening.

Implements nfd::face::Channel.

Definition at line 62 of file tcp-channel.hpp.

◆ listen()

void nfd::face::TcpChannel::listen ( const FaceCreatedCallback onFaceCreated,
const FaceCreationFailedCallback onAcceptFailed,
int  backlog = boost::asio::ip::tcp::acceptor::max_connections 
)

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
onAcceptFailedCallback to notify when channel fails (accept call returns an error)
backlogThe maximum length of the queue of pending incoming connections

Definition at line 52 of file tcp-channel.cpp.

◆ setDefaultMtu()

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

Definition at line 41 of file channel.cpp.

◆ setUri()

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

Definition at line 35 of file channel.cpp.

◆ size()

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

Returns the number of faces in the channel.

Implements nfd::face::Channel.

Definition at line 68 of file tcp-channel.hpp.