NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ndn::Transport Class Referenceabstract

provides TLV-block delivery service More...

#include <transport.hpp>

Inheritance diagram for ndn::Transport:
Collaboration diagram for ndn::Transport:

Classes

class  Error
 

Public Types

typedef function< void(const Block &wire)> ReceiveCallback
 
typedef function< void()> ErrorCallback
 

Public Member Functions

 Transport ()
 
virtual ~Transport ()=default
 
virtual void connect (boost::asio::io_service &ioService, const ReceiveCallback &receiveCallback)
 asynchronously open the connection More...
 
virtual void close ()=0
 Close the connection. More...
 
virtual void send (const Block &wire)=0
 send a TLV block through the transport More...
 
virtual void send (const Block &header, const Block &payload)=0
 send two memory blocks through the transport More...
 
virtual void pause ()=0
 pause the transport More...
 
virtual void resume ()=0
 resume the transport More...
 
bool isConnected () const
 
bool isReceiving () const
 

Protected Member Functions

void receive (const Block &wire)
 invoke the receive callback More...
 

Protected Attributes

boost::asio::io_service * m_ioService
 
bool m_isConnected
 
bool m_isReceiving
 
ReceiveCallback m_receiveCallback
 

Detailed Description

provides TLV-block delivery service

Definition at line 35 of file transport.hpp.

Member Typedef Documentation

◆ ReceiveCallback

typedef function<void(const Block& wire)> ndn::Transport::ReceiveCallback

Definition at line 47 of file transport.hpp.

◆ ErrorCallback

typedef function<void()> ndn::Transport::ErrorCallback

Definition at line 48 of file transport.hpp.

Constructor & Destructor Documentation

◆ Transport()

ndn::Transport::Transport ( )

Definition at line 36 of file transport.cpp.

◆ ~Transport()

virtual ndn::Transport::~Transport ( )
virtualdefault

Member Function Documentation

◆ connect()

void ndn::Transport::connect ( boost::asio::io_service &  ioService,
const ReceiveCallback receiveCallback 
)
virtual

asynchronously open the connection

Parameters
ioServiceio_service to create socket on
receiveCallbackcallback function when a TLV block is received; must not be empty
Exceptions
boost::system::system_errorconnection cannot be established

Reimplemented in ndn::TcpTransport, and ndn::UnixTransport.

Definition at line 44 of file transport.cpp.

References m_ioService, and m_receiveCallback.

Referenced by ndn::UnixTransport::connect(), and ndn::TcpTransport::connect().

◆ close()

virtual void ndn::Transport::close ( )
pure virtual

◆ send() [1/2]

virtual void ndn::Transport::send ( const Block wire)
pure virtual

◆ send() [2/2]

virtual void ndn::Transport::send ( const Block header,
const Block payload 
)
pure virtual

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).

Implemented in nfd::face::InternalClientTransport, ndn::util::DummyClientFace::Transport, ndn::TcpTransport, and ndn::UnixTransport.

◆ pause()

virtual void ndn::Transport::pause ( )
pure virtual

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.

Implemented in nfd::face::InternalClientTransport, ndn::TcpTransport, ndn::UnixTransport, and ndn::util::DummyClientFace::Transport.

◆ resume()

virtual void ndn::Transport::resume ( )
pure virtual

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.

Implemented in nfd::face::InternalClientTransport, ndn::TcpTransport, ndn::util::DummyClientFace::Transport, and ndn::UnixTransport.

◆ isConnected()

bool ndn::Transport::isConnected ( ) const
inline
Return values
trueconnection has been established
falseconnection is not yet established or has been closed

Definition at line 123 of file transport.hpp.

References m_isConnected.

◆ isReceiving()

bool ndn::Transport::isReceiving ( ) const
inline
Return values
trueincoming packets are expected, receiveCallback will be invoked
falseincoming packets are not expected, receiveCallback will not be invoked

Definition at line 129 of file transport.hpp.

References m_isReceiving.

◆ receive()

void ndn::Transport::receive ( const Block wire)
inlineprotected

invoke the receive callback

Definition at line 135 of file transport.hpp.

References m_receiveCallback.

Member Data Documentation

◆ m_ioService

boost::asio::io_service* ndn::Transport::m_ioService
protected

Definition at line 116 of file transport.hpp.

Referenced by connect(), and ndn::util::DummyClientFace::Transport::getIoService().

◆ m_isConnected

bool ndn::Transport::m_isConnected
protected

Definition at line 117 of file transport.hpp.

Referenced by isConnected().

◆ m_isReceiving

bool ndn::Transport::m_isReceiving
protected

Definition at line 118 of file transport.hpp.

Referenced by isReceiving().

◆ m_receiveCallback

ReceiveCallback ndn::Transport::m_receiveCallback
protected

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