[6916] Fixed typos in spell checking code.
[getmangos.git] / dep / ACE_wrappers / ace / MEM_Acceptor.h
blob58582c4d041b452fc6d51a8692d497af185bd481
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file MEM_Acceptor.h
7 * $Id: MEM_Acceptor.h 80826 2008-03-04 14:51:23Z wotte $
9 * @author Nanbor Wang <nanbor@cs.wustl.edu>
11 //=============================================================================
13 #ifndef ACE_MEM_ACCEPTOR_H
14 #define ACE_MEM_ACCEPTOR_H
15 #include /**/ "ace/pre.h"
17 #include /**/ "ace/ACE_export.h"
19 #include "ace/SOCK_Acceptor.h"
21 #if !defined (ACE_LACKS_PRAGMA_ONCE)
22 # pragma once
23 #endif /* ACE_LACKS_PRAGMA_ONCE */
25 #if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
27 #include "ace/MEM_Stream.h"
28 #include "ace/MEM_Addr.h"
30 #if !defined (ACE_HAS_WINCE)
31 #include "ace/OS_QoS.h"
32 #endif // ACE_HAS_WINCE
34 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
36 // Forward decl.
37 class ACE_Reactor;
39 /**
40 * @class ACE_MEM_Acceptor
42 * @brief Defines the format and interface for the acceptor side of the
43 * local mmap stream.
45 * This class should be modified to prevent user passing a
46 * non-localhost endpoint as the acceptor listen point because
47 * it doesn't make any sense at all to make the listening
48 * endpoint visible (or connectable) anywhere outside of this
49 * machine. However, the type of endpoint is left as <ACE_Addr>
50 * so we can later changed to use UNIX-domain sockets with mmap stream
51 * if so desired. (Currently, using UNIX-domain sockets, i.e.,
52 * ACE_LSOCK_*, with this class will not work.)
54 class ACE_Export ACE_MEM_Acceptor : public ACE_SOCK_Acceptor
56 public:
57 // = Initialization methods.
58 /// Default constructor.
59 ACE_MEM_Acceptor (void);
61 /// destructor.
62 ~ACE_MEM_Acceptor (void);
64 /// Initiate a passive mode socket.
65 ACE_MEM_Acceptor (const ACE_MEM_Addr &remote_sap,
66 int reuse_addr = 0,
67 int backlog = ACE_DEFAULT_BACKLOG,
68 int protocol = 0);
70 /**
71 * Initialize a passive-mode BSD-style acceptor socket (no QoS).
72 * @a local_sap is the address that we're going to listen for
73 * connections on. If @a reuse_addr is 1 then we'll use the
74 * @c SO_REUSEADDR to reuse this address. Returns 0 on success and
75 * -1 on failure.
77 int open (const ACE_MEM_Addr &local_sap,
78 int reuse_addr = 0,
79 int backlog = ACE_DEFAULT_BACKLOG,
80 int protocol = 0);
82 /// Accept a new data transfer connection.
83 int accept (ACE_MEM_Stream &new_ipc_sap,
84 ACE_MEM_Addr *remote_addr = 0,
85 ACE_Time_Value *timeout = 0,
86 int restart = 1,
87 int reset_new_handle = 0);
89 /// Perform operations that must occur after <ACE_OS::accept> is
90 /// called.
91 int shared_accept_finish (ACE_MEM_Stream new_stream,
92 int in_blocking_mode,
93 int reset_new_handle) const;
95 /**
96 * Accessor/mutator of mmap filename prefix. By default, the
97 * <mmap_prefix_> is not set and the mmap filename is
98 * ${(TMP|TEMP)}//ACE_MEM_Acceptor_(port-number)_(&stream),
99 * otherwise, it is <mmap_prefix_>_(port-number)_(&stream),
100 * <mmap_prefix_> should include _absolute_ path so the connector
101 * within the same host can located the mmap file. Example:
102 * /tmp/mmapfile.
104 const ACE_TCHAR *mmap_prefix (void) const;
105 void mmap_prefix (const ACE_TCHAR *prefix);
108 * Change the initial MMAP buffer size (in bytes) of the MEM_Stream
109 * this MEM_Acceptor creates.
111 void init_buffer_size (ACE_OFF_T bytes);
113 /// Get the preferred signaling strategy.
114 ACE_MEM_IO::Signal_Strategy preferred_strategy (void) const;
116 /// Set the preferred signaling strategy.
117 void preferred_strategy (ACE_MEM_IO::Signal_Strategy strategy);
119 /// Return the local endpoint address in the referenced <ACE_Addr>.
120 /// Returns 0 if successful, else -1.
121 int get_local_addr (ACE_MEM_Addr &) const;
123 /// Accessor to the mmap options.
124 /// @deprecated This method has been deprecated.
125 ACE_MEM_SAP::MALLOC_OPTIONS& malloc_options (void);
127 // = Meta-type info
128 typedef ACE_MEM_Addr PEER_ADDR;
129 typedef ACE_MEM_Stream PEER_STREAM;
131 /// Dump the state of an object.
132 void dump (void) const;
134 /// Declare the dynamic allocation hooks.
135 ACE_ALLOC_HOOK_DECLARE;
137 protected:
138 // = The following methods should not be accessable externally
139 // because MEM_Acceptor do not support their semantics.
140 int open (const ACE_Addr &local_sap,
141 int reuse_addr = 0,
142 int protocol_family = PF_INET,
143 int backlog = ACE_DEFAULT_BACKLOG,
144 int protocol = 0);
146 int open (const ACE_Addr &local_sap,
147 ACE_Protocol_Info *protocolinfo,
148 ACE_SOCK_GROUP g,
149 u_long flags,
150 int reuse_addr,
151 int protocol_family,
152 int backlog = ACE_DEFAULT_BACKLOG,
153 int protocol = 0);
155 int accept (ACE_SOCK_Stream &new_stream,
156 ACE_Addr *remote_addr = 0,
157 ACE_Time_Value *timeout = 0,
158 int restart = 1,
159 int reset_new_handle = 0) const;
161 #if !defined (ACE_HAS_WINCE)
162 int accept (ACE_SOCK_Stream &new_stream,
163 ACE_Accept_QoS_Params qos_params,
164 ACE_Addr *remote_addr = 0,
165 ACE_Time_Value *timeout = 0,
166 int restart = 1,
167 int reset_new_handle = 0) const;
168 #endif // ACE_HAS_WINCE
170 private:
171 /// The filename prefix of the created mmap files. It should
172 /// contains the absolute path name of the file.
173 ACE_TCHAR *mmap_prefix_;
175 /// A cached MALLOC_OPTIONS. MEM_Accaptor use it to create the shared
176 /// mamory malloc upon every incoming connection.
177 ACE_MEM_SAP::MALLOC_OPTIONS malloc_options_;
179 /// Preferred signaling strategy.
180 ACE_MEM_IO::Signal_Strategy preferred_strategy_;
183 ACE_END_VERSIONED_NAMESPACE_DECL
185 #if defined (__ACE_INLINE__)
186 #include "ace/MEM_Acceptor.inl"
187 #endif /* __ACE_INLINE__ */
189 #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
191 #include /**/ "ace/post.h"
192 #endif /* ACE_MEM_ACCEPTOR_H */