Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / ACE / ace / DEV_Connector.h
blob123fb54dca7d93754242f86e6db20941da86d575
1 /* -*- C++ -*- */
3 //=============================================================================
4 /**
5 * @file DEV_Connector.h
7 * @author Gerhard Lenzer and Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
8 */
9 //=============================================================================
11 #ifndef ACE_DEV_CONNECTOR_H
12 #define ACE_DEV_CONNECTOR_H
13 #include /**/ "ace/pre.h"
15 #include "ace/DEV_IO.h"
16 #include "ace/Log_Category.h"
17 #include "ace/os_include/os_fcntl.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 # pragma once
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
25 /**
26 * @class ACE_DEV_Connector
28 * @brief Defines an active connection factory for the ACE_DEV wrappers.
30 class ACE_Export ACE_DEV_Connector
32 public:
33 /// Default constructor.
34 ACE_DEV_Connector ();
36 /**
37 * Actively connect and produce a @a new_io if things go well.
38 * The @a remote_sap is the address that we are trying to connect
39 * with. The @a timeout is the amount of time to wait to connect.
40 * If it's 0 then we block indefinitely. If *timeout == {0, 0} then
41 * the connection is done using non-blocking mode. In this case, if
42 * the connection can't be made immediately the value of -1 is
43 * returned with @c errno == EWOULDBLOCK. If *timeout > {0, 0} then
44 * this is the maximum amount of time to wait before timing out. If the
45 * time expires before the connection is made @c errno == ETIME. The
46 * @a local_sap is the value of local address to bind to. If it's
47 * the default value of ACE_Addr::sap_any then the user is letting
48 * the OS do the binding. If @a reuse_addr == 1 then the
49 * <local_addr> is reused, even if it hasn't been cleanedup yet.
50 * The @a flags and @a perms arguments are passed down to the <open>
51 * method.
53 ACE_DEV_Connector (ACE_DEV_IO &new_io,
54 const ACE_DEV_Addr &remote_sap,
55 ACE_Time_Value *timeout = 0,
56 const ACE_Addr &local_sap = ACE_Addr::sap_any,
57 int reuse_addr = 0,
58 int flags = O_RDWR,
59 int perms = 0);
61 /**
62 * Actively connect and produce a @a new_io if things go well.
63 * The @a remote_sap is the address that we are trying to connect
64 * with. The @a timeout is the amount of time to wait to connect.
65 * If it's 0 then we block indefinitely. If *timeout == {0, 0} then
66 * the connection is done using non-blocking mode. In this case, if
67 * the connection can't be made immediately the value of -1 is
68 * returned with @c errno == EWOULDBLOCK. If *timeout > {0, 0} then
69 * this is the maximum amount of time to wait before timing out. If the
70 * time expires before the connection is made @c errno == ETIME. The
71 * @a local_sap is the value of local address to bind to. If it's
72 * the default value of ACE_Addr::sap_any then the user is letting
73 * the OS do the binding. If @a reuse_addr == 1 then the
74 * <local_addr> is reused, even if it hasn't been cleanedup yet.
75 * The @a flags and @a perms arguments are passed down to the <open>
76 * method.
78 int connect (ACE_DEV_IO &new_io,
79 const ACE_DEV_Addr &remote_sap,
80 ACE_Time_Value *timeout = 0,
81 const ACE_Addr &local_sap = ACE_Addr::sap_any,
82 int reuse_addr = 0,
83 int flags = O_RDWR,
84 int perms = 0);
86 /// Resets any event associations on this handle
87 bool reset_new_handle (ACE_HANDLE handle);
89 /// Dump the state of an object.
90 void dump () const;
92 /// Declare the dynamic allocation hooks.
93 ACE_ALLOC_HOOK_DECLARE;
95 // = Meta-type info
96 typedef ACE_DEV_Addr PEER_ADDR;
97 typedef ACE_DEV_IO PEER_STREAM;
100 ACE_END_VERSIONED_NAMESPACE_DECL
102 #if defined (__ACE_INLINE__)
103 #include "ace/DEV_Connector.inl"
104 #endif /* __ACE_INLINE__ */
106 #include /**/ "ace/post.h"
107 #endif /* ACE_DEV_CONNECTOR_H */