- Header updates for winsock rewrite
[reactos.git] / reactos / include / psdk / mswsock.h
1 /*
2 * mswsock.h
3 * MS-specific extensions to Windows Sockets, exported from mswsock.dll.
4 * These functions are N/A on Windows9x.
5 *
6 * This file is part of a free library for the Win32 API.
7 * This library is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 */
11
12 #ifndef _MSWSOCK_H
13 #define _MSWSOCK_H
14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18
19 #define SO_CONNDATA 0x7000
20 #define SO_CONNOPT 0x7001
21 #define SO_DISCDATA 0x7002
22 #define SO_DISCOPT 0x7003
23 #define SO_CONNDATALEN 0x7004
24 #define SO_CONNOPTLEN 0x7005
25 #define SO_DISCDATALEN 0x7006
26 #define SO_DISCOPTLEN 0x7007
27 #define SO_OPENTYPE 0x7008
28 #define SO_SYNCHRONOUS_ALERT 0x10
29 #define SO_SYNCHRONOUS_NONALERT 0x20
30 #define SO_MAXDG 0x7009
31 #define SO_MAXPATHDG 0x700A
32 #define SO_UPDATE_ACCEPT_CONTEXT 0x700B
33 #define SO_CONNECT_TIME 0x700C
34 #define TCP_BSDURGENT 0x7000
35
36 #define TF_DISCONNECT 1
37 #define TF_REUSE_SOCKET 2
38 #define TF_WRITE_BEHIND 4
39 #define TF_USE_DEFAULT_WORKER 0
40 #define TF_USE_SYSTEM_THREAD 16
41 #define TF_USE_KERNEL_APC 32
42
43 typedef struct _TRANSMIT_FILE_BUFFERS {
44 PVOID Head;
45 DWORD HeadLength;
46 PVOID Tail;
47 DWORD TailLength;
48 } TRANSMIT_FILE_BUFFERS, *PTRANSMIT_FILE_BUFFERS, *LPTRANSMIT_FILE_BUFFERS;
49
50 int PASCAL WSARecvEx(SOCKET,char*,int,int*);
51 BOOL PASCAL TransmitFile(SOCKET,HANDLE,DWORD,DWORD,LPOVERLAPPED,LPTRANSMIT_FILE_BUFFERS,DWORD);
52 BOOL PASCAL AcceptEx(SOCKET,SOCKET,PVOID,DWORD,DWORD,DWORD,LPDWORD,LPOVERLAPPED);
53 VOID PASCAL GetAcceptExSockaddrs(PVOID,DWORD,DWORD,DWORD,struct sockaddr**, LPINT, struct sockaddr**, LPINT);
54
55 #define WSAID_ACCEPTEX { 0xB5367DF0, 0xCBAC, 0x11CF, { 0x95, 0xCA, 0x00, 0x80, 0x5F, 0x48, 0xA1, 0x92 } }
56 #define WSAID_TRANSMITFILE { 0xB5367DF1, 0xCBAC, 0x11CF, { 0x95, 0xCA, 0x00, 0x80, 0x5F, 0x48, 0xA1, 0x92 } }
57 #define WSAID_GETACCEPTEXSOCKADDRS { 0xB5367DF2, 0xCBAC, 0x11CF, { 0x95, 0xCA, 0x00, 0x80, 0x5F, 0x48, 0xA1, 0x92 } }
58
59 #define NLA_NAMESPACE_GUID { 0x6642243A, 0x3BA8, 0x4AA6, { 0xBA, 0xA5, 0x2E, 0xB, 0xD7, 0x1F, 0xDD, 0x83 } }
60
61 typedef BOOL (PASCAL *LPFN_TRANSMITFILE)(SOCKET,HANDLE,DWORD,DWORD,LPOVERLAPPED,LPTRANSMIT_FILE_BUFFERS,DWORD);
62 typedef BOOL (PASCAL *LPFN_ACCEPTEX)(SOCKET,SOCKET,PVOID,DWORD,DWORD,DWORD,LPDWORD,LPOVERLAPPED);
63 typedef VOID (PASCAL *LPFN_GETACCEPTEXSOCKADDRS)(PVOID,DWORD,DWORD,DWORD,struct sockaddr**, LPINT, struct sockaddr**, LPINT);
64
65 #ifdef _WINSOCK2_H /* These require the winsock2 interface. */
66
67 #define TP_ELEMENT_FILE 1
68 #define TP_ELEMENT_MEMORY 2
69 #define TP_ELEMENT_EOP 4
70
71 typedef struct _TRANSMIT_PACKETS_ELEMENT {
72 ULONG dwElFlags;
73 ULONG cLength;
74 _ANONYMOUS_UNION
75 union {
76 struct {
77 LARGE_INTEGER nFileOffset;
78 HANDLE hFile;
79 };
80 PVOID pBuffer;
81 };
82 } TRANSMIT_PACKETS_ELEMENT;
83
84 typedef struct _WSAMSG {
85 LPSOCKADDR name;
86 INT namelen;
87 LPWSABUF lpBuffers;
88 DWORD dwBufferCount;
89 WSABUF Control;
90 DWORD dwFlags;
91 } WSAMSG, *PWSAMSG, *LPWSAMSG;
92
93
94 /* According to MSDN docs, the WSAMSG.Control buffer starts with a
95 cmsghdr header of the following form. See also RFC 2292. */
96
97 typedef struct wsacmsghdr {
98 UINT cmsg_len;
99 INT cmsg_level;
100 INT cmsg_type;
101 /* followed by UCHAR cmsg_data[]; */
102 } WSACMSGHDR;
103
104 /* TODO: Standard Posix.1g macros as per RFC 2292, with WSA_uglification. */
105 #if 0
106 #define WSA_CMSG_FIRSTHDR(mhdr)
107 #define WSA_CMSG_NXTHDR(mhdr, cmsg)
108 #define WSA_CMSG_SPACE(length)
109 #define WSA_CMSG_LEN(length)
110 #endif
111
112 BOOL PASCAL DisconnectEx(SOCKET,LPOVERLAPPED,DWORD,DWORD);
113 int PASCAL WSARecvMsg(SOCKET,LPWSAMSG,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
114
115 #endif /* _WINSOCK2_H */
116
117 #ifdef __cplusplus
118 }
119 #endif
120 #endif /* _MSWSOCK_H */
121