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

implements a client-side transport that can be paired with another More...

#include <internal-transport.hpp>

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

Public Member Functions

void connectToForwarder (InternalForwarderTransport *forwarderTransport)
 connect to a forwarder-side transport More...
 
virtual void receiveFromLink (const Block &packet) override
 causes the transport to receive a link-layer packet More...
 
virtual void close () override
 Close the connection. More...
 
virtual void pause () override
 pause the transport More...
 
virtual void resume () override
 resume the transport More...
 
virtual void send (const Block &wire) override
 send a TLV block through the transport More...
 
virtual 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
 

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, BlockafterSend
 
- 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
 

Detailed Description

implements a client-side transport that can be paired with another

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

Member Function Documentation

◆ connectToForwarder()

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

connect to a forwarder-side transport

Parameters
forwarderTransportthe 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 94 of file internal-transport.cpp.

References nfd::face::InternalTransportBase::afterSend, nfd::face::Transport::afterStateChange, nfd::face::asyncReceive(), nfd::face::CLOSED, and NFD_LOG_DEBUG.

◆ receiveFromLink()

void nfd::face::InternalClientTransport::receiveFromLink ( const Block packet)
overridevirtual

causes the transport to receive a link-layer packet

Implements nfd::face::InternalTransportBase.

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

◆ close()

virtual void nfd::face::InternalClientTransport::close ( )
inlineoverridevirtual

Close the connection.

Implements ndn::Transport.

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

◆ pause()

virtual void nfd::face::InternalClientTransport::pause ( )
inlineoverridevirtual

pause the transport

Postcondition
receiveCallback 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 104 of file internal-transport.hpp.

◆ resume()

virtual void nfd::face::InternalClientTransport::resume ( )
inlineoverridevirtual

resume the transport

Postcondition
receiveCallback 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 109 of file internal-transport.hpp.

References NFD_LOG_INCLASS_DECLARE.

◆ send() [1/2]

void nfd::face::InternalClientTransport::send ( const Block wire)
overridevirtual

send a TLV block through the transport

Implements ndn::Transport.

Definition at line 123 of file internal-transport.cpp.

References nfd::face::InternalTransportBase::afterSend, and emitSignal.

◆ send() [2/2]

void nfd::face::InternalClientTransport::send ( const Block header,
const Block payload 
)
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 129 of file internal-transport.cpp.

References ndn::encoding::Encoder::appendByteArray(), nfd::face::Transport::send(), ndn::Block::size(), and ndn::Block::wire().


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