avicap32: Use the Unix call helpers.
[wine.git] / include / wine / afd.h
blob788adb4a495722d271c03b3535d4f4cf900b40ac
1 /*
2 * Socket driver ioctls
4 * Copyright 2020 Zebediah Figura for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __WINE_WINE_AFD_H
22 #define __WINE_WINE_AFD_H
24 #include <winternl.h>
25 #include <winioctl.h>
26 #include <mswsock.h>
28 struct afd_wsabuf_32
30 UINT len;
31 UINT buf;
34 #ifdef USE_WS_PREFIX
35 # define WS(x) WS_##x
36 #else
37 # define WS(x) x
38 #endif
40 #define IOCTL_AFD_BIND CTL_CODE(FILE_DEVICE_BEEP, 0x800, METHOD_NEITHER, FILE_ANY_ACCESS)
41 #define IOCTL_AFD_LISTEN CTL_CODE(FILE_DEVICE_BEEP, 0x802, METHOD_NEITHER, FILE_ANY_ACCESS)
42 #define IOCTL_AFD_RECV CTL_CODE(FILE_DEVICE_BEEP, 0x805, METHOD_NEITHER, FILE_ANY_ACCESS)
43 #define IOCTL_AFD_POLL CTL_CODE(FILE_DEVICE_BEEP, 0x809, METHOD_BUFFERED, FILE_ANY_ACCESS)
44 #define IOCTL_AFD_GETSOCKNAME CTL_CODE(FILE_DEVICE_BEEP, 0x80b, METHOD_NEITHER, FILE_ANY_ACCESS)
45 #define IOCTL_AFD_EVENT_SELECT CTL_CODE(FILE_DEVICE_BEEP, 0x821, METHOD_NEITHER, FILE_ANY_ACCESS)
46 #define IOCTL_AFD_GET_EVENTS CTL_CODE(FILE_DEVICE_BEEP, 0x822, METHOD_NEITHER, FILE_ANY_ACCESS)
48 enum afd_poll_bit
50 AFD_POLL_BIT_READ = 0,
51 AFD_POLL_BIT_OOB = 1,
52 AFD_POLL_BIT_WRITE = 2,
53 AFD_POLL_BIT_HUP = 3,
54 AFD_POLL_BIT_RESET = 4,
55 AFD_POLL_BIT_CLOSE = 5,
56 AFD_POLL_BIT_CONNECT = 6,
57 AFD_POLL_BIT_ACCEPT = 7,
58 AFD_POLL_BIT_CONNECT_ERR = 8,
59 /* IOCTL_AFD_GET_EVENTS has space for 13 events. */
60 AFD_POLL_BIT_UNK1 = 9,
61 AFD_POLL_BIT_UNK2 = 10,
62 AFD_POLL_BIT_UNK3 = 11,
63 AFD_POLL_BIT_UNK4 = 12,
64 AFD_POLL_BIT_COUNT = 13,
67 #define AFD_POLL_READ 0x0001
68 #define AFD_POLL_OOB 0x0002
69 #define AFD_POLL_WRITE 0x0004
70 #define AFD_POLL_HUP 0x0008
71 #define AFD_POLL_RESET 0x0010
72 #define AFD_POLL_CLOSE 0x0020
73 #define AFD_POLL_CONNECT 0x0040
74 #define AFD_POLL_ACCEPT 0x0080
75 #define AFD_POLL_CONNECT_ERR 0x0100
76 /* I have never seen these reported, but StarCraft Remastered polls for them. */
77 #define AFD_POLL_UNK1 0x0200
78 #define AFD_POLL_UNK2 0x0400
80 struct afd_bind_params
82 int unknown;
83 struct WS(sockaddr) addr; /* variable size */
85 C_ASSERT( sizeof(struct afd_bind_params) == 20 );
87 struct afd_listen_params
89 int unknown1;
90 int backlog;
91 int unknown2;
93 C_ASSERT( sizeof(struct afd_listen_params) == 12 );
95 #define AFD_RECV_FORCE_ASYNC 0x2
97 #define AFD_MSG_NOT_OOB 0x0020
98 #define AFD_MSG_OOB 0x0040
99 #define AFD_MSG_PEEK 0x0080
100 #define AFD_MSG_WAITALL 0x4000
102 struct afd_recv_params
104 const WSABUF *buffers;
105 unsigned int count;
106 int recv_flags;
107 int msg_flags;
110 struct afd_recv_params_32
112 ULONG buffers;
113 unsigned int count;
114 int recv_flags;
115 int msg_flags;
118 #include <pshpack4.h>
119 struct afd_poll_params
121 LONGLONG timeout;
122 unsigned int count;
123 BOOLEAN exclusive;
124 BOOLEAN padding[3];
125 struct afd_poll_socket
127 SOCKET socket;
128 int flags;
129 int status;
130 } sockets[1];
133 struct afd_poll_params_64
135 LONGLONG timeout;
136 unsigned int count;
137 BOOLEAN exclusive;
138 BOOLEAN padding[3];
139 struct afd_poll_socket_64
141 ULONGLONG socket;
142 int flags;
143 int status;
144 } sockets[1];
147 struct afd_poll_params_32
149 LONGLONG timeout;
150 unsigned int count;
151 BOOLEAN exclusive;
152 BOOLEAN padding[3];
153 struct afd_poll_socket_32
155 ULONG socket;
156 int flags;
157 int status;
158 } sockets[1];
160 #include <poppack.h>
162 struct afd_event_select_params
164 HANDLE event;
165 int mask;
168 struct afd_event_select_params_64
170 ULONGLONG event;
171 int mask;
174 struct afd_event_select_params_32
176 ULONG event;
177 int mask;
180 struct afd_get_events_params
182 int flags;
183 int status[13];
185 C_ASSERT( sizeof(struct afd_get_events_params) == 56 );
187 #define WINE_AFD_IOC(x) CTL_CODE(FILE_DEVICE_NETWORK, x, METHOD_BUFFERED, FILE_ANY_ACCESS)
189 #define IOCTL_AFD_WINE_CREATE WINE_AFD_IOC(200)
190 #define IOCTL_AFD_WINE_ACCEPT WINE_AFD_IOC(201)
191 #define IOCTL_AFD_WINE_ACCEPT_INTO WINE_AFD_IOC(202)
192 #define IOCTL_AFD_WINE_CONNECT WINE_AFD_IOC(203)
193 #define IOCTL_AFD_WINE_SHUTDOWN WINE_AFD_IOC(204)
194 #define IOCTL_AFD_WINE_RECVMSG WINE_AFD_IOC(205)
195 #define IOCTL_AFD_WINE_SENDMSG WINE_AFD_IOC(206)
196 #define IOCTL_AFD_WINE_TRANSMIT WINE_AFD_IOC(207)
197 #define IOCTL_AFD_WINE_ADDRESS_LIST_CHANGE WINE_AFD_IOC(208)
198 #define IOCTL_AFD_WINE_FIONBIO WINE_AFD_IOC(209)
199 #define IOCTL_AFD_WINE_COMPLETE_ASYNC WINE_AFD_IOC(210)
200 #define IOCTL_AFD_WINE_FIONREAD WINE_AFD_IOC(211)
201 #define IOCTL_AFD_WINE_SIOCATMARK WINE_AFD_IOC(212)
202 #define IOCTL_AFD_WINE_GET_INTERFACE_LIST WINE_AFD_IOC(213)
203 #define IOCTL_AFD_WINE_KEEPALIVE_VALS WINE_AFD_IOC(214)
204 #define IOCTL_AFD_WINE_MESSAGE_SELECT WINE_AFD_IOC(215)
205 #define IOCTL_AFD_WINE_GETPEERNAME WINE_AFD_IOC(216)
206 #define IOCTL_AFD_WINE_DEFER WINE_AFD_IOC(217)
207 #define IOCTL_AFD_WINE_GET_INFO WINE_AFD_IOC(218)
208 #define IOCTL_AFD_WINE_GET_SO_ACCEPTCONN WINE_AFD_IOC(219)
209 #define IOCTL_AFD_WINE_GET_SO_BROADCAST WINE_AFD_IOC(220)
210 #define IOCTL_AFD_WINE_SET_SO_BROADCAST WINE_AFD_IOC(221)
211 #define IOCTL_AFD_WINE_GET_SO_ERROR WINE_AFD_IOC(222)
212 #define IOCTL_AFD_WINE_GET_SO_KEEPALIVE WINE_AFD_IOC(223)
213 #define IOCTL_AFD_WINE_SET_SO_KEEPALIVE WINE_AFD_IOC(224)
214 #define IOCTL_AFD_WINE_GET_SO_LINGER WINE_AFD_IOC(225)
215 #define IOCTL_AFD_WINE_SET_SO_LINGER WINE_AFD_IOC(226)
216 #define IOCTL_AFD_WINE_GET_SO_OOBINLINE WINE_AFD_IOC(227)
217 #define IOCTL_AFD_WINE_SET_SO_OOBINLINE WINE_AFD_IOC(228)
218 #define IOCTL_AFD_WINE_SET_SO_RCVBUF WINE_AFD_IOC(229)
219 #define IOCTL_AFD_WINE_GET_SO_RCVBUF WINE_AFD_IOC(230)
220 #define IOCTL_AFD_WINE_SET_SO_RCVTIMEO WINE_AFD_IOC(231)
221 #define IOCTL_AFD_WINE_GET_SO_RCVTIMEO WINE_AFD_IOC(232)
222 #define IOCTL_AFD_WINE_GET_SO_REUSEADDR WINE_AFD_IOC(233)
223 #define IOCTL_AFD_WINE_SET_SO_REUSEADDR WINE_AFD_IOC(234)
224 #define IOCTL_AFD_WINE_SET_SO_SNDBUF WINE_AFD_IOC(235)
225 #define IOCTL_AFD_WINE_GET_SO_SNDBUF WINE_AFD_IOC(236)
226 #define IOCTL_AFD_WINE_GET_SO_SNDTIMEO WINE_AFD_IOC(237)
227 #define IOCTL_AFD_WINE_SET_SO_SNDTIMEO WINE_AFD_IOC(238)
228 #define IOCTL_AFD_WINE_SET_IP_ADD_MEMBERSHIP WINE_AFD_IOC(239)
229 #define IOCTL_AFD_WINE_SET_IP_ADD_SOURCE_MEMBERSHIP WINE_AFD_IOC(240)
230 #define IOCTL_AFD_WINE_SET_IP_BLOCK_SOURCE WINE_AFD_IOC(241)
231 #define IOCTL_AFD_WINE_GET_IP_DONTFRAGMENT WINE_AFD_IOC(242)
232 #define IOCTL_AFD_WINE_SET_IP_DONTFRAGMENT WINE_AFD_IOC(243)
233 #define IOCTL_AFD_WINE_SET_IP_DROP_MEMBERSHIP WINE_AFD_IOC(244)
234 #define IOCTL_AFD_WINE_SET_IP_DROP_SOURCE_MEMBERSHIP WINE_AFD_IOC(245)
235 #define IOCTL_AFD_WINE_GET_IP_HDRINCL WINE_AFD_IOC(246)
236 #define IOCTL_AFD_WINE_SET_IP_HDRINCL WINE_AFD_IOC(247)
237 #define IOCTL_AFD_WINE_GET_IP_MULTICAST_IF WINE_AFD_IOC(248)
238 #define IOCTL_AFD_WINE_SET_IP_MULTICAST_IF WINE_AFD_IOC(249)
239 #define IOCTL_AFD_WINE_GET_IP_MULTICAST_LOOP WINE_AFD_IOC(250)
240 #define IOCTL_AFD_WINE_SET_IP_MULTICAST_LOOP WINE_AFD_IOC(251)
241 #define IOCTL_AFD_WINE_GET_IP_MULTICAST_TTL WINE_AFD_IOC(252)
242 #define IOCTL_AFD_WINE_SET_IP_MULTICAST_TTL WINE_AFD_IOC(253)
243 #define IOCTL_AFD_WINE_GET_IP_OPTIONS WINE_AFD_IOC(254)
244 #define IOCTL_AFD_WINE_SET_IP_OPTIONS WINE_AFD_IOC(255)
245 #define IOCTL_AFD_WINE_GET_IP_PKTINFO WINE_AFD_IOC(256)
246 #define IOCTL_AFD_WINE_SET_IP_PKTINFO WINE_AFD_IOC(257)
247 #define IOCTL_AFD_WINE_GET_IP_TOS WINE_AFD_IOC(258)
248 #define IOCTL_AFD_WINE_SET_IP_TOS WINE_AFD_IOC(259)
249 #define IOCTL_AFD_WINE_GET_IP_TTL WINE_AFD_IOC(260)
250 #define IOCTL_AFD_WINE_SET_IP_TTL WINE_AFD_IOC(261)
251 #define IOCTL_AFD_WINE_SET_IP_UNBLOCK_SOURCE WINE_AFD_IOC(262)
252 #define IOCTL_AFD_WINE_GET_IP_UNICAST_IF WINE_AFD_IOC(263)
253 #define IOCTL_AFD_WINE_SET_IP_UNICAST_IF WINE_AFD_IOC(264)
254 #define IOCTL_AFD_WINE_SET_IPV6_ADD_MEMBERSHIP WINE_AFD_IOC(265)
255 #define IOCTL_AFD_WINE_GET_IPV6_DONTFRAG WINE_AFD_IOC(266)
256 #define IOCTL_AFD_WINE_SET_IPV6_DONTFRAG WINE_AFD_IOC(267)
257 #define IOCTL_AFD_WINE_SET_IPV6_DROP_MEMBERSHIP WINE_AFD_IOC(268)
258 #define IOCTL_AFD_WINE_GET_IPV6_MULTICAST_HOPS WINE_AFD_IOC(269)
259 #define IOCTL_AFD_WINE_SET_IPV6_MULTICAST_HOPS WINE_AFD_IOC(270)
260 #define IOCTL_AFD_WINE_GET_IPV6_MULTICAST_IF WINE_AFD_IOC(271)
261 #define IOCTL_AFD_WINE_SET_IPV6_MULTICAST_IF WINE_AFD_IOC(272)
262 #define IOCTL_AFD_WINE_GET_IPV6_MULTICAST_LOOP WINE_AFD_IOC(273)
263 #define IOCTL_AFD_WINE_SET_IPV6_MULTICAST_LOOP WINE_AFD_IOC(274)
264 #define IOCTL_AFD_WINE_GET_IPV6_UNICAST_HOPS WINE_AFD_IOC(275)
265 #define IOCTL_AFD_WINE_SET_IPV6_UNICAST_HOPS WINE_AFD_IOC(276)
266 #define IOCTL_AFD_WINE_GET_IPV6_UNICAST_IF WINE_AFD_IOC(277)
267 #define IOCTL_AFD_WINE_SET_IPV6_UNICAST_IF WINE_AFD_IOC(278)
268 #define IOCTL_AFD_WINE_GET_IPV6_V6ONLY WINE_AFD_IOC(279)
269 #define IOCTL_AFD_WINE_SET_IPV6_V6ONLY WINE_AFD_IOC(280)
270 #define IOCTL_AFD_WINE_GET_IPX_PTYPE WINE_AFD_IOC(281)
271 #define IOCTL_AFD_WINE_SET_IPX_PTYPE WINE_AFD_IOC(282)
272 #define IOCTL_AFD_WINE_GET_IRLMP_ENUMDEVICES WINE_AFD_IOC(283)
273 #define IOCTL_AFD_WINE_GET_TCP_NODELAY WINE_AFD_IOC(284)
274 #define IOCTL_AFD_WINE_SET_TCP_NODELAY WINE_AFD_IOC(285)
275 #define IOCTL_AFD_WINE_GET_IPV6_RECVHOPLIMIT WINE_AFD_IOC(286)
276 #define IOCTL_AFD_WINE_SET_IPV6_RECVHOPLIMIT WINE_AFD_IOC(287)
277 #define IOCTL_AFD_WINE_GET_IPV6_RECVPKTINFO WINE_AFD_IOC(288)
278 #define IOCTL_AFD_WINE_SET_IPV6_RECVPKTINFO WINE_AFD_IOC(289)
279 #define IOCTL_AFD_WINE_GET_IPV6_RECVTCLASS WINE_AFD_IOC(290)
280 #define IOCTL_AFD_WINE_SET_IPV6_RECVTCLASS WINE_AFD_IOC(291)
281 #define IOCTL_AFD_WINE_GET_SO_CONNECT_TIME WINE_AFD_IOC(292)
282 #define IOCTL_AFD_WINE_GET_IP_RECVTTL WINE_AFD_IOC(293)
283 #define IOCTL_AFD_WINE_SET_IP_RECVTTL WINE_AFD_IOC(294)
284 #define IOCTL_AFD_WINE_GET_IP_RECVTOS WINE_AFD_IOC(295)
285 #define IOCTL_AFD_WINE_SET_IP_RECVTOS WINE_AFD_IOC(296)
286 #define IOCTL_AFD_WINE_GET_SO_EXCLUSIVEADDRUSE WINE_AFD_IOC(297)
287 #define IOCTL_AFD_WINE_SET_SO_EXCLUSIVEADDRUSE WINE_AFD_IOC(298)
289 struct afd_iovec
291 ULONGLONG ptr;
292 ULONG len;
295 struct afd_create_params
297 int family, type, protocol;
298 unsigned int flags;
300 C_ASSERT( sizeof(struct afd_create_params) == 16 );
302 struct afd_accept_into_params
304 ULONG accept_handle;
305 unsigned int recv_len, local_len;
307 C_ASSERT( sizeof(struct afd_accept_into_params) == 12 );
309 struct afd_connect_params
311 int addr_len;
312 int synchronous;
313 /* VARARG(addr, struct WS(sockaddr), addr_len); */
314 /* VARARG(data, bytes); */
316 C_ASSERT( sizeof(struct afd_connect_params) == 8 );
318 struct afd_recvmsg_params
320 ULONGLONG control_ptr; /* WSABUF */
321 ULONGLONG addr_ptr; /* WS(sockaddr) */
322 ULONGLONG addr_len_ptr; /* int */
323 ULONGLONG ws_flags_ptr; /* unsigned int */
324 int force_async;
325 unsigned int count;
326 ULONGLONG buffers_ptr; /* WSABUF[] */
328 C_ASSERT( sizeof(struct afd_recvmsg_params) == 48 );
330 struct afd_sendmsg_params
332 ULONGLONG addr_ptr; /* const struct WS(sockaddr) */
333 unsigned int addr_len;
334 unsigned int ws_flags;
335 int force_async;
336 unsigned int count;
337 ULONGLONG buffers_ptr; /* const WSABUF[] */
339 C_ASSERT( sizeof(struct afd_sendmsg_params) == 32 );
341 struct afd_transmit_params
343 LARGE_INTEGER offset;
344 ULONGLONG head_ptr;
345 ULONGLONG tail_ptr;
346 DWORD head_len;
347 DWORD tail_len;
348 ULONG file;
349 DWORD file_len;
350 DWORD buffer_size;
351 DWORD flags;
353 C_ASSERT( sizeof(struct afd_transmit_params) == 48 );
355 struct afd_message_select_params
357 ULONG handle;
358 ULONG window;
359 unsigned int message;
360 int mask;
362 C_ASSERT( sizeof(struct afd_message_select_params) == 16 );
364 struct afd_get_info_params
366 int family, type, protocol;
368 C_ASSERT( sizeof(struct afd_get_info_params) == 12 );
370 #endif