ACE  6.2.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
ACE_Asynch_Connector< HANDLER > Class Template Reference

This class is an example of the Connector pattern. This class will establish new connections and create new HANDLER objects to handle the new connections. More...

#include <Asynch_Connector.h>

Inheritance diagram for ACE_Asynch_Connector< HANDLER >:
Inheritance graph
[legend]
Collaboration diagram for ACE_Asynch_Connector< HANDLER >:
Collaboration graph
[legend]

Public Member Functions

 ACE_Asynch_Connector (void)
 A do nothing constructor. More...
 
virtual ~ACE_Asynch_Connector (void)
 Virtual destruction. More...
 
virtual int open (bool pass_addresses=false, ACE_Proactor *proactor=0, bool validate_new_connection=true)
 
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. More...
 
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 bool pass_addresses (void) const
 
virtual void pass_addresses (bool new_value)
 
virtual bool validate_new_connection (void) const
 
virtual void validate_new_connection (bool new_value)
 
- Public Member Functions inherited from ACE_Handler
 ACE_Handler (void)
 A do nothing constructor. More...
 
 ACE_Handler (ACE_Proactor *p)
 A do nothing constructor which allows proactor to be set to <p>. More...
 
virtual ~ACE_Handler (void)
 Virtual destruction. More...
 
virtual void handle_read_stream (const ACE_Asynch_Read_Stream::Result &result)
 
virtual void handle_write_dgram (const ACE_Asynch_Write_Dgram::Result &result)
 
virtual void handle_read_dgram (const ACE_Asynch_Read_Dgram::Result &result)
 
virtual void handle_write_stream (const ACE_Asynch_Write_Stream::Result &result)
 
virtual void handle_read_file (const ACE_Asynch_Read_File::Result &result)
 
virtual void handle_write_file (const ACE_Asynch_Write_File::Result &result)
 
virtual void handle_accept (const ACE_Asynch_Accept::Result &result)
 This method will be called when an asynchronous accept completes. More...
 
virtual void handle_transmit_file (const ACE_Asynch_Transmit_File::Result &result)
 
virtual void handle_time_out (const ACE_Time_Value &tv, const void *act=0)
 
virtual void handle_wakeup (void)
 
ACE_Proactorproactor (void)
 Get the proactor associated with this handler. More...
 
void proactor (ACE_Proactor *p)
 Set the proactor. More...
 
virtual ACE_HANDLE handle (void) const
 
virtual void handle (ACE_HANDLE)
 Set the ACE_HANDLE value for this Handler. More...
 
Proxy_Ptrproxy (void)
 

Protected Member Functions

virtual void handle_connect (const ACE_Asynch_Connect::Result &result)
 This is called when an outstanding accept completes. More...
 
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. More...
 
ACE_Asynch_Connectasynch_connect (void)
 Return the asynch Connect object. More...
 
virtual HANDLER * make_handler (void)
 

Private Attributes

ACE_Asynch_Connect asynch_connect_
 Asynch_Connect used to make life easier :-) More...
 
bool pass_addresses_
 Flag that indicates if parsing of addresses is necessary. More...
 
bool validate_new_connection_
 Flag that indicates if address validation is required. More...
 

Additional Inherited Members

- Public Types inherited from ACE_Handler
typedef
ACE_Refcounted_Auto_Ptr< Proxy,
ACE_SYNCH_MUTEX
Proxy_Ptr
 
- Protected Attributes inherited from ACE_Handler
ACE_Proactorproactor_
 The proactor associated with this handler. More...
 
ACE_HANDLE handle_
 The ACE_HANDLE in use with this handler. More...
 
ACE_Refcounted_Auto_Ptr< Proxy,
ACE_SYNCH_MUTEX
proxy_
 Refers to proxy for this handler. More...
 

Detailed Description

template<class HANDLER>
class ACE_Asynch_Connector< HANDLER >

This class is an example of the Connector pattern. This class will establish new connections and create new HANDLER objects to handle the new connections.

Unlike the ACE_Connector, however, this class is designed to be used asynchronously with the ACE Proactor framework.

Constructor & Destructor Documentation

template<class HANDLER >
ACE_Asynch_Connector< HANDLER >::ACE_Asynch_Connector ( void  )

A do nothing constructor.

template<class HANDLER >
ACE_Asynch_Connector< HANDLER >::~ACE_Asynch_Connector ( void  )
virtual

Virtual destruction.

Member Function Documentation

template<class HANDLER >
ACE_Asynch_Connect & ACE_Asynch_Connector< HANDLER >::asynch_connect ( void  )
protected

Return the asynch Connect object.

template<class HANDLER >
int ACE_Asynch_Connector< HANDLER >::cancel ( void  )
virtual

This cancels all pending accepts operations that were issued by the calling thread.

Note
On Windows, this method does not cancel connect operations issued by other threads.
On POSIX, delegates cancelation to ACE_POSIX_Asynch_Connect.
template<class HANDLER >
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.

template<class HANDLER >
void ACE_Asynch_Connector< HANDLER >::handle_connect ( const ACE_Asynch_Connect::Result result)
protectedvirtual

This is called when an outstanding accept completes.

Reimplemented from ACE_Handler.

template<class HANDLER >
HANDLER * ACE_Asynch_Connector< HANDLER >::make_handler ( void  )
protectedvirtual

This is the template method used to create new handler. Subclasses must overwrite this method if a new handler creation strategy is required.

template<class HANDLER >
int ACE_Asynch_Connector< HANDLER >::open ( bool  pass_addresses = false,
ACE_Proactor proactor = 0,
bool  validate_new_connection = true 
)
virtual

This opens asynch connector

template<class HANDLER >
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.

template<class HANDLER >
bool 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.

template<class HANDLER >
void ACE_Asynch_Connector< HANDLER >::pass_addresses ( bool  new_value)
virtual
template<class HANDLER >
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.

Parameters
resultResult of the connection acceptance. Use result.success() to determine success or failure of the connection attempt.
remotePeer's address. If the connection failed, this object is undefined.
localLocal address connection was completed from. If the connection failed, this object is undefined.
Return values
-1ACE_Asynch_Connector will close the connection, and the service will not be opened.
0Service opening will proceeed.
Returns
Return value is ignored if the connection attempt failed.
template<class HANDLER >
bool ACE_Asynch_Connector< HANDLER >::validate_new_connection ( void  ) const
virtual

Set and get flag that indicates if address validation is required.

template<class HANDLER >
void ACE_Asynch_Connector< HANDLER >::validate_new_connection ( bool  new_value)
virtual

Member Data Documentation

template<class HANDLER >
ACE_Asynch_Connect ACE_Asynch_Connector< HANDLER >::asynch_connect_
private

Asynch_Connect used to make life easier :-)

template<class HANDLER >
bool ACE_Asynch_Connector< HANDLER >::pass_addresses_
private

Flag that indicates if parsing of addresses is necessary.

template<class HANDLER >
bool ACE_Asynch_Connector< HANDLER >::validate_new_connection_
private

Flag that indicates if address validation is required.


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