source: trunk/include/win/winsock2.h@ 6104

Last change on this file since 6104 was 5742, checked in by sandervl, 24 years ago

header update

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