pion-net
4.0.9
|
#include <TCPStream.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 | |
TCPStreamBuffer (TCPConnectionPtr &conn_ptr) | |
TCPStreamBuffer (boost::asio::io_service &io_service, const bool ssl_flag=false) | |
TCPStreamBuffer (boost::asio::io_service &io_service, TCPConnection::SSLContext &ssl_context) | |
virtual | ~TCPStreamBuffer () |
virtual destructor flushes the write buffer | |
TCPConnection & | getConnection (void) |
returns a reference to the current TCP connection | |
const TCPConnection & | getConnection (void) const |
returns a const reference to the current TCP connection | |
Protected Member Functions | |
void | setupBuffers (void) |
sets up the read and write buffers for input and output | |
int_type | flushOutput (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) |
TCPStreamBuffer: 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
Definition at line 32 of file TCPStream.hpp.
pion::net::TCPStreamBuffer::TCPStreamBuffer | ( | TCPConnectionPtr & | conn_ptr | ) | [inline, explicit] |
constructs a TCP stream buffer object for an existing TCP connection
conn_ptr | pointer to the TCP connection to use for reading & writing |
Definition at line 56 of file TCPStream.hpp.
References setupBuffers().
pion::net::TCPStreamBuffer::TCPStreamBuffer | ( | boost::asio::io_service & | io_service, |
const bool | ssl_flag = false |
||
) | [inline, explicit] |
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 |
Definition at line 68 of file TCPStream.hpp.
References setupBuffers().
pion::net::TCPStreamBuffer::TCPStreamBuffer | ( | boost::asio::io_service & | io_service, |
TCPConnection::SSLContext & | ssl_context | ||
) | [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 |
Definition at line 82 of file TCPStream.hpp.
References setupBuffers().
int_type pion::net::TCPStreamBuffer::flushOutput | ( | void | ) | [inline, protected] |
writes data in the output buffer to the TCP connection
Definition at line 115 of file TCPStream.hpp.
Referenced by overflow(), sync(), and xsputn().
virtual int_type pion::net::TCPStreamBuffer::overflow | ( | int_type | c | ) | [inline, protected, virtual] |
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 |
Definition at line 182 of file TCPStream.hpp.
References flushOutput().
virtual int_type pion::net::TCPStreamBuffer::sync | ( | void | ) | [inline, protected, virtual] |
synchronize buffers with the TCP connection
Definition at line 279 of file TCPStream.hpp.
References flushOutput().
Referenced by ~TCPStreamBuffer().
virtual int_type pion::net::TCPStreamBuffer::underflow | ( | void | ) | [inline, protected, virtual] |
this function is called when the read buffer has no more characters available
Definition at line 139 of file TCPStream.hpp.
Referenced by xsgetn().
virtual std::streamsize pion::net::TCPStreamBuffer::xsgetn | ( | char_type * | s, |
std::streamsize | n | ||
) | [inline, protected, virtual] |
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 |
Definition at line 252 of file TCPStream.hpp.
References underflow().
virtual std::streamsize pion::net::TCPStreamBuffer::xsputn | ( | const char_type * | s, |
std::streamsize | n | ||
) | [inline, protected, virtual] |
writes a sequence of characters
s | pointer to a sequence of characters |
n | number of characters in the sequence to write |
Definition at line 203 of file TCPStream.hpp.
References flushOutput().