# ACE_SSL_Asynch_Stream Class Reference

This class is a factory for starting off asynchronous reads on a stream. This class forwards all methods to its implementation class. More...

`#include <SSL_Asynch_Stream.h>`

Inheritance diagram for ACE_SSL_Asynch_Stream:

[legend]
Collaboration diagram for ACE_SSL_Asynch_Stream:

[legend]
List of all members.

## Public Types

enum | Stream_Type { ST_CLIENT = 0x0001, ST_SERVER = 0x0002 }

## Public Member Functions

| ACE_SSL_Asynch_Stream (Stream_Type s_type=ST_SERVER, ACE_SSL_Context *context=0)
| The constructor.
virtual | ~ACE_SSL_Asynch_Stream (void)
| Destructor.
int | cancel (void)
int | close (void)
int | open (ACE_Handler &handler, ACE_HANDLE handle=ACE_INVALID_HANDLE, const void *completion_key=0, ACE_Proactor *proactor=0)
void | open (ACE_HANDLE new_handle, ACE_Message_Block &message_block)
int | read (ACE_Message_Block &message_block, size_t num_bytes_to_read, const void *act=0, int priority=0, int signal_number=ACE_SIGRTMIN)
int | write (ACE_Message_Block &message_block, size_t bytes_to_write, const void *act=0, int priority=0, int signal_number=ACE_SIGRTMIN)

## Protected Types

enum | Stream_Flag { SF_STREAM_OPEN = 0x0001, SF_REQ_SHUTDOWN = 0x0002, SF_SHUTDOWN_DONE = 0x0004, SF_CLOSE_NTF_SENT = 0x0008, SF_DELETE_ENABLE = 0x0010 }
| Stream state/flags. More...
enum | BIO_Flag { BF_EOS = 0x01, BF_AIO = 0x02 }

## Protected Member Functions

virtual void | handle_write_stream (const ACE_Asynch_Write_Stream::Result &result)
| virtual from ACE_Service_Handler
virtual void | handle_read_stream (const ACE_Asynch_Read_Stream::Result &result)
virtual void | handle_wakeup (void)
void | print_error (int err_ssl, const ACE_TCHAR *pText)
int | pending_BIO_count (void)
int | notify_read (int bytes_transferred, int error)
int | notify_write (int bytes_transferred, int error)
int | notify_close (void)
SSL State Machine
int | do_SSL_state_machine (void)
int | do_SSL_handshake (void)
int | do_SSL_read (void)
int | do_SSL_write (void)
int | do_SSL_shutdown (void)
BIO Helpers
int | ssl_bio_read (char *buf, size_t len, int &errval)
int | ssl_bio_write (const char *buf, size_t len, int &errval)

## Protected Attributes

Stream_Type | type_
| Stream Type ST_CLIENT/ST_SERVER.
ACE_HANDLE | handle_
| The real file/socket handle.
ACE_Proactor * | proactor_
| The proactor.
ACE_Handler * | ext_handler_
| External,i.e user handler.
ACE_SSL_Asynch_Read_Stream_Result * | ext_read_result_
| External, i.e. read result faked for user.
ACE_SSL_Asynch_Write_Stream_Result * | ext_write_result_
| External, i.e. write result faked for user.
int | flags_
SSL * | ssl_
| The SSL session.
BIO * | bio_
| The BIO implementation.
ACE_SYNCH_MUTEX | mutex_
| Mutex to protect work.
Internal stream, buffer and info for BIO read
ACE_Asynch_Read_Stream | bio_istream_
ACE_Message_Block | bio_inp_msg_
int | bio_inp_errno_
int | bio_inp_flag_
Internal stream, buffer and info for BIO write
ACE_Asynch_Write_Stream | bio_ostream_
ACE_Message_Block | bio_out_msg_
int | bio_out_errno_
int | bio_out_flag_

## Private Member Functions

| ACE_SSL_Asynch_Stream (ACE_SSL_Asynch_Stream const &)
ACE_SSL_Asynch_Stream & | operator= (ACE_SSL_Asynch_Stream const &)

## Friends

struct | ACE_SSL_Asynch_Stream_Accessor

## Detailed Description

This class is a factory for starting off asynchronous reads on a stream. This class forwards all methods to its implementation class.

  Once open() is called, multiple asynchronous read()s can started using this class. An ACE_SSL_Asynch_Stream::Result will be passed back to the

