Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / MEM_Connector.h
blob334ab60590189930ac82ad8db6a1d1d85c3b4390
1 /* -*- C++ -*- */
3 //=============================================================================
4 /**
5 * @file MEM_Connector.h
7 * @author Nanbor Wang <nanbor@cs.wustl.edu>
8 */
9 //=============================================================================
11 #ifndef ACE_MEM_CONNECTOR_H
12 #define ACE_MEM_CONNECTOR_H
13 #include /**/ "ace/pre.h"
15 #include /**/ "ace/ACE_export.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
18 # pragma once
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
23 #include "ace/SOCK_Connector.h"
24 #include "ace/MEM_Stream.h"
25 #include "ace/MEM_Addr.h"
27 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
29 /**
30 * @class ACE_MEM_Connector
32 * @brief Defines the format and interface for connecting to a peer
33 * on a @c ACE_MEM_Stream object.
35 class ACE_Export ACE_MEM_Connector : public ACE_SOCK_Connector
37 public:
38 /// Default constructor.
39 ACE_MEM_Connector ();
41 /**
42 * Actively connect to a peer, producing a connected @c ACE_MEM_Stream
43 * object if the connection succeeds.
45 * @param new_stream The @c ACE_MEM_Stream object that will be connected
46 * to the peer.
47 * @param remote_sap The address that we are trying to connect to.
48 * The protocol family of @c remote_sap is used for
49 * the connected socket. That is, if @c remote_sap
50 * contains an IPv6 address, a socket with family
51 * PF_INET6 will be used, else it will be PF_INET.
52 * @note remote_sap must be an address on the local
53 * host.
54 * @param timeout Pointer to an @c ACE_Time_Value object with amount
55 * of time to wait to connect. If the pointer is 0
56 * then the call blocks until the connection attempt
57 * is complete, whether it succeeds or fails. If
58 * *timeout == {0, 0} then the connection is done
59 * using nonblocking mode. In this case, if the
60 * connection can't be made immediately, this method
61 * returns -1 and errno == EWOULDBLOCK.
62 * If *timeout > {0, 0} then this is the maximum amount
63 * of time to wait before timing out; if the specified
64 * amount of time passes before the connection is made,
65 * this method returns -1 and errno == ETIME. Note
66 * the difference between this case and when a blocking
67 * connect is attempted that TCP times out - in the latter
68 * case, errno will be ETIMEDOUT.
69 * @param local_sap (optional) The local address to bind to. If it's
70 * the default value of @c ACE_Addr::sap_any then the
71 * OS will choose an unused port.
72 * @param reuse_addr (optional) If the value is 1, the local address
73 * (@c local_sap) is reused, even if it hasn't been
74 * cleaned up yet.
75 * @param flags Ignored.
76 * @param perms Ignored.
78 ACE_MEM_Connector (ACE_MEM_Stream &new_stream,
79 const ACE_INET_Addr &remote_sap,
80 const ACE_Time_Value *timeout = 0,
81 const ACE_Addr &local_sap = ACE_Addr::sap_any,
82 int reuse_addr = 0,
83 int flags = 0,
84 int perms = 0);
86 /**
87 * Actively connect to a peer, producing a connected @c ACE_MEM_Stream
88 * object if the connection succeeds.
90 * @param new_stream The @c ACE_MEM_Stream object that will be connected
91 * to the peer.
92 * @param remote_sap The address that we are trying to connect to.
93 * The protocol family of @c remote_sap is used for
94 * the connected socket. That is, if @c remote_sap
95 * contains an IPv6 address, a socket with family
96 * PF_INET6 will be used, else it will be PF_INET.
97 * @note remote_sap must be an address on the local
98 * host.
99 * @param timeout Pointer to an @c ACE_Time_Value object with amount
100 * of time to wait to connect. If the pointer is 0
101 * then the call blocks until the connection attempt
102 * is complete, whether it succeeds or fails. If
103 * *timeout == {0, 0} then the connection is done
104 * using nonblocking mode. In this case, if the
105 * connection can't be made immediately, this method
106 * returns -1 and errno == EWOULDBLOCK.
107 * If *timeout > {0, 0} then this is the maximum amount
108 * of time to wait before timing out; if the specified
109 * amount of time passes before the connection is made,
110 * this method returns -1 and errno == ETIME. Note
111 * the difference between this case and when a blocking
112 * connect is attempted that TCP times out - in the latter
113 * case, errno will be ETIMEDOUT.
114 * @param local_sap (optional) The local address to bind to. If it's
115 * the default value of @c ACE_Addr::sap_any then the
116 * OS will choose an unused port.
117 * @param reuse_addr (optional) If the value is 1, the local address
118 * (@c local_sap) is reused, even if it hasn't been
119 * cleaned up yet.
120 * @param flags Ignored.
121 * @param perms Ignored.
123 * @return Returns 0 if the connection succeeds. If it fails,
124 * -1 is returned and errno contains a specific error
125 * code.
127 int connect (ACE_MEM_Stream &new_stream,
128 const ACE_INET_Addr &remote_sap,
129 const ACE_Time_Value *timeout = 0,
130 const ACE_Addr &local_sap = ACE_Addr::sap_any,
131 int reuse_addr = 0,
132 int flags = 0,
133 int perms = 0);
135 /// Get the preferred signaling strategy.
136 ACE_MEM_IO::Signal_Strategy preferred_strategy () const;
138 /// Set the preferred signaling strategy.
139 void preferred_strategy (ACE_MEM_IO::Signal_Strategy strategy);
141 // = Meta-type info
142 typedef ACE_INET_Addr PEER_ADDR;
143 typedef ACE_MEM_Stream PEER_STREAM;
145 /// Dump the state of an object.
146 void dump () const;
148 /// Declare the dynamic allocation hooks.
149 ACE_ALLOC_HOOK_DECLARE;
151 private:
152 /// The acceptor address this connector is connecting to.
153 ACE_MEM_Addr address_;
155 /// A cached MALLOC_OPTIONS that the MEM_Connector used to initialize
156 /// the shared memory malloc update connection establishment.
157 ACE_MEM_SAP::MALLOC_OPTIONS malloc_options_;
159 /// Preferred signaling strategy.
160 ACE_MEM_IO::Signal_Strategy preferred_strategy_;
163 ACE_END_VERSIONED_NAMESPACE_DECL
165 #if defined (__ACE_INLINE__)
166 #include "ace/MEM_Connector.inl"
167 #endif /* __ACE_INLINE__ */
169 #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
171 #include /**/ "ace/post.h"
172 #endif /* ACE_MEM_CONNECTOR_H */