OSDN Git Service

Prepare environment for Earnie's tools.
[mingw/mingw-org-wsl.git] / w32api / include / 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 #if __GNUC__ >=3
15 #pragma GCC system_header
16 #endif
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20
21 #define SO_CONNDATA     0x7000
22 #define SO_CONNOPT      0x7001
23 #define SO_DISCDATA     0x7002
24 #define SO_DISCOPT      0x7003
25 #define SO_CONNDATALEN  0x7004
26 #define SO_CONNOPTLEN   0x7005
27 #define SO_DISCDATALEN  0x7006
28 #define SO_DISCOPTLEN   0x7007
29 #define SO_OPENTYPE     0x7008
30 #define SO_SYNCHRONOUS_ALERT    0x10
31 #define SO_SYNCHRONOUS_NONALERT 0x20
32 #define SO_MAXDG        0x7009
33 #define SO_MAXPATHDG    0x700A
34 #define SO_UPDATE_ACCEPT_CONTEXT        0x700B
35 #define SO_CONNECT_TIME 0x700C
36 #define TCP_BSDURGENT   0x7000
37
38 #define TF_DISCONNECT   1
39 #define TF_REUSE_SOCKET 2
40 #define TF_WRITE_BEHIND 4
41 #define TF_USE_DEFAULT_WORKER   0
42 #define TF_USE_SYSTEM_THREAD    16
43 #define TF_USE_KERNEL_APC   32
44
45 typedef struct _TRANSMIT_FILE_BUFFERS {
46         PVOID Head;
47         DWORD HeadLength;
48         PVOID Tail;
49         DWORD TailLength;
50 } TRANSMIT_FILE_BUFFERS, *PTRANSMIT_FILE_BUFFERS, *LPTRANSMIT_FILE_BUFFERS;
51
52 int PASCAL WSARecvEx(SOCKET,char*,int,int*);
53 BOOL PASCAL TransmitFile(SOCKET,HANDLE,DWORD,DWORD,LPOVERLAPPED,LPTRANSMIT_FILE_BUFFERS,DWORD);
54 BOOL PASCAL AcceptEx(SOCKET,SOCKET,PVOID,DWORD,DWORD,DWORD,LPDWORD,LPOVERLAPPED);
55 VOID PASCAL GetAcceptExSockaddrs(PVOID,DWORD,DWORD,DWORD,struct sockaddr**, LPINT, struct sockaddr**, LPINT);
56
57 #ifdef _WINSOCK2_H /* These require the winsock2 interface.  */
58
59 #define TP_ELEMENT_FILE         1
60 #define TP_ELEMENT_MEMORY       2
61 #define TP_ELEMENT_EOP          4
62
63 typedef struct _TRANSMIT_PACKETS_ELEMENT {
64         ULONG dwElFlags;
65         ULONG cLength;
66         _ANONYMOUS_UNION
67         union {
68                 struct {
69                         LARGE_INTEGER   nFileOffset;
70                         HANDLE          hFile;
71                 };
72                 PVOID   pBuffer;
73         };
74 } TRANSMIT_PACKETS_ELEMENT;
75
76 typedef struct _WSAMSG {
77         LPSOCKADDR      name;
78         INT             namelen;
79         LPWSABUF        lpBuffers;
80         DWORD           dwBufferCount;
81         WSABUF          Control;
82         DWORD           dwFlags;
83 } WSAMSG, *PWSAMSG, *LPWSAMSG;
84
85
86 /* According to MSDN docs, the WSAMSG.Control buffer starts with a
87    cmsghdr header of the following form.  See also RFC 2292. */
88
89 typedef struct wsacmsghdr {
90         UINT    cmsg_len;
91         INT     cmsg_level;
92         INT     cmsg_type;
93         /* followed by UCHAR cmsg_data[]; */
94 } WSACMSGHDR;
95
96 /* TODO: Standard Posix.1g macros as per RFC 2292, with WSA_uglification. */
97 #if 0
98 #define WSA_CMSG_FIRSTHDR(mhdr)
99 #define WSA_CMSG_NXTHDR(mhdr, cmsg)
100 #define WSA_CMSG_SPACE(length)
101 #define WSA_CMSG_LEN(length)
102 #endif
103
104 BOOL PASCAL DisconnectEx(SOCKET,LPOVERLAPPED,DWORD,DWORD);
105 int PASCAL WSARecvMsg(SOCKET,LPWSAMSG,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
106
107 #endif /* _WINSOCK2_H */
108
109 #ifdef __cplusplus
110 }
111 #endif
112 #endif  /*  _MSWSOCK_H */
113