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 (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 | |
bool | m_isConnected |
bool | m_isReceiving |
ReceiveCallback | m_receiveCallback |
implements a client-side transport that can be paired with another
Definition at line 82 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 83 of file internal-transport.cpp.
References nfd::face::InternalTransportBase::afterSend, nfd::face::Transport::afterStateChange, nfd::face::asyncReceive(), nfd::face::CLOSED, ndn::util::signal::ScopedConnection::disconnect(), and NFD_LOG_DEBUG.
|
overridevirtual |
causes the transport to receive a link-layer packet
Implements nfd::face::InternalTransportBase.
Definition at line 104 of file internal-transport.cpp.
References ndn::Transport::m_receiveCallback.
|
inlineoverridevirtual |
Close the connection.
Implements ndn::Transport.
Definition at line 100 of file internal-transport.hpp.
|
inlineoverridevirtual |
pause the transport
Implements ndn::Transport.
Definition at line 105 of file internal-transport.hpp.
|
inlineoverridevirtual |
resume the transport
Implements ndn::Transport.
Definition at line 110 of file internal-transport.hpp.
|
overridevirtual |
send a TLV block through the transport
Implements ndn::Transport.
Definition at line 112 of file internal-transport.cpp.
References nfd::face::InternalTransportBase::afterSend, and emitSignal.
Referenced by send().
|
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 118 of file internal-transport.cpp.
References ndn::encoding::Encoder::appendByteArray(), send(), ndn::Block::size(), and ndn::Block::wire().