a transport using TCP socket More...
#include <tcp-transport.hpp>
Public Member Functions | |
TcpTransport (const std::string &host, const std::string &port="6363") | |
~TcpTransport () override | |
void | connect (boost::asio::io_service &ioService, const ReceiveCallback &receiveCallback) override |
asynchronously open the connection More... | |
void | close () override |
Close the connection. More... | |
void | pause () override |
pause the transport More... | |
void | resume () override |
resume the transport More... | |
void | send (const Block &wire) override |
send a TLV block through the transport More... | |
void | send (const Block &header, const Block &payload) override |
send two memory blocks through the transport More... | |
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE std::string | getSocketHostAndPortFromUri (const std::string &uri) |
Public Member Functions inherited from ndn::Transport | |
Transport () | |
virtual | ~Transport ()=default |
bool | isConnected () const |
bool | isReceiving () const |
Static Public Member Functions | |
static shared_ptr< TcpTransport > | create (const std::string &uri) |
Create transport with parameters defined in URI. More... | |
Public Attributes | |
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE | __pad0__: static std::pair<std::string |
Friends | |
class | StreamTransportImpl< TcpTransport, boost::asio::ip::tcp > |
Additional Inherited Members | |
Public Types inherited from ndn::Transport | |
typedef function< void(const Block &wire)> | ReceiveCallback |
typedef function< void()> | ErrorCallback |
Protected Member Functions inherited from ndn::Transport | |
void | receive (const Block &wire) |
invoke the receive callback More... | |
Protected Attributes inherited from ndn::Transport | |
boost::asio::io_service * | m_ioService |
bool | m_isConnected |
bool | m_isReceiving |
ReceiveCallback | m_receiveCallback |
a transport using TCP socket
Definition at line 46 of file tcp-transport.hpp.
|
explicit |
Definition at line 32 of file tcp-transport.cpp.
References ~TcpTransport().
|
overridedefault |
Referenced by TcpTransport().
|
overridevirtual |
asynchronously open the connection
ioService | io_service to create socket on |
receiveCallback | callback function when a TLV block is received; must not be empty |
boost::system::system_error | connection cannot be established |
Reimplemented from ndn::Transport.
Definition at line 81 of file tcp-transport.cpp.
References ndn::Transport::connect(), and NDN_LOG_DEBUG.
|
overridevirtual |
Close the connection.
Implements ndn::Transport.
Definition at line 111 of file tcp-transport.cpp.
References NDN_LOG_DEBUG.
|
overridevirtual |
pause the transport
Implements ndn::Transport.
Definition at line 120 of file tcp-transport.cpp.
References NDN_LOG_DEBUG.
|
overridevirtual |
resume the transport
Implements ndn::Transport.
Definition at line 129 of file tcp-transport.cpp.
References NDN_LOG_DEBUG.
|
overridevirtual |
send a TLV block through the transport
Implements ndn::Transport.
Definition at line 97 of file tcp-transport.cpp.
send two memory blocks through the transport
Scatter/gather API is utilized to send two non-consecutive memory blocks together (as part of the same message in datagram-oriented transports).
Implements ndn::Transport.
Definition at line 104 of file tcp-transport.cpp.
|
static |
Create transport with parameters defined in URI.
Transport::Error | incorrect URI or unsupported protocol is specified |
Definition at line 41 of file tcp-transport.cpp.
References getSocketHostAndPortFromUri().
std::pair< std::string, std::string > ndn::TcpTransport::getSocketHostAndPortFromUri | ( | const std::string & | uri | ) |
Definition at line 48 of file tcp-transport.cpp.
References ndn::FaceUri::getHost(), ndn::FaceUri::getPort(), and ndn::FaceUri::getScheme().
Referenced by create().
|
friend |
Definition at line 87 of file tcp-transport.hpp.
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE ndn::TcpTransport::__pad0__ |
Definition at line 79 of file tcp-transport.hpp.