ACE 6.0.3
|
Generic factory for passively connecting clients and creating exactly one service handler of the type SVC_HANDLER specified in the template. More...
#include <Acceptor.h>
Public Types | |
typedef ACE_PEER_ACCEPTOR_ADDR | addr_type |
typedef ACE_PEER_ACCEPTOR | acceptor_type |
typedef SVC_HANDLER | handler_type |
typedef SVC_HANDLER::stream_type | stream_type |
Public Member Functions | |
ACE_Oneshot_Acceptor (void) | |
Constructor. | |
ACE_Oneshot_Acceptor (const ACE_PEER_ACCEPTOR_ADDR &local_addr, ACE_Reactor *reactor=ACE_Reactor::instance(), ACE_Concurrency_Strategy< SVC_HANDLER > *=0) | |
int | open (const ACE_PEER_ACCEPTOR_ADDR &, ACE_Reactor *reactor=ACE_Reactor::instance(), ACE_Concurrency_Strategy< SVC_HANDLER > *=0) |
virtual | ~ACE_Oneshot_Acceptor (void) |
Close down the {Oneshot_Acceptor}. | |
virtual int | accept (SVC_HANDLER *=0, ACE_PEER_ACCEPTOR_ADDR *remote_addr=0, const ACE_Synch_Options &synch_options=ACE_Synch_Options::defaults, bool restart=true, bool reset_new_handle=false) |
virtual int | cancel (void) |
Cancel a oneshot acceptor that was started asynchronously. | |
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 int | close (void) |
Close down the {Oneshot_Acceptor}. | |
void | dump (void) const |
Dump the state of an object. | |
Public Attributes | |
ACE_ALLOC_HOOK_DECLARE | |
Declare the dynamic allocation hooks. | |
Protected Member Functions | |
virtual int | activate_svc_handler (SVC_HANDLER *svc_handler) |
int | shared_accept (SVC_HANDLER *svc_handler, ACE_PEER_ACCEPTOR_ADDR *remote_addr, ACE_Time_Value *timeout, bool restart, bool reset_new_handle) |
virtual ACE_HANDLE | get_handle (void) const |
Returns the listening acceptor's {ACE_HANDLE}. | |
virtual int | handle_close (ACE_HANDLE=ACE_INVALID_HANDLE, ACE_Reactor_Mask=ACE_Event_Handler::ALL_EVENTS_MASK) |
virtual int | handle_input (ACE_HANDLE) |
virtual int | handle_timeout (const ACE_Time_Value &tv, const void *arg) |
Called when an acceptor times out... | |
virtual int | init (int argc, ACE_TCHAR *argv[]) |
virtual int | fini (void) |
virtual int | info (ACE_TCHAR **, size_t) const |
Default version returns address info in {buf}. | |
virtual int | suspend (void) |
virtual int | resume (void) |
Private Member Functions | |
int | register_handler (SVC_HANDLER *svc_handler, const ACE_Synch_Options &options, bool restart) |
Private Attributes | |
SVC_HANDLER * | svc_handler_ |
Hold the svc_handler_ across asynchrony boundaries. | |
bool | restart_ |
Hold the restart flag across asynchrony boundaries. | |
ACE_PEER_ACCEPTOR | peer_acceptor_ |
Factory that establishes connections passively. | |
ACE_Concurrency_Strategy < SVC_HANDLER > * | concurrency_strategy_ |
Concurrency strategy for an Acceptor. | |
bool | delete_concurrency_strategy_ |
Generic factory for passively connecting clients and creating exactly one service handler of the type SVC_HANDLER specified in the template.
This class works similarly to the regular ACE_Acceptor, but with the following differences:
The usage model for ACE_Oneshot_Acceptor is:
typedef ACE_PEER_ACCEPTOR ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::acceptor_type |
typedef ACE_PEER_ACCEPTOR_ADDR ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::addr_type |
typedef SVC_HANDLER ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::handler_type |
typedef SVC_HANDLER::stream_type ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::stream_type |
ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::ACE_Oneshot_Acceptor | ( | void | ) |
Constructor.
ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::ACE_Oneshot_Acceptor | ( | const ACE_PEER_ACCEPTOR_ADDR & | local_addr, |
ACE_Reactor * | reactor = ACE_Reactor::instance () , |
||
ACE_Concurrency_Strategy< SVC_HANDLER > * | cs = 0 |
||
) |
Initialize the appropriate strategies for concurrency and then open the acceptor at the designated local_addr. Note that unlike ACE_Acceptor and ACE_Strategy_Acceptor, this method does NOT register this acceptor with the reactor at this point -- the reactor parameter is saved in case it's needed later.
ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::~ACE_Oneshot_Acceptor | ( | void | ) | [virtual] |
Close down the {Oneshot_Acceptor}.
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::accept | ( | SVC_HANDLER * | svc_handler = 0 , |
ACE_PEER_ACCEPTOR_ADDR * | remote_addr = 0 , |
||
const ACE_Synch_Options & | synch_options = ACE_Synch_Options::defaults , |
||
bool | restart = true , |
||
bool | reset_new_handle = false |
||
) | [virtual] |
Create a {SVC_HANDLER}, accept the connection into the {SVC_HANDLER}, and activate the {SVC_HANDLER}.
ACE_PEER_ACCEPTOR & ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::acceptor | ( | void | ) | const [virtual] |
Return the underlying {PEER_ACCEPTOR} object.
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::activate_svc_handler | ( | SVC_HANDLER * | svc_handler | ) | [protected, virtual] |
Bridge method for activating a {svc_handler} with the appropriate concurrency strategy. Default behavior is to activate the {SVC_HANDLER} as a "passive object." However, subclasses can override this strategy to do more sophisticated concurrency activations (such as creating the {SVC_HANDLER} as an "active object" via multi-threading or multi-processing).
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::cancel | ( | void | ) | [virtual] |
Cancel a oneshot acceptor that was started asynchronously.
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::close | ( | void | ) | [virtual] |
Close down the {Oneshot_Acceptor}.
void ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::dump | ( | void | ) | const |
Dump the state of an object.
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::fini | ( | void | ) | [protected, virtual] |
Default version does no work and returns -1. Must be overloaded by application developer to do anything meaningful.
Reimplemented from ACE_Shared_Object.
ACE_HANDLE ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::get_handle | ( | void | ) | const [protected, virtual] |
Returns the listening acceptor's {ACE_HANDLE}.
Reimplemented from ACE_Event_Handler.
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::handle_close | ( | ACE_HANDLE | = ACE_INVALID_HANDLE , |
ACE_Reactor_Mask | = ACE_Event_Handler::ALL_EVENTS_MASK |
||
) | [protected, virtual] |
Perform termination activities when {this} is removed from the {reactor}.
Reimplemented from ACE_Event_Handler.
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::handle_input | ( | ACE_HANDLE | ) | [protected, virtual] |
Accept one connection from a client and activates the SVC_HANDLER.
Reimplemented from ACE_Event_Handler.
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::handle_timeout | ( | const ACE_Time_Value & | tv, |
const void * | arg | ||
) | [protected, virtual] |
Called when an acceptor times out...
Reimplemented from ACE_Event_Handler.
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::info | ( | ACE_TCHAR ** | strp, |
size_t | length | ||
) | const [protected, virtual] |
Default version returns address info in {buf}.
Reimplemented from ACE_Shared_Object.
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::init | ( | int | argc, |
ACE_TCHAR * | argv[] | ||
) | [protected, virtual] |
Default version does no work and returns -1. Must be overloaded by application developer to do anything meaningful.
Reimplemented from ACE_Shared_Object.
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::open | ( | const ACE_PEER_ACCEPTOR_ADDR & | local_addr, |
ACE_Reactor * | reactor = ACE_Reactor::instance () , |
||
ACE_Concurrency_Strategy< SVC_HANDLER > * | con_s = 0 |
||
) |
Initialize the appropriate strategies for concurrency and then open the acceptor at the designated local_addr. Note that unlike ACE_Acceptor and ACE_Strategy_Acceptor, this method does NOT register this acceptor with the reactor at this point -- the reactor parameter is saved in case it's needed later.
ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::operator ACE_PEER_ACCEPTOR & | ( | ) | const [virtual] |
Return the underlying {PEER_ACCEPTOR} object.
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::register_handler | ( | SVC_HANDLER * | svc_handler, |
const ACE_Synch_Options & | options, | ||
bool | restart | ||
) | [private] |
Insert ourselves into the {ACE_Reactor} so that we can continue accepting this connection asynchronously. This method should NOT be called by developers directly.
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::resume | ( | void | ) | [protected, virtual] |
Default version does no work and returns -1. Must be overloaded by application developer to do anything meaningful.
Reimplemented from ACE_Service_Object.
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::shared_accept | ( | SVC_HANDLER * | svc_handler, |
ACE_PEER_ACCEPTOR_ADDR * | remote_addr, | ||
ACE_Time_Value * | timeout, | ||
bool | restart, | ||
bool | reset_new_handle | ||
) | [protected] |
Factors out the code shared between the {accept} and {handle_input} methods.
int ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::suspend | ( | void | ) | [protected, virtual] |
Default version does no work and returns -1. Must be overloaded by application developer to do anything meaningful.
Reimplemented from ACE_Service_Object.
ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::ACE_ALLOC_HOOK_DECLARE |
Declare the dynamic allocation hooks.
ACE_Concurrency_Strategy<SVC_HANDLER>* ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::concurrency_strategy_ [private] |
Concurrency strategy for an Acceptor.
bool ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::delete_concurrency_strategy_ [private] |
true if Acceptor created the concurrency strategy and thus should delete it, else false.
ACE_PEER_ACCEPTOR ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::peer_acceptor_ [private] |
Factory that establishes connections passively.
bool ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::restart_ [private] |
Hold the restart flag across asynchrony boundaries.
SVC_HANDLER* ACE_Oneshot_Acceptor< SVC_HANDLER, ACE_PEER_ACCEPTOR_1 >::svc_handler_ [private] |
Hold the svc_handler_ across asynchrony boundaries.