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

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

#include <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)
 Create TCP channel for the local endpoint. 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 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...
 
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...
 
- 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 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 47 of file tcp-channel.hpp.

Constructor & Destructor Documentation

◆ TcpChannel()

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

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 38 of file tcp-channel.cpp.

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

Member Function Documentation

◆ isListening()

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

Returns whether the channel is listening.

Implements nfd::face::Channel.

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

Referenced by listen().

◆ size()

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

Returns the number of faces in the channel.

Implements nfd::face::Channel.

Definition at line 65 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 49 of file tcp-channel.cpp.

References isListening(), NFD_LOG_CHAN_DEBUG, and NFD_LOG_CHAN_WARN.

◆ 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 71 of file tcp-channel.cpp.

References nfd::getGlobalIoService(), NFD_LOG_CHAN_TRACE, and nfd::scheduler::schedule().


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