3 //=============================================================================
9 //=============================================================================
12 #ifndef ACE_TLI_ACCEPTOR_H
13 #define ACE_TLI_ACCEPTOR_H
14 #include /**/ "ace/pre.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include "ace/TLI_Stream.h"
23 #include "ace/Default_Constants.h"
25 #if defined (ACE_HAS_TLI)
27 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
29 // Forward reference...
30 class ACE_TLI_Request_Queue
;
34 * @class ACE_TLI_Acceptor
36 * @brief Defines the member functions for ACE_TLI_Acceptor abstraction.
38 * This class implements the algorithm described in Steve Rago's
39 * book on System V UNIX network programming. It basically
40 * makes TLI look like the C++ SOCK_SAP socket wrappers with
41 * respect to establishing passive-mode listener endpoints.
43 class ACE_Export ACE_TLI_Acceptor
: public ACE_TLI
46 friend class ACE_Request_Queue
;
48 /// Default constructor.
51 /// Initiate a passive mode socket.
52 ACE_TLI_Acceptor (const ACE_Addr
&remote_sap
,
55 struct t_info
*info
= 0,
56 int backlog
= ACE_DEFAULT_BACKLOG
,
57 const char device
[] = ACE_TLI_TCP_DEVICE
);
59 /// Initiate a passive mode socket.
60 ACE_HANDLE
open (const ACE_Addr
&remote_sap
,
63 struct t_info
*info
= 0,
64 int backlog
= ACE_DEFAULT_BACKLOG
,
65 const char device
[] = ACE_TLI_TCP_DEVICE
);
67 /// Close down the acceptor and release resources.
70 // = Passive connection acceptance method.
73 * Accept a new data transfer connection. A @a timeout of 0 means
74 * block forever, a @a timeout of {0, 0} means poll. <restart> == 1
75 * means "restart if interrupted."
77 int accept (ACE_TLI_Stream
&new_tli_sap
,
78 ACE_Addr
*remote_addr
= 0,
79 ACE_Time_Value
*timeout
= 0,
81 bool reset_new_handle
= false,
87 typedef ACE_INET_Addr PEER_ADDR
;
88 typedef ACE_TLI_Stream PEER_STREAM
;
90 /// Dump the state of an object.
93 /// Declare the dynamic allocation hooks.
94 ACE_ALLOC_HOOK_DECLARE
;
97 /// Network "device" we are using.
100 /// Number of connections to queue.
103 /// Are we using "tirdwr" mod?
106 /// Handle TLI accept insanity...
107 int handle_async_event (bool restart
, int rwflag
);
109 /// Used for queueing up pending requests.
110 ACE_TLI_Request_Queue
*queue_
;
112 /// Used for handling disconnects
113 struct t_discon
*disp_
;
116 ACE_END_VERSIONED_NAMESPACE_DECL
118 #endif /* ACE_HAS_TLI */
119 #include /**/ "ace/post.h"
120 #endif /* ACE_TLI_ACCEPTOR_H */