3 //=============================================================================
7 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
9 //=============================================================================
11 #ifndef ACE_ACCEPTOR_H
12 #define ACE_ACCEPTOR_H
14 #include /**/ "ace/pre.h"
16 #include "ace/Service_Object.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include "ace/Strategies_T.h"
23 #include "ace/Synch_Options.h"
25 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
30 * @brief Abstract factory for creating a service handler
31 * (SVC_HANDLER), accepting into the SVC_HANDLER, and
32 * activating the SVC_HANDLER.
34 * Implements the basic strategy for passively establishing
35 * connections with clients. An ACE_Acceptor inherits from
36 * ACE_Service_Object, which in turn inherits from ACE_Event_Handler.
37 * This enables the ACE_Reactor to dispatch the ACE_Acceptor's
38 * handle_input method when connection events occur. The handle_input
39 * method performs the ACE_Acceptor's default creation, connection
40 * establishment, and service activation strategies. These strategies
41 * can be overridden by subclasses individually or as a group.
43 * An ACE_Acceptor is parameterized by concrete types that conform to
44 * the interfaces of SVC_HANDLER and PEER_ACCEPTOR described below.
46 * @tparam SVC_HANDLER The name of the concrete type that performs the
47 * application-specific service. The SVC_HANDLER typically
48 * inherits from ACE_Svc_Handler. @see Svc_Handler.h.
50 * @tparam PEER_ACCEPTOR The name of the class that implements the
51 * PEER_ACCEPTOR endpoint (e.g., ACE_SOCK_Acceptor) to
52 * passively establish connections. A PEER_ACCEPTOR
53 * implementation must provide a PEER_STREAM and PEER_ADDR
54 * trait to identify the type of stream (e.g.,
55 * ACE_SOCK_Stream) and type of address (e.g., ACE_INET_Addr)
56 * used by the endpoint.
58 template <typename SVC_HANDLER
, typename PEER_ACCEPTOR
>
59 class ACE_Acceptor
: public ACE_Service_Object
62 // Useful STL-style traits.
63 typedef typename
PEER_ACCEPTOR::PEER_ADDR addr_type
;
64 typedef PEER_ACCEPTOR acceptor_type
;
65 typedef SVC_HANDLER handler_type
;
66 typedef typename
SVC_HANDLER::stream_type stream_type
;
68 /// "Do-nothing" constructor.
69 ACE_Acceptor (ACE_Reactor
* = 0,
70 int use_select
= ACE_DEFAULT_ACCEPTOR_USE_SELECT
);
73 * Open the contained @c PEER_ACCEPTOR object to begin listening, and
74 * register with the specified reactor for accept events. An
75 * acceptor can only listen to one port at a time, so make sure to
76 * @c close() the acceptor before calling @c open() again.
78 * The @c PEER_ACCEPTOR handle is put into non-blocking mode as a
79 * safeguard against the race condition that can otherwise occur
80 * between the time when the passive-mode socket handle is "ready"
81 * and when the actual @c accept() call is made. During this
82 * interval, the client can shutdown the connection, in which case,
83 * the @c accept() call can hang.
85 * @param local_addr The address to listen at.
86 * @param reactor Pointer to the ACE_Reactor instance to register
87 * this object with. The default is the singleton.
88 * @param flags Flags to control what mode an accepted socket
89 * will be put into after it is accepted. The only
90 * legal value for this argument is @c ACE_NONBLOCK,
91 * which enables non-blocking mode on the accepted
92 * peer stream object in @c SVC_HANDLER. The default
94 * @param use_select Affects behavior when called back by the reactor
95 * when a connection can be accepted. If non-zero,
96 * this object will accept all pending connections,
97 * instead of just the one that triggered the reactor
98 * callback. Uses ACE_OS::select() internally to
99 * detect any remaining acceptable connections.
101 * @param reuse_addr Passed to the @c PEER_ACCEPTOR::open() method with
102 * @p local_addr. Generally used to request that the
103 * OS allow reuse of the listen port. The default is 1.
105 ACE_Acceptor (const typename
PEER_ACCEPTOR::PEER_ADDR
&local_addr
,
106 ACE_Reactor
*reactor
= ACE_Reactor::instance (),
108 int use_select
= ACE_DEFAULT_ACCEPTOR_USE_SELECT
,
112 * Open the contained @c PEER_ACCEPTOR object to begin listening, and
113 * register with the specified reactor for accept events. An
114 * acceptor can only listen to one port at a time, so make sure to
115 * @c close() the acceptor before calling @c open() again.
117 * The @c PEER_ACCEPTOR handle is put into non-blocking mode as a
118 * safeguard against the race condition that can otherwise occur
119 * between the time when the passive-mode socket handle is "ready"
120 * and when the actual @c accept() call is made. During this
121 * interval, the client can shutdown the connection, in which case,
122 * the @c accept() call can hang.
124 * @param local_addr The address to listen at.
125 * @param reactor Pointer to the ACE_Reactor instance to register
126 * this object with. The default is the singleton.
127 * @param flags Flags to control what mode an accepted socket
128 * will be put into after it is accepted. The only
129 * legal value for this argument is @c ACE_NONBLOCK,
130 * which enables non-blocking mode on the accepted
131 * peer stream object in @c SVC_HANDLER. The default
133 * @param use_select Affects behavior when called back by the reactor
134 * when a connection can be accepted. If non-zero,
135 * this object will accept all pending connections,
136 * instead of just the one that triggered the reactor
137 * callback. Uses ACE_OS::select() internally to
138 * detect any remaining acceptable connections.
140 * @param reuse_addr Passed to the @c PEER_ACCEPTOR::open() method with
141 * @p local_addr. Generally used to request that the
142 * OS allow reuse of the listen port. The default is 1.
145 * @retval -1 Failure, @c errno contains an error code.
147 virtual int open (const typename
PEER_ACCEPTOR::PEER_ADDR
&local_addr
,
148 ACE_Reactor
*reactor
= ACE_Reactor::instance (),
150 int use_select
= ACE_DEFAULT_ACCEPTOR_USE_SELECT
,
153 /// Close down the Acceptor's resources.
154 virtual ~ACE_Acceptor ();
156 /// Return the underlying PEER_ACCEPTOR object.
157 virtual operator PEER_ACCEPTOR
&() const;
159 /// Return the underlying PEER_ACCEPTOR object.
160 virtual PEER_ACCEPTOR
&acceptor () const;
162 /// Returns the listening acceptor's {ACE_HANDLE}.
163 virtual ACE_HANDLE
get_handle () const;
165 /// Close down the Acceptor
166 virtual int close ();
168 /// In the event that an accept fails, this method will be called and
169 /// the return value will be returned from handle_input().
170 virtual int handle_accept_error ();
172 /// Dump the state of an object.
175 /// Declare the dynamic allocation hooks.
176 ACE_ALLOC_HOOK_DECLARE
;
179 // = The following three methods define the Acceptor's strategies
180 // for creating, accepting, and activating SVC_HANDLER's,
184 * Bridge method for creating a SVC_HANDLER. The default is to
185 * create a new {SVC_HANDLER} if {sh} == 0, else {sh} is unchanged.
186 * However, subclasses can override this policy to perform
187 * SVC_HANDLER creation in any way that they like (such as creating
188 * subclass instances of SVC_HANDLER, using a singleton, dynamically
189 * linking the handler, etc.). Returns -1 on failure, else 0.
191 virtual int make_svc_handler (SVC_HANDLER
*&sh
);
194 * Bridge method for accepting the new connection into the
195 * @a svc_handler. The default behavior delegates to the
196 * PEER_ACCEPTOR::accept.
198 virtual int accept_svc_handler (SVC_HANDLER
*svc_handler
);
201 * Bridge method for activating a @a svc_handler with the appropriate
202 * concurrency strategy. The default behavior of this method is to
203 * activate the SVC_HANDLER by calling its open() method (which
204 * allows the SVC_HANDLER to define its own concurrency strategy).
205 * However, subclasses can override this strategy to do more
206 * sophisticated concurrency activations (such as making the
207 * SVC_HANDLER as an "active object" via multi-threading or
210 virtual int activate_svc_handler (SVC_HANDLER
*svc_handler
);
212 // = Demultiplexing hooks.
213 /// Perform termination activities when {this} is removed from the
215 virtual int handle_close (ACE_HANDLE
= ACE_INVALID_HANDLE
,
216 ACE_Reactor_Mask
= ACE_Event_Handler::ALL_EVENTS_MASK
);
218 /// Accepts all pending connections from clients, and creates and
219 /// activates SVC_HANDLERs.
220 virtual int handle_input (ACE_HANDLE
);
222 // = Dynamic linking hooks.
223 /// Default version does no work and returns -1. Must be overloaded
224 /// by application developer to do anything meaningful.
225 virtual int init (int argc
, ACE_TCHAR
*argv
[]);
227 /// Calls {handle_close}.
230 /// Default version returns address info in {buf}.
231 virtual int info (ACE_TCHAR
**buf
, size_t) const;
234 // = Service management hooks.
235 /// This method calls {Reactor::suspend}.
236 virtual int suspend ();
238 /// This method calls {Reactor::resume}.
239 virtual int resume ();
242 /// Concrete factory for accepting connections from clients...
243 PEER_ACCEPTOR peer_acceptor_
;
245 /// Needed to reopen the socket if {accept} fails.
246 typename
PEER_ACCEPTOR::PEER_ADDR peer_acceptor_addr_
;
249 * Flags that indicate how {SVC_HANDLER}'s should be initialized
250 * prior to being activated. Right now, the only flag that is
251 * processed is {ACE_NONBLOCK}, which enabled non-blocking I/O on
252 * the {SVC_HANDLER} when it is opened.
256 /// Flag that indicates whether it shall use {select} in the
260 /// Needed to reopen the socket if {accept} fails.
265 * @class ACE_Strategy_Acceptor
267 * @brief Abstract factory for creating a service handler
268 * (SVC_HANDLER), accepting into the SVC_HANDLER, and activating
271 * Implements a flexible and extensible set of strategies for
272 * passively establishing connections with clients. There are
273 * three main strategies: (1) creating a SVC_HANDLER, (2)
274 * passively accepting a new connection from a client into the
275 * SVC_HANDLER, and (3) activating the SVC_HANDLER with a
276 * particular concurrency mechanism.
278 template <typename SVC_HANDLER
, typename PEER_ACCEPTOR
>
279 class ACE_Strategy_Acceptor
280 : public ACE_Acceptor
<SVC_HANDLER
, PEER_ACCEPTOR
>
283 // Useful STL-style traits.
284 typedef ACE_Creation_Strategy
<SVC_HANDLER
>
285 creation_strategy_type
;
286 typedef ACE_Accept_Strategy
<SVC_HANDLER
, PEER_ACCEPTOR
>
287 accept_strategy_type
;
288 typedef ACE_Concurrency_Strategy
<SVC_HANDLER
>
289 concurrency_strategy_type
;
290 typedef ACE_Scheduling_Strategy
<SVC_HANDLER
> scheduling_strategy_type
;
291 typedef ACE_Acceptor
<SVC_HANDLER
, PEER_ACCEPTOR
>
294 // = Define some useful (old style) traits.
295 typedef ACE_Creation_Strategy
<SVC_HANDLER
> CREATION_STRATEGY
;
296 typedef ACE_Accept_Strategy
<SVC_HANDLER
, PEER_ACCEPTOR
> ACCEPT_STRATEGY
;
297 typedef ACE_Concurrency_Strategy
<SVC_HANDLER
> CONCURRENCY_STRATEGY
;
298 typedef ACE_Scheduling_Strategy
<SVC_HANDLER
> SCHEDULING_STRATEGY
;
300 /// Default constructor.
301 ACE_Strategy_Acceptor (const ACE_TCHAR service_name
[] = 0,
302 const ACE_TCHAR service_description
[] = 0,
303 int use_select
= ACE_DEFAULT_ACCEPTOR_USE_SELECT
,
307 * Initialize the appropriate strategies for creation, passive
308 * connection acceptance, and concurrency, and then register {this}
309 * with the Reactor and listen for connection requests at the
310 * designated {local_addr}.
312 ACE_Strategy_Acceptor (const typename
PEER_ACCEPTOR::PEER_ADDR
&local_addr
,
313 ACE_Reactor
* = ACE_Reactor::instance (),
314 ACE_Creation_Strategy
<SVC_HANDLER
> * = 0,
315 ACE_Accept_Strategy
<SVC_HANDLER
, PEER_ACCEPTOR
> * = 0,
316 ACE_Concurrency_Strategy
<SVC_HANDLER
> * = 0,
317 ACE_Scheduling_Strategy
<SVC_HANDLER
> * = 0,
318 const ACE_TCHAR service_name
[] = 0,
319 const ACE_TCHAR service_description
[] = 0,
320 int use_select
= ACE_DEFAULT_ACCEPTOR_USE_SELECT
,
324 * Open the contained @c PEER_ACCEPTOR object to begin listening, and
325 * register with the specified reactor for accept events.
327 * The @c PEER_ACCEPTOR handle is put into non-blocking mode as a
328 * safeguard against the race condition that can otherwise occur
329 * between the time when the passive-mode socket handle is "ready"
330 * and when the actual @c accept call is made. During this
331 * interval, the client can shutdown the connection, in which case,
332 * the {accept} call can hang.
334 * @param local_addr The address to listen at.
335 * @param reactor Pointer to the ACE_Reactor instance to register
336 * this object with. The default is the singleton.
337 * @param flags Flags to control what mode an accepted socket
338 * will be put into after it is accepted. The only
339 * legal value for this argument is @c ACE_NONBLOCK,
340 * which enables non-blocking mode on the accepted
341 * peer stream object in @c SVC_HANDLER. The default
343 * @param use_select Affects behavior when called back by the reactor
344 * when a connection can be accepted. If non-zero,
345 * this object will accept all pending connections,
346 * instead of just the one that triggered the reactor
347 * callback. Uses ACE_OS::select() internally to
348 * detect any remaining acceptable connections.
350 * @param reuse_addr Passed to the @c PEER_ACCEPTOR::open() method with
351 * @p local_addr. Generally used to request that the
352 * OS allow reuse of the listen port. The default is 1.
355 * @retval -1 Failure, @c errno contains an error code.
357 virtual int open (const typename
PEER_ACCEPTOR::PEER_ADDR
&local_addr
,
358 ACE_Reactor
*reactor
,
360 int use_select
= ACE_DEFAULT_ACCEPTOR_USE_SELECT
,
364 * Initialize the appropriate strategies for creation, passive
365 * connection acceptance, and concurrency, and then register {this}
366 * with the Reactor and listen for connection requests at the
367 * designated {local_addr}.
369 virtual int open (const typename
PEER_ACCEPTOR::PEER_ADDR
&,
370 ACE_Reactor
* = ACE_Reactor::instance (),
371 ACE_Creation_Strategy
<SVC_HANDLER
> * = 0,
372 ACE_Accept_Strategy
<SVC_HANDLER
, PEER_ACCEPTOR
> * =0,
373 ACE_Concurrency_Strategy
<SVC_HANDLER
> * = 0,
374 ACE_Scheduling_Strategy
<SVC_HANDLER
> * = 0,
375 const ACE_TCHAR
*service_name
= 0,
376 const ACE_TCHAR
*service_description
= 0,
377 int use_select
= ACE_DEFAULT_ACCEPTOR_USE_SELECT
,
380 /// Close down the Strategy_Acceptor's resources.
381 virtual ~ACE_Strategy_Acceptor ();
383 /// Return the underlying PEER_ACCEPTOR object.
384 virtual operator PEER_ACCEPTOR
&() const;
386 /// Return the underlying PEER_ACCEPTOR object.
387 virtual PEER_ACCEPTOR
&acceptor () const;
389 /// Returns the listening acceptor's {ACE_HANDLE}.
390 virtual ACE_HANDLE
get_handle () const;
392 /// Dump the state of an object.
395 /// Declare the dynamic allocation hooks.
396 ACE_ALLOC_HOOK_DECLARE
;
398 // = Service management hooks.
400 /// This method delegates to the {Scheduling_Strategy}'s {suspend}
402 virtual int suspend ();
404 /// This method delegates to the {Scheduling_Strategy}'s {resume}
406 virtual int resume ();
409 /// Calls {handle_close} when dynamically unlinked.
412 /// Default version returns address info in {buf}.
413 virtual int info (ACE_TCHAR
**buf
, size_t) const;
415 // = The following three methods define the {Acceptor}'s strategies
416 // for creating, accepting, and activating {SVC_HANDLER}'s,
420 * Bridge method for creating a {SVC_HANDLER}. The strategy for
421 * creating a {SVC_HANDLER} are configured into the Acceptor via
422 * it's {creation_strategy_}. The default is to create a new
423 * {SVC_HANDLER} if {sh} == 0, else {sh} is unchanged. However,
424 * subclasses can override this policy to perform {SVC_HANDLER}
425 * creation in any way that they like (such as creating subclass
426 * instances of {SVC_HANDLER}, using a singleton, dynamically
427 * linking the handler, etc.). Returns -1 on failure, else 0.
429 virtual int make_svc_handler (SVC_HANDLER
*&);
432 * Bridge method for accepting the new connection into the
433 * {SVC_HANDLER}. The default behavior delegates to the
434 * {PEER_ACCEPTOR::accept} in the {Acceptor_Strategy}.
436 virtual int accept_svc_handler (SVC_HANDLER
*svc_handler
);
439 * Bridge method for activating a {SVC_HANDLER} with the appropriate
440 * concurrency strategy. The default behavior of this method is to
441 * activate the {SVC_HANDLER} by calling its {open} method (which
442 * allows the {SVC_HANDLER} to define its own concurrency strategy).
443 * However, subclasses can override this strategy to do more
444 * sophisticated concurrency activations (such as creating the
445 * {SVC_HANDLER} as an "active object" via multi-threading or
448 virtual int activate_svc_handler (SVC_HANDLER
*svc_handler
);
450 // = Demultiplexing hooks.
451 /// Perform termination activities when {this} is removed from the
453 virtual int handle_close (ACE_HANDLE
= ACE_INVALID_HANDLE
,
454 ACE_Reactor_Mask
= ACE_Event_Handler::ALL_EVENTS_MASK
);
457 virtual int handle_signal (int signum
, siginfo_t
*, ucontext_t
*);
459 // = These data members are "logically private" but are put in the
460 // protected part in case subclasses want to access them.
462 // = Strategy objects.
464 /// Creation strategy for an Acceptor.
465 CREATION_STRATEGY
*creation_strategy_
;
467 /// true if {Acceptor} created the creation strategy and thus should
468 /// delete it, else false.
469 bool delete_creation_strategy_
;
471 /// Accept strategy for an {Acceptor}.
472 ACCEPT_STRATEGY
*accept_strategy_
;
474 /// true if {Acceptor} created the accept strategy and thus should delete
476 bool delete_accept_strategy_
;
478 /// Concurrency strategy for an {Acceptor}.
479 CONCURRENCY_STRATEGY
*concurrency_strategy_
;
481 /// true if {Acceptor} created the concurrency strategy and thus should
482 /// delete it, else false.
483 bool delete_concurrency_strategy_
;
485 /// Scheduling strategy for an {Acceptor}.
486 SCHEDULING_STRATEGY
*scheduling_strategy_
;
488 /// true if {Acceptor} created the scheduling strategy and thus should
489 /// delete it, else false.
490 bool delete_scheduling_strategy_
;
492 // = Service information objects.
494 /// Name of the service.
495 ACE_TCHAR
*service_name_
;
497 /// Description of the service.
498 ACE_TCHAR
*service_description_
;
500 /// Address that the {Strategy_Acceptor} uses to listen for
502 typename
PEER_ACCEPTOR::PEER_ADDR service_addr_
;
506 * @class ACE_Oneshot_Acceptor
508 * @brief Generic factory for passively connecting clients and creating
509 * exactly one service handler of the type SVC_HANDLER specified in the
512 * This class works similarly to the regular ACE_Acceptor, but
513 * with the following differences:
514 * -# ACE_Oneshot_Acceptor doesn't automatically register itself with the
515 * ACE_Reactor; the caller is expected to call the accept() method
516 * directly. Since a later call to accept() may require a reactor,
517 * the constructor and open() methods both accept an ACE_Reactor pointer
518 * which is saved in case it's needed in accept().
519 * -# ACE_Oneshot_Acceptor doesn't need an ACE_Creation_Strategy (because
520 * the user supplies the SVC_HANDLER) or an ACE_Accept_Strategy (because
521 * this class only accepts one connection and then removes all traces of
522 * itself from the ACE_Reactor if it was registered for asynchronous
525 * The usage model for ACE_Oneshot_Acceptor is:
526 * - Instantiate an object and establish its local address to listen at.
527 * This can be accomplished using either the address-accepting constructor
528 * (but there's no error indication) or the default constructor followed
529 * by a call to open().
530 * - Call the accept() method. This will attempt to accept a connection
531 * immediately. If there is no immediately available connection to accept,
532 * behavior is governed by the ACE_Synch_Options argument passed to open().
534 template <typename SVC_HANDLER
, typename PEER_ACCEPTOR
>
535 class ACE_Oneshot_Acceptor
: public ACE_Service_Object
538 // Useful STL-style traits.
539 typedef typename
PEER_ACCEPTOR::PEER_ADDR addr_type
;
540 typedef PEER_ACCEPTOR acceptor_type
;
541 typedef SVC_HANDLER handler_type
;
542 typedef typename
SVC_HANDLER::stream_type stream_type
;
545 ACE_Oneshot_Acceptor ();
548 * Initialize the appropriate strategies for concurrency and then
549 * open the acceptor at the designated @a local_addr. Note
550 * that unlike ACE_Acceptor and ACE_Strategy_Acceptor, this
551 * method does NOT register this acceptor with the @a reactor at
552 * this point -- the @a reactor parameter is saved in case it's
555 ACE_Oneshot_Acceptor (const typename
PEER_ACCEPTOR::PEER_ADDR
&local_addr
,
556 ACE_Reactor
*reactor
= ACE_Reactor::instance (),
557 ACE_Concurrency_Strategy
<SVC_HANDLER
> * = 0);
560 * Initialize the appropriate strategies for concurrency and then
561 * open the acceptor at the designated @a local_addr. Note
562 * that unlike ACE_Acceptor and ACE_Strategy_Acceptor, this
563 * method does NOT register this acceptor with the @a reactor at
564 * this point -- the @a reactor parameter is saved in case it's
567 int open (const typename
PEER_ACCEPTOR::PEER_ADDR
&,
568 ACE_Reactor
*reactor
= ACE_Reactor::instance (),
569 ACE_Concurrency_Strategy
<SVC_HANDLER
> * = 0);
571 /// Close down the {Oneshot_Acceptor}.
572 virtual ~ACE_Oneshot_Acceptor ();
574 // = Explicit factory operation.
575 /// Create a {SVC_HANDLER}, accept the connection into the
576 /// {SVC_HANDLER}, and activate the {SVC_HANDLER}.
577 virtual int accept (SVC_HANDLER
* = 0,
578 typename
PEER_ACCEPTOR::PEER_ADDR
*remote_addr
= 0,
579 const ACE_Synch_Options
&synch_options
= ACE_Synch_Options::defaults
,
581 bool reset_new_handle
= false);
583 /// Cancel a oneshot acceptor that was started asynchronously.
584 virtual int cancel ();
586 /// Return the underlying {PEER_ACCEPTOR} object.
587 virtual operator PEER_ACCEPTOR
&() const;
589 /// Return the underlying {PEER_ACCEPTOR} object.
590 virtual PEER_ACCEPTOR
&acceptor () const;
592 /// Close down the {Oneshot_Acceptor}.
593 virtual int close ();
595 /// Dump the state of an object.
598 /// Declare the dynamic allocation hooks.
599 ACE_ALLOC_HOOK_DECLARE
;
603 * Bridge method for activating a {svc_handler} with the appropriate
604 * concurrency strategy. Default behavior is to activate the
605 * {SVC_HANDLER} as a "passive object." However, subclasses can
606 * override this strategy to do more sophisticated concurrency
607 * activations (such as creating the {SVC_HANDLER} as an "active
608 * object" via multi-threading or multi-processing).
610 virtual int activate_svc_handler (SVC_HANDLER
*svc_handler
);
612 /// Factors out the code shared between the {accept} and
613 /// {handle_input} methods.
614 int shared_accept (SVC_HANDLER
*svc_handler
,
615 typename
PEER_ACCEPTOR::PEER_ADDR
*remote_addr
,
616 ACE_Time_Value
*timeout
,
618 bool reset_new_handle
);
620 // = Demultiplexing hooks.
621 /// Returns the listening acceptor's {ACE_HANDLE}.
622 virtual ACE_HANDLE
get_handle () const;
624 /// Perform termination activities when {this} is removed from the
626 virtual int handle_close (ACE_HANDLE
= ACE_INVALID_HANDLE
,
627 ACE_Reactor_Mask
= ACE_Event_Handler::ALL_EVENTS_MASK
);
629 /// Accept one connection from a client and activates the
631 virtual int handle_input (ACE_HANDLE
);
633 /// Called when an acceptor times out...
634 virtual int handle_timeout (const ACE_Time_Value
&tv
,
637 // = Dynamic linking hooks.
638 /// Default version does no work and returns -1. Must be overloaded
639 /// by application developer to do anything meaningful.
640 virtual int init (int argc
, ACE_TCHAR
*argv
[]);
642 /// Default version does no work and returns -1. Must be overloaded
643 /// by application developer to do anything meaningful.
646 /// Default version returns address info in {buf}.
647 virtual int info (ACE_TCHAR
**, size_t) const;
649 // = Service management hooks.
650 /// Default version does no work and returns -1. Must be overloaded
651 /// by application developer to do anything meaningful.
652 virtual int suspend ();
654 /// Default version does no work and returns -1. Must be overloaded
655 /// by application developer to do anything meaningful.
656 virtual int resume ();
660 * Insert ourselves into the {ACE_Reactor} so that we can continue
661 * accepting this connection asynchronously. This method should NOT
662 * be called by developers directly.
664 int register_handler (SVC_HANDLER
*svc_handler
,
665 const ACE_Synch_Options
&options
,
668 /// Hold the svc_handler_ across asynchrony boundaries.
669 SVC_HANDLER
*svc_handler_
;
671 /// Hold the restart flag across asynchrony boundaries.
674 /// Factory that establishes connections passively.
675 PEER_ACCEPTOR peer_acceptor_
;
677 /// Concurrency strategy for an Acceptor.
678 ACE_Concurrency_Strategy
<SVC_HANDLER
> *concurrency_strategy_
;
680 /// true if Acceptor created the concurrency strategy and thus should
681 /// delete it, else false.
682 bool delete_concurrency_strategy_
;
685 ACE_END_VERSIONED_NAMESPACE_DECL
687 #include "ace/Acceptor.cpp"
689 #include /**/ "ace/post.h"
691 #endif /* ACE_ACCEPTOR_H */