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

a transport using Unix stream socket More...

#include <unix-transport.hpp>

Inheritance diagram for ndn::UnixTransport:
Collaboration diagram for ndn::UnixTransport:

Public Member Functions

 UnixTransport (const std::string &unixSocket)
 
 ~UnixTransport () override
 
void connect (boost::asio::io_service &ioService, const ReceiveCallback &receiveCallback) override
 asynchronously open the connection 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
 
bool isConnected () const
 
bool isReceiving () const
 

Static Public Member Functions

static shared_ptr< UnixTransportcreate (const std::string &uri)
 Create transport with parameters defined in URI. More...
 

Public Attributes

NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE __pad0__: static std::string getSocketNameFromUri(const std::string& uri)
 

Additional Inherited Members

- Public Types inherited from ndn::Transport
typedef function< void(const Block &wire)> ReceiveCallback
 
typedef function< void()> ErrorCallback
 
- 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

a transport using Unix stream socket

Definition at line 43 of file unix-transport.hpp.

Constructor & Destructor Documentation

ndn::UnixTransport::UnixTransport ( const std::string &  unixSocket)
explicit
ndn::UnixTransport::~UnixTransport ( )
overridedefault

Referenced by UnixTransport().

Member Function Documentation

void ndn::UnixTransport::connect ( boost::asio::io_service &  ioService,
const ReceiveCallback receiveCallback 
)
overridevirtual

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 from ndn::Transport.

Definition at line 77 of file unix-transport.cpp.

References ndn::Transport::connect(), and NDN_LOG_DEBUG.

void ndn::UnixTransport::close ( )
overridevirtual

Close the connection.

Implements ndn::Transport.

Definition at line 106 of file unix-transport.cpp.

References NDN_LOG_DEBUG.

void ndn::UnixTransport::pause ( )
overridevirtual

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 115 of file unix-transport.cpp.

References NDN_LOG_DEBUG.

void ndn::UnixTransport::resume ( )
overridevirtual

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 124 of file unix-transport.cpp.

References NDN_LOG_DEBUG.

void ndn::UnixTransport::send ( const Block wire)
overridevirtual

send a TLV block through the transport

Implements ndn::Transport.

Definition at line 92 of file unix-transport.cpp.

void ndn::UnixTransport::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 99 of file unix-transport.cpp.

shared_ptr< UnixTransport > ndn::UnixTransport::create ( const std::string &  uri)
static

Create transport with parameters defined in URI.

Exceptions
Transport::Errorincorrect URI or unsupported protocol is specified

Definition at line 71 of file unix-transport.cpp.

Member Data Documentation

NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE ndn::UnixTransport::__pad0__

Definition at line 78 of file unix-transport.hpp.


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