Use override/default for RTPortableServer
[ACE_TAO.git] / ACE / ace / OS_NS_stropts.cpp
bloba3360172787d46bd940d6e74d81316df8f68e5a3
1 #include "ace/OS_NS_stropts.h"
3 #if !defined (ACE_HAS_INLINED_OSCALLS)
4 # include "ace/OS_NS_stropts.inl"
5 #endif /* ACE_HAS_INLINED_OSCALLS */
7 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
9 int
10 ACE_OS::ioctl (ACE_HANDLE socket,
11 unsigned long io_control_code,
12 void *in_buffer_p,
13 unsigned long in_buffer,
14 void *out_buffer_p,
15 unsigned long out_buffer,
16 unsigned long *bytes_returned,
17 ACE_OVERLAPPED *overlapped,
18 ACE_OVERLAPPED_COMPLETION_FUNC func)
20 # if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
21 ACE_SOCKCALL_RETURN (::WSAIoctl ((ACE_SOCKET) socket,
22 io_control_code,
23 in_buffer_p,
24 in_buffer,
25 out_buffer_p,
26 out_buffer,
27 bytes_returned,
28 (WSAOVERLAPPED *) overlapped,
29 func),
30 int,
31 SOCKET_ERROR);
32 # else
33 ACE_UNUSED_ARG (socket);
34 ACE_UNUSED_ARG (io_control_code);
35 ACE_UNUSED_ARG (in_buffer_p);
36 ACE_UNUSED_ARG (in_buffer);
37 ACE_UNUSED_ARG (out_buffer_p);
38 ACE_UNUSED_ARG (out_buffer);
39 ACE_UNUSED_ARG (bytes_returned);
40 ACE_UNUSED_ARG (overlapped);
41 ACE_UNUSED_ARG (func);
42 ACE_NOTSUP_RETURN (-1);
43 # endif /* ACE_HAS_WINSOCK2 */
46 int
47 ACE_OS::ioctl (ACE_HANDLE socket,
48 unsigned long io_control_code,
49 ACE_QoS &ace_qos,
50 unsigned long *bytes_returned,
51 void *buffer_p,
52 unsigned long buffer,
53 ACE_OVERLAPPED *overlapped,
54 ACE_OVERLAPPED_COMPLETION_FUNC func)
56 # if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
57 if (io_control_code == SIO_SET_QOS)
59 QOS qos;
60 unsigned long qos_len = sizeof (QOS);
62 qos.SendingFlowspec = *(ace_qos.sending_flowspec ());
63 qos.ReceivingFlowspec = *(ace_qos.receiving_flowspec ());
64 qos.ProviderSpecific = (WSABUF) ace_qos.provider_specific ();
66 qos_len += ace_qos.provider_specific ().iov_len;
68 ACE_SOCKCALL_RETURN (::WSAIoctl ((ACE_SOCKET) socket,
69 io_control_code,
70 &qos,
71 qos_len,
72 buffer_p,
73 buffer,
74 bytes_returned,
75 (WSAOVERLAPPED *) overlapped,
76 func),
77 int,
78 SOCKET_ERROR);
80 else
82 unsigned long dwBufferLen = 0;
84 // Query for the buffer size.
85 int result = ::WSAIoctl ((ACE_SOCKET) socket,
86 io_control_code,
89 &dwBufferLen,
90 sizeof (dwBufferLen),
91 bytes_returned,
93 0);
96 if (result == SOCKET_ERROR)
98 unsigned long dwErr = ::WSAGetLastError ();
100 if (dwErr == WSAEWOULDBLOCK)
102 errno = dwErr;
103 return -1;
105 else
106 if (dwErr != WSAENOBUFS)
108 errno = dwErr;
109 return -1;
113 char *qos_buf = 0;
114 ACE_NEW_RETURN (qos_buf,
115 char [dwBufferLen],
116 -1);
118 QOS *qos = reinterpret_cast<QOS*> (qos_buf);
120 result = ::WSAIoctl ((ACE_SOCKET) socket,
121 io_control_code,
124 qos,
125 dwBufferLen,
126 bytes_returned,
130 if (result == SOCKET_ERROR)
131 return result;
133 ACE_Flow_Spec sending_flowspec (qos->SendingFlowspec.TokenRate,
134 qos->SendingFlowspec.TokenBucketSize,
135 qos->SendingFlowspec.PeakBandwidth,
136 qos->SendingFlowspec.Latency,
137 qos->SendingFlowspec.DelayVariation,
138 # if defined(ACE_HAS_WINSOCK2_GQOS)
139 qos->SendingFlowspec.ServiceType,
140 qos->SendingFlowspec.MaxSduSize,
141 qos->SendingFlowspec.MinimumPolicedSize,
142 # else /* ACE_HAS_WINSOCK2_GQOS */
146 # endif /* ACE_HAS_WINSOCK2_GQOS */
150 ACE_Flow_Spec receiving_flowspec (qos->ReceivingFlowspec.TokenRate,
151 qos->ReceivingFlowspec.TokenBucketSize,
152 qos->ReceivingFlowspec.PeakBandwidth,
153 qos->ReceivingFlowspec.Latency,
154 qos->ReceivingFlowspec.DelayVariation,
155 # if defined(ACE_HAS_WINSOCK2_GQOS)
156 qos->ReceivingFlowspec.ServiceType,
157 qos->ReceivingFlowspec.MaxSduSize,
158 qos->ReceivingFlowspec.MinimumPolicedSize,
159 # else /* ACE_HAS_WINSOCK2_GQOS */
163 # endif /* ACE_HAS_WINSOCK2_GQOS */
167 ace_qos.sending_flowspec (&sending_flowspec);
168 ace_qos.receiving_flowspec (&receiving_flowspec);
169 ace_qos.provider_specific (*((struct iovec *) (&qos->ProviderSpecific)));
172 return result;
175 # else
176 ACE_UNUSED_ARG (socket);
177 ACE_UNUSED_ARG (io_control_code);
178 ACE_UNUSED_ARG (ace_qos);
179 ACE_UNUSED_ARG (bytes_returned);
180 ACE_UNUSED_ARG (buffer_p);
181 ACE_UNUSED_ARG (buffer);
182 ACE_UNUSED_ARG (overlapped);
183 ACE_UNUSED_ARG (func);
184 ACE_NOTSUP_RETURN (-1);
185 # endif /* ACE_HAS_WINSOCK2 */
188 ACE_END_VERSIONED_NAMESPACE_DECL