Parameters:

  | handler | when the asynchronous reads completes through the ACE_Handler::handle_read_stream callback.

## Member Enumeration Documentation

enum ACE_SSL_Asynch_Stream::BIO_Flag `[protected]`

The real streams which work under the ssl connection. BIO performs I/O via this streams

Enumeration values:

  BF_EOS | End of stream.
  BF_AIO | Real AIO in progress.

enum ACE_SSL_Asynch_Stream::Stream_Flag `[protected]`

Stream state/flags.

Enumeration values:

  SF_STREAM_OPEN | istream_ open OK
  SF_REQ_SHUTDOWN | request to SSL shutdown
  SF_SHUTDOWN_DONE | SSL shutdown finished.
  SF_CLOSE_NTF_SENT | Close notification sent.
  SF_DELETE_ENABLE | Stream can be safely destroyed.

enum ACE_SSL_Asynch_Stream::Stream_Type

Enumeration values:

  ST_CLIENT |
  ST_SERVER |

## Constructor & Destructor Documentation

ACE_SSL_Asynch_Stream::ACE_SSL_Asynch_Stream | ( | Stream_Type | s_type = `ST_SERVER`,
|  | ACE_SSL_Context * | context = `0`
| ) |

The constructor.

Parameters:

  | context | Pointer to `ACE_SSL_Context` instance containing the OpenSSL `SSL` data structure to be associated with this `ACE_SSL_SOCK_Stream`. The `SSL` data structure will be copied to make it at least logically independent of the supplied context.

ACE_SSL_Asynch_Stream::~ACE_SSL_Asynch_Stream | ( | void |  | ) | `[virtual]`

| Destructor.

ACE_SSL_Asynch_Stream::ACE_SSL_Asynch_Stream | ( | ACE_SSL_Asynch_Stream const & |  | ) | `[private]`

## Member Function Documentation

int ACE_SSL_Asynch_Stream::cancel | ( | void |  | ) |

| Reimplemented from ACE_Asynch_Operation.

int ACE_SSL_Asynch_Stream::close | ( | void |  | ) |

int ACE_SSL_Asynch_Stream::do_SSL_handshake | ( | void |  | ) | `[protected]`

int ACE_SSL_Asynch_Stream::do_SSL_read | ( | void |  | ) | `[protected]`

int ACE_SSL_Asynch_Stream::do_SSL_shutdown | ( | void |  | ) | `[protected]`

int ACE_SSL_Asynch_Stream::do_SSL_state_machine | ( | void |  | ) | `[protected]`

int ACE_SSL_Asynch_Stream::do_SSL_write | ( | void |  | ) | `[protected]`

void ACE_SSL_Asynch_Stream::handle_read_stream | ( | const ACE_Asynch_Read_Stream::Result & | result | ) | `[protected, virtual]`

| This method is called when BIO read request is completed. It processes the IO completion and calls do_SSL_state_machine(). Reimplemented from ACE_Handler.

void ACE_SSL_Asynch_Stream::handle_wakeup | ( | void |  | ) | `[protected, virtual]`

| This method is called when all SSL sessions are closed and no more pending AIOs exist. It also calls users handle_wakeup(). Reimplemented from ACE_Handler.

void ACE_SSL_Asynch_Stream::handle_write_stream | ( | const ACE_Asynch_Write_Stream::Result & | result | ) | `[protected, virtual]`

| virtual from ACE_Service_Handler This method is called when BIO write request is completed. It processes the IO completion and calls do_SSL_state_machine(). Reimplemented from ACE_Handler.

int ACE_SSL_Asynch_Stream::notify_close | ( | void |  | ) | `[protected]`

| This method is called to notify ourself that SSL session is shutdown and that there is no more I/O activity now and in the future.

int ACE_SSL_Asynch_Stream::notify_read | ( | int | bytes_transferred,
|  | int | error
| ) | `[protected]`

| This method is called to notify user handler when user's read in done.

int ACE_SSL_Asynch_Stream::notify_write | ( | int | bytes_transferred,
|  | int | error
| ) | `[protected]`

| This method is called to notify user handler when user's write in done.

void ACE_SSL_Asynch_Stream::open | ( | ACE_HANDLE | new_handle,
|  | ACE_Message_Block & | message_block
| ) | `[virtual]`

