wined3d: Directly call wined3d_texture_create() to create swapchain textures.
[wine.git] / include / ws2def.h
blob46fb80db470561160cae41861191b5053fcbc95b
1 /*
2 * Copyright (C) 2009 Robert Shearman
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.
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.
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
19 #ifndef _WS2DEF_
20 #define _WS2DEF_
22 #include <inaddr.h>
24 #ifdef USE_WS_PREFIX
25 #define WS(x) WS_##x
26 #else
27 #define WS(x) x
28 #endif
30 typedef USHORT ADDRESS_FAMILY;
32 typedef struct WS(sockaddr)
34 unsigned short sa_family;
35 char sa_data[14];
36 } SOCKADDR, *PSOCKADDR, *LPSOCKADDR;
38 #ifndef USE_WS_PREFIX
39 #define AF_UNSPEC 0
40 #define AF_UNIX 1
41 #define AF_INET 2
42 #define AF_IMPLINK 3
43 #define AF_PUP 4
44 #define AF_CHAOS 5
45 #define AF_NS 6
46 #define AF_IPX AF_NS
47 #define AF_ISO 7
48 #define AF_OSI AF_ISO
49 #define AF_ECMA 8
50 #define AF_DATAKIT 9
51 #define AF_CCITT 10
52 #define AF_SNA 11
53 #define AF_DECnet 12
54 #define AF_DLI 13
55 #define AF_LAT 14
56 #define AF_HYLINK 15
57 #define AF_APPLETALK 16
58 #define AF_NETBIOS 17
59 #define AF_VOICEVIEW 18
60 #define AF_FIREFOX 19
61 #define AF_UNKNOWN1 20
62 #define AF_BAN 21
63 #define AF_ATM 22
64 #define AF_INET6 23
65 #define AF_CLUSTER 24
66 #define AF_12844 25
67 #define AF_IRDA 26
68 #define AF_MAX 27
69 #else /* USE_WS_PREFIX */
70 #define WS_AF_UNSPEC 0
71 #define WS_AF_UNIX 1
72 #define WS_AF_INET 2
73 #define WS_AF_IMPLINK 3
74 #define WS_AF_PUP 4
75 #define WS_AF_CHAOS 5
76 #define WS_AF_NS 6
77 #define WS_AF_IPX WS_AF_NS
78 #define WS_AF_ISO 7
79 #define WS_AF_OSI WS_AF_ISO
80 #define WS_AF_ECMA 8
81 #define WS_AF_DATAKIT 9
82 #define WS_AF_CCITT 10
83 #define WS_AF_SNA 11
84 #define WS_AF_DECnet 12
85 #define WS_AF_DLI 13
86 #define WS_AF_LAT 14
87 #define WS_AF_HYLINK 15
88 #define WS_AF_APPLETALK 16
89 #define WS_AF_NETBIOS 17
90 #define WS_AF_VOICEVIEW 18
91 #define WS_AF_FIREFOX 19
92 #define WS_AF_UNKNOWN1 20
93 #define WS_AF_BAN 21
94 #define WS_AF_ATM 22
95 #define WS_AF_INET6 23
96 #define WS_AF_CLUSTER 24
97 #define WS_AF_12844 25
98 #define WS_AF_IRDA 26
99 #define WS_AF_MAX 27
100 #endif /* USE_WS_PREFIX */
102 #ifndef USE_WS_PREFIX
103 #define IPPROTO_IP 0
104 #else
105 #define WS_IPPROTO_IP 0
106 #endif
108 typedef enum
110 WS(IPPROTO_ICMP) = 1,
111 WS(IPPROTO_IGMP) = 2,
112 WS(IPPROTO_GGP) = 3,
113 WS(IPPROTO_IPV4) = 4,
114 WS(IPPROTO_TCP) = 6,
115 WS(IPPROTO_UDP) = 17,
116 WS(IPPROTO_IDP) = 22,
117 WS(IPPROTO_IPV6) = 41,
118 WS(IPPROTO_ICMPV6) = 58,
119 WS(IPPROTO_ND) = 77,
120 WS(IPPROTO_RAW) = 255,
121 WS(IPPROTO_MAX) = 256,
122 } IPPROTO;
124 #ifndef USE_WS_PREFIX
125 #define INADDR_ANY ((ULONG)0x00000000)
126 #define INADDR_LOOPBACK 0x7f000001
127 #define INADDR_BROADCAST ((ULONG)0xffffffff)
128 #define INADDR_NONE 0xffffffff
129 #else
130 #define WS_INADDR_ANY ((ULONG)0x00000000)
131 #define WS_INADDR_LOOPBACK 0x7f000001
132 #define WS_INADDR_BROADCAST ((ULONG)0xffffffff)
133 #define WS_INADDR_NONE 0xffffffff
134 #endif
136 #ifndef USE_WS_PREFIX
137 #define IN_CLASSA_NSHIFT 24
138 #define IN_CLASSA_MAX 128
139 #define IN_CLASSA_NET 0xff000000
140 #define IN_CLASSA_HOST 0x00ffffff
141 #define IN_CLASSA(i) (((LONG)(i) & 0x80000000) == 0)
142 #define IN_CLASSB_NSHIFT 16
143 #define IN_CLASSB_MAX 65536
144 #define IN_CLASSB_NET 0xffff0000
145 #define IN_CLASSB_HOST 0x0000ffff
146 #define IN_CLASSB(i) (((LONG)(i) & 0xc0000000) == 0x80000000)
147 #define IN_CLASSC_NSHIFT 8
148 #define IN_CLASSC_NET 0xffffff00
149 #define IN_CLASSC_HOST 0x000000ff
150 #define IN_CLASSC(i) (((LONG)(i) & 0xe0000000) == 0xc0000000)
151 #else
152 #define WS_IN_CLASSA_NSHIFT 24
153 #define WS_IN_CLASSA_MAX 128
154 #define WS_IN_CLASSA_NET 0xff000000
155 #define WS_IN_CLASSA_HOST 0x00ffffff
156 #define WS_IN_CLASSA(i) (((LONG)(i) & 0x80000000) == 0)
157 #define WS_IN_CLASSB_NSHIFT 16
158 #define WS_IN_CLASSB_MAX 65536
159 #define WS_IN_CLASSB_NET 0xffff0000
160 #define WS_IN_CLASSB_HOST 0x0000ffff
161 #define WS_IN_CLASSB(i) (((LONG)(i) & 0xc0000000) == 0x80000000)
162 #define WS_IN_CLASSC_NSHIFT 8
163 #define WS_IN_CLASSC_NET 0xffffff00
164 #define WS_IN_CLASSC_HOST 0x000000ff
165 #define WS_IN_CLASSC(i) (((LONG)(i) & 0xe0000000) == 0xc0000000)
166 #endif /* USE_WS_PREFIX */
168 #ifndef USE_WS_PREFIX
169 #define SO_BSP_STATE 0x1009
170 #define SO_RANDOMIZE_PORT 0x3005
171 #define SO_PORT_SCALABILITY 0x3006
172 #define SO_REUSE_UNICASTPORT 0x3007
173 #define SO_REUSE_MULTICASTPORT 0x3008
174 #define TCP_NODELAY 0x0001
175 #else
176 #define WS_SO_BSP_STATE 0x1009
177 #define WS_SO_RANDOMIZE_PORT 0x3005
178 #define WS_SO_PORT_SCALABILITY 0x3006
179 #define WS_SO_REUSE_UNICASTPORT 0x3007
180 #define WS_SO_REUSE_MULTICASTPORT 0x3008
181 #define WS_TCP_NODELAY 0x0001
182 #endif
184 typedef struct WS(sockaddr_in)
186 short sin_family;
187 unsigned short sin_port;
188 struct WS(in_addr) sin_addr;
189 char sin_zero[8];
190 } SOCKADDR_IN, *PSOCKADDR_IN, *LPSOCKADDR_IN;
192 #ifndef __CSADDR_DEFINED__
193 #define __CSADDR_DEFINED__
195 typedef struct _SOCKET_ADDRESS {
196 LPSOCKADDR lpSockaddr;
197 INT iSockaddrLength;
198 } SOCKET_ADDRESS, *PSOCKET_ADDRESS, *LPSOCKET_ADDRESS;
200 typedef struct _CSADDR_INFO {
201 SOCKET_ADDRESS LocalAddr;
202 SOCKET_ADDRESS RemoteAddr;
203 INT iSocketType;
204 INT iProtocol;
205 } CSADDR_INFO, *PCSADDR_INFO, *LPCSADDR_INFO;
206 #endif
208 #ifdef USE_WS_PREFIX
209 #define WS__SS_MAXSIZE 128
210 #define WS__SS_ALIGNSIZE (sizeof(__int64))
211 #define WS__SS_PAD1SIZE (WS__SS_ALIGNSIZE - sizeof(short))
212 #define WS__SS_PAD2SIZE (WS__SS_MAXSIZE - 2 * WS__SS_ALIGNSIZE)
213 #else
214 #define _SS_MAXSIZE 128
215 #define _SS_ALIGNSIZE (sizeof(__int64))
216 #define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(short))
217 #define _SS_PAD2SIZE (_SS_MAXSIZE - 2 * _SS_ALIGNSIZE)
218 #endif
220 typedef struct WS(sockaddr_storage) {
221 short ss_family;
222 char __ss_pad1[WS(_SS_PAD1SIZE)];
223 __int64 DECLSPEC_ALIGN(8) __ss_align;
224 char __ss_pad2[WS(_SS_PAD2SIZE)];
225 } SOCKADDR_STORAGE, *PSOCKADDR_STORAGE, *LPSOCKADDR_STORAGE;
227 /*socket address list */
228 typedef struct _SOCKET_ADDRESS_LIST {
229 INT iAddressCount;
230 SOCKET_ADDRESS Address[1];
231 } SOCKET_ADDRESS_LIST, *LPSOCKET_ADDRESS_LIST;
233 typedef enum {
234 ScopeLevelInterface = 1,
235 ScopeLevelLink = 2,
236 ScopeLevelSubnet = 3,
237 ScopeLevelAdmin = 4,
238 ScopeLevelSite = 5,
239 ScopeLevelOrganization = 8,
240 ScopeLevelGlobal = 14,
241 ScopeLevelCount = 16,
242 } SCOPE_LEVEL;
244 typedef struct
246 union {
247 struct {
248 ULONG Zone : 28;
249 ULONG Level : 4;
250 } DUMMYSTRUCTNAME;
251 ULONG Value;
252 } DUMMYUNIONNAME;
253 } SCOPE_ID, *PSCOPE_ID;
255 typedef struct _WSABUF
257 ULONG len;
258 CHAR* buf;
259 } WSABUF, *LPWSABUF;
261 typedef struct _WSAMSG {
262 LPSOCKADDR name;
263 INT namelen;
264 LPWSABUF lpBuffers;
265 DWORD dwBufferCount;
266 WSABUF Control;
267 DWORD dwFlags;
268 } WSAMSG, *PWSAMSG, *LPWSAMSG;
271 * Macros for retrieving control message data returned by WSARecvMsg()
273 #define WSA_CMSG_DATA(cmsg) ((UCHAR*)((WSACMSGHDR*)(cmsg)+1))
274 #define WSA_CMSG_FIRSTHDR(mhdr) ((mhdr)->Control.len >= sizeof(WSACMSGHDR) ? (WSACMSGHDR *) (mhdr)->Control.buf : (WSACMSGHDR *) 0)
275 #define WSA_CMSG_ALIGN(len) (((len) + sizeof(SIZE_T) - 1) & ~(sizeof(SIZE_T) - 1))
277 * Next Header: If the response is too short (or the next message in the response
278 * is too short) then return NULL, otherwise return the next control message.
280 #define WSA_CMSG_NXTHDR(mhdr,cmsg) \
281 (!(cmsg) ? WSA_CMSG_FIRSTHDR(mhdr) : \
282 ((mhdr)->Control.len < sizeof(WSACMSGHDR) ? NULL : \
283 (((unsigned char*)(((WSACMSGHDR*)((unsigned char*)cmsg + WSA_CMSG_ALIGN(cmsg->cmsg_len)))+1) > ((unsigned char*)(mhdr)->Control.buf + (mhdr)->Control.len)) ? NULL : \
284 (((unsigned char*)cmsg + WSA_CMSG_ALIGN(cmsg->cmsg_len)+WSA_CMSG_ALIGN(((WSACMSGHDR*)((unsigned char*)cmsg + WSA_CMSG_ALIGN(cmsg->cmsg_len)))->cmsg_len) > ((unsigned char*)(mhdr)->Control.buf + (mhdr)->Control.len)) ? NULL : \
285 (WSACMSGHDR*)((unsigned char*)cmsg + WSA_CMSG_ALIGN(cmsg->cmsg_len))))))
287 #ifndef USE_WS_PREFIX
288 #define AI_DNS_ONLY 0x00000010
289 #else
290 #define WS_AI_DNS_ONLY 0x00000010
291 #endif
293 typedef struct addrinfoexA {
294 int ai_flags;
295 int ai_family;
296 int ai_socktype;
297 int ai_protocol;
298 SIZE_T ai_addrlen;
299 char *ai_canonname;
300 struct WS(sockaddr) *ai_addr;
301 void *ai_blob;
302 SIZE_T ai_bloblen;
303 GUID *ai_provider;
304 struct addrinfoexA *ai_next;
305 } ADDRINFOEXA, *PADDRINFOEXA, *LPADDRINFOEXA;
307 typedef struct addrinfoexW {
308 int ai_flags;
309 int ai_family;
310 int ai_socktype;
311 int ai_protocol;
312 SIZE_T ai_addrlen;
313 WCHAR *ai_canonname;
314 struct WS(sockaddr) *ai_addr;
315 void *ai_blob;
316 SIZE_T ai_bloblen;
317 GUID *ai_provider;
318 struct addrinfoexW *ai_next;
319 } ADDRINFOEXW, *PADDRINFOEXW, *LPADDRINFOEXW;
321 #endif /* _WS2DEF_ */