ntdll: Fix compilation on systems that don't support nameless unions.
[wine] / include / mswsock.h
1 /*
2  * Copyright (C) the Wine project
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18 #ifndef _MSWSOCK_
19 #define _MSWSOCK_
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif /* defined(__cplusplus) */
24
25 #ifndef USE_WS_PREFIX
26 #define SO_CONNDATA        0x7000
27 #define SO_CONNOPT         0x7001
28 #define SO_DISCDATA        0x7002
29 #define SO_DISCOPT         0x7003
30 #define SO_CONNDATALEN     0x7004
31 #define SO_CONNOPTLEN      0x7005
32 #define SO_DISCDATALEN     0x7006
33 #define SO_DISCOPTLEN      0x7007
34 #else
35 #define WS_SO_CONNDATA     0x7000
36 #define WS_SO_CONNOPT      0x7001
37 #define WS_SO_DISCDATA     0x7002
38 #define WS_SO_DISCOPT      0x7003
39 #define WS_SO_CONNDATALEN  0x7004
40 #define WS_SO_CONNOPTLEN   0x7005
41 #define WS_SO_DISCDATALEN  0x7006
42 #define WS_SO_DISCOPTLEN   0x7007
43 #endif
44
45 #ifndef USE_WS_PREFIX
46 #define SO_OPENTYPE     0x7008
47 #else
48 #define WS_SO_OPENTYPE  0x7008
49 #endif
50
51 #ifndef USE_WS_PREFIX
52 #define SO_SYNCHRONOUS_ALERT       0x10
53 #define SO_SYNCHRONOUS_NONALERT    0x20
54 #else
55 #define WS_SO_SYNCHRONOUS_ALERT    0x10
56 #define WS_SO_SYNCHRONOUS_NONALERT 0x20
57 #endif
58
59 #ifndef USE_WS_PREFIX
60 #define SO_MAXDG                      0x7009
61 #define SO_MAXPATHDG                  0x700A
62 #define SO_UPDATE_ACCEPT_CONTEXT      0x700B
63 #define SO_CONNECT_TIME               0x700C
64 #define SO_UPDATE_CONNECT_CONTEXT     0x7010
65 #else
66 #define WS_SO_MAXDG                   0x7009
67 #define WS_SO_MAXPATHDG               0x700A
68 #define WS_SO_UPDATE_ACCEPT_CONTEXT   0x700B
69 #define WS_SO_CONNECT_TIME            0x700C
70 #define WS_SO_UPDATE_CONNECT_CONTEXT  0x7010
71 #endif
72
73 #ifndef USE_WS_PREFIX
74 #define TCP_BSDURGENT              0x7000
75 #else
76 #define WS_TCP_BSDURGENT              0x7000
77 #endif
78
79 #ifndef USE_WS_PREFIX
80 #define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12)
81 #else
82 #define WS_SIO_UDP_CONNRESET _WSAIOW(WS_IOC_VENDOR,12)
83 #endif
84
85 #define DE_REUSE_SOCKET TF_REUSE_SOCKET
86
87 #ifndef USE_WS_PREFIX
88 #define MSG_TRUNC   0x0100
89 #define MSG_CTRUNC  0x0200
90 #define MSG_BCAST   0x0400
91 #define MSG_MCAST   0x0800
92 #else
93 #define WS_MSG_TRUNC   0x0100
94 #define WS_MSG_CTRUNC  0x0200
95 #define WS_MSG_BCAST   0x0400
96 #define WS_MSG_MCAST   0x0800
97 #endif
98
99 #define TF_DISCONNECT          0x01
100 #define TF_REUSE_SOCKET        0x02
101 #define TF_WRITE_BEHIND        0x04
102 #define TF_USE_DEFAULT_WORKER  0x00
103 #define TF_USE_SYSTEM_THREAD   0x10
104 #define TF_USE_KERNEL_APC      0x20
105
106 #define TP_DISCONNECT           TF_DISCONNECT
107 #define TP_REUSE_SOCKET         TF_REUSE_SOCKET
108 #define TP_USE_DEFAULT_WORKER   TF_USE_DEFAULT_WORKER
109 #define TP_USE_SYSTEM_THREAD    TF_USE_SYSTEM_THREAD
110 #define TP_USE_KERNEL_APC       TF_USE_KERNEL_APC
111
112 #define TP_ELEMENT_MEMORY   1
113 #define TP_ELEMENT_FILE     2
114 #define TP_ELEMENT_EOP      4
115
116 #define WSAID_ACCEPTEX \
117         {0xb5367df1,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}}
118 #define WSAID_CONNECTEX \
119         {0x25a207b9,0xddf3,0x4660,{0x8e,0xe9,0x76,0xe5,0x8c,0x74,0x06,0x3e}}
120 #define WSAID_DISCONNECTEX \
121         {0x7fda2e11,0x8630,0x436f,{0xa0, 0x31, 0xf5, 0x36, 0xa6, 0xee, 0xc1, 0x57}}
122 #define WSAID_GETACCEPTEXSOCKADDRS \
123         {0xb5367df2,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}}
124 #define WSAID_TRANSMITFILE \
125         {0xb5367df0,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}}
126 #define WSAID_TRANSMITPACKETS \
127         {0xd9689da0,0x1f90,0x11d3,{0x99,0x71,0x00,0xc0,0x4f,0x68,0xc8,0x76}}
128 #define WSAID_WSARECVMSG \
129         {0xf689d7c8,0x6f1f,0x436b,{0x8a,0x53,0xe5,0x4f,0xe3,0x51,0xc3,0x22}}
130
131 typedef struct _TRANSMIT_FILE_BUFFERS {
132     LPVOID  Head;
133     DWORD   HeadLength;
134     LPVOID  Tail;
135     DWORD   TailLength;
136 } TRANSMIT_FILE_BUFFERS, *PTRANSMIT_FILE_BUFFERS, *LPTRANSMIT_FILE_BUFFERS;
137
138 typedef struct _TRANSMIT_PACKETS_ELEMENT {
139     ULONG  dwElFlags;
140     ULONG  cLength;
141     union {
142       struct {
143         LARGE_INTEGER  nFileOffset;
144         HANDLE         hFile;
145       } DUMMYSTRUCTNAME;
146       PVOID  pBuffer;
147     } DUMMYUNIONNAME;
148 } TRANSMIT_PACKETS_ELEMENT, *PTRANSMIT_PACKETS_ELEMENT, *LPTRANSMIT_PACKETS_ELEMENT;
149
150 typedef struct _WSAMSG {
151     LPSOCKADDR  name;
152     INT         namelen;
153     LPWSABUF    lpBuffers;
154     DWORD       dwBufferCount;
155     WSABUF      Control;
156     DWORD       dwFlags;
157 } WSAMSG, *PWSAMSG, *LPWSAMSG;
158
159 typedef struct _WSACMSGHDR {
160     SIZE_T      cmsg_len;
161     INT         cmsg_level;
162     INT         cmsg_type;
163     /* followed by UCHAR cmsg_data[] */
164 } WSACMSGHDR, *PWSACMSGHDR, *LPWSACMSGHDR;
165
166 typedef BOOL (WINAPI * LPFN_ACCEPTEX)(SOCKET, SOCKET, PVOID, DWORD, DWORD, DWORD, LPDWORD, LPOVERLAPPED);
167 typedef BOOL (WINAPI * LPFN_CONNECTEX)(SOCKET, const struct sockaddr *, int, PVOID, DWORD, LPDWORD, LPOVERLAPPED);
168 typedef BOOL (WINAPI * LPFN_DISCONNECTEX)(SOCKET, LPOVERLAPPED, DWORD, DWORD);
169 typedef VOID (WINAPI * LPFN_GETACCEPTEXSOCKADDRS)(PVOID, DWORD, DWORD, DWORD, struct sockaddr **, LPINT, struct sockaddr **, LPINT);
170 typedef BOOL (WINAPI * LPFN_TRANSMITFILE)(SOCKET, HANDLE, DWORD, DWORD, LPOVERLAPPED, LPTRANSMIT_FILE_BUFFERS, DWORD);
171 typedef BOOL (WINAPI * LPFN_TRANSMITPACKETS)(SOCKET, LPTRANSMIT_PACKETS_ELEMENT, DWORD, DWORD, LPOVERLAPPED, DWORD);
172 typedef INT  (WINAPI * LPFN_WSARECVMSG)(SOCKET, LPWSAMSG, LPDWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
173
174 BOOL WINAPI AcceptEx(SOCKET, SOCKET, PVOID, DWORD, DWORD, DWORD, LPDWORD, LPOVERLAPPED);
175 VOID WINAPI GetAcceptExSockaddrs(PVOID, DWORD, DWORD, DWORD, struct sockaddr **, LPINT, struct sockaddr **, LPINT);
176 BOOL WINAPI TransmitFile(SOCKET, HANDLE, DWORD, DWORD, LPOVERLAPPED, LPTRANSMIT_FILE_BUFFERS, DWORD);
177 INT  WINAPI WSARecvEx(SOCKET, char *, INT, INT *);
178
179 #ifdef __cplusplus
180 }
181 #endif
182
183 #endif /* _MSWSOCK_ */