3 //=============================================================================
5 * @file SOCK_SEQPACK_Acceptor.h
7 * @author Patrick J. Lardieri <plardier@atl.lmco.com>
8 * @author Gaurav Naik, Lockheed Martin ATL
9 * @author based on SOCK_STREAM_Acceptor
10 * by Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
12 //=============================================================================
14 #ifndef ACE_SOCK_SEQ_ACCEPTOR_H
15 #define ACE_SOCK_SEQ_ACCEPTOR_H
17 #include /**/ "ace/pre.h"
19 #include /**/ "ace/ACE_export.h"
21 #if !defined (ACE_LACKS_PRAGMA_ONCE)
23 #endif /* ACE_LACKS_PRAGMA_ONCE */
25 #include "ace/SOCK_SEQPACK_Association.h"
26 #include "ace/Multihomed_INET_Addr.h"
28 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
33 * @class ACE_SOCK_SEQPACK_Acceptor
35 * @brief Defines a factory that creates new ACE_Associations passively.
37 * The <ACE_SOCK_SEQPACK_Acceptor> has its own "passive-mode" socket.
38 * This serves as a factory to create so-called "data-mode"
39 * sockets, which are what the ACE_SOCK_SEQPACK_Association encapsulates.
40 * Therefore, by inheriting from <ACE_SOCK>, <ACE_SOCK_SEQPACK_Acceptor>
41 * gets its very own socket.
43 class ACE_Export ACE_SOCK_SEQPACK_Acceptor
: public ACE_SOCK
46 /// Default constructor.
47 ACE_SOCK_SEQPACK_Acceptor ();
50 * Initialize a passive-mode BSD-style acceptor socket (no QoS).
51 * @a local_sap is the address that we're going to listen for
52 * connections on. If @a reuse_addr is 1 then we'll use the
53 * @c SO_REUSEADDR to reuse this address.
55 ACE_SOCK_SEQPACK_Acceptor (const ACE_Addr
&local_sap
,
57 int protocol_family
= PF_UNSPEC
,
58 int backlog
= ACE_DEFAULT_BACKLOG
,
61 /// Multihomed version of same
63 ACE_SOCK_SEQPACK_Acceptor (const ACE_Multihomed_INET_Addr
&local_sap
,
65 int protocol_family
= PF_UNSPEC
,
66 int backlog
= ACE_DEFAULT_BACKLOG
,
69 /// Initialize a passive-mode QoS-enabled acceptor socket. Returns 0
70 /// on success and -1 on failure.
71 ACE_SOCK_SEQPACK_Acceptor (const ACE_Addr
&local_sap
,
72 ACE_Protocol_Info
*protocolinfo
,
76 int protocol_family
= PF_UNSPEC
,
77 int backlog
= ACE_DEFAULT_BACKLOG
,
81 * Initialize a passive-mode BSD-style acceptor socket (no QoS).
82 * @a local_sap is the address that we're going to listen for
83 * connections on. If @a reuse_addr is 1 then we'll use the
84 * @c SO_REUSEADDR to reuse this address. Returns 0 on success and
87 int open (const ACE_Addr
&local_sap
,
89 int protocol_family
= PF_UNSPEC
,
90 int backlog
= ACE_DEFAULT_BACKLOG
,
93 /// Multihomed version of same
95 int open (const ACE_Multihomed_INET_Addr
&local_sap
,
97 int protocol_family
= PF_UNSPEC
,
98 int backlog
= ACE_DEFAULT_BACKLOG
,
102 /// Initialize a passive-mode QoS-enabled acceptor socket. Returns 0
103 /// on success and -1 on failure.
104 int open (const ACE_Addr
&local_sap
,
105 ACE_Protocol_Info
*protocolinfo
,
109 int protocol_family
= PF_UNSPEC
,
110 int backlog
= ACE_DEFAULT_BACKLOG
,
113 /// Close the socket. Returns 0 on success and -1 on failure.
117 ~ACE_SOCK_SEQPACK_Acceptor ();
119 // = Passive connection <accept> methods.
121 * Accept a new ACE_SOCK_SEQPACK_Association connection. A @a timeout of 0
122 * means block forever, a @a timeout of {0, 0} means poll. <restart>
123 * == 1 means "restart if interrupted," i.e., if errno == EINTR.
124 * Note that <new_association> inherits the "blocking mode" of @c this
125 * <ACE_SOCK_SEQPACK_Acceptor>, i.e., if @c this acceptor factory is in
126 * non-blocking mode, the <net_association> will be in non-blocking mode
129 int accept (ACE_SOCK_SEQPACK_Association
&new_association
,
130 ACE_Addr
*remote_addr
= 0,
131 ACE_Time_Value
*timeout
= 0,
133 bool reset_new_handle
= false) const;
136 typedef ACE_Multihomed_INET_Addr PEER_ADDR
;
137 typedef ACE_SOCK_SEQPACK_Association PEER_STREAM
;
139 /// Dump the state of an object.
142 /// Declare the dynamic allocation hooks.
143 ACE_ALLOC_HOOK_DECLARE
;
146 /// Perform operations that must occur before <ACE_OS::accept> is
148 int shared_accept_start (ACE_Time_Value
*timeout
,
150 int &in_blocking_mode
) const;
152 /// Perform operations that must occur after <ACE_OS::accept> is
154 int shared_accept_finish (ACE_SOCK_SEQPACK_Association new_association
,
155 int in_blocking_mode
,
156 bool reset_new_handle
) const;
159 * This method factors out the common <open> code and is called by
160 * both the QoS-enabled <open> method and the BSD-style <open>
163 int shared_open (const ACE_Addr
&local_sap
,
167 /// Multihomed version of same.
169 int shared_open (const ACE_Multihomed_INET_Addr
&local_sap
,
174 /// Do not allow this function to percolate up to this interface...
175 int get_remote_addr (ACE_Addr
&) const;
178 ACE_END_VERSIONED_NAMESPACE_DECL
180 #if defined (__ACE_INLINE__)
181 #include "ace/SOCK_SEQPACK_Acceptor.inl"
182 #endif /* __ACE_INLINE__ */
184 #include /**/ "ace/post.h"
186 #endif /* ACE_SOCK_SEQ_ACCEPTOR_H */