blob: 31293295dbf9155d6cfc42d8b856ee8751a89fe3 [file] [log] [blame]
Ove Kaavena39ad1a1999-09-27 11:48:11 +00001/*
James Hatheway829405a2000-06-18 17:23:17 +00002 * Winsock 2 definitions - used for ws2_32.dll
Ove Kaavena39ad1a1999-09-27 11:48:11 +00003 *
James Hatheway829405a2000-06-18 17:23:17 +00004 * FIXME: Still missing required Winsock 2 definitions.
Ove Kaavena39ad1a1999-09-27 11:48:11 +00005 */
6
7#ifndef __WINSOCK2API__
8#define __WINSOCK2API__
9
10#include "winsock.h"
James Hatheway829405a2000-06-18 17:23:17 +000011#include "wtypes.h"
Ove Kaavena39ad1a1999-09-27 11:48:11 +000012
Andreas Mohrae509412000-08-03 22:19:09 +000013/* proper 4-byte packing */
14#include "pshpack4.h"
15
Peter Hunnisett565b0082000-09-19 02:43:00 +000016#define WS_SO_GROUP_ID 0x2001
17#define WS_SO_GROUP_PRIORITY 0x2002
18#define WS_SO_MAX_MSG_SIZE 0x2003
19#define WS_SO_PROTOCOL_INFOA 0x2004
20#define WS_SO_PROTOCOL_INFOW 0x2005
21#define WS_SO_PROTOCOL_INFO WINELIB_NAME_AW(WS_SO_PROTOCOL_INFO)
22
23#define PVD_CONFIG 0x3001
24#define SO_CONDITIONAL_ACCEPT 0x3002
25
26
27/* option flags per socket */
28
James Hatheway829405a2000-06-18 17:23:17 +000029#define FD_MAX_EVENTS 10
Ove Kaavena39ad1a1999-09-27 11:48:11 +000030#define FD_READ_BIT 0
31#define FD_WRITE_BIT 1
32#define FD_OOB_BIT 2
33#define FD_ACCEPT_BIT 3
34#define FD_CONNECT_BIT 4
35#define FD_CLOSE_BIT 5
36
James Hatheway829405a2000-06-18 17:23:17 +000037/*
38 * Constants for WSAIoctl()
39 */
40#define IOC_UNIX 0x00000000
41#define IOC_WS2 0x08000000
42#define IOC_PROTOCOL 0x10000000
43#define IOC_VENDOR 0x18000000
44#define _WSAIO(x,y) (IOC_VOID|(x)|(y))
45#define _WSAIOR(x,y) (IOC_OUT|(x)|(y))
46#define _WSAIOW(x,y) (IOC_IN|(x)|(y))
47#define _WSAIORW(x,y) (IOC_INOUT|(x)|(y))
48#define SIO_ASSOCIATE_HANDLE _WSAIOW(IOC_WS2,1)
49#define SIO_ENABLE_CIRCULAR_QUEUEING _WSAIO(IOC_WS2,2)
50#define SIO_FIND_ROUTE _WSAIOR(IOC_WS2,3)
51#define SIO_FLUSH _WSAIO(IOC_WS2,4)
52#define SIO_GET_BROADCAST_ADDRESS _WSAIOR(IOC_WS2,5)
53#define SIO_GET_EXTENSION_FUNCTION_POINTER _WSAIORW(IOC_WS2,6)
54#define SIO_GET_QOS _WSAIORW(IOC_WS2,7)
55#define SIO_GET_GROUP_QOS _WSAIORW(IOC_WS2,8)
56#define SIO_MULTIPOINT_LOOPBACK _WSAIOW(IOC_WS2,9)
57#define SIO_MULTICAST_SCOPE _WSAIOW(IOC_WS2,10)
58#define SIO_SET_QOS _WSAIOW(IOC_WS2,11)
59#define SIO_SET_GROUP_QOS _WSAIOW(IOC_WS2,12)
60#define SIO_TRANSLATE_HANDLE _WSAIORW(IOC_WS2,13)
61#define SIO_ROUTING_INTERFACE_QUERY _WSAIORW(IOC_WS2,20)
62#define SIO_ROUTING_INTERFACE_CHANGE _WSAIOW(IOC_WS2,21)
63#define SIO_ADDRESS_LIST_QUERY _WSAIOR(IOC_WS2,22)
64#define SIO_ADDRESS_LIST_CHANGE _WSAIO(IOC_WS2,23)
65#define SIO_QUERY_TARGET_PNP_HANDLE _WSAIOR(IOC_W32,24)
66#define SIO_GET_INTERFACE_LIST WS_IOR ('t', 127, u_long)
67
68/* Unfortunately the sockaddr_in6 structure doesn't
69 seem to be defined in a standard place, even across
70 different Linux distributions. Until IPv6 support settles
71 down, let's do our own here so the sockaddr_gen
72 union is the correct size.*/
73#ifdef s6_addr
74#undef s6_addr
75#endif
Andreas Mohrae509412000-08-03 22:19:09 +000076
James Hatheway829405a2000-06-18 17:23:17 +000077struct ws_in_addr6
78{
79 unsigned char s6_addr[16]; /* IPv6 address */
80};
81struct ws_sockaddr_in6
82{
83 short sin6_family; /* AF_INET6 */
84 u_short sin6_port; /* Transport level port number */
85 u_long sin6_flowinfo; /* IPv6 flow information */
86 struct ws_in_addr6 sin6_addr; /* IPv6 address */
87};
88
89typedef union sockaddr_gen
90{
91 struct sockaddr Address;
92 struct ws_sockaddr_in AddressIn;
93 struct ws_sockaddr_in6 AddressIn6;
94} sockaddr_gen;
95
Andreas Mohrae509412000-08-03 22:19:09 +000096/* ws_hostent, ws_protoent, ws_servent, ws_netent are 4-byte aligned here ! */
97
98typedef struct ws_hostent32
99{
100 char *h_name; /* official name of host */
101 char **h_aliases; /* alias list */
102 short h_addrtype; /* host address type */
103 short h_length; /* length of address */
104 char **h_addr_list; /* list of addresses from name server */
105} _ws_hostent32;
106
107typedef struct ws_protoent32
108{
109 char *p_name; /* official protocol name */
110 char **p_aliases; /* alias list */
111 short p_proto; /* protocol # */
112} _ws_protoent32;
113
114typedef struct ws_servent32
115{
116 char *s_name; /* official service name */
117 char **s_aliases; /* alias list */
118 short s_port; /* port # */
119 char *s_proto; /* protocol to use */
120} _ws_servent32;
121
122typedef struct ws_netent32
123{
124 char *n_name; /* official name of net */
125 char **n_aliases; /* alias list */
126 short n_addrtype; /* net address type */
127 u_long n_net; /* network # */
128} _ws_netent32;
129
James Hatheway829405a2000-06-18 17:23:17 +0000130/* Structure to keep interface specific information */
131typedef struct _INTERFACE_INFO
132{
133 u_long iiFlags; /* Interface flags */
134 sockaddr_gen iiAddress; /* Interface address */
135 sockaddr_gen iiBroadcastAddress; /* Broadcast address */
136 sockaddr_gen iiNetmask; /* Network mask */
137} INTERFACE_INFO, * LPINTERFACE_INFO;
138
139/* Possible flags for the iiFlags - bitmask */
140#ifndef HAVE_NET_IF_H
141# define IFF_UP 0x00000001 /* Interface is up */
142# define IFF_BROADCAST 0x00000002 /* Broadcast is supported */
143# define IFF_LOOPBACK 0x00000004 /* this is loopback interface */
144# define IFF_POINTTOPOINT 0x00000008 /* this is point-to-point interface */
145# define IFF_MULTICAST 0x00000010 /* multicast is supported */
146#endif
147
148#define MAX_PROTOCOL_CHAIN 7
149#define BASE_PROTOCOL 1
150#define LAYERED_PROTOCOL 0
151
152typedef struct _WSAPROTOCOLCHAIN
153{
154 int ChainLen; /* the length of the chain, */
155 /* length = 0 means layered protocol, */
156 /* length = 1 means base protocol, */
157 /* length > 1 means protocol chain */
158 DWORD ChainEntries[MAX_PROTOCOL_CHAIN]; /* a list of dwCatalogEntryIds */
159} WSAPROTOCOLCHAIN, * LPWSAPROTOCOLCHAIN;
160#define WSAPROTOCOL_LEN 255
161
162typedef struct _WSAPROTOCOL_INFOA
163{
164 DWORD dwServiceFlags1;
165 DWORD dwServiceFlags2;
166 DWORD dwServiceFlags3;
167 DWORD dwServiceFlags4;
168 DWORD dwProviderFlags;
169 GUID ProviderId;
170 DWORD dwCatalogEntryId;
171 WSAPROTOCOLCHAIN ProtocolChain;
172 int iVersion;
173 int iAddressFamily;
174 int iMaxSockAddr;
175 int iMinSockAddr;
176 int iSocketType;
177 int iProtocol;
178 int iProtocolMaxOffset;
179 int iNetworkByteOrder;
180 int iSecurityScheme;
181 DWORD dwMessageSize;
182 DWORD dwProviderReserved;
183 CHAR szProtocol[WSAPROTOCOL_LEN+1];
184} WSAPROTOCOL_INFOA, * LPWSAPROTOCOL_INFOA;
185
186typedef struct _WSANETWORKEVENTS
187{
Ove Kaavena39ad1a1999-09-27 11:48:11 +0000188 long lNetworkEvents;
189 int iErrorCode[FD_MAX_EVENTS];
190} WSANETWORKEVENTS, *LPWSANETWORKEVENTS;
191
James Hatheway829405a2000-06-18 17:23:17 +0000192typedef struct _OVERLAPPED * LPWSAOVERLAPPED;
Ove Kaavena39ad1a1999-09-27 11:48:11 +0000193typedef HANDLE WSAEVENT;
James Hatheway829405a2000-06-18 17:23:17 +0000194typedef unsigned int GROUP;
Ove Kaavena39ad1a1999-09-27 11:48:11 +0000195
James Hatheway829405a2000-06-18 17:23:17 +0000196typedef void
197(CALLBACK * LPWSAOVERLAPPED_COMPLETION_ROUTINE)
198(
199 DWORD dwError,
200 DWORD cbTransferred,
201 LPWSAOVERLAPPED lpOverlapped,
202 DWORD dwFlags
203);
Ove Kaavena39ad1a1999-09-27 11:48:11 +0000204
James Hatheway829405a2000-06-18 17:23:17 +0000205
206/* Function declarations */
Ove Kaavena39ad1a1999-09-27 11:48:11 +0000207int WINAPI WSAEnumNetworkEvents(SOCKET s, WSAEVENT hEventObject, LPWSANETWORKEVENTS lpNetworkEvents);
208int WINAPI WSAEventSelect(SOCKET s, WSAEVENT hEventObject, long lNetworkEvents);
James Hatheway829405a2000-06-18 17:23:17 +0000209WSAEVENT WINAPI WSACreateEvent(void);
210BOOL WINAPI WSACloseEvent(WSAEVENT event);
211SOCKET WINAPI WSASocketA(int af, int type, int protocol,
212 LPWSAPROTOCOL_INFOA lpProtocolInfo,
213 GROUP g, DWORD dwFlags);
Ove Kaavena39ad1a1999-09-27 11:48:11 +0000214
Andreas Mohrae509412000-08-03 22:19:09 +0000215#include "poppack.h"
216
Ove Kaavena39ad1a1999-09-27 11:48:11 +0000217#endif