Fixed lvalue casts.
[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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  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 #define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12)
80
81
82 #define DE_REUSE_SOCKET TF_REUSE_SOCKET
83
84 #ifndef USE_WS_PREFIX
85 #define MSG_TRUNC   0x0100
86 #define MSG_CTRUNC  0x0200
87 #define MSG_BCAST   0x0400
88 #define MSG_MCAST   0x0800
89 #else
90 #define WS_MSG_TRUNC   0x0100
91 #define WS_MSG_CTRUNC  0x0200
92 #define WS_MSG_BCAST   0x0400
93 #define WS_MSG_MCAST   0x0800
94 #endif
95
96 #define TF_DISCONNECT          0x01
97 #define TF_REUSE_SOCKET        0x02
98 #define TF_WRITE_BEHIND        0x04
99 #define TF_USE_DEFAULT_WORKER  0x00
100 #define TF_USE_SYSTEM_THREAD   0x10
101 #define TF_USE_KERNEL_APC      0x20
102
103 #define TP_DISCONNECT           TF_DISCONNECT
104 #define TP_REUSE_SOCKET         TF_REUSE_SOCKET
105 #define TP_USE_DEFAULT_WORKER   TF_USE_DEFAULT_WORKER
106 #define TP_USE_SYSTEM_THREAD    TF_USE_SYSTEM_THREAD
107 #define TP_USE_KERNEL_APC       TF_USE_KERNEL_APC
108
109 #define TP_ELEMENT_MEMORY   1
110 #define TP_ELEMENT_FILE     2
111 #define TP_ELEMENT_EOP      4
112
113 #define WSAID_ACCEPTEX \
114         {0xb5367df1,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}}
115 #define WSAID_CONNECTEX \
116         {0x25a207b9,0xddf3,0x4660,{0x8e,0xe9,0x76,0xe5,0x8c,0x74,0x06,0x3e}}
117 #define WSAID_DISCONNECTEX \
118         {0x7fda2e11,0x8630,0x436f,{0xa0, 0x31, 0xf5, 0x36, 0xa6, 0xee, 0xc1, 0x57}}
119 #define WSAID_GETACCEPTEXSOCKADDRS \
120         {0xb5367df2,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}}
121 #define WSAID_TRANSMITFILE \
122         {0xb5367df0,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}}
123 #define WSAID_TRANSMITPACKETS \
124         {0xd9689da0,0x1f90,0x11d3,{0x99,0x71,0x00,0xc0,0x4f,0x68,0xc8,0x76}}
125 #define WSAID_WSARECVMSG \
126         {0xf689d7c8,0x6f1f,0x436b,{0x8a,0x53,0xe5,0x4f,0xe3,0x51,0xc3,0x22}}
127
128 typedef struct _TRANSMIT_FILE_BUFFERS {
129     LPVOID  Head;
130     DWORD   HeadLength;
131     LPVOID  Tail;
132     DWORD   TailLength;
133 } TRANSMIT_FILE_BUFFERS, *PTRANSMIT_FILE_BUFFERS, *LPTRANSMIT_FILE_BUFFERS;
134
135 typedef struct _TRANSMIT_PACKETS_ELEMENT {
136     ULONG  dwElFlags;
137     ULONG  cLength;
138     union {
139       struct {
140         LARGE_INTEGER  nFileOffset;
141         HANDLE         hFile;
142       } DUMMYSTRUCTNAME;
143       PVOID  pBuffer;
144     } DUMMYUNIONNAME;
145 } TRANSMIT_PACKETS_ELEMENT, *PTRANSMIT_PACKETS_ELEMENT, *LPTRANSMIT_PACKETS_ELEMENT;
146
147 typedef struct _WSAMSG {
148     LPSOCKADDR  name;
149     INT         namelen;
150     LPWSABUF    lpBuffers;
151     DWORD       dwBufferCount;
152     WSABUF      Control;
153     DWORD       dwFlags;
154 } WSAMSG, *PWSAMSG, *LPWSAMSG;
155
156 typedef struct _WSACMSGHDR {
157     SIZE_T      cmsg_len;
158     INT         cmsg_level;
159     INT         cmsg_type;
160     /* followed by UCHAR cmsg_data[] */
161 } WSACMSGHDR, *PWSACMSGHDR, *LPWSACMSGHDR;
162
163 typedef BOOL (WINAPI * LPFN_ACCEPTEX)(SOCKET, SOCKET, PVOID, DWORD, DWORD, DWORD, LPDWORD, LPOVERLAPPED);
164 typedef BOOL (WINAPI * LPFN_CONNECTEX)(SOCKET, const struct sockaddr *, int, PVOID, DWORD, LPDWORD, LPOVERLAPPED);
165 typedef BOOL (WINAPI * LPFN_DISCONNECTEX)(SOCKET, LPOVERLAPPED, DWORD, DWORD);
166 typedef VOID (WINAPI * LPFN_GETACCEPTEXSOCKADDRS)(PVOID, DWORD, DWORD, DWORD, struct sockaddr **, LPINT, struct sockaddr **, LPINT);
167 typedef BOOL (WINAPI * LPFN_TRANSMITFILE)(SOCKET, HANDLE, DWORD, DWORD, LPOVERLAPPED, LPTRANSMIT_FILE_BUFFERS, DWORD);
168 typedef BOOL (WINAPI * LPFN_TRANSMITPACKETS)(SOCKET, LPTRANSMIT_PACKETS_ELEMENT, DWORD, DWORD, LPOVERLAPPED, DWORD);
169 typedef INT  (WINAPI * LPFN_WSARECVMSG)(SOCKET, LPWSAMSG, LPDWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE);
170
171 BOOL WINAPI AcceptEx(SOCKET, SOCKET, PVOID, DWORD, DWORD, DWORD, LPDWORD, LPOVERLAPPED);
172 VOID WINAPI GetAcceptExSockaddrs(PVOID, DWORD, DWORD, DWORD, struct sockaddr **, LPINT, struct sockaddr **, LPINT);
173 BOOL WINAPI TransmitFile(SOCKET, HANDLE, DWORD, DWORD, LPOVERLAPPED, LPTRANSMIT_FILE_BUFFERS, DWORD);
174 INT  WINAPI WSARecvEx(SOCKET, char *, INT, INT *);
175
176 #ifdef __cplusplus
177 }
178 #endif
179
180 #endif /* _MSWSOCK_ */