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

Member Function Documentation

◆ writeHandshake()

bool writeHandshake ( )

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

◆ readHandshake()

bool readHandshake ( )

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

◆ shutdown()

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.

◆ import()

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.

◆ peeksome()

std::streamsize peeksome ( CharT *  buffer,
std::streamsize  n 
)
inherited

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().