Abstract factory for creating a service handler (SVC_HANDLER), accepting into the SVC_HANDLER, and activating the SVC_HANDLER.
More...
Public Types |
typedef ACE_Creation_Strategy
< SVC_HANDLER > | creation_strategy_type |
typedef ACE_Accept_Strategy
< SVC_HANDLER,
ACE_PEER_ACCEPTOR_2 > | accept_strategy_type |
typedef
ACE_Concurrency_Strategy
< SVC_HANDLER > | concurrency_strategy_type |
typedef
ACE_Scheduling_Strategy
< SVC_HANDLER > | scheduling_strategy_type |
typedef ACE_Acceptor
< SVC_HANDLER,
ACE_PEER_ACCEPTOR_2 > | base_type |
typedef ACE_Creation_Strategy
< SVC_HANDLER > | CREATION_STRATEGY |
typedef ACE_Accept_Strategy
< SVC_HANDLER,
ACE_PEER_ACCEPTOR_2 > | ACCEPT_STRATEGY |
typedef
ACE_Concurrency_Strategy
< SVC_HANDLER > | CONCURRENCY_STRATEGY |
typedef
ACE_Scheduling_Strategy
< SVC_HANDLER > | SCHEDULING_STRATEGY |
Public Member Functions |
| | ACE_Strategy_Acceptor (const ACE_TCHAR service_name[]=0, const ACE_TCHAR service_description[]=0, int use_select=1, int reuse_addr=1) |
| | Default constructor.
|
| | ACE_Strategy_Acceptor (const ACE_PEER_ACCEPTOR_ADDR &local_addr, ACE_Reactor *=ACE_Reactor::instance(), ACE_Creation_Strategy< SVC_HANDLER > *=0, ACE_Accept_Strategy< SVC_HANDLER, ACE_PEER_ACCEPTOR_2 > *=0, ACE_Concurrency_Strategy< SVC_HANDLER > *=0, ACE_Scheduling_Strategy< SVC_HANDLER > *=0, const ACE_TCHAR service_name[]=0, const ACE_TCHAR service_description[]=0, int use_select=1, int reuse_addr=1) |
| virtual int | open (const ACE_PEER_ACCEPTOR_ADDR &local_addr, ACE_Reactor *reactor, int flags=0, int use_select=1, int reuse_addr=1) |
| virtual int | open (const ACE_PEER_ACCEPTOR_ADDR &, ACE_Reactor *=ACE_Reactor::instance(), ACE_Creation_Strategy< SVC_HANDLER > *=0, ACE_Accept_Strategy< SVC_HANDLER, ACE_PEER_ACCEPTOR_2 > *=0, ACE_Concurrency_Strategy< SVC_HANDLER > *=0, ACE_Scheduling_Strategy< SVC_HANDLER > *=0, const ACE_TCHAR *service_name=0, const ACE_TCHAR *service_description=0, int use_select=1, int reuse_addr=1) |
| virtual | ~ACE_Strategy_Acceptor (void) |
| | Close down the Strategy_Acceptor's resources.
|
| virtual | operator ACE_PEER_ACCEPTOR & () const |
| | Return the underlying PEER_ACCEPTOR object.
|
| virtual ACE_PEER_ACCEPTOR & | acceptor (void) const |
| | Return the underlying PEER_ACCEPTOR object.
|
| virtual ACE_HANDLE | get_handle (void) const |
| | Returns the listening acceptor's {ACE_HANDLE}.
|
| void | dump (void) const |
| | Dump the state of an object.
|
| virtual int | suspend (void) |
| virtual int | resume (void) |
Public Attributes |
| | ACE_ALLOC_HOOK_DECLARE |
| | Declare the dynamic allocation hooks.
|
Protected Member Functions |
| virtual int | fini (void) |
| | Calls {handle_close} when dynamically unlinked.
|
| virtual int | info (ACE_TCHAR **buf, size_t) const |
| | Default version returns address info in {buf}.
|
| virtual int | make_svc_handler (SVC_HANDLER *&) |
| virtual int | accept_svc_handler (SVC_HANDLER *svc_handler) |
| virtual int | activate_svc_handler (SVC_HANDLER *svc_handler) |
| virtual int | handle_close (ACE_HANDLE=ACE_INVALID_HANDLE, ACE_Reactor_Mask=ACE_Event_Handler::ALL_EVENTS_MASK) |
| virtual int | handle_signal (int signum, siginfo_t *, ucontext_t *) |
| | Handle SIGINT.
|
Protected Attributes |
| CREATION_STRATEGY * | creation_strategy_ |
| | Creation strategy for an Acceptor.
|
| bool | delete_creation_strategy_ |
| ACCEPT_STRATEGY * | accept_strategy_ |
| | Accept strategy for an {Acceptor}.
|
| bool | delete_accept_strategy_ |
| CONCURRENCY_STRATEGY * | concurrency_strategy_ |
| | Concurrency strategy for an {Acceptor}.
|
| bool | delete_concurrency_strategy_ |
| SCHEDULING_STRATEGY * | scheduling_strategy_ |
| | Scheduling strategy for an {Acceptor}.
|
| bool | delete_scheduling_strategy_ |
| ACE_TCHAR * | service_name_ |
| | Name of the service.
|
| ACE_TCHAR * | service_description_ |
| | Description of the service.
|
| ACE_PEER_ACCEPTOR_ADDR | service_addr_ |
template<class SVC_HANDLER, ACE_PEER_ACCEPTOR_1>
class ACE_Strategy_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >
Abstract factory for creating a service handler (SVC_HANDLER), accepting into the SVC_HANDLER, and activating the SVC_HANDLER.
Implements a flexible and extensible set of strategies for passively establishing connections with clients. There are three main strategies: (1) creating a SVC_HANDLER, (2) passively accepting a new connection from a client into the SVC_HANDLER, and (3) activating the SVC_HANDLER with a particular concurrency mechanism.
template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
Bridge method for creating a {SVC_HANDLER}. The strategy for creating a {SVC_HANDLER} are configured into the Acceptor via it's {creation_strategy_}. The default is to create a new {SVC_HANDLER} if {sh} == 0, else {sh} is unchanged. However, subclasses can override this policy to perform {SVC_HANDLER} creation in any way that they like (such as creating subclass instances of {SVC_HANDLER}, using a singleton, dynamically linking the handler, etc.). Returns -1 on failure, else 0.
Reimplemented from ACE_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_2 >.
template<class SVC_HANDLER , ACE_PEER_ACCEPTOR_1 >
Open the contained PEER_ACCEPTOR object to begin listening, and register with the specified reactor for accept events.
The PEER_ACCEPTOR handle is put into non-blocking mode as a safeguard against the race condition that can otherwise occur between the time when the passive-mode socket handle is "ready" and when the actual accept call is made. During this interval, the client can shutdown the connection, in which case, the {accept} call can hang.
- Parameters:
-
| local_addr | The address to listen at. |
| reactor | Pointer to the ACE_Reactor instance to register this object with. The default is the singleton. |
| flags | Flags to control what mode an accepted socket will be put into after it is accepted. The only legal value for this argument is ACE_NONBLOCK, which enables non-blocking mode on the accepted peer stream object in SVC_HANDLER. The default is 0. |
| use_select | Affects behavior when called back by the reactor when a connection can be accepted. If non-zero, this object will accept all pending connections, instead of just the one that triggered the reactor callback. Uses ACE_OS::select() internally to detect any remaining acceptable connections. The default is 1. |
| reuse_addr | Passed to the PEER_ACCEPTOR::open() method with local_addr. Generally used to request that the OS allow reuse of the listen port. The default is 1. |
- Return values:
-
| 0 | Success |
| -1 | Failure, errno contains an error code. |
Reimplemented from ACE_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_2 >.