ws2_32: Move the setsockopt(SO_KEEPALIVE) implementation to ntdll.
[wine.git] / include / wine / afd.h
blob616ba27b679d16c4358ddcf19f50d7a15fa57f7b
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>
27 #include "wine/server_protocol.h"
29 #ifdef USE_WS_PREFIX
30 # define WS(x) WS_##x
31 #else
32 # define WS(x) x
33 #endif
35 #define IOCTL_AFD_BIND CTL_CODE(FILE_DEVICE_BEEP, 0x800, METHOD_NEITHER, FILE_ANY_ACCESS)
36 #define IOCTL_AFD_LISTEN CTL_CODE(FILE_DEVICE_BEEP, 0x802, METHOD_NEITHER, FILE_ANY_ACCESS)
37 #define IOCTL_AFD_RECV CTL_CODE(FILE_DEVICE_BEEP, 0x805, METHOD_NEITHER, FILE_ANY_ACCESS)
38 #define IOCTL_AFD_POLL CTL_CODE(FILE_DEVICE_BEEP, 0x809, METHOD_BUFFERED, FILE_ANY_ACCESS)
39 #define IOCTL_AFD_GETSOCKNAME CTL_CODE(FILE_DEVICE_BEEP, 0x80b, METHOD_NEITHER, FILE_ANY_ACCESS)
40 #define IOCTL_AFD_EVENT_SELECT CTL_CODE(FILE_DEVICE_BEEP, 0x821, METHOD_NEITHER, FILE_ANY_ACCESS)
41 #define IOCTL_AFD_GET_EVENTS CTL_CODE(FILE_DEVICE_BEEP, 0x822, METHOD_NEITHER, FILE_ANY_ACCESS)
43 enum afd_poll_bit
45 AFD_POLL_BIT_READ = 0,
46 AFD_POLL_BIT_OOB = 1,
47 AFD_POLL_BIT_WRITE = 2,
48 AFD_POLL_BIT_HUP = 3,
49 AFD_POLL_BIT_RESET = 4,
50 AFD_POLL_BIT_CLOSE = 5,
51 AFD_POLL_BIT_CONNECT = 6,
52 AFD_POLL_BIT_ACCEPT = 7,
53 AFD_POLL_BIT_CONNECT_ERR = 8,
54 /* IOCTL_AFD_GET_EVENTS has space for 13 events. */
55 AFD_POLL_BIT_UNK1 = 9,
56 AFD_POLL_BIT_UNK2 = 10,
57 AFD_POLL_BIT_UNK3 = 11,
58 AFD_POLL_BIT_UNK4 = 12,
59 AFD_POLL_BIT_COUNT = 13,
62 #define AFD_POLL_READ 0x0001
63 #define AFD_POLL_OOB 0x0002
64 #define AFD_POLL_WRITE 0x0004
65 #define AFD_POLL_HUP 0x0008
66 #define AFD_POLL_RESET 0x0010
67 #define AFD_POLL_CLOSE 0x0020
68 #define AFD_POLL_CONNECT 0x0040
69 #define AFD_POLL_ACCEPT 0x0080
70 #define AFD_POLL_CONNECT_ERR 0x0100
71 /* I have never seen these reported, but StarCraft Remastered polls for them. */
72 #define AFD_POLL_UNK1 0x0200
73 #define AFD_POLL_UNK2 0x0400
75 struct afd_bind_params
77 int unknown;
78 struct WS(sockaddr) addr; /* variable size */
81 struct afd_listen_params
83 int unknown1;
84 int backlog;
85 int unknown2;
88 #define AFD_RECV_FORCE_ASYNC 0x2
90 #define AFD_MSG_NOT_OOB 0x0020
91 #define AFD_MSG_OOB 0x0040
92 #define AFD_MSG_PEEK 0x0080
93 #define AFD_MSG_WAITALL 0x4000
95 struct afd_recv_params
97 const WSABUF *buffers;
98 unsigned int count;
99 int recv_flags;
100 int msg_flags;
103 #include <pshpack4.h>
104 struct afd_poll_params
106 LONGLONG timeout;
107 unsigned int count;
108 BOOLEAN unknown;
109 BOOLEAN padding[3];
110 struct
112 SOCKET socket;
113 int flags;
114 NTSTATUS status;
115 } sockets[1];
117 #include <poppack.h>
119 struct afd_event_select_params
121 HANDLE event;
122 int mask;
125 struct afd_event_select_params_64
127 ULONGLONG event;
128 int mask;
131 struct afd_event_select_params_32
133 ULONG event;
134 int mask;
137 struct afd_get_events_params
139 int flags;
140 NTSTATUS status[13];
143 #define IOCTL_AFD_WINE_CREATE CTL_CODE(FILE_DEVICE_NETWORK, 200, METHOD_BUFFERED, FILE_ANY_ACCESS)
144 #define IOCTL_AFD_WINE_ACCEPT CTL_CODE(FILE_DEVICE_NETWORK, 201, METHOD_BUFFERED, FILE_ANY_ACCESS)
145 #define IOCTL_AFD_WINE_ACCEPT_INTO CTL_CODE(FILE_DEVICE_NETWORK, 202, METHOD_BUFFERED, FILE_ANY_ACCESS)
146 #define IOCTL_AFD_WINE_CONNECT CTL_CODE(FILE_DEVICE_NETWORK, 203, METHOD_BUFFERED, FILE_ANY_ACCESS)
147 #define IOCTL_AFD_WINE_SHUTDOWN CTL_CODE(FILE_DEVICE_NETWORK, 204, METHOD_BUFFERED, FILE_ANY_ACCESS)
148 #define IOCTL_AFD_WINE_RECVMSG CTL_CODE(FILE_DEVICE_NETWORK, 205, METHOD_BUFFERED, FILE_ANY_ACCESS)
149 #define IOCTL_AFD_WINE_SENDMSG CTL_CODE(FILE_DEVICE_NETWORK, 206, METHOD_BUFFERED, FILE_ANY_ACCESS)
150 #define IOCTL_AFD_WINE_TRANSMIT CTL_CODE(FILE_DEVICE_NETWORK, 207, METHOD_BUFFERED, FILE_ANY_ACCESS)
151 #define IOCTL_AFD_WINE_ADDRESS_LIST_CHANGE CTL_CODE(FILE_DEVICE_NETWORK, 208, METHOD_BUFFERED, FILE_ANY_ACCESS)
152 #define IOCTL_AFD_WINE_FIONBIO CTL_CODE(FILE_DEVICE_NETWORK, 209, METHOD_BUFFERED, FILE_ANY_ACCESS)
153 #define IOCTL_AFD_WINE_COMPLETE_ASYNC CTL_CODE(FILE_DEVICE_NETWORK, 210, METHOD_BUFFERED, FILE_ANY_ACCESS)
154 #define IOCTL_AFD_WINE_FIONREAD CTL_CODE(FILE_DEVICE_NETWORK, 211, METHOD_BUFFERED, FILE_ANY_ACCESS)
155 #define IOCTL_AFD_WINE_SIOCATMARK CTL_CODE(FILE_DEVICE_NETWORK, 212, METHOD_BUFFERED, FILE_ANY_ACCESS)
156 #define IOCTL_AFD_WINE_GET_INTERFACE_LIST CTL_CODE(FILE_DEVICE_NETWORK, 213, METHOD_BUFFERED, FILE_ANY_ACCESS)
157 #define IOCTL_AFD_WINE_KEEPALIVE_VALS CTL_CODE(FILE_DEVICE_NETWORK, 214, METHOD_BUFFERED, FILE_ANY_ACCESS)
158 #define IOCTL_AFD_WINE_MESSAGE_SELECT CTL_CODE(FILE_DEVICE_NETWORK, 215, METHOD_BUFFERED, FILE_ANY_ACCESS)
159 #define IOCTL_AFD_WINE_GETPEERNAME CTL_CODE(FILE_DEVICE_NETWORK, 216, METHOD_BUFFERED, FILE_ANY_ACCESS)
160 #define IOCTL_AFD_WINE_DEFER CTL_CODE(FILE_DEVICE_NETWORK, 217, METHOD_BUFFERED, FILE_ANY_ACCESS)
161 #define IOCTL_AFD_WINE_GET_INFO CTL_CODE(FILE_DEVICE_NETWORK, 218, METHOD_BUFFERED, FILE_ANY_ACCESS)
162 #define IOCTL_AFD_WINE_GET_SO_ACCEPTCONN CTL_CODE(FILE_DEVICE_NETWORK, 219, METHOD_BUFFERED, FILE_ANY_ACCESS)
163 #define IOCTL_AFD_WINE_GET_SO_BROADCAST CTL_CODE(FILE_DEVICE_NETWORK, 220, METHOD_BUFFERED, FILE_ANY_ACCESS)
164 #define IOCTL_AFD_WINE_SET_SO_BROADCAST CTL_CODE(FILE_DEVICE_NETWORK, 221, METHOD_BUFFERED, FILE_ANY_ACCESS)
165 #define IOCTL_AFD_WINE_GET_SO_ERROR CTL_CODE(FILE_DEVICE_NETWORK, 222, METHOD_BUFFERED, FILE_ANY_ACCESS)
166 #define IOCTL_AFD_WINE_GET_SO_KEEPALIVE CTL_CODE(FILE_DEVICE_NETWORK, 223, METHOD_BUFFERED, FILE_ANY_ACCESS)
167 #define IOCTL_AFD_WINE_SET_SO_KEEPALIVE CTL_CODE(FILE_DEVICE_NETWORK, 224, METHOD_BUFFERED, FILE_ANY_ACCESS)
169 struct afd_create_params
171 int family, type, protocol;
172 unsigned int flags;
175 struct afd_accept_into_params
177 obj_handle_t accept_handle;
178 unsigned int recv_len, local_len;
181 struct afd_connect_params
183 int addr_len;
184 int synchronous;
185 /* VARARG(addr, struct WS(sockaddr), addr_len); */
186 /* VARARG(data, bytes); */
189 struct afd_recvmsg_params
191 WSABUF *control;
192 struct WS(sockaddr) *addr;
193 int *addr_len;
194 unsigned int *ws_flags;
195 int force_async;
196 unsigned int count;
197 WSABUF *buffers;
200 struct afd_sendmsg_params
202 const struct WS(sockaddr) *addr;
203 unsigned int addr_len;
204 unsigned int ws_flags;
205 int force_async;
206 unsigned int count;
207 const WSABUF *buffers;
210 struct afd_transmit_params
212 HANDLE file;
213 DWORD file_len;
214 DWORD buffer_size;
215 LARGE_INTEGER offset;
216 TRANSMIT_FILE_BUFFERS buffers;
217 DWORD flags;
220 struct afd_message_select_params
222 obj_handle_t handle;
223 user_handle_t window;
224 unsigned int message;
225 int mask;
228 struct afd_get_info_params
230 int family, type, protocol;
233 #endif