provides TLV-block delivery service More...
#include <transport.hpp>
Classes | |
class | Error |
Public Types | |
typedef function< void(const Block &wire)> | ReceiveCallback |
typedef function< void()> | ErrorCallback |
Public Member Functions | |
Transport () | |
virtual | ~Transport ()=default |
virtual void | connect (boost::asio::io_service &ioService, const ReceiveCallback &receiveCallback) |
asynchronously open the connection More... | |
virtual void | close ()=0 |
Close the connection. More... | |
virtual void | send (const Block &wire)=0 |
send a TLV block through the transport More... | |
virtual void | send (const Block &header, const Block &payload)=0 |
send two memory blocks through the transport More... | |
virtual void | pause ()=0 |
pause the transport More... | |
virtual void | resume ()=0 |
resume the transport More... | |
bool | isConnected () const |
bool | isReceiving () const |
Protected Member Functions | |
void | receive (const Block &wire) |
invoke the receive callback More... | |
Protected Attributes | |
boost::asio::io_service * | m_ioService |
bool | m_isConnected |
bool | m_isReceiving |
ReceiveCallback | m_receiveCallback |
provides TLV-block delivery service
Definition at line 35 of file transport.hpp.
typedef function<void(const Block& wire)> ndn::Transport::ReceiveCallback |
Definition at line 47 of file transport.hpp.
typedef function<void()> ndn::Transport::ErrorCallback |
Definition at line 48 of file transport.hpp.
ndn::Transport::Transport | ( | ) |
Definition at line 36 of file transport.cpp.
|
virtualdefault |
|
virtual |
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 in ndn::TcpTransport, and ndn::UnixTransport.
Definition at line 44 of file transport.cpp.
References m_ioService, and m_receiveCallback.
Referenced by ndn::UnixTransport::connect(), and ndn::TcpTransport::connect().
|
pure virtual |
Close the connection.
Implemented in nfd::face::InternalClientTransport, ndn::TcpTransport, ndn::UnixTransport, and ndn::util::DummyClientFace::Transport.
|
pure virtual |
send a TLV block through the transport
Implemented in nfd::face::InternalClientTransport, ndn::util::DummyClientFace::Transport, ndn::TcpTransport, and ndn::UnixTransport.
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).
Implemented in nfd::face::InternalClientTransport, ndn::util::DummyClientFace::Transport, ndn::TcpTransport, and ndn::UnixTransport.
|
pure virtual |
pause the transport
Implemented in nfd::face::InternalClientTransport, ndn::TcpTransport, ndn::UnixTransport, and ndn::util::DummyClientFace::Transport.
|
pure virtual |
resume the transport
Implemented in nfd::face::InternalClientTransport, ndn::TcpTransport, ndn::util::DummyClientFace::Transport, and ndn::UnixTransport.
|
inline |
true | connection has been established |
false | connection is not yet established or has been closed |
Definition at line 123 of file transport.hpp.
References m_isConnected.
|
inline |
true | incoming packets are expected, receiveCallback will be invoked |
false | incoming packets are not expected, receiveCallback will not be invoked |
Definition at line 129 of file transport.hpp.
References m_isReceiving.
|
inlineprotected |
invoke the receive callback
Definition at line 135 of file transport.hpp.
References m_receiveCallback.
|
protected |
Definition at line 116 of file transport.hpp.
Referenced by connect(), and ndn::util::DummyClientFace::Transport::getIoService().
|
protected |
Definition at line 117 of file transport.hpp.
Referenced by isConnected().
|
protected |
Definition at line 118 of file transport.hpp.
Referenced by isReceiving().
|
protected |
Definition at line 119 of file transport.hpp.
Referenced by connect(), ndn::util::DummyClientFace::Transport::receive(), receive(), and nfd::face::InternalClientTransport::receiveFromLink().