Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / ATM_Connector.h
blobe288e03b4f2c1c2dd6b1b71cdc3502197231eac5
1 /* -*- C++ -*- */
3 //=============================================================================
4 /**
5 * @file ATM_Connector.h
7 * @author Joe Hoffert <joeh@cs.wustl.edu>
8 */
9 //=============================================================================
11 #ifndef ACE_ATM_CONNECTOR_H
12 #define ACE_ATM_CONNECTOR_H
13 #include /**/ "ace/pre.h"
15 #include /**/ "ace/config-all.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
18 # pragma once
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #if defined (ACE_HAS_ATM)
23 #include "ace/ATM_Stream.h"
24 #include "ace/ATM_Params.h"
25 #include "ace/ATM_QoS.h"
27 #if defined (ACE_WIN32) || defined (ACE_HAS_LINUX_ATM)
28 #include "ace/SOCK_Connector.h"
29 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
30 typedef ACE_SOCK_Connector ATM_Connector;
31 ACE_END_VERSIONED_NAMESPACE_DECL
32 #else
33 #include "ace/XTI_ATM_Mcast.h"
34 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
35 typedef ACE_XTI_ATM_Mcast ATM_Connector;
36 // Open versioned namespace, if enabled by the user.
37 ACE_END_VERSIONED_NAMESPACE_DECL
38 #endif
40 // Open versioned namespace, if enabled by the user.
41 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
43 /**
44 * @class ACE_ATM_Connector
46 * @brief Defines an active connection factory for the ACE_ATM C++
47 * wrappers.
49 class ACE_Export ACE_ATM_Connector
51 public:
52 /// Default constructor.
53 ACE_ATM_Connector ();
55 /**
56 * Actively connect and produce a @a new_stream if things go well.
57 * The @a remote_sap is the address that we are trying to connect
58 * with. The <params> are the parameters needed for either socket
59 * or XTI/ATM connections. The @a timeout is the amount of time to
60 * wait to connect. If it's 0 then we block indefinitely. If
61 * *timeout == {0, 0} then the connection is done using non-blocking
62 * mode. In this case, if the connection can't be made immediately
63 * the value of -1 is returned with @c errno == EWOULDBLOCK. If
64 * *timeout > {0, 0} then this is the maximum amount of time to wait before
65 * timing out. If the time expires before the connection is made
66 * @c errno == ETIME. The @a local_sap is the value of local address
67 * to bind to. If it's the default value of <ACE_ATM_Addr::sap_any> then
68 * the user is letting the OS do the binding. If @a reuse_addr == 1
69 * then the <local_addr> is reused, even if it hasn't been cleanedup yet.
71 ACE_ATM_Connector (ACE_ATM_Stream &new_stream,
72 const ACE_ATM_Addr &remote_sap,
73 ACE_ATM_Params params = ACE_ATM_Params(),
74 ACE_ATM_QoS options = ACE_ATM_QoS(),
75 ACE_Time_Value *timeout = 0,
76 const ACE_ATM_Addr &local_sap = ACE_ATM_Addr( "", 0 ),
77 int reuse_addr = 0,
78 #if defined (ACE_WIN32)
79 int flags = 0,
80 #else
81 int flags = O_RDWR,
82 #endif /* ACE_WIN32 */
83 int perms = 0);
85 /**
86 * Actively connect and produce a @a new_stream if things go well.
87 * The @a remote_sap is the address that we are trying to connect
88 * with. The <params> are the parameters needed for either socket
89 * or XTI/ATM connections. The @a timeout is the amount of time to
90 * wait to connect. If it's 0 then we block indefinitely. If
91 * *timeout == {0, 0} then the connection is done using non-blocking
92 * mode. In this case, if the connection can't be made immediately
93 * the value of -1 is returned with @c errno == EWOULDBLOCK. If
94 * *timeout > {0, 0} then this is the maximum amount of time to wait before
95 * timing out. If the time expires before the connection is made
96 * @c errno == ETIME. The @a local_sap is the value of local address
97 * to bind to. If it's the default value of <ACE_ATM_Addr::sap_any> then
98 * the user is letting the OS do the binding. If @a reuse_addr == 1
99 * then the <local_addr> is reused, even if it hasn't been cleanedup yet.
101 int connect (ACE_ATM_Stream &new_stream,
102 const ACE_ATM_Addr &remote_sap,
103 ACE_ATM_Params params = ACE_ATM_Params(),
104 ACE_ATM_QoS options = ACE_ATM_QoS(),
105 ACE_Time_Value *timeout = 0,
106 const ACE_ATM_Addr &local_sap = ACE_ATM_Addr( "",
107 0 ),
108 int reuse_addr = 0,
109 #if defined (ACE_WIN32)
110 int flags = 0,
111 #else
112 int flags = O_RDWR,
113 #endif /* ACE_WIN32 */
114 int perms = 0);
117 * Try to complete a non-blocking connection.
118 * If connection completion is successful then @a new_stream contains
119 * the connected ACE_SOCK_Stream. If @a remote_sap is non-NULL then it
120 * will contain the address of the connected peer.
122 int complete (ACE_ATM_Stream &new_stream,
123 ACE_ATM_Addr *remote_sap,
124 ACE_Time_Value *tv);
127 * Actively add a leaf to the root (i.e., point-to-multipoint). The
128 * @a remote_sap is the address of the leaf that we
129 * are trying to add.
131 int add_leaf (ACE_ATM_Stream &current_stream,
132 const ACE_Addr &remote_sap,
133 ACE_ATM_QoS &qos);
135 /// Resets any event associations on this handle
136 bool reset_new_handle (ACE_HANDLE handle);
138 // = Meta-type info
139 typedef ACE_ATM_Addr PEER_ADDR;
140 typedef ACE_ATM_Stream PEER_STREAM;
142 /// Dump the state of an object.
143 void dump () const;
145 /// Declare the dynamic allocation hooks.
146 ACE_ALLOC_HOOK_DECLARE;
148 private:
149 ATM_Connector connector_;
152 // Open versioned namespace, if enabled by the user.
153 ACE_END_VERSIONED_NAMESPACE_DECL
155 #if defined (__ACE_INLINE__)
156 #include "ace/ATM_Connector.inl"
157 #endif /* __ACE_INLINE__ */
159 #endif /* ACE_HAS_ATM */
160 #include /**/ "ace/post.h"
161 #endif /* ACE_ATM_CONNECTOR_H */