Class implementing TCP-based channel to create faces. More...
#include <daemon/face/tcp-channel.hpp>
Public Member Functions | |
TcpChannel (const tcp::Endpoint &localEndpoint) | |
Create TCP channel for the local endpoint. More... | |
void | connect (const tcp::Endpoint &remoteEndpoint, ndn::nfd::FacePersistency persistency, bool wantLocalFields, bool wantLpReliability, const FaceCreatedCallback &onFaceCreated, const FaceCreationFailedCallback &onConnectFailed, time::nanoseconds timeout=time::seconds(4)) |
Create a face by establishing a TCP connection to remoteEndpoint . More... | |
const FaceUri & | getUri () const |
bool | isListening () const override |
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 override |
Returns the number of faces in the channel. More... | |
Protected Member Functions | |
void | setUri (const FaceUri &uri) |
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.
|
explicit |
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.
void nfd::face::TcpChannel::connect | ( | const tcp::Endpoint & | remoteEndpoint, |
ndn::nfd::FacePersistency | persistency, | ||
bool | wantLocalFields, | ||
bool | wantLpReliability, | ||
const FaceCreatedCallback & | onFaceCreated, | ||
const FaceCreationFailedCallback & | onConnectFailed, | ||
time::nanoseconds | timeout = time::seconds(4) |
||
) |
Create a face by establishing a TCP connection to remoteEndpoint
.
Definition at line 70 of file tcp-channel.cpp.
|
inlineinherited |
Definition at line 59 of file channel.hpp.
|
inlineoverridevirtual |
Returns whether the channel is listening.
Implements nfd::face::Channel.
Definition at line 60 of file tcp-channel.hpp.
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.
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 48 of file tcp-channel.cpp.
|
protectedinherited |
Definition at line 34 of file channel.cpp.
|
inlineoverridevirtual |
Returns the number of faces in the channel.
Implements nfd::face::Channel.
Definition at line 66 of file tcp-channel.hpp.