2 * Winsock 2 definitions - used for ws2_32.dll
4 * FIXME: Still missing required Winsock 2 definitions.
7 #ifndef __WINSOCK2API__
8 #define __WINSOCK2API__
13 #define FD_MAX_EVENTS 10
15 #define FD_WRITE_BIT 1
17 #define FD_ACCEPT_BIT 3
18 #define FD_CONNECT_BIT 4
19 #define FD_CLOSE_BIT 5
22 * Constants for WSAIoctl()
24 #define IOC_UNIX 0x00000000
25 #define IOC_WS2 0x08000000
26 #define IOC_PROTOCOL 0x10000000
27 #define IOC_VENDOR 0x18000000
28 #define _WSAIO(x,y) (IOC_VOID|(x)|(y))
29 #define _WSAIOR(x,y) (IOC_OUT|(x)|(y))
30 #define _WSAIOW(x,y) (IOC_IN|(x)|(y))
31 #define _WSAIORW(x,y) (IOC_INOUT|(x)|(y))
32 #define SIO_ASSOCIATE_HANDLE _WSAIOW(IOC_WS2,1)
33 #define SIO_ENABLE_CIRCULAR_QUEUEING _WSAIO(IOC_WS2,2)
34 #define SIO_FIND_ROUTE _WSAIOR(IOC_WS2,3)
35 #define SIO_FLUSH _WSAIO(IOC_WS2,4)
36 #define SIO_GET_BROADCAST_ADDRESS _WSAIOR(IOC_WS2,5)
37 #define SIO_GET_EXTENSION_FUNCTION_POINTER _WSAIORW(IOC_WS2,6)
38 #define SIO_GET_QOS _WSAIORW(IOC_WS2,7)
39 #define SIO_GET_GROUP_QOS _WSAIORW(IOC_WS2,8)
40 #define SIO_MULTIPOINT_LOOPBACK _WSAIOW(IOC_WS2,9)
41 #define SIO_MULTICAST_SCOPE _WSAIOW(IOC_WS2,10)
42 #define SIO_SET_QOS _WSAIOW(IOC_WS2,11)
43 #define SIO_SET_GROUP_QOS _WSAIOW(IOC_WS2,12)
44 #define SIO_TRANSLATE_HANDLE _WSAIORW(IOC_WS2,13)
45 #define SIO_ROUTING_INTERFACE_QUERY _WSAIORW(IOC_WS2,20)
46 #define SIO_ROUTING_INTERFACE_CHANGE _WSAIOW(IOC_WS2,21)
47 #define SIO_ADDRESS_LIST_QUERY _WSAIOR(IOC_WS2,22)
48 #define SIO_ADDRESS_LIST_CHANGE _WSAIO(IOC_WS2,23)
49 #define SIO_QUERY_TARGET_PNP_HANDLE _WSAIOR(IOC_W32,24)
50 #define SIO_GET_INTERFACE_LIST WS_IOR ('t', 127, u_long)
52 /* Unfortunately the sockaddr_in6 structure doesn't
53 seem to be defined in a standard place, even across
54 different Linux distributions. Until IPv6 support settles
55 down, let's do our own here so the sockaddr_gen
56 union is the correct size.*/
62 unsigned char s6_addr
[16]; /* IPv6 address */
64 struct ws_sockaddr_in6
66 short sin6_family
; /* AF_INET6 */
67 u_short sin6_port
; /* Transport level port number */
68 u_long sin6_flowinfo
; /* IPv6 flow information */
69 struct ws_in_addr6 sin6_addr
; /* IPv6 address */
72 typedef union sockaddr_gen
74 struct sockaddr Address
;
75 struct ws_sockaddr_in AddressIn
;
76 struct ws_sockaddr_in6 AddressIn6
;
79 /* Structure to keep interface specific information */
80 typedef struct _INTERFACE_INFO
82 u_long iiFlags
; /* Interface flags */
83 sockaddr_gen iiAddress
; /* Interface address */
84 sockaddr_gen iiBroadcastAddress
; /* Broadcast address */
85 sockaddr_gen iiNetmask
; /* Network mask */
86 } INTERFACE_INFO
, * LPINTERFACE_INFO
;
88 /* Possible flags for the iiFlags - bitmask */
90 # define IFF_UP 0x00000001 /* Interface is up */
91 # define IFF_BROADCAST 0x00000002 /* Broadcast is supported */
92 # define IFF_LOOPBACK 0x00000004 /* this is loopback interface */
93 # define IFF_POINTTOPOINT 0x00000008 /* this is point-to-point interface */
94 # define IFF_MULTICAST 0x00000010 /* multicast is supported */
97 #define MAX_PROTOCOL_CHAIN 7
98 #define BASE_PROTOCOL 1
99 #define LAYERED_PROTOCOL 0
101 typedef struct _WSAPROTOCOLCHAIN
103 int ChainLen
; /* the length of the chain, */
104 /* length = 0 means layered protocol, */
105 /* length = 1 means base protocol, */
106 /* length > 1 means protocol chain */
107 DWORD ChainEntries
[MAX_PROTOCOL_CHAIN
]; /* a list of dwCatalogEntryIds */
108 } WSAPROTOCOLCHAIN
, * LPWSAPROTOCOLCHAIN
;
109 #define WSAPROTOCOL_LEN 255
111 typedef struct _WSAPROTOCOL_INFOA
113 DWORD dwServiceFlags1
;
114 DWORD dwServiceFlags2
;
115 DWORD dwServiceFlags3
;
116 DWORD dwServiceFlags4
;
117 DWORD dwProviderFlags
;
119 DWORD dwCatalogEntryId
;
120 WSAPROTOCOLCHAIN ProtocolChain
;
127 int iProtocolMaxOffset
;
128 int iNetworkByteOrder
;
131 DWORD dwProviderReserved
;
132 CHAR szProtocol
[WSAPROTOCOL_LEN
+1];
133 } WSAPROTOCOL_INFOA
, * LPWSAPROTOCOL_INFOA
;
135 typedef struct _WSANETWORKEVENTS
138 int iErrorCode
[FD_MAX_EVENTS
];
139 } WSANETWORKEVENTS
, *LPWSANETWORKEVENTS
;
141 typedef struct _OVERLAPPED
* LPWSAOVERLAPPED
;
142 typedef HANDLE WSAEVENT
;
143 typedef unsigned int GROUP
;
146 (CALLBACK
* LPWSAOVERLAPPED_COMPLETION_ROUTINE
)
150 LPWSAOVERLAPPED lpOverlapped
,
155 /* Function declarations */
156 int WINAPI
WSAEnumNetworkEvents(SOCKET s
, WSAEVENT hEventObject
, LPWSANETWORKEVENTS lpNetworkEvents
);
157 int WINAPI
WSAEventSelect(SOCKET s
, WSAEVENT hEventObject
, long lNetworkEvents
);
158 WSAEVENT WINAPI
WSACreateEvent(void);
159 BOOL WINAPI
WSACloseEvent(WSAEVENT event
);
160 SOCKET WINAPI
WSASocketA(int af
, int type
, int protocol
,
161 LPWSAPROTOCOL_INFOA lpProtocolInfo
,
162 GROUP g
, DWORD dwFlags
);