1 | /*
|
---|
2 | * Winsock 2 definitions - used for ws2_32.dll
|
---|
3 | *
|
---|
4 | * FIXME: Still missing required Winsock 2 definitions.
|
---|
5 | */
|
---|
6 |
|
---|
7 | #ifndef __WINSOCK2API__
|
---|
8 | #define __WINSOCK2API__
|
---|
9 |
|
---|
10 | #include "winsock.h"
|
---|
11 |
|
---|
12 | /* proper 4-byte packing */
|
---|
13 | #include "pshpack4.h"
|
---|
14 |
|
---|
15 | #define WS_SO_GROUP_ID 0x2001
|
---|
16 | #define WS_SO_GROUP_PRIORITY 0x2002
|
---|
17 | #define WS_SO_MAX_MSG_SIZE 0x2003
|
---|
18 | #define WS_SO_PROTOCOL_INFOA 0x2004
|
---|
19 | #define WS_SO_PROTOCOL_INFOW 0x2005
|
---|
20 | #define WS_SO_PROTOCOL_INFO WINELIB_NAME_AW(WS_SO_PROTOCOL_INFO)
|
---|
21 |
|
---|
22 | #define PVD_CONFIG 0x3001
|
---|
23 | #define SO_CONDITIONAL_ACCEPT 0x3002
|
---|
24 |
|
---|
25 |
|
---|
26 | /* option flags per socket */
|
---|
27 |
|
---|
28 | #define FD_MAX_EVENTS 10
|
---|
29 | #define FD_ALL_EVENTS ((1 << FD_MAX_EVENTS) - 1)
|
---|
30 | #define FD_READ_BIT 0
|
---|
31 | #define FD_READ (1 << FD_READ_BIT)
|
---|
32 | #define FD_WRITE_BIT 1
|
---|
33 | #define FD_WRITE (1 << FD_WRITE_BIT)
|
---|
34 | #define FD_OOB_BIT 2
|
---|
35 | #define FD_OOB (1 << FD_OOB_BIT)
|
---|
36 | #define FD_ACCEPT_BIT 3
|
---|
37 | #define FD_ACCEPT (1 << FD_ACCEPT_BIT)
|
---|
38 | #define FD_CONNECT_BIT 4
|
---|
39 | #define FD_CONNECT (1 << FD_CONNECT_BIT)
|
---|
40 | #define FD_CLOSE_BIT 5
|
---|
41 | #define FD_CLOSE (1 << FD_CLOSE_BIT)
|
---|
42 | #define FD_QOS_BIT 6
|
---|
43 | #define FD_QOS (1 << FD_QOS_BIT)
|
---|
44 | #define FD_GROUP_QOS_BIT 7
|
---|
45 | #define FD_GROUP_QOS (1 << FD_GROUP_QOS_BIT)
|
---|
46 | #define FD_ROUTING_INTERFACE_CHANGE_BIT 8
|
---|
47 | #define FD_ROUTING_INTERFACE_CHANGE (1 << FD_ROUTING_INTERFACE_CHANGE_BIT)
|
---|
48 | #define FD_ADDRESS_LIST_CHANGE_BIT 9
|
---|
49 | #define FD_ADDRESS_LIST_CHANGE (1 << FD_ADDRESS_LIST_CHANGE_BIT)
|
---|
50 |
|
---|
51 | /*
|
---|
52 | * Constants for WSAIoctl()
|
---|
53 | */
|
---|
54 | #define IOC_UNIX 0x00000000
|
---|
55 | #define IOC_WS2 0x08000000
|
---|
56 | #define IOC_PROTOCOL 0x10000000
|
---|
57 | #define IOC_VENDOR 0x18000000
|
---|
58 | #define _WSAIO(x,y) (IOC_VOID|(x)|(y))
|
---|
59 | #define _WSAIOR(x,y) (IOC_OUT|(x)|(y))
|
---|
60 | #define _WSAIOW(x,y) (IOC_IN|(x)|(y))
|
---|
61 | #define _WSAIORW(x,y) (IOC_INOUT|(x)|(y))
|
---|
62 | #define SIO_ASSOCIATE_HANDLE _WSAIOW(IOC_WS2,1)
|
---|
63 | #define SIO_ENABLE_CIRCULAR_QUEUEING _WSAIO(IOC_WS2,2)
|
---|
64 | #define SIO_FIND_ROUTE _WSAIOR(IOC_WS2,3)
|
---|
65 | #define SIO_FLUSH _WSAIO(IOC_WS2,4)
|
---|
66 | #define SIO_GET_BROADCAST_ADDRESS _WSAIOR(IOC_WS2,5)
|
---|
67 | #define SIO_GET_EXTENSION_FUNCTION_POINTER _WSAIORW(IOC_WS2,6)
|
---|
68 | #define SIO_GET_QOS _WSAIORW(IOC_WS2,7)
|
---|
69 | #define SIO_GET_GROUP_QOS _WSAIORW(IOC_WS2,8)
|
---|
70 | #define SIO_MULTIPOINT_LOOPBACK _WSAIOW(IOC_WS2,9)
|
---|
71 | #define SIO_MULTICAST_SCOPE _WSAIOW(IOC_WS2,10)
|
---|
72 | #define SIO_SET_QOS _WSAIOW(IOC_WS2,11)
|
---|
73 | #define SIO_SET_GROUP_QOS _WSAIOW(IOC_WS2,12)
|
---|
74 | #define SIO_TRANSLATE_HANDLE _WSAIORW(IOC_WS2,13)
|
---|
75 | #define SIO_ROUTING_INTERFACE_QUERY _WSAIORW(IOC_WS2,20)
|
---|
76 | #define SIO_ROUTING_INTERFACE_CHANGE _WSAIOW(IOC_WS2,21)
|
---|
77 | #define SIO_ADDRESS_LIST_QUERY _WSAIOR(IOC_WS2,22)
|
---|
78 | #define SIO_ADDRESS_LIST_CHANGE _WSAIO(IOC_WS2,23)
|
---|
79 | #define SIO_QUERY_TARGET_PNP_HANDLE _WSAIOR(IOC_W32,24)
|
---|
80 | #define SIO_GET_INTERFACE_LIST WS_IOR ('t', 127, u_long)
|
---|
81 |
|
---|
82 | /* Unfortunately the sockaddr_in6 structure doesn't
|
---|
83 | seem to be defined in a standard place, even across
|
---|
84 | different Linux distributions. Until IPv6 support settles
|
---|
85 | down, let's do our own here so the sockaddr_gen
|
---|
86 | union is the correct size.*/
|
---|
87 | #ifdef s6_addr
|
---|
88 | #undef s6_addr
|
---|
89 | #endif
|
---|
90 |
|
---|
91 | struct ws_in_addr6
|
---|
92 | {
|
---|
93 | unsigned char s6_addr[16]; /* IPv6 address */
|
---|
94 | };
|
---|
95 | struct ws_sockaddr_in6
|
---|
96 | {
|
---|
97 | short sin6_family; /* AF_INET6 */
|
---|
98 | u_short sin6_port; /* Transport level port number */
|
---|
99 | u_long sin6_flowinfo; /* IPv6 flow information */
|
---|
100 | struct ws_in_addr6 sin6_addr; /* IPv6 address */
|
---|
101 | };
|
---|
102 |
|
---|
103 | struct ws_in_addr
|
---|
104 | {
|
---|
105 | union {
|
---|
106 | struct { BYTE s_b1,s_b2,s_b3,s_b4; } S_un_b;
|
---|
107 | struct { WORD s_w1,s_w2; } S_un_w;
|
---|
108 | UINT S_addr;
|
---|
109 | } S_un;
|
---|
110 | #define ws_addr S_un.S_addr /* can be used for most tcp & ip code */
|
---|
111 | #define ws_host S_un.S_un_b.s_b2 /* host on imp */
|
---|
112 | #define ws_net S_un.S_un_b.s_b1 /* network */
|
---|
113 | #define ws_imp S_un.S_un_w.s_w2 /* imp */
|
---|
114 | #define ws_impno S_un.S_un_b.s_b4 /* imp # */
|
---|
115 | #define ws_lh S_un.S_un_b.s_b3 /* logical host */
|
---|
116 | };
|
---|
117 |
|
---|
118 | struct ws_sockaddr_in
|
---|
119 | {
|
---|
120 | SHORT sin_family;
|
---|
121 | WORD sin_port;
|
---|
122 | struct ws_in_addr sin_addr;
|
---|
123 | BYTE sin_zero[8];
|
---|
124 | };
|
---|
125 |
|
---|
126 | typedef union sockaddr_gen
|
---|
127 | {
|
---|
128 | struct sockaddr Address;
|
---|
129 | struct ws_sockaddr_in AddressIn;
|
---|
130 | struct ws_sockaddr_in6 AddressIn6;
|
---|
131 | } sockaddr_gen;
|
---|
132 |
|
---|
133 | /* ws_hostent, ws_protoent, ws_servent, ws_netent are 4-byte aligned here ! */
|
---|
134 |
|
---|
135 | typedef struct ws_hostent32
|
---|
136 | {
|
---|
137 | char *h_name; /* official name of host */
|
---|
138 | char **h_aliases; /* alias list */
|
---|
139 | short h_addrtype; /* host address type */
|
---|
140 | short h_length; /* length of address */
|
---|
141 | char **h_addr_list; /* list of addresses from name server */
|
---|
142 | } _ws_hostent32;
|
---|
143 |
|
---|
144 | typedef struct ws_protoent32
|
---|
145 | {
|
---|
146 | char *p_name; /* official protocol name */
|
---|
147 | char **p_aliases; /* alias list */
|
---|
148 | short p_proto; /* protocol # */
|
---|
149 | } _ws_protoent32;
|
---|
150 |
|
---|
151 | typedef struct ws_servent32
|
---|
152 | {
|
---|
153 | char *s_name; /* official service name */
|
---|
154 | char **s_aliases; /* alias list */
|
---|
155 | short s_port; /* port # */
|
---|
156 | char *s_proto; /* protocol to use */
|
---|
157 | } _ws_servent32;
|
---|
158 |
|
---|
159 | typedef struct ws_netent32
|
---|
160 | {
|
---|
161 | char *n_name; /* official name of net */
|
---|
162 | char **n_aliases; /* alias list */
|
---|
163 | short n_addrtype; /* net address type */
|
---|
164 | u_long n_net; /* network # */
|
---|
165 | } _ws_netent32;
|
---|
166 |
|
---|
167 | /* Structure to keep interface specific information */
|
---|
168 | typedef struct _INTERFACE_INFO
|
---|
169 | {
|
---|
170 | u_long iiFlags; /* Interface flags */
|
---|
171 | sockaddr_gen iiAddress; /* Interface address */
|
---|
172 | sockaddr_gen iiBroadcastAddress; /* Broadcast address */
|
---|
173 | sockaddr_gen iiNetmask; /* Network mask */
|
---|
174 | } INTERFACE_INFO, * LPINTERFACE_INFO;
|
---|
175 |
|
---|
176 | /* Possible flags for the iiFlags - bitmask */
|
---|
177 | #ifndef HAVE_NET_IF_H
|
---|
178 | # define IFF_UP 0x00000001 /* Interface is up */
|
---|
179 | # define IFF_BROADCAST 0x00000002 /* Broadcast is supported */
|
---|
180 | # define IFF_LOOPBACK 0x00000004 /* this is loopback interface */
|
---|
181 | # define IFF_POINTTOPOINT 0x00000008 /* this is point-to-point interface */
|
---|
182 | # define IFF_MULTICAST 0x00000010 /* multicast is supported */
|
---|
183 | #endif
|
---|
184 |
|
---|
185 | #ifndef GUID_DEFINED
|
---|
186 | #include "guiddef.h"
|
---|
187 | #endif
|
---|
188 |
|
---|
189 | #define MAX_PROTOCOL_CHAIN 7
|
---|
190 | #define BASE_PROTOCOL 1
|
---|
191 | #define LAYERED_PROTOCOL 0
|
---|
192 |
|
---|
193 | typedef struct _WSAPROTOCOLCHAIN
|
---|
194 | {
|
---|
195 | int ChainLen; /* the length of the chain, */
|
---|
196 | /* length = 0 means layered protocol, */
|
---|
197 | /* length = 1 means base protocol, */
|
---|
198 | /* length > 1 means protocol chain */
|
---|
199 | DWORD ChainEntries[MAX_PROTOCOL_CHAIN]; /* a list of dwCatalogEntryIds */
|
---|
200 | } WSAPROTOCOLCHAIN, * LPWSAPROTOCOLCHAIN;
|
---|
201 | #define WSAPROTOCOL_LEN 255
|
---|
202 |
|
---|
203 | typedef struct _WSAPROTOCOL_INFOA
|
---|
204 | {
|
---|
205 | DWORD dwServiceFlags1;
|
---|
206 | DWORD dwServiceFlags2;
|
---|
207 | DWORD dwServiceFlags3;
|
---|
208 | DWORD dwServiceFlags4;
|
---|
209 | DWORD dwProviderFlags;
|
---|
210 | GUID ProviderId;
|
---|
211 | DWORD dwCatalogEntryId;
|
---|
212 | WSAPROTOCOLCHAIN ProtocolChain;
|
---|
213 | int iVersion;
|
---|
214 | int iAddressFamily;
|
---|
215 | int iMaxSockAddr;
|
---|
216 | int iMinSockAddr;
|
---|
217 | int iSocketType;
|
---|
218 | int iProtocol;
|
---|
219 | int iProtocolMaxOffset;
|
---|
220 | int iNetworkByteOrder;
|
---|
221 | int iSecurityScheme;
|
---|
222 | DWORD dwMessageSize;
|
---|
223 | DWORD dwProviderReserved;
|
---|
224 | CHAR szProtocol[WSAPROTOCOL_LEN+1];
|
---|
225 | } WSAPROTOCOL_INFOA, * LPWSAPROTOCOL_INFOA;
|
---|
226 |
|
---|
227 | typedef struct _WSAPROTOCOL_INFOW
|
---|
228 | {
|
---|
229 | DWORD dwServiceFlags1;
|
---|
230 | DWORD dwServiceFlags2;
|
---|
231 | DWORD dwServiceFlags3;
|
---|
232 | DWORD dwServiceFlags4;
|
---|
233 | DWORD dwProviderFlags;
|
---|
234 | GUID ProviderId;
|
---|
235 | DWORD dwCatalogEntryId;
|
---|
236 | WSAPROTOCOLCHAIN ProtocolChain;
|
---|
237 | int iVersion;
|
---|
238 | int iAddressFamily;
|
---|
239 | int iMaxSockAddr;
|
---|
240 | int iMinSockAddr;
|
---|
241 | int iSocketType;
|
---|
242 | int iProtocol;
|
---|
243 | int iProtocolMaxOffset;
|
---|
244 | int iNetworkByteOrder;
|
---|
245 | int iSecurityScheme;
|
---|
246 | DWORD dwMessageSize;
|
---|
247 | DWORD dwProviderReserved;
|
---|
248 | WCHAR szProtocol[WSAPROTOCOL_LEN+1];
|
---|
249 | } WSAPROTOCOL_INFOW, * LPWSAPROTOCOL_INFOW;
|
---|
250 |
|
---|
251 | typedef struct _WSANETWORKEVENTS
|
---|
252 | {
|
---|
253 | long lNetworkEvents;
|
---|
254 | int iErrorCode[FD_MAX_EVENTS];
|
---|
255 | } WSANETWORKEVENTS, *LPWSANETWORKEVENTS;
|
---|
256 |
|
---|
257 | typedef struct _WSABUF
|
---|
258 | {
|
---|
259 | ULONG len;
|
---|
260 | CHAR* buf;
|
---|
261 | } WSABUF, *LPWSABUF;
|
---|
262 |
|
---|
263 | typedef struct _OVERLAPPED * LPWSAOVERLAPPED;
|
---|
264 | typedef HANDLE WSAEVENT;
|
---|
265 | typedef unsigned int GROUP;
|
---|
266 |
|
---|
267 | typedef void (* CALLBACK LPWSAOVERLAPPED_COMPLETION_ROUTINE)
|
---|
268 | (
|
---|
269 | DWORD dwError,
|
---|
270 | DWORD cbTransferred,
|
---|
271 | LPWSAOVERLAPPED lpOverlapped,
|
---|
272 | DWORD dwFlags
|
---|
273 | );
|
---|
274 |
|
---|
275 |
|
---|
276 | /* Function declarations */
|
---|
277 | int WINAPI WSAEnumNetworkEvents(SOCKET s, WSAEVENT hEventObject, LPWSANETWORKEVENTS lpNetworkEvents);
|
---|
278 | int WINAPI WSAEventSelect(SOCKET s, WSAEVENT hEventObject, long lNetworkEvents);
|
---|
279 | WSAEVENT WINAPI WSACreateEvent(void);
|
---|
280 | BOOL WINAPI WSACloseEvent(WSAEVENT event);
|
---|
281 | SOCKET WINAPI WSASocketA(int af, int type, int protocol,
|
---|
282 | LPWSAPROTOCOL_INFOA lpProtocolInfo,
|
---|
283 | GROUP g, DWORD dwFlags);
|
---|
284 | extern INT WINAPI ioctlsocket(SOCKET s, LONG cmd, ULONG *argp);
|
---|
285 |
|
---|
286 | #include "poppack.h"
|
---|
287 |
|
---|
288 | #endif
|
---|