Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_Asynch_Acceptor Class Template Reference

This class is an example of the Acceptor Pattern. This class will accept new connections and create new HANDLER to handle the new connections. More...

#include <Asynch_Acceptor.h>

Inheritance diagram for ACE_Asynch_Acceptor

Inheritance graph
[legend]
Collaboration diagram for ACE_Asynch_Acceptor:

Collaboration graph
[legend]
List of all members.

Public Methods

 ACE_Asynch_Acceptor (void)
 A do nothing constructor.

virtual ~ACE_Asynch_Acceptor (void)
 Virtual destruction.

virtual int open (const ACE_INET_Addr &address, size_t bytes_to_read = 0, int pass_addresses = 0, int backlog = ACE_DEFAULT_BACKLOG, int reuse_addr = 1, ACE_Proactor *proactor = 0, int validate_new_connection = 0, int reissue_accept = 1, int number_of_initial_accepts = -1)
virtual ACE_HANDLE get_handle (void) const
 Get the underlying handle.

virtual void set_handle (ACE_HANDLE handle)
virtual int accept (size_t bytes_to_read = 0, const void *act = 0)
 This initiates a new asynchronous accept through the call.

virtual int cancel (void)
virtual int validate_new_connection (const ACE_INET_Addr &remote_address)
virtual int should_reissue_accept (void)
virtual int pass_addresses (void) const
 Set and get flag that indicates if parsing and passing of addresses to the service_handler is necessary.

virtual void pass_addresses (int new_value)
virtual int validate_new_connection (void) const
 Set and get flag that indicates if address validation is required.

virtual void validate_new_connection (int new_value)
virtual int reissue_accept (void) const
 Set and get flag that indicates if a new accept should be reissued when a accept completes.

virtual void reissue_accept (int new_value)
virtual int bytes_to_read (void) const
 Set and get bytes to be read with the call.

virtual void bytes_to_read (int new_value)

Static Public Methods

size_t address_size (void)
 This is required by the AcceptEx call.


Protected Methods

virtual void handle_accept (const ACE_Asynch_Accept::Result &result)
 This is called when an outstanding accept completes.

ACE_HANDLE handle (void) const
 Return the listen handle.

void handle (ACE_HANDLE h)
 Set the listen handle.

void parse_address (const ACE_Asynch_Accept::Result &result, ACE_INET_Addr &remote_address, ACE_INET_Addr &local_address)
 This parses the address from read buffer.

ACE_Asynch_Acceptasynch_accept (void)
 Return the asynch accept object.

virtual HANDLER* make_handler (void)

Private Attributes

ACE_HANDLE listen_handle_
 Handle used to listen for new connections.

ACE_Asynch_Accept asynch_accept_
  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.

int reissue_accept_
 Flag that indicates if a new accept should be reissued when a accept completes.

int bytes_to_read_
 Bytes to be read with the call.


Detailed Description

template<class HANDLER> template class ACE_Asynch_Acceptor

This class is an example of the Acceptor Pattern. This class will accept new connections and create new HANDLER to handle the new connections.

Unlike the , however, this class is designed to be used asynchronously.


Constructor & Destructor Documentation

template<classHANDLER>
ACE_Asynch_Acceptor<HANDLER>::ACE_Asynch_Acceptor<HANDLER> ( void ) [inline]
 

A do nothing constructor.

template<classHANDLER>
ACE_Asynch_Acceptor<HANDLER>::~ACE_Asynch_Acceptor<HANDLER> ( void ) [virtual]
 

Virtual destruction.


Member Function Documentation

template<classHANDLER>
int ACE_Asynch_Acceptor<HANDLER>::accept ( size_t bytes_to_read = 0,
const void * act = 0 ) [virtual]
 

This initiates a new asynchronous accept through the call.

template<classHANDLER>
size_t ACE_Asynch_Acceptor<HANDLER>::address_size ( void ) [static]
 

This is required by the AcceptEx call.

template<classHANDLER>
ACE_Asynch_Accept & ACE_Asynch_Acceptor<HANDLER>::asynch_accept ( void ) [protected]
 

Return the asynch accept object.

template<classHANDLER>
void ACE_Asynch_Acceptor< HANDLER >::bytes_to_read ( int new_value ) [virtual]
 

template<classHANDLER>
int ACE_Asynch_Acceptor<HANDLER>::bytes_to_read ( void ) const [virtual]
 

Set and get bytes to be read with the call.

template<classHANDLER>
int ACE_Asynch_Acceptor<HANDLER>::cancel ( void ) [virtual]
 

This cancels all pending accepts operations that were issued by the calling thread. Windows NT- The function does not cancel accept operations issued by other threads POSIX - all OK, it delegates cancelation to the ACE_POSIX_Asynch_Accept

template<classHANDLER>
ACE_HANDLE ACE_Asynch_Acceptor<HANDLER>::get_handle ( void ) const [virtual]
 

Get the underlying handle.

