3 //=============================================================================
5 * @file SPIPE_Connector.h
7 * @author Doug Schmidt <d.schmidt@vanderbilt.edu>
8 * @author Prashant Jain <pjain@cs.wustl.edu>
10 //=============================================================================
12 #ifndef ACE_SPIPE_CONNECTOR_H
13 #define ACE_SPIPE_CONNECTOR_H
14 #include /**/ "ace/pre.h"
16 #include "ace/SPIPE_Stream.h"
17 #include "ace/os_include/os_fcntl.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
26 * @class ACE_SPIPE_Connector
28 * @brief Defines an active connection factory for ACE_SPIPE_Stream.
29 * On Windows this is mapped to Named Pipes, whereas on UNIX it is
30 * mapped to STREAM pipes.
32 class ACE_Export ACE_SPIPE_Connector
35 /// Default constructor.
36 ACE_SPIPE_Connector ();
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.
52 * The @a flags and @a perms arguments are passed down to the <open>
53 * method. The @a pipe_mode argument is only used in NT and is used to
54 * establish the NT pipe mode.
56 ACE_SPIPE_Connector (ACE_SPIPE_Stream
&new_io
,
57 const ACE_SPIPE_Addr
&remote_sap
,
58 ACE_Time_Value
*timeout
= 0,
59 const ACE_Addr
&local_sap
= ACE_Addr::sap_any
,
63 LPSECURITY_ATTRIBUTES sa
= 0,
64 int pipe_mode
= PIPE_READMODE_MESSAGE
| PIPE_WAIT
);
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.
80 * The @a flags and @a perms arguments are passed down to the <open>
81 * method. The @a pipe_mode argument is only used in NT and is used to
82 * establish the NT pipe mode.
84 int connect (ACE_SPIPE_Stream
&new_io
,
85 const ACE_SPIPE_Addr
&remote_sap
,
86 ACE_Time_Value
*timeout
= 0,
87 const ACE_Addr
&local_sap
= ACE_Addr::sap_any
,
91 LPSECURITY_ATTRIBUTES sa
= 0,
92 int pipe_mode
= PIPE_READMODE_MESSAGE
| PIPE_WAIT
);
94 /// Resets any event associations on this handle
95 bool reset_new_handle (ACE_HANDLE handle
);
98 typedef ACE_SPIPE_Addr PEER_ADDR
;
99 typedef ACE_SPIPE_Stream PEER_STREAM
;
101 /// Dump the state of an object.
104 /// Declare the dynamic allocation hooks.
105 ACE_ALLOC_HOOK_DECLARE
;
108 ACE_END_VERSIONED_NAMESPACE_DECL
110 #if defined (__ACE_INLINE__)
111 #include "ace/SPIPE_Connector.inl"
112 #endif /* __ACE_INLINE__ */
114 #include /**/ "ace/post.h"
115 #endif /* ACE_SPIPE_CONNECTOR_H */