3 //=============================================================================
5 * @file DEV_Connector.h
7 * $Id: DEV_Connector.h 80826 2008-03-04 14:51:23Z wotte $
9 * @author Gerhard Lenzer and Douglas C. Schmidt <schmidt@cs.wustl.edu>
11 //=============================================================================
13 #ifndef ACE_DEV_CONNECTOR_H
14 #define ACE_DEV_CONNECTOR_H
15 #include /**/ "ace/pre.h"
17 #include "ace/DEV_IO.h"
18 #include "ace/Log_Msg.h"
19 #include "ace/os_include/os_fcntl.h"
21 #if !defined (ACE_LACKS_PRAGMA_ONCE)
23 #endif /* ACE_LACKS_PRAGMA_ONCE */
26 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
29 * @class ACE_DEV_Connector
31 * @brief Defines an active connection factory for the ACE_DEV wrappers.
33 class ACE_Export ACE_DEV_Connector
36 /// Default constructor.
37 ACE_DEV_Connector (void);
40 * Actively connect and produce a @a new_io if things go well.
41 * The @a remote_sap is the address that we are trying to connect
42 * with. The @a timeout is the amount of time to wait to connect.
43 * If it's 0 then we block indefinitely. If *timeout == {0, 0} then
44 * the connection is done using non-blocking mode. In this case, if
45 * the connection can't be made immediately the value of -1 is
46 * returned with @c errno == EWOULDBLOCK. If *timeout > {0, 0} then
47 * this is the maximum amount of time to wait before timing out. If the
48 * time expires before the connection is made @c errno == ETIME. The
49 * @a local_sap is the value of local address to bind to. If it's
50 * the default value of ACE_Addr::sap_any then the user is letting
51 * the OS do the binding. If @a reuse_addr == 1 then the
52 * <local_addr> is reused, even if it hasn't been cleanedup yet.
53 * The @a flags and @a perms arguments are passed down to the <open>
56 ACE_DEV_Connector (ACE_DEV_IO
&new_io
,
57 const ACE_DEV_Addr
&remote_sap
,
58 ACE_Time_Value
*timeout
= 0,
59 const ACE_Addr
&local_sap
= ACE_Addr::sap_any
,
65 * Actively connect and produce a @a new_io if things go well.
66 * The @a remote_sap is the address that we are trying to connect
67 * with. The @a timeout is the amount of time to wait to connect.
68 * If it's 0 then we block indefinitely. If *timeout == {0, 0} then
69 * the connection is done using non-blocking mode. In this case, if
70 * the connection can't be made immediately the value of -1 is
71 * returned with @c errno == EWOULDBLOCK. If *timeout > {0, 0} then
72 * this is the maximum amount of time to wait before timing out. If the
73 * time expires before the connection is made @c errno == ETIME. The
74 * @a local_sap is the value of local address to bind to. If it's
75 * the default value of ACE_Addr::sap_any then the user is letting
76 * the OS do the binding. If @a reuse_addr == 1 then the
77 * <local_addr> is reused, even if it hasn't been cleanedup yet.
78 * The @a flags and @a perms arguments are passed down to the <open>
81 int connect (ACE_DEV_IO
&new_io
,
82 const ACE_DEV_Addr
&remote_sap
,
83 ACE_Time_Value
*timeout
= 0,
84 const ACE_Addr
&local_sap
= ACE_Addr::sap_any
,
89 /// Resets any event associations on this handle
90 int reset_new_handle (ACE_HANDLE handle
);
92 /// Dump the state of an object.
93 void dump (void) const;
95 /// Declare the dynamic allocation hooks.
96 ACE_ALLOC_HOOK_DECLARE
;
99 typedef ACE_DEV_Addr PEER_ADDR
;
100 typedef ACE_DEV_IO PEER_STREAM
;
103 ACE_END_VERSIONED_NAMESPACE_DECL
105 #if defined (__ACE_INLINE__)
106 #include "ace/DEV_Connector.inl"
107 #endif /* __ACE_INLINE__ */
109 #include /**/ "ace/post.h"
110 #endif /* ACE_DEV_CONNECTOR_H */