template<classHANDLER>
void ACE_Asynch_Acceptor<HANDLER>::handle ( ACE_HANDLE h ) [protected, virtual]
 

Set the listen handle.

Reimplemented from ACE_Handler.

template<classHANDLER>
ACE_HANDLE ACE_Asynch_Acceptor<HANDLER>::handle ( void ) const [protected, virtual]
 

Return the listen handle.

Reimplemented from ACE_Handler.

template<classHANDLER>
void ACE_Asynch_Acceptor<HANDLER>::handle_accept ( const ACE_Asynch_Accept::Result & result ) [protected, virtual]
 

This is called when an outstanding accept completes.

Reimplemented from ACE_Handler.

template<classHANDLER>
HANDLER * ACE_Asynch_Acceptor<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.

template<classHANDLER>
int ACE_Asynch_Acceptor<HANDLER>::open ( const ACE_INET_Addr & address,
size_t bytes_to_read = 0,
int pass_addresses = 0,
int backlog = ACE_DEFAULT_BACKLOG,
int reuse_addr = 1,
ACE_Proactor * proactor = 0,
int validate_new_connection = 0,
int reissue_accept = 1,
int number_of_initial_accepts = -1 ) [virtual]
 

This starts the listening process at the port specified by . ACE_Asynch_Acceptor initiates the AcceptEx calls with <bytes_to_read>. The buffer for the initial data will be created by ACE_Asynch_Acceptor. This buffer will be passed to the handler in the callback. If this buffer is required past the <open> callback, the ACE_Service_Handler must copy the data. If the <pass_addresses> flag is set, ACE_Asynch_Acceptor will call before calling . The <backlog> parameter specifies the listen backlog and the outstanding AcceptEx calls. <number_of_initial_accepts> is the number of asynchronous accepts that are started at the end of <open>. If <number_of_initial_accepts> is -1, then <number_of_initial_accepts> is set to <backlog> and hence <backlog> number of asynchronous accepts are started.

template<classHANDLER>
void ACE_Asynch_Acceptor<HANDLER>::parse_address ( const ACE_Asynch_Accept::Result & result,
ACE_INET_Addr & remote_address,
ACE_INET_Addr & local_address ) [protected]
 

This parses the address from read buffer.

template<classHANDLER>
void ACE_Asynch_Acceptor< HANDLER >::pass_addresses ( int new_value ) [virtual]
 

template<classHANDLER>
int ACE_Asynch_Acceptor<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<classHANDLER>
void ACE_Asynch_Acceptor< HANDLER >::reissue_accept ( int new_value ) [virtual]
 

template<classHANDLER>
int ACE_Asynch_Acceptor<HANDLER>::reissue_accept ( void ) const [virtual]
 

Set and get flag that indicates if a new accept should be reissued when a accept completes.

template<classHANDLER>
void ACE_Asynch_Acceptor<HANDLER>::set_handle ( ACE_HANDLE handle ) [virtual]
 

Set the underlying listen handle. It is the user's responsibility to make sure that the old listen handle has been appropriately closed and the all outstanding asynchronous operations have either completed or have been canceled on the old listen handle.

template<classHANDLER>
int ACE_Asynch_Acceptor<HANDLER>::should_reissue_accept ( void ) [virtual]
 

Template method for deciding whether to reissue accept.

Default implemenation always returns this->reissue_accept_.

template<classHANDLER>
void ACE_Asynch_Acceptor< HANDLER >::validate_new_connection ( int new_value ) [virtual]
 

template<classHANDLER>
int ACE_Asynch_Acceptor<HANDLER>::validate_new_connection ( void ) const [virtual]
 

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

template<classHANDLER>
int ACE_Asynch_Acceptor<HANDLER>::validate_new_connection ( const ACE_INET_Addr & remote_address ) [virtual]
 

Template method for address validation.

Default implemenation always validates the remote address.


Member Data Documentation

template<classHANDLER>
ACE_Asynch_Accept ACE_Asynch_Acceptor<HANDLER>::asynch_accept_ [private]
 

used to make life easier :-).

template<classHANDLER>
int ACE_Asynch_Acceptor<HANDLER>::bytes_to_read_ [private]
 

Bytes to be read with the call.

template<classHANDLER>
ACE_HANDLE ACE_Asynch_Acceptor<HANDLER>::listen_handle_ [private]
 

Handle used to listen for new connections.

template<classHANDLER>
int ACE_Asynch_Acceptor<HANDLER>::pass_addresses_ [private]
 

Flag that indicates if parsing of addresses is necessary.

template<classHANDLER>
int ACE_Asynch_Acceptor<HANDLER>::reissue_accept_ [private]
 

Flag that indicates if a new accept should be reissued when a accept completes.

template<classHANDLER>
int ACE_Asynch_Acceptor<HANDLER>::validate_new_connection_ [private]
 

Flag that indicates if address validation is required.


The documentation for this class was generated from the following files:
Generated at Sat Dec 1 11:00:44 2001 for ACE by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000