Class implementing TCP-based channel to create faces. More...
#include <tcp-channel.hpp>
Public Member Functions | |
TcpChannel (const tcp::Endpoint &localEndpoint) | |
Create TCP channel for the local endpoint. 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, bool wantLocalFieldsEnabled, const FaceCreatedCallback &onFaceCreated, const FaceCreationFailedCallback &onConnectFailed, const time::seconds &timeout=time::seconds(4)) |
Create a face by establishing connection to remote endpoint. More... | |
size_t | size () const |
Get number of faces in the channel. More... | |
bool | isListening () const |
Public Member Functions inherited from nfd::Channel | |
virtual | ~Channel () |
const FaceUri & | getUri () const |
Additional Inherited Members | |
Protected Member Functions inherited from nfd::Channel | |
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 45 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 37 of file tcp-channel.cpp.
References nfd::Channel::setUri().
void nfd::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 46 of file tcp-channel.cpp.
References isListening(), and NFD_LOG_WARN.
void nfd::TcpChannel::connect | ( | const tcp::Endpoint & | remoteEndpoint, |
bool | wantLocalFieldsEnabled, | ||
const FaceCreatedCallback & | onFaceCreated, | ||
const FaceCreationFailedCallback & | onConnectFailed, | ||
const time::seconds & | timeout = time::seconds(4) |
||
) |
Create a face by establishing connection to remote endpoint.
Definition at line 68 of file tcp-channel.cpp.
References nfd::getGlobalIoService(), and nfd::scheduler::schedule().
size_t nfd::TcpChannel::size | ( | ) | const |
Get number of faces in the channel.
Definition at line 93 of file tcp-channel.cpp.
References nfd::scheduler::cancel(), nfd::connectFaceClosedSignal(), ndn::nfd::FACE_PERSISTENCY_ON_DEMAND, ndn::nfd::FACE_PERSISTENCY_PERSISTENT, NFD_LOG_DEBUG, NFD_LOG_TRACE, and NFD_LOG_WARN.
|
inline |
Definition at line 127 of file tcp-channel.hpp.
Referenced by listen().