Document return values
[ACE_TAO.git] / ACE / ace / TLI_Connector.h
blob4ad528ce2f89e54686dcfd6c0ab611eda8225f0c
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file TLI_Connector.h
7 * @author Doug Schmidt
8 */
9 //=============================================================================
11 #ifndef ACE_TLI_CONNECTOR_H
12 #define ACE_TLI_CONNECTOR_H
13 #include /**/ "ace/pre.h"
15 #include "ace/TLI_Stream.h"
16 #include "ace/Log_Category.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 # pragma once
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #if defined (ACE_HAS_TLI)
24 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
26 /**
27 * @class ACE_TLI_Connector
29 * @brief Defines an active connection factory for the ACE_TLI C++
30 * wrappers.
32 class ACE_Export ACE_TLI_Connector
34 public:
35 /// Default constructor.
36 ACE_TLI_Connector ();
38 /**
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.
53 ACE_TLI_Connector (ACE_TLI_Stream &new_stream,
54 const ACE_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,
60 const char device[] = ACE_TLI_TCP_DEVICE,
61 struct t_info *info = 0,
62 int rw_flag = 1,
63 struct netbuf *udata = 0,
64 struct netbuf *opt = 0);
66 /**
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.
81 int connect (ACE_TLI_Stream &new_stream,
82 const ACE_Addr &remote_sap,
83 ACE_Time_Value *timeout = 0,
84 const ACE_Addr &local_sap = ACE_Addr::sap_any,
85 int reuse_addr = 0,
86 int flags = O_RDWR,
87 int perms = 0,
88 const char device[] = ACE_TLI_TCP_DEVICE,
89 struct t_info *info = 0,
90 int rw_flag = 1,
91 struct netbuf *udata = 0,
92 struct netbuf *opt = 0);
94 /**
95 * Try to complete a non-blocking connection.
96 * If connection completion is successful then @a new_stream contains
97 * the connected ACE_SOCK_Stream. If @a remote_sap is non-NULL then it
98 * will contain the address of the connected peer.
100 int complete (ACE_TLI_Stream &new_stream,
101 ACE_Addr *remote_sap,
102 ACE_Time_Value *tv);
104 /// Resets any event associations on this handle
105 bool reset_new_handle (ACE_HANDLE handle);
107 // = Meta-type info
108 typedef ACE_INET_Addr PEER_ADDR;
109 typedef ACE_TLI_Stream PEER_STREAM;
111 /// Dump the state of an object.
112 void dump () const;
114 /// Declare the dynamic allocation hooks.
115 ACE_ALLOC_HOOK_DECLARE;
118 ACE_END_VERSIONED_NAMESPACE_DECL
120 #if defined (__ACE_INLINE__)
121 #include "ace/TLI_Connector.inl"
122 #endif /* __ACE_INLINE__ */
124 #endif /* ACE_HAS_TLI */
125 #include /**/ "ace/post.h"
126 #endif /* ACE_TLI_CONNECTOR_H */