PionNetworkLibrary
|
#include <stream.hpp>
Public Types | |
enum | { PUT_BACK_MAX = 10, WRITE_BUFFER_SIZE = 8192 } |
typedef char | char_type |
typedef std::char_traits< char > ::int_type | int_type |
typedef std::char_traits< char > ::off_type | off_type |
typedef std::char_traits< char > ::pos_type | pos_type |
typedef std::char_traits< char > | traits_type |
Public Member Functions | |
stream_buffer (const tcp::connection_ptr &conn_ptr) | |
stream_buffer (boost::asio::io_service &io_service, const bool ssl_flag=false) | |
stream_buffer (boost::asio::io_service &io_service, connection::ssl_context_type &ssl_context) | |
virtual | ~stream_buffer () |
virtual destructor flushes the write buffer More... | |
connection & | get_connection (void) |
returns a reference to the current TCP connection More... | |
const connection & | get_connection (void) const |
returns a const reference to the current TCP connection More... | |
Protected Member Functions | |
void | setup_buffers (void) |
sets up the read and write buffers for input and output More... | |
int_type | flush_output (void) |
virtual int_type | underflow (void) |
virtual int_type | overflow (int_type c) |
virtual std::streamsize | xsputn (const char_type *s, std::streamsize n) |
virtual std::streamsize | xsgetn (char_type *s, std::streamsize n) |
virtual int_type | sync (void) |
stream_buffer: std::basic_streambuf wrapper for TCP network connections. Based in part on section 13.13.3 of "The Standard C++ Library" by Nicolai M. Josuttis, published in 1999 by Addison-Wesley
typedef char pion::tcp::stream_buffer::char_type |
typedef std::char_traits<char>::int_type pion::tcp::stream_buffer::int_type |
typedef std::char_traits<char>::off_type pion::tcp::stream_buffer::off_type |
typedef std::char_traits<char>::pos_type pion::tcp::stream_buffer::pos_type |
typedef std::char_traits<char> pion::tcp::stream_buffer::traits_type |
|
inlineexplicit |
constructs a TCP stream buffer object for an existing TCP connection
conn_ptr | pointer to the TCP connection to use for reading & writing |
References setup_buffers().
|
inlineexplicit |
constructs a TCP stream buffer object for a new TCP connection
io_service | asio service associated with the connection |
ssl_flag | if true then the connection will be encrypted using SSL |
References setup_buffers().
|
inline |
constructs a TCP stream buffer object for a new SSL/TCP connection
io_service | asio service associated with the connection |
ssl_context | asio ssl context associated with the connection |
References setup_buffers().
|
inlinevirtual |
virtual destructor flushes the write buffer
References sync().
|
inlineprotected |
writes data in the output buffer to the TCP connection
Referenced by overflow(), sync(), and xsputn().
|
inline |
returns a reference to the current TCP connection
Referenced by pion::tcp::stream::accept(), pion::tcp::stream::close(), pion::tcp::stream::connect(), pion::tcp::stream::get_remote_ip(), pion::tcp::stream::get_ssl_flag(), and pion::tcp::stream::is_open().
|
inline |
returns a const reference to the current TCP connection
this function is called when the write buffer for the stream is full
c | character that has not been written yet, or eof() if we are flushing |
References flush_output().
|
inlineprotected |
sets up the read and write buffers for input and output
References PUT_BACK_MAX, and WRITE_BUFFER_SIZE.
Referenced by stream_buffer().
|
inlineprotectedvirtual |
synchronize buffers with the TCP connection
References flush_output().
Referenced by ~stream_buffer().
|
inlineprotectedvirtual |
this function is called when the read buffer has no more characters available
References PUT_BACK_MAX, and pion::tcp::connection::READ_BUFFER_SIZE.
Referenced by xsgetn().
|
inlineprotectedvirtual |
reads a sequence of characters
s | pointer to where the sequence of characters will be stored |
n | number of characters in the sequence to read |
References underflow().
|
inlineprotectedvirtual |
writes a sequence of characters
s | pointer to a sequence of characters |
n | number of characters in the sequence to write |
References flush_output(), and WRITE_BUFFER_SIZE.