#include <Asynch_Connector.h>
Inheritance diagram for ACE_Asynch_Connector< HANDLER >:
Public Member Functions | |
ACE_Asynch_Connector (void) | |
A do nothing constructor. | |
virtual | ~ACE_Asynch_Connector (void) |
Virtual destruction. | |
virtual int | open (int pass_addresses=0, ACE_Proactor *proactor=0, int validate_new_connection=1) |
virtual int | connect (const ACE_INET_Addr &remote_sap, const ACE_INET_Addr &local_sap=(const ACE_INET_Addr &) ACE_Addr::sap_any, int reuse_addr=1, const void *act=0) |
This initiates a new asynchronous connect. | |
virtual int | cancel (void) |
virtual int | validate_connection (const ACE_Asynch_Connect::Result &result, const ACE_INET_Addr &remote, const ACE_INET_Addr &local) |
virtual int | pass_addresses (void) const |
virtual void | pass_addresses (int new_value) |
virtual int | validate_new_connection (void) const |
virtual void | validate_new_connection (int new_value) |
Protected Member Functions | |
virtual void | handle_connect (const ACE_Asynch_Connect::Result &result) |
This is called when an outstanding accept completes. | |
void | parse_address (const ACE_Asynch_Connect::Result &result, ACE_INET_Addr &remote_address, ACE_INET_Addr &local_address) |
This parses the address from read buffer. | |
ACE_Asynch_Connect & | asynch_connect (void) |
Return the asynch Connect object. | |
virtual HANDLER * | make_handler (void) |
Private Attributes | |
ACE_Asynch_Connect | asynch_connect_ |
Asynch_Connect used to make life easier :-). | |
int | pass_addresses_ |
Flag that indicates if parsing of addresses is necessary. | |
int | validate_new_connection_ |
Flag that indicates if address validation is required. |
Unlike the ACE_Connector, however, this class is designed to be used asynchronously with the ACE Proactor framework.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_Asynch_Connector< HANDLER >::ACE_Asynch_Connector | ( | void | ) |
A do nothing constructor.
ACE_Asynch_Connector< HANDLER >::~ACE_Asynch_Connector | ( | void | ) | [virtual] |
Virtual destruction.
ACE_Asynch_Connect & ACE_Asynch_Connector< HANDLER >::asynch_connect | ( | void | ) | [protected] |
Return the asynch Connect object.
int ACE_Asynch_Connector< HANDLER >::cancel | ( | void | ) | [virtual] |
This cancels all pending accepts operations that were issued by the calling thread.
On POSIX, delegates cancelation to ACE_POSIX_Asynch_Connect.
int ACE_Asynch_Connector< HANDLER >::connect | ( | const ACE_INET_Addr & | remote_sap, | |
const ACE_INET_Addr & | local_sap = (const ACE_INET_Addr &) ACE_Addr::sap_any , |
|||
int | reuse_addr = 1 , |
|||
const void * | act = 0 | |||
) | [virtual] |
This initiates a new asynchronous connect.
void ACE_Asynch_Connector< HANDLER >::handle_connect | ( | const ACE_Asynch_Connect::Result & | result | ) | [protected, virtual] |
HANDLER * ACE_Asynch_Connector< HANDLER >::make_handler | ( | void | ) | [protected, virtual] |
This is the template method used to create new handler. Subclasses must overwrite this method if a new handler creation strategy is required.
int ACE_Asynch_Connector< HANDLER >::open | ( | int | pass_addresses = 0 , |
|
ACE_Proactor * | proactor = 0 , |
|||
int | validate_new_connection = 1 | |||
) | [virtual] |
This opens asynch connector
void ACE_Asynch_Connector< HANDLER >::parse_address | ( | const ACE_Asynch_Connect::Result & | result, | |
ACE_INET_Addr & | remote_address, | |||
ACE_INET_Addr & | local_address | |||
) | [protected] |
This parses the address from read buffer.
void ACE_Asynch_Connector< HANDLER >::pass_addresses | ( | int | new_value | ) | [virtual] |
int ACE_Asynch_Connector< HANDLER >::pass_addresses | ( | void | ) | const [virtual] |
Set and get flag that indicates if parsing and passing of addresses to the service_handler is necessary.
int ACE_Asynch_Connector< HANDLER >::validate_connection | ( | const ACE_Asynch_Connect::Result & | result, | |
const ACE_INET_Addr & | remote, | |||
const ACE_INET_Addr & | local | |||
) | [virtual] |
Template method to validate peer before service is opened. This method is called when the connection attempt completes, whether it succeeded or failed, if the validate_connection argument to open()
was non-zero or the validate_new_connection()
method is called to turn this feature on. The default implementation returns 0. Users can (and probably should) reimplement this method to learn about the success or failure of the connection attempt. If the connection completed successfully, this method can be used to perform validation of the peer using it's address, running an authentication procedure (such as SSL) or anything else necessary or desireable. The return value from this method determines whether or not ACE will continue opening the service or abort the connection.
result | Result of the connection acceptance. Use result.success() to determine success or failure of the connection attempt. | |
remote | Peer's address. If the connection failed, this object is undefined. | |
local | Local address connection was completed from. If the connection failed, this object is undefined. |
-1 | ACE_Asynch_Connector will close the connection, and the service will not be opened. | |
0 | Service opening will proceeed. |
void ACE_Asynch_Connector< HANDLER >::validate_new_connection | ( | int | new_value | ) | [virtual] |
int ACE_Asynch_Connector< HANDLER >::validate_new_connection | ( | void | ) | const [virtual] |
Set and get flag that indicates if address validation is required.
ACE_Asynch_Connect ACE_Asynch_Connector< HANDLER >::asynch_connect_ [private] |
Asynch_Connect used to make life easier :-).
int ACE_Asynch_Connector< HANDLER >::pass_addresses_ [private] |
Flag that indicates if parsing of addresses is necessary.
int ACE_Asynch_Connector< HANDLER >::validate_new_connection_ [private] |
Flag that indicates if address validation is required.