00001 /* -*- C++ -*- */ 00002 00003 //============================================================================= 00004 /** 00005 * @file TLI_Connector.h 00006 * 00007 * $Id: TLI_Connector.h,v 1.1.1.3 2001/12/04 14:33:10 chad Exp $ 00008 * 00009 * @author Doug Schmidt 00010 */ 00011 //============================================================================= 00012 00013 00014 #ifndef ACE_TLI_CONNECTOR_H 00015 #define ACE_TLI_CONNECTOR_H 00016 #include "ace/pre.h" 00017 00018 #include "ace/TLI_Stream.h" 00019 #include "ace/Log_Msg.h" 00020 00021 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00022 # pragma once 00023 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00024 00025 #if defined (ACE_HAS_TLI) 00026 00027 /** 00028 * @class ACE_TLI_Connector 00029 * 00030 * @brief Defines an active connection factory for the ACE_TLI C++ 00031 * wrappers. 00032 */ 00033 class ACE_Export ACE_TLI_Connector 00034 { 00035 public: 00036 // = Initialization methods. 00037 /// Default constructor. 00038 ACE_TLI_Connector (void); 00039 00040 /** 00041 * Actively connect and produce a <new_stream> if things go well. 00042 * The <remote_sap> is the address that we are trying to connect 00043 * with. The <timeout> is the amount of time to wait to connect. 00044 * If it's 0 then we block indefinitely. If *timeout == {0, 0} then 00045 * the connection is done using non-blocking mode. In this case, if 00046 * the connection can't be made immediately the value of -1 is 00047 * returned with <errno == EWOULDBLOCK>. If *timeout > {0, 0} then 00048 * this is the maximum amount of time to wait before timing out. If the 00049 * time expires before the connection is made <errno == ETIME>. The 00050 * <local_sap> is the value of local address to bind to. If it's 00051 * the default value of <ACE_Addr::sap_any> then the user is letting 00052 * the OS do the binding. If <reuse_addr> == 1 then the 00053 * <local_addr> is reused, even if it hasn't been cleanedup yet. 00054 */ 00055 ACE_TLI_Connector (ACE_TLI_Stream &new_stream, 00056 const ACE_Addr &remote_sap, 00057 ACE_Time_Value *timeout = 0, 00058 const ACE_Addr &local_sap = ACE_Addr::sap_any, 00059 int reuse_addr = 0, 00060 int flags = O_RDWR, 00061 int perms = 0, 00062 const char device[] = ACE_TLI_TCP_DEVICE, 00063 struct t_info *info = 0, 00064 int rw_flag = 1, 00065 struct netbuf *udata = 0, 00066 struct netbuf *opt = 0); 00067 00068 /** 00069 * Actively connect and produce a <new_stream> if things go well. 00070 * The <remote_sap> is the address that we are trying to connect 00071 * with. The <timeout> is the amount of time to wait to connect. 00072 * If it's 0 then we block indefinitely. If *timeout == {0, 0} then 00073 * the connection is done using non-blocking mode. In this case, if 00074 * the connection can't be made immediately the value of -1 is 00075 * returned with <errno == EWOULDBLOCK>. If *timeout > {0, 0} then 00076 * this is the maximum amount of time to wait before timing out. If the 00077 * time expires before the connection is made <errno == ETIME>. The 00078 * <local_sap> is the value of local address to bind to. If it's 00079 * the default value of <ACE_Addr::sap_any> then the user is letting 00080 * the OS do the binding. If <reuse_addr> == 1 then the 00081 * <local_addr> is reused, even if it hasn't been cleanedup yet. 00082 */ 00083 int connect (ACE_TLI_Stream &new_stream, 00084 const ACE_Addr &remote_sap, 00085 ACE_Time_Value *timeout = 0, 00086 const ACE_Addr &local_sap = ACE_Addr::sap_any, 00087 int reuse_addr = 0, 00088 int flags = O_RDWR, 00089 int perms = 0, 00090 const char device[] = ACE_TLI_TCP_DEVICE, 00091 struct t_info *info = 0, 00092 int rw_flag = 1, 00093 struct netbuf *udata = 0, 00094 struct netbuf *opt = 0); 00095 00096 /** 00097 * Try to complete a non-blocking connection. 00098 * If connection completion is successful then <new_stream> contains 00099 * the connected ACE_SOCK_Stream. If <remote_sap> is non-NULL then it 00100 * will contain the address of the connected peer. 00101 */ 00102 int complete (ACE_TLI_Stream &new_stream, 00103 ACE_Addr *remote_sap, 00104 ACE_Time_Value *tv); 00105 00106 /// Resets any event associations on this handle 00107 int reset_new_handle (ACE_HANDLE handle); 00108 00109 // = Meta-type info 00110 typedef ACE_INET_Addr PEER_ADDR; 00111 typedef ACE_TLI_Stream PEER_STREAM; 00112 00113 /// Dump the state of an object. 00114 void dump (void) const; 00115 00116 /// Declare the dynamic allocation hooks. 00117 ACE_ALLOC_HOOK_DECLARE; 00118 }; 00119 00120 #if defined (__ACE_INLINE__) 00121 #include "ace/TLI_Connector.i" 00122 #endif /* __ACE_INLINE__ */ 00123 00124 #endif /* ACE_HAS_TLI */ 00125 #include "ace/post.h" 00126 #endif /* ACE_TLI_CONNECTOR_H */
1.2.14 written by Dimitri van Heesch,
© 1997-2002