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

ATM_Stream.i

Go to the documentation of this file.
00001 // $Id: ATM_Stream.i,v 1.1.1.2 2001/12/04 14:32:58 chad Exp $
00002 
00003 // ATM_Stream.i
00004 
00005 #include "ace/ATM_Stream.h"
00006 
00007 ACE_INLINE
00008 ACE_ATM_Stream::ACE_ATM_Stream (void)
00009 {
00010   ACE_TRACE ("ACE_ATM_Stream::ACE_ATM_Stream");
00011 }
00012 
00013 ACE_INLINE
00014 int
00015 ACE_ATM_Stream::open (ACE_ATM_Params params)
00016 {
00017   ACE_TRACE ("ACE_ATM_Stream::open");
00018 #if defined (ACE_HAS_FORE_ATM_XTI)
00019   ACE_HANDLE handle = stream_.open (params.get_device(),
00020                                     params.get_oflag(),
00021                                     params.get_info());
00022   return (handle == ACE_INVALID_HANDLE ? -1 : 0);
00023 #elif defined (ACE_HAS_FORE_ATM_WS2)
00024   params.set_flags( ACE_FLAG_MULTIPOINT_C_ROOT | ACE_FLAG_MULTIPOINT_D_ROOT );
00025 
00026   int retval = stream_.open (params.get_type(),
00027                              params.get_protocol_family(),
00028                              params.get_protocol(),
00029                              params.get_protocol_info(),
00030                              params.get_sock_group(),
00031                              params.get_flags(),
00032                              params.get_reuse_addr());
00033   if (retval == -1)
00034     return -1;
00035 
00036   struct sockaddr_atm sock_addr;
00037 
00038   ACE_OS::memset(&sock_addr, 0, sizeof(struct sockaddr_atm));
00039   sock_addr.satm_family = AF_ATM;
00040   sock_addr.satm_number.AddressType=ADDR_ANY;
00041   sock_addr.satm_number.NumofDigits = ATM_ADDR_SIZE;
00042   sock_addr.satm_blli.Layer2Protocol = SAP_FIELD_ABSENT;
00043   sock_addr.satm_blli.Layer3Protocol = SAP_FIELD_ABSENT;
00044   sock_addr.satm_bhli.HighLayerInfoType = SAP_FIELD_ABSENT;
00045   if (ACE_OS::bind(get_handle(),
00046                    (struct sockaddr FAR *)&sock_addr,
00047                    sizeof(struct sockaddr_atm)) < 0)
00048     {
00049       ACE_OS::printf("Error binding local address: %d",WSAGetLastError());
00050       return -1;
00051     }
00052 
00053   return 0;
00054 #else
00055   ACE_UNUSED_ARG(params);
00056   return 0;
00057 #endif /* ACE_HAS_FORE_ATM_XTI */
00058 }
00059 
00060 ACE_INLINE
00061 int
00062 ACE_ATM_Stream::close (void)
00063 {
00064   ACE_TRACE ("ACE_ATM_Stream::close");
00065 #if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2)
00066   return stream_.close ();
00067 #else
00068   return 0;
00069 #endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */
00070 }
00071 
00072 ACE_INLINE
00073 ATM_Stream&
00074 ACE_ATM_Stream::get_stream (void)
00075 {
00076   ACE_TRACE ("ACE_ATM_Stream::get_stream");
00077   return stream_;
00078 }
00079 
00080 ACE_INLINE
00081 ssize_t
00082 ACE_ATM_Stream::recv (void *buf,
00083                       size_t n,
00084                       int *flags) const
00085 {
00086   ACE_TRACE ("ACE_ATM_Stream::recv");
00087 #if defined (ACE_HAS_FORE_ATM_XTI)
00088   return stream_.recv (buf,
00089                        n,
00090                        flags);
00091 #elif defined (ACE_HAS_FORE_ATM_WS2)
00092   return stream_.recv (buf,
00093                        n);
00094 #else
00095   ACE_UNUSED_ARG(buf);
00096   ACE_UNUSED_ARG(n);
00097   ACE_UNUSED_ARG(flags);
00098   return (0);
00099 #endif /* ACE_HAS_FORE_ATM_XTI */
00100 }
00101 
00102 ACE_INLINE
00103 ssize_t
00104 ACE_ATM_Stream::send_n (const void *buf,
00105                         size_t n,
00106                         int flags) const
00107 {
00108   ACE_TRACE ("ACE_ATM_Stream::send_n");
00109 #if defined (ACE_HAS_FORE_ATM_XTI)
00110   return stream_.send_n (buf,
00111                          n,
00112                          flags);
00113 #elif defined (ACE_HAS_FORE_ATM_WS2)
00114   return stream_.send_n (buf,
00115                          n,
00116                          flags);
00117 #else
00118   ACE_UNUSED_ARG(buf);
00119   ACE_UNUSED_ARG(n);
00120   ACE_UNUSED_ARG(flags);
00121   return (0);
00122 #endif /* ACE_HAS_FORE_ATM_XTI */
00123 }
00124 

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