All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ndn::TcpTransport Class Reference

#include <tcp-transport.hpp>

Inheritance diagram for ndn::TcpTransport:
[legend]
Collaboration diagram for ndn::TcpTransport:
[legend]

Public Types

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

Public Member Functions

 TcpTransport (const std::string &host, const std::string &port="6363")
 
 ~TcpTransport ()
 
virtual void connect (boost::asio::io_service &ioService, const ReceiveCallback &receiveCallback)
 Connect transport. More...
 
virtual void close ()
 Close the connection. More...
 
virtual void pause ()
 
virtual void resume ()
 
virtual void send (const Block &wire)
 Set data to the host. More...
 
virtual void send (const Block &header, const Block &payload)
 Alternative version of sending data, applying scatter/gather I/O concept. More...
 
bool isConnected ()
 
bool isExpectingData ()
 

Protected Member Functions

void receive (const Block &wire)
 

Protected Attributes

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

Friends

class StreamTransportImpl< TcpTransport, boost::asio::ip::tcp >
 
class StreamTransportWithResolverImpl< TcpTransport, boost::asio::ip::tcp >
 

Detailed Description

Definition at line 22 of file tcp-transport.hpp.

Member Typedef Documentation

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

Definition at line 26 of file transport.hpp.

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

Definition at line 25 of file transport.hpp.

Constructor & Destructor Documentation

ndn::TcpTransport::TcpTransport ( const std::string &  host,
const std::string &  port = "6363" 
)

Definition at line 14 of file tcp-transport.cpp.

ndn::TcpTransport::~TcpTransport ( )

Definition at line 20 of file tcp-transport.cpp.

Member Function Documentation

void ndn::TcpTransport::close ( )
virtual

Close the connection.

Implements ndn::Transport.

Definition at line 52 of file tcp-transport.cpp.

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

Connect transport.

Exceptions
Ifconnection cannot be established

Reimplemented from ndn::Transport.

Definition at line 25 of file tcp-transport.cpp.

bool ndn::Transport::isConnected ( )
inlineinherited

Definition at line 124 of file transport.hpp.

bool ndn::Transport::isExpectingData ( )
inlineinherited

Definition at line 130 of file transport.hpp.

void ndn::TcpTransport::pause ( )
virtual

Implements ndn::Transport.

Definition at line 58 of file tcp-transport.cpp.

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

Definition at line 136 of file transport.hpp.

void ndn::TcpTransport::resume ( )
virtual

Implements ndn::Transport.

Definition at line 64 of file tcp-transport.cpp.

void ndn::TcpTransport::send ( const Block wire)
virtual

Set data to the host.

Parameters
dataA pointer to the buffer of data to send.
dataLengthThe number of bytes in data.

Implements ndn::Transport.

Definition at line 40 of file tcp-transport.cpp.

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

Alternative version of sending data, applying scatter/gather I/O concept.

Two non-consecutive memory blocks will be send out together, e.g., as part of the same message in datagram-oriented transports.

Implements ndn::Transport.

Definition at line 46 of file tcp-transport.cpp.

Friends And Related Function Documentation

friend class StreamTransportImpl< TcpTransport, boost::asio::ip::tcp >
friend

Definition at line 53 of file tcp-transport.hpp.

friend class StreamTransportWithResolverImpl< TcpTransport, boost::asio::ip::tcp >
friend

Definition at line 54 of file tcp-transport.hpp.

Field Documentation

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

Definition at line 84 of file transport.hpp.

bool ndn::Transport::m_isConnected
protectedinherited

Definition at line 85 of file transport.hpp.

bool ndn::Transport::m_isExpectingData
protectedinherited

Definition at line 86 of file transport.hpp.

ReceiveCallback ndn::Transport::m_receiveCallback
protectedinherited

Definition at line 87 of file transport.hpp.