IOStream Class Reference

#include <Pt/Ssl/IOStream.h>

SSL stream.

Inherits BasicIOStream< char >, and NonCopyable.

Public Member Functions

 IOStream (std::size_t bufferSize=1024)
 Construct an SSL stream.
 IOStream (Context &ctx, std::iostream &ios, OpenMode mode, std::size_t bufferSize=1024)
 Constructs an open SSL stream.
virtual ~IOStream ()
BasicStreamBuffer< char > * buffer ()
 Returns the buffer.
void close ()
 Closes the stream.
const char * currentCipher () const
 Returns the currently used cipher.
std::streamsize import (std::streamsize maxImport=0)
 Reads user message from the underlying stream. More...
bool isClosed () const
 Returns true if the connection is closed.
bool isConnected () const
 Returns true if connected to peer.
bool isShutdown () const
 Returns true if the shutown notify has to be completed.
void open (Context &ctx, std::iostream &ios, OpenMode mode)
 Opens the SSL stream.
std::streamsize peeksome (char *buffer, std::streamsize n)
 Peeks bytes in the stream buffer. More...
bool readHandshake ()
 Reads handshake message from the underlying stream. More...
void setBuffer (BasicStreamBuffer< char > *sb)
 Sets the buffer.
bool shutdown ()
 Shutdown the SSL connection. More...
StreamBuffersslBuffer ()
 Returns the ssl buffer.
bool writeHandshake ()
 Writes a handshake message to the underlying stream. More...
std::streamsize writesome (char *buffer, std::streamsize n)
 Write as much data as fits in buffer.

Member Function Documentation

bool writeHandshake ( )

Returns true if handshake data was written, false if not.

bool readHandshake ( )

Returns true if more handshake data needs to be read, false if not.

bool shutdown ( )

If isShutdown() returned false, the shutdown message is written to the output. If isShutdown() returned true, or a previous call of shutdown() returned false, more data is required to read the shutdown reply. True is returned if the shutown was completed.

std::streamsize import ( std::streamsize  maxImport = 0)

Call isShutdown() to find out if a shutdown notify was received and isClosed() if the connection was prematurely closed.

std::streamsize peeksome ( char *  buffer,
std::streamsize  n 

The number of bytes that can be peeked depends on the current stream buffer get area and maybe less than requested, similar to istream::readsome().