Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / ace / ATM_Stream.inl
blob70403bab9a93b6ea0a1a321d1e5a8b3520eae15d
1 // -*- C++ -*-
2 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
4 ACE_INLINE void
5 ACE_ATM_Stream::dump () const
7 #if defined (ACE_HAS_DUMP)
8   ACE_TRACE ("ACE_ATM_Stream::dump");
9 #endif /* ACE_HAS_DUMP */
12 ACE_INLINE
13 ACE_ATM_Stream::ACE_ATM_Stream ()
15   ACE_TRACE ("ACE_ATM_Stream::ACE_ATM_Stream");
18 ACE_INLINE
19 int
20 ACE_ATM_Stream::open (ACE_ATM_Params params)
22   ACE_TRACE ("ACE_ATM_Stream::open");
23 #if defined (ACE_HAS_FORE_ATM_XTI)
24   ACE_HANDLE handle = stream_.open (params.get_device(),
25                                     params.get_oflag(),
26                                     params.get_info());
27   return (handle == ACE_INVALID_HANDLE ? -1 : 0);
28 #elif defined (ACE_HAS_FORE_ATM_WS2)
29   params.set_flags( ACE_FLAG_MULTIPOINT_C_ROOT | ACE_FLAG_MULTIPOINT_D_ROOT );
31   int retval = stream_.open (params.get_type(),
32                              params.get_protocol_family(),
33                              params.get_protocol(),
34                              params.get_protocol_info(),
35                              params.get_sock_group(),
36                              params.get_flags(),
37                              params.get_reuse_addr());
38   if (retval == -1)
39     return -1;
41   struct sockaddr_atm sock_addr;
43   ACE_OS::memset(&sock_addr, 0, sizeof(struct sockaddr_atm));
44   sock_addr.satm_family = AF_ATM;
45   sock_addr.satm_number.AddressType=ADDR_ANY;
46   sock_addr.satm_number.NumofDigits = ATM_ADDR_SIZE;
47   sock_addr.satm_blli.Layer2Protocol = SAP_FIELD_ABSENT;
48   sock_addr.satm_blli.Layer3Protocol = SAP_FIELD_ABSENT;
49   sock_addr.satm_bhli.HighLayerInfoType = SAP_FIELD_ABSENT;
50   if (ACE_OS::bind(get_handle(),
51                    (struct sockaddr FAR *)&sock_addr,
52                    sizeof(struct sockaddr_atm)) < 0)
53     {
54       ACE_OS::printf("Error binding local address: %d",WSAGetLastError());
55       return -1;
56     }
58   return 0;
59 #else
60   ACE_UNUSED_ARG(params);
61   return 0;
62 #endif /* ACE_HAS_FORE_ATM_XTI */
65 ACE_INLINE
66 int
67 ACE_ATM_Stream::close ()
69   ACE_TRACE ("ACE_ATM_Stream::close");
70 #if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2)
71   return stream_.close ();
72 #else
73   return 0;
74 #endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */
77 ACE_INLINE
78 ATM_Stream&
79 ACE_ATM_Stream::get_stream ()
81   ACE_TRACE ("ACE_ATM_Stream::get_stream");
82   return stream_;
85 ACE_INLINE
86 ssize_t
87 ACE_ATM_Stream::recv (void *buf,
88                       size_t n,
89                       int *flags) const
91   ACE_TRACE ("ACE_ATM_Stream::recv");
92 #if defined (ACE_HAS_FORE_ATM_XTI)
93   return stream_.recv (buf,
94                        n,
95                        flags);
96 #elif defined (ACE_HAS_FORE_ATM_WS2)
97   return stream_.recv (buf,
98                        n);
99 #else
100   ACE_UNUSED_ARG(buf);
101   ACE_UNUSED_ARG(n);
102   ACE_UNUSED_ARG(flags);
103   return 0;
104 #endif /* ACE_HAS_FORE_ATM_XTI */
107 ACE_INLINE
108 ssize_t
109 ACE_ATM_Stream::send_n (const void *buf,
110                         size_t n,
111                         int flags) const
113   ACE_TRACE ("ACE_ATM_Stream::send_n");
114 #if defined (ACE_HAS_FORE_ATM_XTI)
115   return stream_.send_n (buf,
116                          n,
117                          flags);
118 #elif defined (ACE_HAS_FORE_ATM_WS2)
119   return stream_.send_n (buf,
120                          n,
121                          flags);
122 #else
123   ACE_UNUSED_ARG(buf);
124   ACE_UNUSED_ARG(n);
125   ACE_UNUSED_ARG(flags);
126   return 0;
127 #endif /* ACE_HAS_FORE_ATM_XTI */
130 ACE_END_VERSIONED_NAMESPACE_DECL