ndn::detail::StreamTransportImpl< BaseTransport, Protocol > Class Template Reference

Implementation detail of a Boost.Asio-based stream-oriented transport. More...

#include <ndn-cxx/transport/detail/stream-transport-impl.hpp>

+ Inheritance diagram for ndn::detail::StreamTransportImpl< BaseTransport, Protocol >:
+ Collaboration diagram for ndn::detail::StreamTransportImpl< BaseTransport, Protocol >:

Public Types

typedef std::list< BlockBlockSequence
 
typedef StreamTransportImpl< BaseTransport, Protocol > Impl
 
typedef std::list< BlockSequenceTransmissionQueue
 

Public Member Functions

 StreamTransportImpl (BaseTransport &transport, boost::asio::io_service &ioService)
 
void close ()
 
void connect (const typename Protocol::endpoint &endpoint)
 
void pause ()
 
void resume ()
 
void send (const Block &wire)
 
void send (const Block &header, const Block &payload)
 

Protected Member Functions

void asyncReceive ()
 
void asyncWrite ()
 
void connectHandler (const boost::system::error_code &error)
 
void connectTimeoutHandler (const boost::system::error_code &error)
 
void handleAsyncReceive (const boost::system::error_code &error, std::size_t nBytesRecvd)
 
void handleAsyncWrite (const boost::system::error_code &error, TransmissionQueue::iterator queueItem)
 
bool processAllReceived (uint8_t *buffer, size_t &offset, size_t nBytesAvailable)
 
void send (BlockSequence &&sequence)
 

Protected Attributes

boost::asio::steady_timer m_connectTimer
 
uint8_t m_inputBuffer [MAX_NDN_PACKET_SIZE]
 
size_t m_inputBufferSize
 
bool m_isConnecting
 
Protocol::socket m_socket
 
TransmissionQueue m_transmissionQueue
 
BaseTransport & m_transport
 

Detailed Description

template<typename BaseTransport, typename Protocol>
class ndn::detail::StreamTransportImpl< BaseTransport, Protocol >

Implementation detail of a Boost.Asio-based stream-oriented transport.

Template Parameters
BaseTransporta subclass of Transport
Protocola Boost.Asio stream-oriented protocol, e.g. boost::asio::ip::tcp or boost::asio::local::stream_protocol

Definition at line 41 of file stream-transport-impl.hpp.

Member Typedef Documentation

template<typename BaseTransport , typename Protocol >
typedef std::list<Block> ndn::detail::StreamTransportImpl< BaseTransport, Protocol >::BlockSequence

Definition at line 45 of file stream-transport-impl.hpp.

template<typename BaseTransport , typename Protocol >
typedef StreamTransportImpl<BaseTransport, Protocol> ndn::detail::StreamTransportImpl< BaseTransport, Protocol >::Impl

Definition at line 44 of file stream-transport-impl.hpp.

template<typename BaseTransport , typename Protocol >
typedef std::list<BlockSequence> ndn::detail::StreamTransportImpl< BaseTransport, Protocol >::TransmissionQueue

Definition at line 46 of file stream-transport-impl.hpp.

Constructor & Destructor Documentation

template<typename BaseTransport , typename Protocol >
ndn::detail::StreamTransportImpl< BaseTransport, Protocol >::StreamTransportImpl ( BaseTransport &  transport,
boost::asio::io_service &  ioService 
)
inline

Definition at line 48 of file stream-transport-impl.hpp.

Member Function Documentation

template<typename BaseTransport , typename Protocol >
void ndn::detail::StreamTransportImpl< BaseTransport, Protocol >::asyncReceive ( )
inlineprotected

Definition at line 212 of file stream-transport-impl.hpp.

template<typename BaseTransport , typename Protocol >
void ndn::detail::StreamTransportImpl< BaseTransport, Protocol >::asyncWrite ( )
inlineprotected

Definition at line 180 of file stream-transport-impl.hpp.

template<typename BaseTransport , typename Protocol >
void ndn::detail::StreamTransportImpl< BaseTransport, Protocol >::close ( )
inline

Definition at line 78 of file stream-transport-impl.hpp.

template<typename BaseTransport , typename Protocol >
void ndn::detail::StreamTransportImpl< BaseTransport, Protocol >::connect ( const typename Protocol::endpoint &  endpoint)
inline
Todo:
Decide whether this number should be configurable

