Restore build on FreeBSD.
[getmangos.git] / dep / ACE_wrappers / ace / TLI_Connector.h
blobe1b5907495d651000a5d6c545ee1f33c25003240
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file TLI_Connector.h
7 * $Id: TLI_Connector.h 80826 2008-03-04 14:51:23Z wotte $
9 * @author Doug Schmidt
11 //=============================================================================
14 #ifndef ACE_TLI_CONNECTOR_H
15 #define ACE_TLI_CONNECTOR_H
16 #include /**/ "ace/pre.h"
18 #include "ace/TLI_Stream.h"
19 #include "ace/Log_Msg.h"
21 #if !defined (ACE_LACKS_PRAGMA_ONCE)
22 # pragma once
23 #endif /* ACE_LACKS_PRAGMA_ONCE */
25 #if defined (ACE_HAS_TLI)
27 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
29 /**
30 * @class ACE_TLI_Connector
32 * @brief Defines an active connection factory for the ACE_TLI C++
33 * wrappers.
35 class ACE_Export ACE_TLI_Connector
37 public:
38 // = Initialization methods.
39 /// Default constructor.
40 ACE_TLI_Connector (void);
42 /**
43 * Actively connect and produce a <new_stream> if things go well.
44 * The @a remote_sap is the address that we are trying to connect
45 * with. The @a timeout is the amount of time to wait to connect.
46 * If it's 0 then we block indefinitely. If *timeout == {0, 0} then
47 * the connection is done using non-blocking mode. In this case, if
48 * the connection can't be made immediately the value of -1 is
49 * returned with @c errno == EWOULDBLOCK. If *timeout > {0, 0} then
50 * this is the maximum amount of time to wait before timing out. If the
51 * time expires before the connection is made @c errno == ETIME. The
52 * @a local_sap is the value of local address to bind to. If it's
53 * the default value of ACE_Addr::sap_any then the user is letting
54 * the OS do the binding. If @a reuse_addr == 1 then the
55 * <local_addr> is reused, even if it hasn't been cleanedup yet.
57 ACE_TLI_Connector (ACE_TLI_Stream &new_stream,
58 const ACE_Addr &remote_sap,
59 ACE_Time_Value *timeout = 0,
60 const ACE_Addr &local_sap = ACE_Addr::sap_any,
61 int reuse_addr = 0,
62 int flags = O_RDWR,
63 int perms = 0,
64 const char device[] = ACE_TLI_TCP_DEVICE,
65 struct t_info *info = 0,
66 int rw_flag = 1,
67 struct netbuf *udata = 0,
68 struct netbuf *opt = 0);
70 /**
71 * Actively connect and produce a <new_stream> if things go well.
72 * The @a remote_sap is the address that we are trying to connect
73 * with. The @a timeout is the amount of time to wait to connect.
74 * If it's 0 then we block indefinitely. If *timeout == {0, 0} then
75 * the connection is done using non-blocking mode. In this case, if
76 * the connection can't be made immediately the value of -1 is
77 * returned with @c errno == EWOULDBLOCK. If *timeout > {0, 0} then
78 * this is the maximum amount of time to wait before timing out. If the
79 * time expires before the connection is made @c errno == ETIME. The
80 * @a local_sap is the value of local address to bind to. If it's
81 * the default value of ACE_Addr::sap_any then the user is letting
82 * the OS do the binding. If @a reuse_addr == 1 then the
83 * <local_addr> is reused, even if it hasn't been cleanedup yet.
85 int connect (ACE_TLI_Stream &new_stream,
86 const ACE_Addr &remote_sap,
87 ACE_Time_Value *timeout = 0,
88 const ACE_Addr &local_sap = ACE_Addr::sap_any,
89 int reuse_addr = 0,
90 int flags = O_RDWR,
91 int perms = 0,
92 const char device[] = ACE_TLI_TCP_DEVICE,
93 struct t_info *info = 0,
94 int rw_flag = 1,
95 struct netbuf *udata = 0,
96 struct netbuf *opt = 0);
98 /**
99 * Try to complete a non-blocking connection.
100 * If connection completion is successful then @a new_stream contains
101 * the connected ACE_SOCK_Stream. If @a remote_sap is non-NULL then it
102 * will contain the address of the connected peer.
104 int complete (ACE_TLI_Stream &new_stream,
105 ACE_Addr *remote_sap,
106 ACE_Time_Value *tv);
108 /// Resets any event associations on this handle
109 int reset_new_handle (ACE_HANDLE handle);
111 // = Meta-type info
112 typedef ACE_INET_Addr PEER_ADDR;
113 typedef ACE_TLI_Stream PEER_STREAM;
115 /// Dump the state of an object.
116 void dump (void) const;
118 /// Declare the dynamic allocation hooks.
119 ACE_ALLOC_HOOK_DECLARE;
122 ACE_END_VERSIONED_NAMESPACE_DECL
124 #if defined (__ACE_INLINE__)
125 #include "ace/TLI_Connector.inl"
126 #endif /* __ACE_INLINE__ */
128 #endif /* ACE_HAS_TLI */
129 #include /**/ "ace/post.h"
130 #endif /* ACE_TLI_CONNECTOR_H */