3 //=============================================================================
5 * @file ATM_Connector.h
7 * $Id: ATM_Connector.h 80826 2008-03-04 14:51:23Z wotte $
9 * @author Joe Hoffert <joeh@cs.wustl.edu>
11 //=============================================================================
13 #ifndef ACE_ATM_CONNECTOR_H
14 #define ACE_ATM_CONNECTOR_H
15 #include /**/ "ace/pre.h"
17 #include /**/ "ace/config-all.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 #if defined (ACE_HAS_ATM)
25 #include "ace/ATM_Stream.h"
26 #include "ace/ATM_Params.h"
27 #include "ace/ATM_QoS.h"
29 #if defined (ACE_WIN32) || defined (ACE_HAS_LINUX_ATM)
30 #include "ace/SOCK_Connector.h"
31 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
32 typedef ACE_SOCK_Connector ATM_Connector
;
33 ACE_END_VERSIONED_NAMESPACE_DECL
35 #include "ace/XTI_ATM_Mcast.h"
36 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
37 typedef ACE_XTI_ATM_Mcast ATM_Connector
;
38 // Open versioned namespace, if enabled by the user.
39 ACE_END_VERSIONED_NAMESPACE_DECL
42 // Open versioned namespace, if enabled by the user.
43 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
46 * @class ACE_ATM_Connector
48 * @brief Defines an active connection factory for the ACE_ATM C++
51 class ACE_Export ACE_ATM_Connector
54 // = Initialization methods.
55 /// Default constructor.
56 ACE_ATM_Connector (void);
59 * Actively connect and produce a @a new_stream if things go well.
60 * The @a remote_sap is the address that we are trying to connect
61 * with. The <params> are the parameters needed for either socket
62 * or XTI/ATM connections. The @a timeout is the amount of time to
63 * wait to connect. If it's 0 then we block indefinitely. If
64 * *timeout == {0, 0} then the connection is done using non-blocking
65 * mode. In this case, if the connection can't be made immediately
66 * the value of -1 is returned with @c errno == EWOULDBLOCK. If
67 * *timeout > {0, 0} then this is the maximum amount of time to wait before
68 * timing out. If the time expires before the connection is made
69 * @c errno == ETIME. The @a local_sap is the value of local address
70 * to bind to. If it's the default value of <ACE_ATM_Addr::sap_any> then
71 * the user is letting the OS do the binding. If @a reuse_addr == 1
72 * then the <local_addr> is reused, even if it hasn't been cleanedup yet.
74 ACE_ATM_Connector (ACE_ATM_Stream
&new_stream
,
75 const ACE_ATM_Addr
&remote_sap
,
76 ACE_ATM_Params params
= ACE_ATM_Params(),
77 ACE_ATM_QoS options
= ACE_ATM_QoS(),
78 ACE_Time_Value
*timeout
= 0,
79 const ACE_ATM_Addr
&local_sap
= ACE_ATM_Addr( "", 0 ),
81 #if defined (ACE_WIN32)
85 #endif /* ACE_WIN32 */
89 * Actively connect and produce a @a new_stream if things go well.
90 * The @a remote_sap is the address that we are trying to connect
91 * with. The <params> are the parameters needed for either socket
92 * or XTI/ATM connections. The @a timeout is the amount of time to
93 * wait to connect. If it's 0 then we block indefinitely. If
94 * *timeout == {0, 0} then the connection is done using non-blocking
95 * mode. In this case, if the connection can't be made immediately
96 * the value of -1 is returned with @c errno == EWOULDBLOCK. If
97 * *timeout > {0, 0} then this is the maximum amount of time to wait before
98 * timing out. If the time expires before the connection is made
99 * @c errno == ETIME. The @a local_sap is the value of local address
100 * to bind to. If it's the default value of <ACE_ATM_Addr::sap_any> then
101 * the user is letting the OS do the binding. If @a reuse_addr == 1
102 * then the <local_addr> is reused, even if it hasn't been cleanedup yet.
104 int connect (ACE_ATM_Stream
&new_stream
,
105 const ACE_ATM_Addr
&remote_sap
,
106 ACE_ATM_Params params
= ACE_ATM_Params(),
107 ACE_ATM_QoS options
= ACE_ATM_QoS(),
108 ACE_Time_Value
*timeout
= 0,
109 const ACE_ATM_Addr
&local_sap
= ACE_ATM_Addr( "",
112 #if defined (ACE_WIN32)
116 #endif /* ACE_WIN32 */
120 * Try to complete a non-blocking connection.
121 * If connection completion is successful then @a new_stream contains
122 * the connected ACE_SOCK_Stream. If @a remote_sap is non-NULL then it
123 * will contain the address of the connected peer.
125 int complete (ACE_ATM_Stream
&new_stream
,
126 ACE_ATM_Addr
*remote_sap
,
130 * Actively add a leaf to the root (i.e., point-to-multipoint). The
131 * @a remote_sap is the address of the leaf that we
134 int add_leaf (ACE_ATM_Stream
¤t_stream
,
135 const ACE_Addr
&remote_sap
,
138 /// Resets any event associations on this handle
139 int reset_new_handle (ACE_HANDLE handle
);
142 typedef ACE_ATM_Addr PEER_ADDR
;
143 typedef ACE_ATM_Stream PEER_STREAM
;
145 /// Dump the state of an object.
146 void dump (void) const;
148 /// Declare the dynamic allocation hooks.
149 ACE_ALLOC_HOOK_DECLARE
;
152 ATM_Connector connector_
;
155 // Open versioned namespace, if enabled by the user.
156 ACE_END_VERSIONED_NAMESPACE_DECL
158 #if defined (__ACE_INLINE__)
159 #include "ace/ATM_Connector.inl"
160 #endif /* __ACE_INLINE__ */
162 #endif /* ACE_HAS_ATM */
163 #include /**/ "ace/post.h"
164 #endif /* ACE_ATM_CONNECTOR_H */