Definition at line 58 of file stream-transport-impl.hpp.

template<typename BaseTransport , typename Protocol >
void ndn::detail::StreamTransportImpl< BaseTransport, Protocol >::connectHandler ( const boost::system::error_code &  error)
inlineprotected

Definition at line 136 of file stream-transport-impl.hpp.

template<typename BaseTransport , typename Protocol >
void ndn::detail::StreamTransportImpl< BaseTransport, Protocol >::connectTimeoutHandler ( const boost::system::error_code &  error)
inlineprotected

Definition at line 157 of file stream-transport-impl.hpp.

template<typename BaseTransport , typename Protocol >
void ndn::detail::StreamTransportImpl< BaseTransport, Protocol >::handleAsyncReceive ( const boost::system::error_code &  error,
std::size_t  nBytesRecvd 
)
inlineprotected

Definition at line 220 of file stream-transport-impl.hpp.

template<typename BaseTransport , typename Protocol >
void ndn::detail::StreamTransportImpl< BaseTransport, Protocol >::handleAsyncWrite ( const boost::system::error_code &  error,
TransmissionQueue::iterator  queueItem 
)
inlineprotected

Definition at line 188 of file stream-transport-impl.hpp.

template<typename BaseTransport , typename Protocol >
void ndn::detail::StreamTransportImpl< BaseTransport, Protocol >::pause ( )
inline

Definition at line 93 of file stream-transport-impl.hpp.

template<typename BaseTransport , typename Protocol >
bool ndn::detail::StreamTransportImpl< BaseTransport, Protocol >::processAllReceived ( uint8_t *  buffer,
size_t &  offset,
size_t  nBytesAvailable 
)
inlineprotected

Definition at line 257 of file stream-transport-impl.hpp.

template<typename BaseTransport , typename Protocol >
void ndn::detail::StreamTransportImpl< BaseTransport, Protocol >::resume ( )
inline

Definition at line 105 of file stream-transport-impl.hpp.

template<typename BaseTransport , typename Protocol >
void ndn::detail::StreamTransportImpl< BaseTransport, Protocol >::send ( const Block wire)
inline

Definition at line 118 of file stream-transport-impl.hpp.

template<typename BaseTransport , typename Protocol >
void ndn::detail::StreamTransportImpl< BaseTransport, Protocol >::send ( const Block header,
const Block payload 
)
inline

Definition at line 126 of file stream-transport-impl.hpp.

template<typename BaseTransport , typename Protocol >
void ndn::detail::StreamTransportImpl< BaseTransport, Protocol >::send ( BlockSequence &&  sequence)
inlineprotected

Definition at line 167 of file stream-transport-impl.hpp.

Member Data Documentation

template<typename BaseTransport , typename Protocol >
boost::asio::steady_timer ndn::detail::StreamTransportImpl< BaseTransport, Protocol >::m_connectTimer
protected

Definition at line 282 of file stream-transport-impl.hpp.

template<typename BaseTransport , typename Protocol >
uint8_t ndn::detail::StreamTransportImpl< BaseTransport, Protocol >::m_inputBuffer[MAX_NDN_PACKET_SIZE]
protected

Definition at line 276 of file stream-transport-impl.hpp.

template<typename BaseTransport , typename Protocol >
size_t ndn::detail::StreamTransportImpl< BaseTransport, Protocol >::m_inputBufferSize
protected

Definition at line 277 of file stream-transport-impl.hpp.

template<typename BaseTransport , typename Protocol >
bool ndn::detail::StreamTransportImpl< BaseTransport, Protocol >::m_isConnecting
protected

Definition at line 280 of file stream-transport-impl.hpp.

template<typename BaseTransport , typename Protocol >
Protocol::socket ndn::detail::StreamTransportImpl< BaseTransport, Protocol >::m_socket
protected

Definition at line 275 of file stream-transport-impl.hpp.

template<typename BaseTransport , typename Protocol >
TransmissionQueue ndn::detail::StreamTransportImpl< BaseTransport, Protocol >::m_transmissionQueue
protected

Definition at line 279 of file stream-transport-impl.hpp.

template<typename BaseTransport , typename Protocol >
BaseTransport& ndn::detail::StreamTransportImpl< BaseTransport, Protocol >::m_transport
protected

Definition at line 273 of file stream-transport-impl.hpp.