Implements a client-side transport that can be paired with an InternalForwarderTransport. More...
#include <internal-transport.hpp>
Public Member Functions | |
~InternalClientTransport () final | |
void | connectToForwarder (InternalForwarderTransport *forwarder) |
Connect to a forwarder-side transport. More... | |
void | receivePacket (const Block &packet) final |
void | send (const Block &wire) final |
send a TLV block through the transport More... | |
void | send (const Block &header, const Block &payload) final |
send two memory blocks through the transport More... | |
void | close () final |
Close the connection. More... | |
void | pause () final |
pause the transport More... | |
void | resume () final |
resume the transport More... | |
Public Member Functions inherited from ndn::Transport | |
virtual | ~Transport ()=default |
virtual void | connect (ReceiveCallback receiveCallback) |
Asynchronously open the connection. More... | |
bool | isConnected () const noexcept |
bool | isReceiving () const noexcept |
Public Member Functions inherited from nfd::face::InternalTransportBase | |
virtual | ~InternalTransportBase ()=default |
Additional Inherited Members | |
Public Types inherited from ndn::Transport | |
using | ReceiveCallback = std::function< void(const Block &wire)> |
using | ErrorCallback = std::function< void()> |
Protected Attributes inherited from ndn::Transport | |
ReceiveCallback | m_receiveCallback |
bool | m_isConnected = false |
bool | m_isReceiving = false |
Implements a client-side transport that can be paired with an InternalForwarderTransport.
Definition at line 84 of file internal-transport.hpp.
|
final |
Definition at line 74 of file internal-transport.cpp.
References nfd::face::InternalForwarderTransport::setPeer().
void nfd::face::InternalClientTransport::connectToForwarder | ( | InternalForwarderTransport * | forwarder | ) |
Connect to a forwarder-side transport.
forwarder | the forwarder-side transport to connect to; may be nullptr |
The connected forwarder-side transport will be disconnected automatically if this method is called again, or if that transport is closed. It's safe to use InternalClientTransport without a connected forwarder-side transport: all sent packets would be lost, and nothing would be received.
Definition at line 82 of file internal-transport.cpp.
References nfd::face::Transport::afterStateChange, nfd::face::CLOSED, ndn::util::signal::ScopedConnection::disconnect(), NFD_LOG_DEBUG, and nfd::face::InternalForwarderTransport::setPeer().
|
finalvirtual |
Implements nfd::face::InternalTransportBase.
Definition at line 107 of file internal-transport.cpp.
References nfd::getGlobalIoService(), ndn::Transport::m_receiveCallback, NFD_LOG_TRACE, nfd::detail::SimulatorIo::post(), and ndn::Block::size().
|
finalvirtual |
send a TLV block through the transport
Implements ndn::Transport.
Definition at line 118 of file internal-transport.cpp.
References NFD_LOG_TRACE, and nfd::face::InternalForwarderTransport::receivePacket().
Referenced by send().
|
finalvirtual |
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 127 of file internal-transport.cpp.
References send(), ndn::Block::size(), and ndn::Block::wire().
|
inlinefinalvirtual |
Close the connection.
Implements ndn::Transport.
Definition at line 110 of file internal-transport.hpp.
|
inlinefinalvirtual |
pause the transport
Implements ndn::Transport.
Definition at line 115 of file internal-transport.hpp.
|
inlinefinalvirtual |
resume the transport
Implements ndn::Transport.
Definition at line 120 of file internal-transport.hpp.