NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
nfd::face::InternalClientTransport Class Referencefinal

Implements a client-side transport that can be paired with an InternalForwarderTransport. More...

#include <internal-transport.hpp>

Inheritance diagram for nfd::face::InternalClientTransport:
Collaboration diagram for nfd::face::InternalClientTransport:

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
 

Detailed Description

Implements a client-side transport that can be paired with an InternalForwarderTransport.

Definition at line 84 of file internal-transport.hpp.

Constructor & Destructor Documentation

◆ ~InternalClientTransport()

nfd::face::InternalClientTransport::~InternalClientTransport ( )
final

Member Function Documentation

◆ connectToForwarder()

void nfd::face::InternalClientTransport::connectToForwarder ( InternalForwarderTransport forwarder)

Connect to a forwarder-side transport.

Parameters
forwarderthe 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().

◆ receivePacket()

void nfd::face::InternalClientTransport::receivePacket ( const Block packet)
finalvirtual

◆ send() [1/2]

void nfd::face::InternalClientTransport::send ( const Block wire)
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().

◆ send() [2/2]

void nfd::face::InternalClientTransport::send ( const Block header,
const Block payload 
)
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().

◆ close()

void nfd::face::InternalClientTransport::close ( )
inlinefinalvirtual

Close the connection.

Implements ndn::Transport.

Definition at line 110 of file internal-transport.hpp.

◆ pause()

void nfd::face::InternalClientTransport::pause ( )
inlinefinalvirtual

pause the transport

Postcondition
the receive callback will not be invoked
Note
This operation has no effect if transport has been paused, or when connection is being established.

Implements ndn::Transport.

Definition at line 115 of file internal-transport.hpp.

◆ resume()

void nfd::face::InternalClientTransport::resume ( )
inlinefinalvirtual

resume the transport

Postcondition
the receive callback will be invoked
Note
This operation has no effect if transport is not paused, or when connection is being established.

Implements ndn::Transport.

Definition at line 120 of file internal-transport.hpp.


The documentation for this class was generated from the following files: