26 #ifndef NFD_DAEMON_FACE_TCP_CHANNEL_HPP
27 #define NFD_DAEMON_FACE_TCP_CHANNEL_HPP
35 typedef boost::asio::ip::tcp::endpoint
Endpoint;
69 int backlog = boost::asio::ip::tcp::acceptor::max_connections);
76 bool wantLocalFieldsEnabled,
79 const time::seconds& timeout = time::seconds(4));
92 createFace(boost::asio::ip::tcp::socket&& socket,
94 bool wantLocalFieldsEnabled,
102 handleAccept(
const boost::system::error_code& error,
107 handleConnect(
const boost::system::error_code& error,
108 const shared_ptr<boost::asio::ip::tcp::socket>& socket,
109 bool wantLocalFieldsEnabled,
110 const scheduler::EventId& connectTimeoutEvent,
115 handleConnectTimeout(
const shared_ptr<boost::asio::ip::tcp::socket>& socket,
119 std::map<tcp::Endpoint, shared_ptr<Face>> m_channelFaces;
122 boost::asio::ip::tcp::acceptor m_acceptor;
123 boost::asio::ip::tcp::socket m_acceptSocket;
129 return m_acceptor.is_open();
134 #endif // NFD_DAEMON_FACE_TCP_CHANNEL_HPP
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.
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...
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
boost::asio::ip::tcp::endpoint Endpoint
Class implementing TCP-based channel to create faces.
function< void(uint32_t status, const std::string &reason)> FaceCreationFailedCallback
Prototype for the callback that is invoked when the face fails to be created.
function< void(const shared_ptr< Face > &newFace)> FaceCreatedCallback
Prototype for the callback that is invoked when the face is created (as a response to incoming connec...
TcpChannel(const tcp::Endpoint &localEndpoint)
Create TCP channel for the local endpoint.
size_t size() const
Get number of faces in the channel.