Correct feature names
[ACE_TAO.git] / ACE / ace / TLI_Connector.h
blob16fbe687ebe6e047bf3d003275e683e8abc56139
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file TLI_Connector.h
7 * @author Doug Schmidt
8 */
9 //=============================================================================
12 #ifndef ACE_TLI_CONNECTOR_H
13 #define ACE_TLI_CONNECTOR_H
14 #include /**/ "ace/pre.h"
16 #include "ace/TLI_Stream.h"
17 #include "ace/Log_Category.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 # pragma once
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 #if defined (ACE_HAS_TLI)
25 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
27 /**
28 * @class ACE_TLI_Connector
30 * @brief Defines an active connection factory for the ACE_TLI C++
31 * wrappers.
33 class ACE_Export ACE_TLI_Connector
35 public:
36 /// Default constructor.
37 ACE_TLI_Connector (void);
39 /**
40 * Actively connect and produce a <new_stream> 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.
54 ACE_TLI_Connector (ACE_TLI_Stream &new_stream,
55 const ACE_Addr &remote_sap,
56 ACE_Time_Value *timeout = 0,
57 const ACE_Addr &local_sap = ACE_Addr::sap_any,
58 int reuse_addr = 0,
59 int flags = O_RDWR,
60 int perms = 0,
61 const char device[] = ACE_TLI_TCP_DEVICE,
62 struct t_info *info = 0,
63 int rw_flag = 1,
64 struct netbuf *udata = 0,
65 struct netbuf *opt = 0);
67 /**
68 * Actively connect and produce a <new_stream> if things go well.
69 * The @a remote_sap is the address that we are trying to connect
70 * with. The @a timeout is the amount of time to wait to connect.
71 * If it's 0 then we block indefinitely. If *timeout == {0, 0} then
72 * the connection is done using non-blocking mode. In this case, if
73 * the connection can't be made immediately the value of -1 is
74 * returned with @c errno == EWOULDBLOCK. If *timeout > {0, 0} then
75 * this is the maximum amount of time to wait before timing out. If the
76 * time expires before the connection is made @c errno == ETIME. The
77 * @a local_sap is the value of local address to bind to. If it's
78 * the default value of ACE_Addr::sap_any then the user is letting
79 * the OS do the binding. If @a reuse_addr == 1 then the
80 * <local_addr> is reused, even if it hasn't been cleanedup yet.
82 int connect (ACE_TLI_Stream &new_stream,
83 const ACE_Addr &remote_sap,
84 ACE_Time_Value *timeout = 0,
85 const ACE_Addr &local_sap = ACE_Addr::sap_any,
86 int reuse_addr = 0,
87 int flags = O_RDWR,
88 int perms = 0,
89 const char device[] = ACE_TLI_TCP_DEVICE,
90 struct t_info *info = 0,
91 int rw_flag = 1,
92 struct netbuf *udata = 0,
93 struct netbuf *opt = 0);
95 /**
96 * Try to complete a non-blocking connection.
97 * If connection completion is successful then @a new_stream contains
98 * the connected ACE_SOCK_Stream. If @a remote_sap is non-NULL then it
99 * will contain the address of the connected peer.
101 int complete (ACE_TLI_Stream &new_stream,
102 ACE_Addr *remote_sap,
103 ACE_Time_Value *tv);
105 /// Resets any event associations on this handle
106 bool reset_new_handle (ACE_HANDLE handle);
108 // = Meta-type info
109 typedef ACE_INET_Addr PEER_ADDR;
110 typedef ACE_TLI_Stream PEER_STREAM;
112 /// Dump the state of an object.
113 void dump (void) const;
115 /// Declare the dynamic allocation hooks.
116 ACE_ALLOC_HOOK_DECLARE;
119 ACE_END_VERSIONED_NAMESPACE_DECL
121 #if defined (__ACE_INLINE__)
122 #include "ace/TLI_Connector.inl"
123 #endif /* __ACE_INLINE__ */
125 #endif /* ACE_HAS_TLI */
126 #include /**/ "ace/post.h"
127 #endif /* ACE_TLI_CONNECTOR_H */