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

using ReceiveCallback = std::function< void(const Block &wire)>
 
using ErrorCallback = std::function< void()>
 

Public Member Functions

virtual ~Transport ()=default
 
virtual void connect (ReceiveCallback receiveCallback)
 Asynchronously open the connection. More...
 
virtual void close ()=0
 Close the connection. More...
 
virtual void send (const Block &block)=0
 Send a TLV block through the transport. More...
 
virtual void pause ()=0
 Pause the transport, canceling all pending operations. More...
 
virtual void resume ()=0
 Resume the transport. More...
 
bool isConnected () const noexcept
 Return whether the transport is connected. More...
 
bool isReceiving () const noexcept
 

Protected Attributes

ReceiveCallback m_receiveCallback
 
bool m_isConnected = false
 
bool m_isReceiving = false
 

Detailed Description

Provides TLV-block delivery service.

Definition at line 35 of file transport.hpp.

Member Typedef Documentation

◆ ReceiveCallback

using ndn::Transport::ReceiveCallback = std::function<void(const Block& wire)>

Definition at line 46 of file transport.hpp.

◆ ErrorCallback

using ndn::Transport::ErrorCallback = std::function<void()>

Definition at line 47 of file transport.hpp.

Constructor & Destructor Documentation

◆ ~Transport()

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

Member Function Documentation

◆ connect()

void ndn::Transport::connect ( ReceiveCallback  receiveCallback)
virtual

Asynchronously open the connection.

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

Definition at line 32 of file transport.cpp.

References m_receiveCallback, and nonstd::optional_lite::std11::move().

Referenced by ndn::util::DummyClientFace::~DummyClientFace().

◆ close()

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

◆ send()

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

Send a TLV block through the transport.

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

◆ pause()

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

Pause the transport, canceling all pending operations.

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

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

◆ resume()

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

Resume the transport.

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

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

◆ isConnected()

bool ndn::Transport::isConnected ( ) const
inlinenoexcept

Return whether the transport is connected.

Definition at line 93 of file transport.hpp.

References m_isConnected.

◆ isReceiving()

bool ndn::Transport::isReceiving ( ) const
inlinenoexcept
Return values
trueincoming packets are expected, the receive callback will be invoked
falseincoming packets are not expected, the receive callback will not be invoked

Definition at line 103 of file transport.hpp.

References m_isReceiving.

Member Data Documentation

◆ m_receiveCallback

ReceiveCallback ndn::Transport::m_receiveCallback
protected

Definition at line 109 of file transport.hpp.

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

◆ m_isConnected

bool ndn::Transport::m_isConnected = false
protected

Definition at line 110 of file transport.hpp.

Referenced by isConnected().

◆ m_isReceiving

bool ndn::Transport::m_isReceiving = false
protected

Definition at line 111 of file transport.hpp.

Referenced by isReceiving().


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