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

using Impl = StreamTransportImpl< BaseTransport, Protocol >
 
using TransmissionQueue = std::queue< Block, std::list< Block > >
 

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 &block)
 

Protected Member Functions

void asyncReceive ()
 
void asyncWrite ()
 
void connectHandler (const boost::system::error_code &error)
 
void connectTimeoutHandler (const boost::system::error_code &error)
 
bool processAllReceived (uint8_t *buffer, size_t &offset, size_t nBytesAvailable)
 

Protected Attributes

boost::asio::steady_timer m_connectTimer
 
uint8_t m_inputBuffer [MAX_NDN_PACKET_SIZE]
 
size_t m_inputBufferSize = 0
 
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 42 of file stream-transport-impl.hpp.

Member Typedef Documentation

◆ Impl

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

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

◆ TransmissionQueue

template<typename BaseTransport , typename Protocol >
using ndn::detail::StreamTransportImpl< BaseTransport, Protocol >::TransmissionQueue = std::queue<Block, std::list<Block> >

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

Constructor & Destructor Documentation

◆ StreamTransportImpl()

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

◆ asyncReceive()

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

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

◆ asyncWrite()

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

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

◆ close()

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

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

◆ connect()

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 56 of file stream-transport-impl.hpp.

◆ connectHandler()

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

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

◆ connectTimeoutHandler()

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

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

◆ pause()

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

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

◆ processAllReceived()

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 221 of file stream-transport-impl.hpp.

◆ resume()

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

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

◆ send()

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

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

Member Data Documentation

◆ m_connectTimer

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

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

◆ m_inputBuffer

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

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

◆ m_inputBufferSize

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

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

◆ m_socket

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

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

◆ m_transmissionQueue

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

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

◆ m_transport

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

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