Class implementing a TCP-based channel to create faces. More...
#include <daemon/face/tcp-channel.hpp>
Public Member Functions | |
TcpChannel (const tcp::Endpoint &localEndpoint, bool wantCongestionMarking, DetermineFaceScopeFromAddress determineFaceScope) | |
Create a TCP channel for the specified localEndpoint . More... | |
void | connect (const tcp::Endpoint &remoteEndpoint, const FaceParams ¶ms, 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 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 &onAcceptFailed, int backlog=boost::asio::socket_base::max_listen_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) noexcept |
void | setUri (const FaceUri &uri) noexcept |
Class implementing a TCP-based channel to create faces.
The channel can create faces as a response to incoming TCP connections (TcpChannel::listen() needs to be called for that to work) or explicitly by using TcpChannel::connect().
Definition at line 52 of file tcp-channel.hpp.
nfd::face::TcpChannel::TcpChannel | ( | const tcp::Endpoint & | localEndpoint, |
bool | wantCongestionMarking, | ||
DetermineFaceScopeFromAddress | determineFaceScope | ||
) |
Create a TCP channel for the specified localEndpoint
.
To enable the creation of faces upon incoming connections, one needs to explicitly call listen().
Definition at line 40 of file tcp-channel.cpp.
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.
|
inlinenoexceptinherited |
Returns the default MTU for all faces created by this channel.
Definition at line 58 of file channel.hpp.
|
inlinenoexceptinherited |
Definition at line 49 of file channel.hpp.
|
inlinefinalvirtual |
Returns whether the channel is listening.
Implements nfd::face::Channel.
Definition at line 65 of file tcp-channel.hpp.
void nfd::face::TcpChannel::listen | ( | const FaceCreatedCallback & | onFaceCreated, |
const FaceCreationFailedCallback & | onAcceptFailed, | ||
int | backlog = boost::asio::socket_base::max_listen_connections |
||
) |
Enable listening on the local endpoint, accept connections, and create faces when remote host makes a connection.
onFaceCreated | Callback to notify successful creation of the face |
onAcceptFailed | Callback to notify when channel fails (accept call returns an error) |
backlog | The maximum length of the queue of pending incoming connections |
Definition at line 52 of file tcp-channel.cpp.
|
protectednoexceptinherited |
Definition at line 40 of file channel.cpp.
|
protectednoexceptinherited |
Definition at line 34 of file channel.cpp.
|
inlinefinalvirtual |
Returns the number of faces in the channel.
Implements nfd::face::Channel.
Definition at line 71 of file tcp-channel.hpp.