| NOTE: This method has been specifically put in place so that compilers like the borland doesnt get confused between the above open () call with the one in the ACE_Service_Handler, from which this class is derived from.. Reimplemented from ACE_Service_Handler.

int ACE_SSL_Asynch_Stream::open | ( | ACE_Handler & | handler,
|  | ACE_HANDLE | handle = `ACE_INVALID_HANDLE`,
|  | const void * | completion_key = `0`,
|  | ACE_Proactor * | proactor = `0`
| ) |

| Reimplemented from ACE_Asynch_Operation.

ACE_SSL_Asynch_Stream& ACE_SSL_Asynch_Stream::operator= | ( | ACE_SSL_Asynch_Stream const & |  | ) | `[private]`

int ACE_SSL_Asynch_Stream::pending_BIO_count | ( | void |  | ) | `[protected]`

void ACE_SSL_Asynch_Stream::print_error | ( | int | err_ssl,
|  | const ACE_TCHAR * | pText
| ) | `[protected]`

int ACE_SSL_Asynch_Stream::read | ( | ACE_Message_Block & | message_block,
|  | size_t | num_bytes_to_read,
|  | const void * | act = `0`,
|  | int | priority = `0`,
|  | int | signal_number = `ACE_SIGRTMIN`
| ) |

int ACE_SSL_Asynch_Stream::ssl_bio_read | ( | char * | buf,
|  | size_t | len,
|  | int & | errval
| ) | `[protected]`

int ACE_SSL_Asynch_Stream::ssl_bio_write | ( | const char * | buf,
|  | size_t | len,
|  | int & | errval
| ) | `[protected]`

int ACE_SSL_Asynch_Stream::write | ( | ACE_Message_Block & | message_block,
|  | size_t | bytes_to_write,
|  | const void * | act = `0`,
|  | int | priority = `0`,
|  | int | signal_number = `ACE_SIGRTMIN`
| ) |

## Friends And Related Function Documentation

friend struct ACE_SSL_Asynch_Stream_Accessor `[friend]`

## Member Data Documentation

BIO* ACE_SSL_Asynch_Stream::bio_ `[protected]`

| The BIO implementation.

int ACE_SSL_Asynch_Stream::bio_inp_errno_ `[protected]`

int ACE_SSL_Asynch_Stream::bio_inp_flag_ `[protected]`

ACE_Message_Block ACE_SSL_Asynch_Stream::bio_inp_msg_ `[protected]`

ACE_Asynch_Read_Stream ACE_SSL_Asynch_Stream::bio_istream_ `[protected]`

ACE_Asynch_Write_Stream ACE_SSL_Asynch_Stream::bio_ostream_ `[protected]`

int ACE_SSL_Asynch_Stream::bio_out_errno_ `[protected]`

int ACE_SSL_Asynch_Stream::bio_out_flag_ `[protected]`

ACE_Message_Block ACE_SSL_Asynch_Stream::bio_out_msg_ `[protected]`

ACE_Handler* ACE_SSL_Asynch_Stream::ext_handler_ `[protected]`

| External,i.e user handler.

ACE_SSL_Asynch_Read_Stream_Result* ACE_SSL_Asynch_Stream::ext_read_result_ `[protected]`

| External, i.e. read result faked for user.

ACE_SSL_Asynch_Write_Stream_Result* ACE_SSL_Asynch_Stream::ext_write_result_ `[protected]`

| External, i.e. write result faked for user.

int ACE_SSL_Asynch_Stream::flags_ `[protected]`

ACE_HANDLE ACE_SSL_Asynch_Stream::handle_ `[protected]`

| The real file/socket handle. Reimplemented from ACE_Handler.

ACE_SYNCH_MUTEX ACE_SSL_Asynch_Stream::mutex_ `[protected]`

| Mutex to protect work.

ACE_Proactor* ACE_SSL_Asynch_Stream::proactor_ `[protected]`

| The proactor. Reimplemented from ACE_Handler.

SSL* ACE_SSL_Asynch_Stream::ssl_ `[protected]`

| The SSL session.

Stream_Type ACE_SSL_Asynch_Stream::type_ `[protected]`

| Stream Type ST_CLIENT/ST_SERVER.

The documentation for this class was generated from the following files:

- SSL_Asynch_Stream.h
- SSL_Asynch_Stream.cpp