3 //=============================================================================
5 * @file TLI_Connector.h
9 //=============================================================================
11 #ifndef ACE_TLI_CONNECTOR_H
12 #define ACE_TLI_CONNECTOR_H
13 #include /**/ "ace/pre.h"
15 #include "ace/TLI_Stream.h"
16 #include "ace/Log_Category.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #if defined (ACE_HAS_TLI)
24 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
27 * @class ACE_TLI_Connector
29 * @brief Defines an active connection factory for the ACE_TLI C++
32 class ACE_Export ACE_TLI_Connector
35 /// Default constructor.
39 * Actively connect and produce a <new_stream> if things go well.
40 * The @a remote_sap is the address that we are trying to connect
41 * with. The @a timeout is the amount of time to wait to connect.
42 * If it's 0 then we block indefinitely. If *timeout == {0, 0} then
43 * the connection is done using non-blocking mode. In this case, if
44 * the connection can't be made immediately the value of -1 is
45 * returned with @c errno == EWOULDBLOCK. If *timeout > {0, 0} then
46 * this is the maximum amount of time to wait before timing out. If the
47 * time expires before the connection is made @c errno == ETIME. The
48 * @a local_sap is the value of local address to bind to. If it's
49 * the default value of ACE_Addr::sap_any then the user is letting
50 * the OS do the binding. If @a reuse_addr == 1 then the
51 * <local_addr> is reused, even if it hasn't been cleanedup yet.
53 ACE_TLI_Connector (ACE_TLI_Stream
&new_stream
,
54 const ACE_Addr
&remote_sap
,
55 ACE_Time_Value
*timeout
= 0,
56 const ACE_Addr
&local_sap
= ACE_Addr::sap_any
,
60 const char device
[] = ACE_TLI_TCP_DEVICE
,
61 struct t_info
*info
= 0,
63 struct netbuf
*udata
= 0,
64 struct netbuf
*opt
= 0);
67 * Actively connect and produce a <new_stream> if things go well.
68 * The @a remote_sap is the address that we are trying to connect
69 * with. The @a timeout is the amount of time to wait to connect.
70 * If it's 0 then we block indefinitely. If *timeout == {0, 0} then
71 * the connection is done using non-blocking mode. In this case, if
72 * the connection can't be made immediately the value of -1 is
73 * returned with @c errno == EWOULDBLOCK. If *timeout > {0, 0} then
74 * this is the maximum amount of time to wait before timing out. If the
75 * time expires before the connection is made @c errno == ETIME. The
76 * @a local_sap is the value of local address to bind to. If it's
77 * the default value of ACE_Addr::sap_any then the user is letting
78 * the OS do the binding. If @a reuse_addr == 1 then the
79 * <local_addr> is reused, even if it hasn't been cleanedup yet.
81 int connect (ACE_TLI_Stream
&new_stream
,
82 const ACE_Addr
&remote_sap
,
83 ACE_Time_Value
*timeout
= 0,
84 const ACE_Addr
&local_sap
= ACE_Addr::sap_any
,
88 const char device
[] = ACE_TLI_TCP_DEVICE
,
89 struct t_info
*info
= 0,
91 struct netbuf
*udata
= 0,
92 struct netbuf
*opt
= 0);
95 * Try to complete a non-blocking connection.
96 * If connection completion is successful then @a new_stream contains
97 * the connected ACE_SOCK_Stream. If @a remote_sap is non-NULL then it
98 * will contain the address of the connected peer.
100 int complete (ACE_TLI_Stream
&new_stream
,
101 ACE_Addr
*remote_sap
,
104 /// Resets any event associations on this handle
105 bool reset_new_handle (ACE_HANDLE handle
);
108 typedef ACE_INET_Addr PEER_ADDR
;
109 typedef ACE_TLI_Stream PEER_STREAM
;
111 /// Dump the state of an object.
114 /// Declare the dynamic allocation hooks.
115 ACE_ALLOC_HOOK_DECLARE
;
118 ACE_END_VERSIONED_NAMESPACE_DECL
120 #if defined (__ACE_INLINE__)
121 #include "ace/TLI_Connector.inl"
122 #endif /* __ACE_INLINE__ */
124 #endif /* ACE_HAS_TLI */
125 #include /**/ "ace/post.h"
126 #endif /* ACE_TLI_CONNECTOR_H */