3 //=============================================================================
5 * @file UPIPE_Connector.h
7 * @author Gerhard Lenzer and Douglas C. Schmidt
9 //=============================================================================
12 #ifndef ACE_UPIPE_CONNECTOR_H
13 #define ACE_UPIPE_CONNECTOR_H
14 #include /**/ "ace/pre.h"
16 #include "ace/UPIPE_Stream.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #if defined (ACE_HAS_THREADS)
24 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
27 * @class ACE_UPIPE_Connector
29 * @brief Defines an active connection factory for the
30 * ACE_UPIPE_STREAM wrappers.
32 class ACE_Export ACE_UPIPE_Connector
35 /// Default constructor.
36 ACE_UPIPE_Connector ();
39 * Actively connect and produce a @a new_stream if things go well.
40 * The @a addr 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 * @a local_addr is reused, even if it hasn't been cleanedup yet.
52 * The @a flags and @a perms arguments are passed down to the open()
55 ACE_UPIPE_Connector (ACE_UPIPE_Stream
&new_stream
,
56 const ACE_UPIPE_Addr
&addr
,
57 ACE_Time_Value
*timeout
= 0,
58 const ACE_Addr
&local_sap
= ACE_Addr::sap_any
,
64 * Actively connect and produce a @a new_stream if things go well.
65 * The @a addr is the address that we are trying to connect
66 * with. The @a timeout is the amount of time to wait to connect.
67 * If it's 0 then we block indefinitely. If *timeout == {0, 0} then
68 * the connection is done using non-blocking mode. In this case, if
69 * the connection can't be made immediately the value of -1 is
70 * returned with @c errno == EWOULDBLOCK. If *timeout > {0, 0} then
71 * this is the maximum amount of time to wait before timing out. If the
72 * time expires before the connection is made @c errno == ETIME. The
73 * @a local_sap is the value of local address to bind to. If it's
74 * the default value of ACE_Addr::sap_any then the user is letting
75 * the OS do the binding. If @a reuse_addr == 1 then the
76 * @a local_addr is reused, even if it hasn't been cleanedup yet.
77 * The @a flags and @a perms arguments are passed down to the open()
80 int connect (ACE_UPIPE_Stream
&new_stream
,
81 const ACE_UPIPE_Addr
&addr
,
82 ACE_Time_Value
*timeout
= 0,
83 const ACE_Addr
&local_sap
= ACE_Addr::sap_any
,
88 /// Resets any event associations on this handle
89 bool reset_new_handle (ACE_HANDLE handle
);
92 typedef ACE_UPIPE_Addr PEER_ADDR
;
93 typedef ACE_UPIPE_Stream PEER_STREAM
;
95 /// Dump the state of an object.
98 /// Declare the dynamic allocation hooks.
99 ACE_ALLOC_HOOK_DECLARE
;
102 ACE_END_VERSIONED_NAMESPACE_DECL
104 #if defined (__ACE_INLINE__)
105 #include "ace/UPIPE_Connector.inl"
106 #endif /* __ACE_INLINE__ */
108 #endif /* ACE_HAS_THREADS */
110 #include /**/ "ace/post.h"
112 #endif /* ACE_UPIPE_CONNECTOR_H */