| 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 | /* Constants for LPCONDITIONPROC */
|
|---|
| 52 | #define CF_ACCEPT 0x0000
|
|---|
| 53 | #define CF_REJECT 0x0001
|
|---|
| 54 | #define CF_DEFER 0x0002
|
|---|
| 55 |
|
|---|
| 56 | /* Constants for shutdown() */
|
|---|
| 57 | #define SD_RECEIVE 0x00
|
|---|
| 58 | #define SD_SEND 0x01
|
|---|
| 59 | #define SD_BOTH 0x02
|
|---|
| 60 |
|
|---|
| 61 | /*
|
|---|
| 62 | * Constants for WSAIoctl()
|
|---|
| 63 | */
|
|---|
| 64 | #define IOC_UNIX 0x00000000
|
|---|
| 65 | #define IOC_WS2 0x08000000
|
|---|
| 66 | #define IOC_PROTOCOL 0x10000000
|
|---|
| 67 | #define IOC_VENDOR 0x18000000
|
|---|
| 68 | #define _WSAIO(x,y) (IOC_VOID|(x)|(y))
|
|---|
| 69 | #define _WSAIOR(x,y) (IOC_OUT|(x)|(y))
|
|---|
| 70 | #define _WSAIOW(x,y) (IOC_IN|(x)|(y))
|
|---|
| 71 | #define _WSAIORW(x,y) (IOC_INOUT|(x)|(y))
|
|---|
| 72 | #define SIO_ASSOCIATE_HANDLE _WSAIOW(IOC_WS2,1)
|
|---|
| 73 | #define SIO_ENABLE_CIRCULAR_QUEUEING _WSAIO(IOC_WS2,2)
|
|---|
| 74 | #define SIO_FIND_ROUTE _WSAIOR(IOC_WS2,3)
|
|---|
| 75 | #define SIO_FLUSH _WSAIO(IOC_WS2,4)
|
|---|
| 76 | #define SIO_GET_BROADCAST_ADDRESS _WSAIOR(IOC_WS2,5)
|
|---|
| 77 | #define SIO_GET_EXTENSION_FUNCTION_POINTER _WSAIORW(IOC_WS2,6)
|
|---|
| 78 | #define SIO_GET_QOS _WSAIORW(IOC_WS2,7)
|
|---|
| 79 | #define SIO_GET_GROUP_QOS _WSAIORW(IOC_WS2,8)
|
|---|
| 80 | #define SIO_MULTIPOINT_LOOPBACK _WSAIOW(IOC_WS2,9)
|
|---|
| 81 | #define SIO_MULTICAST_SCOPE _WSAIOW(IOC_WS2,10)
|
|---|
| 82 | #define SIO_SET_QOS _WSAIOW(IOC_WS2,11)
|
|---|
| 83 | #define SIO_SET_GROUP_QOS _WSAIOW(IOC_WS2,12)
|
|---|
| 84 | #define SIO_TRANSLATE_HANDLE _WSAIORW(IOC_WS2,13)
|
|---|
| 85 | #define SIO_ROUTING_INTERFACE_QUERY _WSAIORW(IOC_WS2,20)
|
|---|
| 86 | #define SIO_ROUTING_INTERFACE_CHANGE _WSAIOW(IOC_WS2,21)
|
|---|
| 87 | #define SIO_ADDRESS_LIST_QUERY _WSAIOR(IOC_WS2,22)
|
|---|
| 88 | #define SIO_ADDRESS_LIST_CHANGE _WSAIO(IOC_WS2,23)
|
|---|
| 89 | #define SIO_QUERY_TARGET_PNP_HANDLE _WSAIOR(IOC_W32,24)
|
|---|
| 90 | #define SIO_GET_INTERFACE_LIST WS_IOR ('t', 127, u_long)
|
|---|
| 91 |
|
|---|
| 92 | /* Unfortunately the sockaddr_in6 structure doesn't
|
|---|
| 93 | seem to be defined in a standard place, even across
|
|---|
| 94 | different Linux distributions. Until IPv6 support settles
|
|---|
| 95 | down, let's do our own here so the sockaddr_gen
|
|---|
| 96 | union is the correct size.*/
|
|---|
| 97 | #ifdef s6_addr
|
|---|
| 98 | #undef s6_addr
|
|---|
| 99 | #endif
|
|---|
| 100 |
|
|---|
| 101 | struct ws_in_addr6
|
|---|
| 102 | {
|
|---|
| 103 | unsigned char s6_addr[16]; /* IPv6 address */
|
|---|
| 104 | };
|
|---|
| 105 | struct ws_sockaddr_in6
|
|---|
| 106 | {
|
|---|
| 107 | short sin6_family; /* AF_INET6 */
|
|---|
| 108 | u_short sin6_port; /* Transport level port number */
|
|---|
| 109 | u_long sin6_flowinfo; /* IPv6 flow information */
|
|---|
| 110 | struct ws_in_addr6 sin6_addr; /* IPv6 address */
|
|---|
| 111 | };
|
|---|
| 112 |
|
|---|
| 113 | struct ws_in_addr
|
|---|
| 114 | {
|
|---|
| 115 | union {
|
|---|
| 116 | struct { BYTE s_b1,s_b2,s_b3,s_b4; } S_un_b;
|
|---|
| 117 | struct { WORD s_w1,s_w2; } S_un_w;
|
|---|
| 118 | UINT S_addr;
|
|---|
| 119 | } S_un;
|
|---|
| 120 | #define ws_addr S_un.S_addr /* can be used for most tcp & ip code */
|
|---|
| 121 | #define ws_host S_un.S_un_b.s_b2 /* host on imp */
|
|---|
| 122 | #define ws_net S_un.S_un_b.s_b1 /* network */
|
|---|
| 123 | #define ws_imp S_un.S_un_w.s_w2 /* imp */
|
|---|
| 124 | #define ws_impno S_un.S_un_b.s_b4 /* imp # */
|
|---|
| 125 | #define ws_lh S_un.S_un_b.s_b3 /* logical host */
|
|---|
| 126 | };
|
|---|
| 127 |
|
|---|
| 128 | struct ws_sockaddr_in
|
|---|
| 129 | {
|
|---|
| 130 | SHORT sin_family;
|
|---|
| 131 | WORD sin_port;
|
|---|
| 132 | struct ws_in_addr sin_addr;
|
|---|
| 133 | BYTE sin_zero[8];
|
|---|
| 134 | };
|
|---|
| 135 |
|
|---|
| 136 | typedef union sockaddr_gen
|
|---|
| 137 | {
|
|---|
| 138 | struct sockaddr Address;
|
|---|
| 139 | struct ws_sockaddr_in AddressIn;
|
|---|
| 140 | struct ws_sockaddr_in6 AddressIn6;
|
|---|
| 141 | } sockaddr_gen;
|
|---|
| 142 |
|
|---|
| 143 | /* ws_hostent, ws_protoent, ws_servent, ws_netent are 4-byte aligned here ! */
|
|---|
| 144 |
|
|---|
| 145 | typedef struct ws_hostent32
|
|---|
| 146 | {
|
|---|
| 147 | char *h_name; /* official name of host */
|
|---|
| 148 | char **h_aliases; /* alias list */
|
|---|
| 149 | short h_addrtype; /* host address type */
|
|---|
| 150 | short h_length; /* length of address */
|
|---|
| 151 | char **h_addr_list; /* list of addresses from name server */
|
|---|
| 152 | } _ws_hostent32;
|
|---|
| 153 |
|
|---|
| 154 | typedef struct ws_protoent32
|
|---|
| 155 | {
|
|---|
| 156 | char *p_name; /* official protocol name */
|
|---|
| 157 | char **p_aliases; /* alias list */
|
|---|
| 158 | short p_proto; /* protocol # */
|
|---|
| 159 | } _ws_protoent32;
|
|---|
| 160 |
|
|---|
| 161 | typedef struct ws_servent32
|
|---|
| 162 | {
|
|---|
| 163 | char *s_name; /* official service name */
|
|---|
| 164 | char **s_aliases; /* alias list */
|
|---|
| 165 | short s_port; /* port # */
|
|---|
| 166 | char *s_proto; /* protocol to use */
|
|---|
| 167 | } _ws_servent32;
|
|---|
| 168 |
|
|---|
| 169 | typedef struct ws_netent32
|
|---|
| 170 | {
|
|---|
| 171 | char *n_name; /* official name of net */
|
|---|
| 172 | char **n_aliases; /* alias list */
|
|---|
| 173 | short n_addrtype; /* net address type */
|
|---|
| 174 | u_long n_net; /* network # */
|
|---|
| 175 | } _ws_netent32;
|
|---|
| 176 |
|
|---|
| 177 | /* Structure to keep interface specific information */
|
|---|
| 178 | typedef struct _INTERFACE_INFO
|
|---|
| 179 | {
|
|---|
| 180 | u_long iiFlags; /* Interface flags */
|
|---|
| 181 | sockaddr_gen iiAddress; /* Interface address */
|
|---|
| 182 | sockaddr_gen iiBroadcastAddress; /* Broadcast address */
|
|---|
| 183 | sockaddr_gen iiNetmask; /* Network mask */
|
|---|
| 184 | } INTERFACE_INFO, * LPINTERFACE_INFO;
|
|---|
| 185 |
|
|---|
| 186 | /* Possible flags for the iiFlags - bitmask */
|
|---|
| 187 | #ifndef HAVE_NET_IF_H
|
|---|
| 188 | # define IFF_UP 0x00000001 /* Interface is up */
|
|---|
| 189 | # define IFF_BROADCAST 0x00000002 /* Broadcast is supported */
|
|---|
| 190 | # define IFF_LOOPBACK 0x00000004 /* this is loopback interface */
|
|---|
| 191 | # define IFF_POINTTOPOINT 0x00000008 /* this is point-to-point interface */
|
|---|
| 192 | # define IFF_MULTICAST 0x00000010 /* multicast is supported */
|
|---|
| 193 | #endif
|
|---|
| 194 |
|
|---|
| 195 | #ifndef GUID_DEFINED
|
|---|
| 196 | #include "guiddef.h"
|
|---|
| 197 | #endif
|
|---|
| 198 |
|
|---|
| 199 | #define MAX_PROTOCOL_CHAIN 7
|
|---|
| 200 | #define BASE_PROTOCOL 1
|
|---|
| 201 | #define LAYERED_PROTOCOL 0
|
|---|
| 202 |
|
|---|
| 203 | typedef struct _WSAPROTOCOLCHAIN
|
|---|
| 204 | {
|
|---|
| 205 | int ChainLen; /* the length of the chain, */
|
|---|
| 206 | /* length = 0 means layered protocol, */
|
|---|
| 207 | /* length = 1 means base protocol, */
|
|---|
| 208 | /* length > 1 means protocol chain */
|
|---|
| 209 | DWORD ChainEntries[MAX_PROTOCOL_CHAIN]; /* a list of dwCatalogEntryIds */
|
|---|
| 210 | } WSAPROTOCOLCHAIN, * LPWSAPROTOCOLCHAIN;
|
|---|
| 211 | #define WSAPROTOCOL_LEN 255
|
|---|
| 212 |
|
|---|
| 213 | typedef struct _WSAPROTOCOL_INFOA
|
|---|
| 214 | {
|
|---|
| 215 | DWORD dwServiceFlags1;
|
|---|
| 216 | DWORD dwServiceFlags2;
|
|---|
| 217 | DWORD dwServiceFlags3;
|
|---|
| 218 | DWORD dwServiceFlags4;
|
|---|
| 219 | DWORD dwProviderFlags;
|
|---|
| 220 | GUID ProviderId;
|
|---|
| 221 | DWORD dwCatalogEntryId;
|
|---|
| 222 | WSAPROTOCOLCHAIN ProtocolChain;
|
|---|
| 223 | int iVersion;
|
|---|
| 224 | int iAddressFamily;
|
|---|
| 225 | int iMaxSockAddr;
|
|---|
| 226 | int iMinSockAddr;
|
|---|
| 227 | int iSocketType;
|
|---|
| 228 | int iProtocol;
|
|---|
| 229 | int iProtocolMaxOffset;
|
|---|
| 230 | int iNetworkByteOrder;
|
|---|
| 231 | int iSecurityScheme;
|
|---|
| 232 | DWORD dwMessageSize;
|
|---|
| 233 | DWORD dwProviderReserved;
|
|---|
| 234 | CHAR szProtocol[WSAPROTOCOL_LEN+1];
|
|---|
| 235 | } WSAPROTOCOL_INFOA, * LPWSAPROTOCOL_INFOA;
|
|---|
| 236 |
|
|---|
| 237 | typedef struct _WSAPROTOCOL_INFOW
|
|---|
| 238 | {
|
|---|
| 239 | DWORD dwServiceFlags1;
|
|---|
| 240 | DWORD dwServiceFlags2;
|
|---|
| 241 | DWORD dwServiceFlags3;
|
|---|
| 242 | DWORD dwServiceFlags4;
|
|---|
| 243 | DWORD dwProviderFlags;
|
|---|
| 244 | GUID ProviderId;
|
|---|
| 245 | DWORD dwCatalogEntryId;
|
|---|
| 246 | WSAPROTOCOLCHAIN ProtocolChain;
|
|---|
| 247 | int iVersion;
|
|---|
| 248 | int iAddressFamily;
|
|---|
| 249 | int iMaxSockAddr;
|
|---|
| 250 | int iMinSockAddr;
|
|---|
| 251 | int iSocketType;
|
|---|
| 252 | int iProtocol;
|
|---|
| 253 | int iProtocolMaxOffset;
|
|---|
| 254 | int iNetworkByteOrder;
|
|---|
| 255 | int iSecurityScheme;
|
|---|
| 256 | DWORD dwMessageSize;
|
|---|
| 257 | DWORD dwProviderReserved;
|
|---|
| 258 | WCHAR szProtocol[WSAPROTOCOL_LEN+1];
|
|---|
| 259 | } WSAPROTOCOL_INFOW, * LPWSAPROTOCOL_INFOW;
|
|---|
| 260 |
|
|---|
| 261 | typedef struct _WSANETWORKEVENTS
|
|---|
| 262 | {
|
|---|
| 263 | long lNetworkEvents;
|
|---|
| 264 | int iErrorCode[FD_MAX_EVENTS];
|
|---|
| 265 | } WSANETWORKEVENTS, *LPWSANETWORKEVENTS;
|
|---|
| 266 |
|
|---|
| 267 | typedef struct _WSABUF
|
|---|
| 268 | {
|
|---|
| 269 | ULONG len;
|
|---|
| 270 | CHAR* buf;
|
|---|
| 271 | } WSABUF, *LPWSABUF;
|
|---|
| 272 |
|
|---|
| 273 | typedef struct _OVERLAPPED * LPWSAOVERLAPPED;
|
|---|
| 274 | typedef HANDLE WSAEVENT;
|
|---|
| 275 | typedef unsigned int GROUP;
|
|---|
| 276 |
|
|---|
| 277 | #define WSA_IO_PENDING (ERROR_IO_PENDING)
|
|---|
| 278 | #define WSA_IO_INCOMPLETE (ERROR_IO_INCOMPLETE)
|
|---|
| 279 | #define WSA_INVALID_HANDLE (ERROR_INVALID_HANDLE)
|
|---|
| 280 | #define WSA_INVALID_PARAMETER (ERROR_INVALID_PARAMETER)
|
|---|
| 281 | #define WSA_NOT_ENOUGH_MEMORY (ERROR_NOT_ENOUGH_MEMORY)
|
|---|
| 282 | #define WSA_OPERATION_ABORTED (ERROR_OPERATION_ABORTED)
|
|---|
| 283 |
|
|---|
| 284 | #define WSA_INVALID_EVENT ((WSAEVENT)NULL)
|
|---|
| 285 | #define WSA_MAXIMUM_WAIT_EVENTS (MAXIMUM_WAIT_OBJECTS)
|
|---|
| 286 | #define WSA_WAIT_FAILED ((DWORD)-1L)
|
|---|
| 287 | #define WSA_WAIT_EVENT_0 (WAIT_OBJECT_0)
|
|---|
| 288 | #define WSA_WAIT_IO_COMPLETION (WAIT_IO_COMPLETION)
|
|---|
| 289 | #define WSA_WAIT_TIMEOUT (WAIT_TIMEOUT)
|
|---|
| 290 | #define WSA_INFINITE (INFINITE)
|
|---|
| 291 |
|
|---|
| 292 | typedef unsigned int GROUP;
|
|---|
| 293 | #define SG_UNCONSTRAINED_GROUP 0x01
|
|---|
| 294 | #define SG_CONSTRAINED_GROUP 0x02
|
|---|
| 295 |
|
|---|
| 296 | /*
|
|---|
| 297 | * FLOWSPEC and SERVICETYPE should eventually move to qos.h
|
|---|
| 298 | */
|
|---|
| 299 |
|
|---|
| 300 | typedef ULONG SERVICETYPE;
|
|---|
| 301 |
|
|---|
| 302 | typedef struct _FLOWSPEC {
|
|---|
| 303 | unsigned int TokenRate;
|
|---|
| 304 | unsigned int TokenBucketSize;
|
|---|
| 305 | unsigned int PeakBandwidth;
|
|---|
| 306 | unsigned int Latency;
|
|---|
| 307 | unsigned int DelayVariation;
|
|---|
| 308 | SERVICETYPE ServiceType;
|
|---|
| 309 | unsigned int MaxSduSize;
|
|---|
| 310 | unsigned int MinimumPolicedSize;
|
|---|
| 311 | } FLOWSPEC, *PFLOWSPEC, *LPFLOWSPEC;
|
|---|
| 312 |
|
|---|
| 313 | typedef struct _QUALITYOFSERVICE {
|
|---|
| 314 | FLOWSPEC SendingFlowspec;
|
|---|
| 315 | FLOWSPEC ReceivingFlowspec;
|
|---|
| 316 | WSABUF ProviderSpecific;
|
|---|
| 317 | } QOS, *LPQOS;
|
|---|
| 318 |
|
|---|
| 319 | typedef int (* CALLBACK LPCONDITIONPROC)
|
|---|
| 320 | (
|
|---|
| 321 | LPWSABUF lpCallerId,
|
|---|
| 322 | LPWSABUF lpCallerData,
|
|---|
| 323 | LPQOS lpSQOS,
|
|---|
| 324 | LPQOS lpGQOS,
|
|---|
| 325 | LPWSABUF lpCalleeId,
|
|---|
| 326 | LPWSABUF lpCalleeData,
|
|---|
| 327 | GROUP *g,
|
|---|
| 328 | DWORD dwCallbackData
|
|---|
| 329 | );
|
|---|
| 330 |
|
|---|
| 331 | typedef void (* CALLBACK LPWSAOVERLAPPED_COMPLETION_ROUTINE)
|
|---|
| 332 | (
|
|---|
| 333 | DWORD dwError,
|
|---|
| 334 | DWORD cbTransferred,
|
|---|
| 335 | LPWSAOVERLAPPED lpOverlapped,
|
|---|
| 336 | DWORD dwFlags
|
|---|
| 337 | );
|
|---|
| 338 |
|
|---|
| 339 |
|
|---|
| 340 | /* Function declarations */
|
|---|
| 341 | int WINAPI WSAEnumNetworkEvents(SOCKET s, WSAEVENT hEventObject, LPWSANETWORKEVENTS lpNetworkEvents);
|
|---|
| 342 | int WINAPI WSAEventSelect(SOCKET s, WSAEVENT hEventObject, long lNetworkEvents);
|
|---|
| 343 | WSAEVENT WINAPI WSACreateEvent(void);
|
|---|
| 344 | BOOL WINAPI WSACloseEvent(WSAEVENT event);
|
|---|
| 345 | SOCKET WINAPI WSASocketA(int af, int type, int protocol,
|
|---|
| 346 | LPWSAPROTOCOL_INFOA lpProtocolInfo,
|
|---|
| 347 | GROUP g, DWORD dwFlags);
|
|---|
| 348 | extern INT WINAPI ioctlsocket(SOCKET s, LONG cmd, ULONG *argp);
|
|---|
| 349 |
|
|---|
| 350 | #include "poppack.h"
|
|---|
| 351 |
|
|---|
| 352 | #endif
|
|---|