Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ATM_Connector.i

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 // $Id: ATM_Connector.i,v 1.1.1.4 2003/02/21 18:36:32 chad Exp $
00003 
00004 // ATM_Connector.i
00005 
00006 ACE_INLINE
00007 ACE_ATM_Connector::ACE_ATM_Connector (ACE_ATM_Stream &new_stream, 
00008                                       const ACE_ATM_Addr &remote_sap, 
00009                                       ACE_ATM_Params params,
00010                                       ACE_ATM_QoS options,
00011                                       ACE_Time_Value *timeout,
00012                                       const ACE_ATM_Addr &local_sap, 
00013                                       int reuse_addr, 
00014                                       int flags,
00015                                       int perms)
00016 {
00017   ACE_TRACE ("ACE_ATM_Connector::ACE_ATM_Connector");
00018   if ((ACE_HANDLE)this->connect (new_stream,
00019                                  remote_sap,
00020                                  params,
00021                                  options,
00022                                  timeout,
00023                                  local_sap,
00024                                  reuse_addr, 
00025                                  flags,
00026                                  perms) == ACE_INVALID_HANDLE
00027       && timeout != 0 && !(errno == EWOULDBLOCK || errno == ETIME))
00028     ACE_ERROR ((LM_ERROR,  ACE_LIB_TEXT ("%p\n"),  
00029                 ACE_LIB_TEXT ("ACE_ATM_Stream::ACE_ATM_Stream")));
00030 }
00031 
00032 // Try to complete a non-blocking connection.
00033 
00034 ACE_INLINE
00035 int
00036 ACE_ATM_Connector::complete (ACE_ATM_Stream &new_stream, 
00037                              ACE_ATM_Addr *remote_sap,
00038                              ACE_Time_Value *tv)
00039 {
00040   ACE_TRACE ("ACE_ATM_Connector::complete");
00041 #if defined (ACE_HAS_ATM)
00042   return connector_.complete(new_stream.get_stream(),
00043                              remote_sap,
00044                              tv);
00045 #else
00046   ACE_UNUSED_ARG(new_stream);
00047   ACE_UNUSED_ARG(remote_sap);
00048   ACE_UNUSED_ARG(tv);
00049   return 0;
00050 #endif
00051 }
00052 
00053 ACE_INLINE
00054 int
00055 ACE_ATM_Connector::add_leaf (ACE_ATM_Stream &current_stream,
00056                              const ACE_Addr &remote_sap,
00057                              ACE_ATM_QoS &qos)
00058 {
00059   ACE_TRACE ("ACE_ATM_Connector::add_leaf");
00060 #if defined (ACE_HAS_FORE_ATM_XTI)
00061   return connector_.add_leaf(current_stream.get_stream(),
00062                              remote_sap,
00063                              leaf_id,
00064                              timeout);
00065 #elif defined (ACE_HAS_FORE_ATM_WS2)
00066   struct sockaddr_atm *saddr = (struct sockaddr_atm *)remote_sap.get_addr();
00067   ACE_QoS cqos = qos.get_qos();
00068   int addr_len = sizeof( struct sockaddr_atm );
00069 
00070   ACE_QoS_Params qos_params(0,
00071                             0,
00072                             &cqos,
00073                             0,
00074                             (JL_SENDER_ONLY));
00075  
00076   ACE_OS::printf( "ATM_Connector::add_leaf: connecting...\n" );
00077 
00078   ACE_HANDLE result = ACE_OS::join_leaf(current_stream.get_handle(),
00079                                         (struct sockaddr *)saddr, 
00080                                         addr_len,
00081                                         qos_params);
00082   
00083   if ( result == ACE_INVALID_HANDLE ) 
00084     ACE_OS::printf( "ATM_Connector(add_leaf): connection failed, %d\n", 
00085                     ::WSAGetLastError());
00086   
00087   return (result != ACE_INVALID_HANDLE);
00088 #elif defined (ACE_HAS_LINUX_ATM)
00089   ACE_OS::printf("ATM_Connector(add_leaf): not yet implemented in Linux \n");
00090 
00091   ACE_UNUSED_ARG(current_stream);
00092   ACE_UNUSED_ARG(remote_sap);
00093   ACE_UNUSED_ARG(leaf_id);
00094   ACE_UNUSED_ARG(timeout);
00095 
00096   return 0;
00097 #else
00098   ACE_UNUSED_ARG(current_stream);
00099   ACE_UNUSED_ARG(remote_sap);
00100   ACE_UNUSED_ARG(leaf_id);
00101   ACE_UNUSED_ARG(timeout);
00102   return 0;
00103 #endif
00104 }
00105 
00106 ACE_INLINE
00107 int
00108 ACE_ATM_Connector::reset_new_handle (ACE_HANDLE handle)
00109 {
00110 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00111   // Reset the event association 
00112   return ::WSAEventSelect ((SOCKET) handle,
00113                            0,
00114                            0);    
00115 #else /* !defined ACE_HAS_WINSOCK2 */
00116   ACE_UNUSED_ARG (handle);
00117   return 0;
00118 #endif /* ACE_WIN32 */
00119 }
00120 

Generated on Mon Jun 16 11:19:08 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002