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. More...

virtual ~ACE_Asynch_Acceptor (void)
 Virtual destruction. More...

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. More...

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 <AcceptEx> call. More...

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. More...

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. More...

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. More...

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

virtual void bytes_to_read (int new_value)

Static Public Methods

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


Protected Methods

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

ACE_HANDLE handle (void) const
 Return the listen handle. More...

void handle (ACE_HANDLE h)
 Set the listen handle. More...

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. More...

ACE_Asynch_Acceptasynch_accept (void)
 Return the asynch accept object. More...

virtual HANDLER * make_handler (void)

Private Attributes

ACE_HANDLE listen_handle_
 Handle used to listen for new connections. More...

ACE_Asynch_Accept asynch_accept_
 <Asynch_Accept> used to make life easier :-). More...

int pass_addresses_
 Flag that indicates if parsing of addresses is necessary. More...

int validate_new_connection_
 Flag that indicates if address validation is required. More...

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

int bytes_to_read_
 Bytes to be read with the <accept> call. More...


Detailed Description

template<class HANDLER>
class ACE_Asynch_Acceptor< HANDLER >

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 <ACE_Acceptor>, however, this class is designed to be used asynchronously.


Constructor & Destructor Documentation

template<class HANDLER>
ACE_Asynch_Acceptor< HANDLER >::ACE_Asynch_Acceptor void   
 

A do nothing constructor.

template<class HANDLER>
ACE_Asynch_Acceptor< HANDLER >::~ACE_Asynch_Acceptor void    [virtual]
 

Virtual destruction.


Member Function Documentation

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

template<class HANDLER>
size_t ACE_Asynch_Acceptor< HANDLER >::address_size void    [static]
 

This is required by the AcceptEx call.

template<class HANDLER>
ACE_Asynch_Accept & ACE_Asynch_Acceptor< HANDLER >::asynch_accept void    [protected]
 

Return the asynch accept object.

template<class HANDLER>
void ACE_Asynch_Acceptor< HANDLER >::bytes_to_read int    new_value [virtual]
 

template<class HANDLER>
int ACE_Asynch_Acceptor< HANDLER >::bytes_to_read void    const [virtual]
 

Set and get bytes to be read with the <accept> call.

template<class HANDLER>
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<class HANDLER>
ACE_HANDLE ACE_Asynch_Acceptor< HANDLER >::get_handle void    const [virtual]
 

Get the underlying handle.

template<class HANDLER>
void ACE_Asynch_Acceptor< HANDLER >::handle ACE_HANDLE    h [protected, virtual]
 

Set the listen handle.

Reimplemented from ACE_Handler.

template<class HANDLER>
ACE_HANDLE ACE_Asynch_Acceptor< HANDLER >::handle void    const [protected, virtual]
 

Return the listen handle.

Reimplemented from ACE_Handler.

template<class HANDLER>
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<class HANDLER>
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<class HANDLER>
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 <address>. 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 <ACE_Service_Handler::open> 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 <ACE_Service_Handler::addresses> before calling <ACE_Service_Handler::open>. 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<class HANDLER>
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<class HANDLER>
void ACE_Asynch_Acceptor< HANDLER >::pass_addresses int    new_value [virtual]
 

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

template<class HANDLER>
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<class HANDLER>
void ACE_Asynch_Acceptor< HANDLER >::set_handle ACE_HANDLE    listen_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<class HANDLER>
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<class HANDLER>
void ACE_Asynch_Acceptor< HANDLER >::validate_new_connection int    new_value [virtual]
 

template<class HANDLER>
int ACE_Asynch_Acceptor< HANDLER >::validate_new_connection void    const [virtual]
 

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

template<class HANDLER>
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<class HANDLER>
ACE_Asynch_Accept ACE_Asynch_Acceptor::asynch_accept_ [private]
 

<Asynch_Accept> used to make life easier :-).

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

Bytes to be read with the <accept> call.

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

Handle used to listen for new connections.

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

Flag that indicates if parsing of addresses is necessary.

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

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

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

Flag that indicates if address validation is required.


The documentation for this class was generated from the following files:
Generated on Sun Feb 17 17:37:07 2002 for ACE by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001