#include <ATM_Connector.h>
Public Types | |
typedef ACE_ATM_Addr | PEER_ADDR |
typedef ACE_ATM_Stream | PEER_STREAM |
Public Member Functions | |
ACE_ATM_Connector (void) | |
Default constructor. | |
ACE_ATM_Connector (ACE_ATM_Stream &new_stream, const ACE_ATM_Addr &remote_sap, ACE_ATM_Params params=ACE_ATM_Params(), ACE_ATM_QoS options=ACE_ATM_QoS(), ACE_Time_Value *timeout=0, const ACE_ATM_Addr &local_sap=ACE_ATM_Addr("", 0), int reuse_addr=0, int flags=0, int perms=0) | |
int | connect (ACE_ATM_Stream &new_stream, const ACE_ATM_Addr &remote_sap, ACE_ATM_Params params=ACE_ATM_Params(), ACE_ATM_QoS options=ACE_ATM_QoS(), ACE_Time_Value *timeout=0, const ACE_ATM_Addr &local_sap=ACE_ATM_Addr("", 0), int reuse_addr=0, int flags=0, int perms=0) |
int | complete (ACE_ATM_Stream &new_stream, ACE_ATM_Addr *remote_sap, ACE_Time_Value *tv) |
int | add_leaf (ACE_ATM_Stream ¤t_stream, const ACE_Addr &remote_sap, ACE_ATM_QoS &qos) |
int | reset_new_handle (ACE_HANDLE handle) |
Resets any event associations on this handle. | |
void | dump (void) const |
Dump the state of an object. | |
Public Attributes | |
ACE_ALLOC_HOOK_DECLARE | |
Declare the dynamic allocation hooks. | |
Private Attributes | |
ATM_Connector | connector_ |
Definition at line 51 of file ATM_Connector.h.
|
Definition at line 147 of file ATM_Connector.h. |
|
Definition at line 148 of file ATM_Connector.h. |
|
Default constructor.
Definition at line 20 of file ATM_Connector.cpp. References ACE_TRACE.
00021 { 00022 ACE_TRACE ("ACE_ATM_Connector::ACE_ATM_Connector"); 00023 } |
|
Actively connect and produce a if things go well. The is the address that we are trying to connect with. The are the parameters needed for either socket or XTI/ATM connections. The is the amount of time to wait to connect. If it's 0 then we block indefinitely. If *timeout == {0, 0} then the connection is done using non-blocking mode. In this case, if the connection can't be made immediately the value of -1 is returned with <errno == EWOULDBLOCK>. If *timeout > {0, 0} then this is the maximum amount of time to wait before timing out. If the time expires before the connection is made <errno == ETIME>. The is the value of local address to bind to. If it's the default value of <ACE_ATM_Addr::sap_any> then the user is letting the OS do the binding. If == 1 then the is reused, even if it hasn't been cleanedup yet. Definition at line 17 of file ATM_Connector.inl. References ACE_ERROR, ACE_LIB_TEXT, ACE_TRACE, connect(), ETIME, EWOULDBLOCK, and LM_ERROR.
00026 { 00027 ACE_TRACE ("ACE_ATM_Connector::ACE_ATM_Connector"); 00028 if ((ACE_HANDLE)this->connect (new_stream, 00029 remote_sap, 00030 params, 00031 options, 00032 timeout, 00033 local_sap, 00034 reuse_addr, 00035 flags, 00036 perms) == ACE_INVALID_HANDLE 00037 && timeout != 0 && !(errno == EWOULDBLOCK || errno == ETIME)) 00038 ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), 00039 ACE_LIB_TEXT ("ACE_ATM_Stream::ACE_ATM_Stream"))); 00040 } |
|
Actively add a leaf to the root (i.e., point-to-multipoint). The is the address of the leaf that we are trying to add. Definition at line 65 of file ATM_Connector.inl. References ACE_TRACE, connector_, ACE_Addr::get_addr(), ACE_ATM_Stream::get_handle(), ACE_ATM_QoS::get_qos(), ACE_ATM_Stream::get_stream(), ACE_OS::join_leaf(), and ACE_OS::printf().
00068 { 00069 ACE_TRACE ("ACE_ATM_Connector::add_leaf"); 00070 #if defined (ACE_HAS_FORE_ATM_XTI) 00071 return connector_.add_leaf(current_stream.get_stream(), 00072 remote_sap, 00073 leaf_id, 00074 timeout); 00075 #elif defined (ACE_HAS_FORE_ATM_WS2) 00076 struct sockaddr_atm *saddr = (struct sockaddr_atm *)remote_sap.get_addr(); 00077 ACE_QoS cqos = qos.get_qos(); 00078 int addr_len = sizeof( struct sockaddr_atm ); 00079 00080 ACE_QoS_Params qos_params(0, 00081 0, 00082 &cqos, 00083 0, 00084 (JL_SENDER_ONLY)); 00085 00086 ACE_OS::printf( "ATM_Connector::add_leaf: connecting...\n" ); 00087 00088 ACE_HANDLE result = ACE_OS::join_leaf(current_stream.get_handle(), 00089 (struct sockaddr *)saddr, 00090 addr_len, 00091 qos_params); 00092 00093 if ( result == ACE_INVALID_HANDLE ) 00094 ACE_OS::printf( "ATM_Connector(add_leaf): connection failed, %d\n", 00095 ::WSAGetLastError()); 00096 00097 return (result != ACE_INVALID_HANDLE); 00098 #elif defined (ACE_HAS_LINUX_ATM) 00099 ACE_OS::printf("ATM_Connector(add_leaf): not yet implemented in Linux \n"); 00100 00101 ACE_UNUSED_ARG(current_stream); 00102 ACE_UNUSED_ARG(remote_sap); 00103 ACE_UNUSED_ARG(leaf_id); 00104 ACE_UNUSED_ARG(timeout); 00105 00106 return 0; 00107 #else 00108 ACE_UNUSED_ARG(current_stream); 00109 ACE_UNUSED_ARG(remote_sap); 00110 ACE_UNUSED_ARG(leaf_id); 00111 ACE_UNUSED_ARG(timeout); 00112 return 0; 00113 #endif 00114 } |
|
Try to complete a non-blocking connection. If connection completion is successful then contains the connected ACE_SOCK_Stream. If is non-NULL then it will contain the address of the connected peer. Definition at line 46 of file ATM_Connector.inl. References ACE_TRACE, connector_, and ACE_ATM_Stream::get_stream().
00049 { 00050 ACE_TRACE ("ACE_ATM_Connector::complete"); 00051 #if defined (ACE_HAS_ATM) 00052 return connector_.complete(new_stream.get_stream(), 00053 remote_sap, 00054 tv); 00055 #else 00056 ACE_UNUSED_ARG(new_stream); 00057 ACE_UNUSED_ARG(remote_sap); 00058 ACE_UNUSED_ARG(tv); 00059 return 0; 00060 #endif 00061 } |
|
Actively connect and produce a if things go well. The is the address that we are trying to connect with. The are the parameters needed for either socket or XTI/ATM connections. The is the amount of time to wait to connect. If it's 0 then we block indefinitely. If *timeout == {0, 0} then the connection is done using non-blocking mode. In this case, if the connection can't be made immediately the value of -1 is returned with <errno == EWOULDBLOCK>. If *timeout > {0, 0} then this is the maximum amount of time to wait before timing out. If the time expires before the connection is made <errno == ETIME>. The is the value of local address to bind to. If it's the default value of <ACE_ATM_Addr::sap_any> then the user is letting the OS do the binding. If == 1 then the is reused, even if it hasn't been cleanedup yet. Definition at line 30 of file ATM_Connector.cpp. References ACE_DEBUG, ACE_LIB_TEXT, ACE_QoS_Params, ACE_TRACE, ATM_Addr, ATM_QoS, ACE_OS::connect(), connector_, ACE_ATM_Addr::get_addr(), ACE_ATM_Params::get_device(), ACE_ATM_Stream::get_handle(), ACE_ATM_Params::get_info(), ACE_ATM_QoS::get_qos(), ACE_ATM_Params::get_rw_flag(), ACE_ATM_Stream::get_stream(), ACE_ATM_Params::get_user_data(), LM_DEBUG, ACE_OS::printf(), and ACE_OS::setsockopt(). Referenced by ACE_ATM_Connector().
00039 { 00040 ACE_TRACE ("ACE_ATM_Connector::connect"); 00041 #if defined (ACE_HAS_FORE_ATM_XTI) 00042 return connector_.connect(new_stream.get_stream(), 00043 remote_sap, 00044 timeout, 00045 local_sap, 00046 reuse_addr, 00047 flags, 00048 perms, 00049 params.get_device(), 00050 params.get_info(), 00051 params.get_rw_flag(), 00052 params.get_user_data(), 00053 &options.get_qos()); 00054 #elif defined (ACE_HAS_FORE_ATM_WS2) 00055 ACE_DEBUG(LM_DEBUG, 00056 ACE_LIB_TEXT ("ATM_Connector(connect): set QoS parameters\n" )); 00057 00058 ACE_HANDLE s = new_stream.get_handle(); 00059 struct sockaddr_atm *saddr = ( struct sockaddr_atm *)remote_sap.get_addr(); 00060 ACE_QoS cqos = options.get_qos(); 00061 00062 ACE_QoS_Params qos_params = ACE_QoS_Params(0, 00063 0, 00064 &cqos, 00065 0, 00066 0); 00067 00068 ACE_DEBUG(LM_DEBUG, 00069 ACE_LIB_TEXT ("ATM_Connector(connect): connecting...\n")); 00070 00071 int result = ACE_OS::connect( s, 00072 ( struct sockaddr *)saddr, 00073 sizeof( struct sockaddr_atm ), 00074 qos_params ); 00075 00076 if ( result != 0 ) 00077 ACE_OS::printf( "ATM_Connector(connect): connection failed, %d\n", 00078 ::WSAGetLastError()); 00079 00080 return result; 00081 #elif defined (ACE_HAS_LINUX_ATM) 00082 ACE_UNUSED_ARG (params); 00083 ACE_UNUSED_ARG (timeout); 00084 ACE_UNUSED_ARG (reuse_addr); 00085 ACE_UNUSED_ARG (perms); 00086 ACE_UNUSED_ARG (flags); 00087 00088 ACE_HANDLE handle = new_stream.get_handle(); 00089 ATM_QoS qos =options.get_qos(); 00090 ATM_Addr *local_addr=(ATM_Addr*)local_sap.get_addr(), 00091 *remote_addr=(ATM_Addr*)remote_sap.get_addr(); 00092 00093 if (ACE_OS::setsockopt(handle, 00094 SOL_ATM, 00095 SO_ATMSAP, 00096 reinterpret_cast<char*> (&(local_addr->atmsap)), 00097 sizeof(local_addr->atmsap)) < 0) { 00098 ACE_OS::printf( "ATM_Connector(connect): unable to set atmsap %d\nContinuing...", 00099 errno); 00100 } 00101 if (ACE_OS::setsockopt(handle, 00102 SOL_ATM, 00103 SO_ATMQOS, 00104 reinterpret_cast<char*> (&qos), 00105 sizeof(qos)) < 0) { 00106 ACE_DEBUG((LM_DEBUG,ACE_LIB_TEXT ("ATM_Connector(connect): unable to set qos %d\n"), 00107 errno)); 00108 return -1; 00109 } 00110 00111 int result = ACE_OS::connect(handle, 00112 (struct sockaddr *)&(remote_addr->sockaddratmsvc), 00113 sizeof( remote_addr->sockaddratmsvc)); 00114 00115 if ( result != 0 ) 00116 ACE_DEBUG(LM_DEBUG, 00117 ACE_LIB_TEXT ("ATM_Connector(connect): connection failed, %d\n"), 00118 errno); 00119 00120 return result; 00121 #else 00122 ACE_UNUSED_ARG (new_stream); 00123 ACE_UNUSED_ARG (remote_sap); 00124 ACE_UNUSED_ARG (params); 00125 ACE_UNUSED_ARG (options); 00126 ACE_UNUSED_ARG (timeout); 00127 ACE_UNUSED_ARG (local_sap); 00128 ACE_UNUSED_ARG (reuse_addr); 00129 ACE_UNUSED_ARG (flags); 00130 ACE_UNUSED_ARG (perms); 00131 return 0; 00132 #endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ 00133 } |
|
Dump the state of an object.
Definition at line 9 of file ATM_Connector.inl. References ACE_TRACE.
00010 { 00011 #if defined (ACE_HAS_DUMP) 00012 ACE_TRACE ("ACE_ATM_Connector::dump"); 00013 #endif /* ACE_HAS_DUMP */ 00014 } |
|
Resets any event associations on this handle.
Definition at line 118 of file ATM_Connector.inl. References WSAEventSelect().
00119 { 00120 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) 00121 // Reset the event association 00122 return ::WSAEventSelect ((SOCKET) handle, 00123 0, 00124 0); 00125 #else /* !defined ACE_HAS_WINSOCK2 */ 00126 ACE_UNUSED_ARG (handle); 00127 return 0; 00128 #endif /* ACE_WIN32 */ 00129 } |
|
Declare the dynamic allocation hooks.
Definition at line 154 of file ATM_Connector.h. |
|
Definition at line 157 of file ATM_Connector.h. Referenced by add_leaf(), complete(), and connect(). |