00001 /* -*- C++ -*- */ 00002 00003 //============================================================================= 00004 /** 00005 * @file ATM_Connector.h 00006 * 00007 * $Id: ATM_Connector.h,v 1.1.1.4 2003/02/21 18:36:32 chad Exp $ 00008 * 00009 * @author Joe Hoffert <joeh@cs.wustl.edu> 00010 */ 00011 //============================================================================= 00012 00013 #ifndef ACE_ATM_CONNECTOR_H 00014 #define ACE_ATM_CONNECTOR_H 00015 #include "ace/pre.h" 00016 00017 #include "ace/config-all.h" 00018 00019 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00020 # pragma once 00021 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00022 00023 #if defined (ACE_HAS_ATM) 00024 00025 #include "ace/ATM_Stream.h" 00026 #include "ace/ATM_Params.h" 00027 #include "ace/ATM_QoS.h" 00028 00029 #if defined (ACE_WIN32) || defined (ACE_HAS_LINUX_ATM) 00030 #include "SOCK_Connector.h" 00031 typedef ACE_SOCK_Connector ATM_Connector; 00032 #else 00033 #include "XTI_ATM_Mcast.h" 00034 typedef ACE_XTI_ATM_Mcast ATM_Connector; 00035 #endif 00036 00037 /** 00038 * @class ACE_ATM_Connector 00039 * 00040 * @brief Defines an active connection factory for the ACE_ATM C++ 00041 * wrappers. 00042 */ 00043 class ACE_Export ACE_ATM_Connector 00044 { 00045 public: 00046 // = Initialization methods. 00047 /// Default constructor. 00048 ACE_ATM_Connector (void); 00049 00050 /** 00051 * Actively connect and produce a <new_stream> if things go well. 00052 * The <remote_sap> is the address that we are trying to connect 00053 * with. The <params> are the parameters needed for either socket 00054 * or XTI/ATM connections. The <timeout> is the amount of time to 00055 * wait to connect. If it's 0 then we block indefinitely. If 00056 * *timeout == {0, 0} then the connection is done using non-blocking 00057 * mode. In this case, if the connection can't be made immediately 00058 * the value of -1 is returned with <errno == EWOULDBLOCK>. If 00059 * *timeout > {0, 0} then this is the maximum amount of time to wait before 00060 * timing out. If the time expires before the connection is made 00061 * <errno == ETIME>. The <local_sap> is the value of local address 00062 * to bind to. If it's the default value of <ACE_ATM_Addr::sap_any> then 00063 * the user is letting the OS do the binding. If <reuse_addr> == 1 00064 * then the <local_addr> is reused, even if it hasn't been cleanedup yet. 00065 */ 00066 ACE_ATM_Connector (ACE_ATM_Stream &new_stream, 00067 const ACE_ATM_Addr &remote_sap, 00068 ACE_ATM_Params params = ACE_ATM_Params(), 00069 ACE_ATM_QoS options = ACE_ATM_QoS(), 00070 ACE_Time_Value *timeout = 0, 00071 const ACE_ATM_Addr &local_sap = ACE_ATM_Addr( "", 0 ), 00072 int reuse_addr = 0, 00073 #if defined (ACE_WIN32) 00074 int flags = 0, 00075 #else 00076 int flags = O_RDWR, 00077 #endif /* ACE_WIN32 */ 00078 int perms = 0); 00079 00080 /** 00081 * Actively connect and produce a <new_stream> if things go well. 00082 * The <remote_sap> is the address that we are trying to connect 00083 * with. The <params> are the parameters needed for either socket 00084 * or XTI/ATM connections. The <timeout> is the amount of time to 00085 * wait to connect. If it's 0 then we block indefinitely. If 00086 * *timeout == {0, 0} then the connection is done using non-blocking 00087 * mode. In this case, if the connection can't be made immediately 00088 * the value of -1 is returned with <errno == EWOULDBLOCK>. If 00089 * *timeout > {0, 0} then this is the maximum amount of time to wait before 00090 * timing out. If the time expires before the connection is made 00091 * <errno == ETIME>. The <local_sap> is the value of local address 00092 * to bind to. If it's the default value of <ACE_ATM_Addr::sap_any> then 00093 * the user is letting the OS do the binding. If <reuse_addr> == 1 00094 * then the <local_addr> is reused, even if it hasn't been cleanedup yet. 00095 */ 00096 int connect (ACE_ATM_Stream &new_stream, 00097 const ACE_ATM_Addr &remote_sap, 00098 ACE_ATM_Params params = ACE_ATM_Params(), 00099 ACE_ATM_QoS options = ACE_ATM_QoS(), 00100 ACE_Time_Value *timeout = 0, 00101 const ACE_ATM_Addr &local_sap = ACE_ATM_Addr( "", 00102 0 ), 00103 int reuse_addr = 0, 00104 #if defined (ACE_WIN32) 00105 int flags = 0, 00106 #else 00107 int flags = O_RDWR, 00108 #endif /* ACE_WIN32 */ 00109 int perms = 0); 00110 00111 /** 00112 * Try to complete a non-blocking connection. 00113 * If connection completion is successful then <new_stream> contains 00114 * the connected ACE_SOCK_Stream. If <remote_sap> is non-NULL then it 00115 * will contain the address of the connected peer. 00116 */ 00117 int complete (ACE_ATM_Stream &new_stream, 00118 ACE_ATM_Addr *remote_sap, 00119 ACE_Time_Value *tv); 00120 00121 //int add_leaf (ACE_ATM_Stream ¤t_stream, 00122 // const ACE_Addr &remote_sap, 00123 // ACE_INT32 leaf_id, 00124 // ACE_Time_Value *timeout = 0); 00125 00126 /** 00127 * Actively add a leaf to the root (i.e., point-to-multipoint). The 00128 * <remote_sap> is the address of the leaf that we 00129 * are trying to add. 00130 */ 00131 int add_leaf (ACE_ATM_Stream ¤t_stream, 00132 const ACE_Addr &remote_sap, 00133 ACE_ATM_QoS &qos); 00134 00135 /// Resets any event associations on this handle 00136 int reset_new_handle (ACE_HANDLE handle); 00137 00138 // = Meta-type info 00139 typedef ACE_ATM_Addr PEER_ADDR; 00140 typedef ACE_ATM_Stream PEER_STREAM; 00141 00142 /// Dump the state of an object. 00143 void dump (void) const; 00144 00145 /// Declare the dynamic allocation hooks. 00146 ACE_ALLOC_HOOK_DECLARE; 00147 00148 private: 00149 ATM_Connector connector_; 00150 }; 00151 00152 #if defined (__ACE_INLINE__) 00153 #include "ace/ATM_Connector.i" 00154 #endif /* __ACE_INLINE__ */ 00155 00156 #endif /* ACE_HAS_ATM */ 00157 #include "ace/post.h" 00158 #endif /* ACE_ATM_CONNECTOR_H */
1.2.14 written by Dimitri van Heesch,
© 1997-2002