implements a client-side transport that can be paired with another More...
#include <internal-transport.hpp>
Public Member Functions | |
void | connectToForwarder (InternalForwarderTransport *forwarderTransport) |
connect to a forwarder-side transport More... | |
void | receiveFromLink (const Block &packet) override |
causes the transport to receive a link-layer packet 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... | |
Public Member Functions inherited from ndn::Transport | |
Transport () | |
virtual | ~Transport ()=default |
virtual void | connect (boost::asio::io_service &ioService, const ReceiveCallback &receiveCallback) |
asynchronously open the connection More... | |
bool | isConnected () const |
bool | isReceiving () const |
Public Member Functions inherited from nfd::face::InternalTransportBase | |
virtual | ~InternalTransportBase ()=default |
Additional Inherited Members | |
Public Types inherited from ndn::Transport | |
typedef function< void(const Block &wire)> | ReceiveCallback |
typedef function< void()> | ErrorCallback |
Public Attributes inherited from nfd::face::InternalTransportBase | |
signal::Signal< InternalTransportBase, Block > | afterSend |
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 |
implements a client-side transport that can be paired with another
Definition at line 81 of file internal-transport.hpp.
void nfd::face::InternalClientTransport::connectToForwarder | ( | InternalForwarderTransport * | forwarderTransport | ) |
connect to a forwarder-side transport
forwarderTransport | 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 85 of file internal-transport.cpp.
References nfd::face::InternalTransportBase::afterSend, nfd::face::Transport::afterStateChange, nfd::face::asyncReceive(), nfd::face::CLOSED, and NFD_LOG_DEBUG.
|
overridevirtual |
causes the transport to receive a link-layer packet
Implements nfd::face::InternalTransportBase.
Definition at line 106 of file internal-transport.cpp.
|
inlineoverridevirtual |
Close the connection.
Implements ndn::Transport.
Definition at line 99 of file internal-transport.hpp.
|
inlineoverridevirtual |
pause the transport
Implements ndn::Transport.
Definition at line 104 of file internal-transport.hpp.
|
inlineoverridevirtual |
resume the transport
Implements ndn::Transport.
Definition at line 109 of file internal-transport.hpp.
References NFD_LOG_INCLASS_DECLARE.
|
overridevirtual |
send a TLV block through the transport
Implements ndn::Transport.
Definition at line 114 of file internal-transport.cpp.
References nfd::face::InternalTransportBase::afterSend, and emitSignal.
|
overridevirtual |
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 120 of file internal-transport.cpp.
References ndn::encoding::Encoder::appendByteArray(), nfd::face::Transport::send(), ndn::Block::size(), and ndn::Block::wire().