Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / SOCK_SEQPACK_Acceptor.h
blob2095e222e3249d1c1b424ff0723d92d225d33582
1 // -*- C++ -*-
3 //=============================================================================
4 /**
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)
22 # 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
30 class ACE_Time_Value;
32 /**
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
45 public:
46 /// Default constructor.
47 ACE_SOCK_SEQPACK_Acceptor ();
49 /**
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,
56 int reuse_addr = 0,
57 int protocol_family = PF_UNSPEC,
58 int backlog = ACE_DEFAULT_BACKLOG,
59 int protocol = 132);
61 /// Multihomed version of same
63 ACE_SOCK_SEQPACK_Acceptor (const ACE_Multihomed_INET_Addr &local_sap,
64 int reuse_addr = 0,
65 int protocol_family = PF_UNSPEC,
66 int backlog = ACE_DEFAULT_BACKLOG,
67 int protocol = 132);
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,
73 ACE_SOCK_GROUP g,
74 u_long flags,
75 int reuse_addr,
76 int protocol_family = PF_UNSPEC,
77 int backlog = ACE_DEFAULT_BACKLOG,
78 int protocol = 132);
80 /**
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
85 * -1 on failure.
87 int open (const ACE_Addr &local_sap,
88 int reuse_addr = 0,
89 int protocol_family = PF_UNSPEC,
90 int backlog = ACE_DEFAULT_BACKLOG,
91 int protocol = 132);
93 /// Multihomed version of same
95 int open (const ACE_Multihomed_INET_Addr &local_sap,
96 int reuse_addr = 0,
97 int protocol_family = PF_UNSPEC,
98 int backlog = ACE_DEFAULT_BACKLOG,
99 int protocol = 132);
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,
106 ACE_SOCK_GROUP g,
107 u_long flags,
108 int reuse_addr,
109 int protocol_family = PF_UNSPEC,
110 int backlog = ACE_DEFAULT_BACKLOG,
111 int protocol = 132);
113 /// Close the socket. Returns 0 on success and -1 on failure.
114 int close ();
116 /// Default dtor.
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
127 * and vice versa.
129 int accept (ACE_SOCK_SEQPACK_Association &new_association,
130 ACE_Addr *remote_addr = 0,
131 ACE_Time_Value *timeout = 0,
132 bool restart = true,
133 bool reset_new_handle = false) const;
135 // = Meta-type info
136 typedef ACE_Multihomed_INET_Addr PEER_ADDR;
137 typedef ACE_SOCK_SEQPACK_Association PEER_STREAM;
139 /// Dump the state of an object.
140 void dump () const;
142 /// Declare the dynamic allocation hooks.
143 ACE_ALLOC_HOOK_DECLARE;
145 protected:
146 /// Perform operations that must occur before <ACE_OS::accept> is
147 /// called.
148 int shared_accept_start (ACE_Time_Value *timeout,
149 bool restart,
150 int &in_blocking_mode) const;
152 /// Perform operations that must occur after <ACE_OS::accept> is
153 /// called.
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>
161 * method.
163 int shared_open (const ACE_Addr &local_sap,
164 int protocol_family,
165 int backlog);
167 /// Multihomed version of same.
169 int shared_open (const ACE_Multihomed_INET_Addr &local_sap,
170 int protocol_family,
171 int backlog);
173 private:
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 */