1 module tango.sys.win32.WsaSock;
2 
3 public import tango.sys.Common;
4 
5 struct Guid
6 {
7         uint     g1;
8         ushort   g2,
9                  g3;
10         ubyte[8] g4;
11 }
12 
13 enum 
14 {
15         WSADESCRIPTION_LEN = 256,
16         WSASYS_STATUS_LEN = 128,
17         WSAEWOULDBLOCK =  10035,
18         WSAEINTR =        10004,
19 }
20 
21 struct WSABUF
22 {
23         uint    len;
24         void*   buf;
25 }
26 
27 struct WSADATA
28 {
29         WORD wVersion;
30         WORD wHighVersion;
31         char szDescription[WSADESCRIPTION_LEN+1];
32         char szSystemStatus[WSASYS_STATUS_LEN+1];
33         ushort iMaxSockets;
34         ushort iMaxUdpDg;
35         char* lpVendorInfo;
36 }
37 
38 enum 
39 {
40         SIO_GET_EXTENSION_FUNCTION_POINTER = 0x40000000 | 0x80000000 | 0x08000000 | 6,
41         SO_UPDATE_CONNECT_CONTEXT = 0x7010,
42         SO_UPDATE_ACCEPT_CONTEXT = 0x700B
43 }
44 
45 extern (Windows)
46 {
47         int WSACleanup();
48         int WSAGetLastError ();
49         int WSAStartup(WORD wVersionRequested, WSADATA* lpWSAData);
50         int WSAGetOverlappedResult (HANDLE, OVERLAPPED*, DWORD*, BOOL, DWORD*);
51         int WSAIoctl (HANDLE s, DWORD op, LPVOID inBuf, DWORD cbIn, LPVOID outBuf, DWORD cbOut, DWORD* result, LPOVERLAPPED, void*);
52         int WSARecv (HANDLE, WSABUF*, DWORD, DWORD*, DWORD*, OVERLAPPED*, void*);
53         int WSASend (HANDLE, WSABUF*, DWORD, DWORD*, DWORD, OVERLAPPED*, void*);
54 }
55