[1166] | 1 | /**
|
---|
| 2 | * This file has no copyright assigned and is placed in the Public Domain.
|
---|
| 3 | * This file is part of the mingw-w64 runtime package.
|
---|
| 4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
---|
| 5 | */
|
---|
| 6 |
|
---|
| 7 | #include <winsock2.h>
|
---|
| 8 |
|
---|
| 9 | #ifndef _MSWSOCK_
|
---|
| 10 | #define _MSWSOCK_
|
---|
| 11 |
|
---|
| 12 | #ifdef __cplusplus
|
---|
| 13 | extern "C" {
|
---|
| 14 | #endif
|
---|
| 15 |
|
---|
| 16 | #define SO_CONNDATA 0x7000
|
---|
| 17 | #define SO_CONNOPT 0x7001
|
---|
| 18 | #define SO_DISCDATA 0x7002
|
---|
| 19 | #define SO_DISCOPT 0x7003
|
---|
| 20 | #define SO_CONNDATALEN 0x7004
|
---|
| 21 | #define SO_CONNOPTLEN 0x7005
|
---|
| 22 | #define SO_DISCDATALEN 0x7006
|
---|
| 23 | #define SO_DISCOPTLEN 0x7007
|
---|
| 24 |
|
---|
| 25 | #define SO_OPENTYPE 0x7008
|
---|
| 26 |
|
---|
| 27 | #define SO_SYNCHRONOUS_ALERT 0x10
|
---|
| 28 | #define SO_SYNCHRONOUS_NONALERT 0x20
|
---|
| 29 |
|
---|
| 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 SO_UPDATE_CONNECT_CONTEXT 0x7010
|
---|
| 35 |
|
---|
| 36 | #define TCP_BSDURGENT 0x7000
|
---|
| 37 |
|
---|
| 38 | #define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12)
|
---|
| 39 | #if (_WIN32_WINNT < 0x0600) && (_WIN32_WINNT >= 0x0501)
|
---|
| 40 | #define SIO_SOCKET_CLOSE_NOTIFY _WSAIOW(IOC_VENDOR,13)
|
---|
| 41 | #endif /* >= XP && < VISTA */
|
---|
| 42 | #if (_WIN32_WINNT >= 0x0600)
|
---|
| 43 | #define SIO_BSP_HANDLE _WSAIOR(IOC_WS2,27)
|
---|
| 44 | #define SIO_BSP_HANDLE_SELECT _WSAIOR(IOC_WS2,28)
|
---|
| 45 | #define SIO_BSP_HANDLE_POLL _WSAIOR(IOC_WS2,29)
|
---|
| 46 |
|
---|
| 47 | #define SIO_EXT_SELECT _WSAIORW(IOC_WS2,30)
|
---|
| 48 | #define SIO_EXT_POLL _WSAIORW(IOC_WS2,31)
|
---|
| 49 | #define SIO_EXT_SENDMSG _WSAIORW(IOC_WS2,32)
|
---|
| 50 |
|
---|
| 51 | #define SIO_BASE_HANDLE _WSAIOR(IOC_WS2,34)
|
---|
| 52 | #endif /* _WIN32_WINNT >= 0x0600 */
|
---|
| 53 |
|
---|
| 54 | #ifndef __MSWSOCK_WS1_SHARED
|
---|
| 55 | int WINAPI WSARecvEx(SOCKET s,char *buf,int len,int *flags);
|
---|
| 56 | #endif /* __MSWSOCK_WS1_SHARED */
|
---|
| 57 |
|
---|
| 58 | #define TF_DISCONNECT 0x01
|
---|
| 59 | #define TF_REUSE_SOCKET 0x02
|
---|
| 60 | #define TF_WRITE_BEHIND 0x04
|
---|
| 61 | #define TF_USE_DEFAULT_WORKER 0x00
|
---|
| 62 | #define TF_USE_SYSTEM_THREAD 0x10
|
---|
| 63 | #define TF_USE_KERNEL_APC 0x20
|
---|
| 64 |
|
---|
| 65 | #include <psdk_inc/_xmitfile.h>
|
---|
| 66 | #ifndef __MSWSOCK_WS1_SHARED
|
---|
| 67 | WINBOOL WINAPI TransmitFile(SOCKET hSocket,HANDLE hFile,DWORD nNumberOfBytesToWrite,DWORD nNumberOfBytesPerSend,LPOVERLAPPED lpOverlapped,LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers,DWORD dwReserved);
|
---|
| 68 | WINBOOL WINAPI AcceptEx(SOCKET sListenSocket,SOCKET sAcceptSocket,PVOID lpOutputBuffer,DWORD dwReceiveDataLength,DWORD dwLocalAddressLength,DWORD dwRemoteAddressLength,LPDWORD lpdwBytesReceived,LPOVERLAPPED lpOverlapped);
|
---|
| 69 | VOID WINAPI GetAcceptExSockaddrs(PVOID lpOutputBuffer,DWORD dwReceiveDataLength,DWORD dwLocalAddressLength,DWORD dwRemoteAddressLength,struct sockaddr **LocalSockaddr,LPINT LocalSockaddrLength,struct sockaddr **RemoteSockaddr,LPINT RemoteSockaddrLength);
|
---|
| 70 | #endif /* __MSWSOCK_WS1_SHARED */
|
---|
| 71 |
|
---|
| 72 | typedef WINBOOL (WINAPI *LPFN_TRANSMITFILE)(SOCKET hSocket,HANDLE hFile,DWORD nNumberOfBytesToWrite,DWORD nNumberOfBytesPerSend,LPOVERLAPPED lpOverlapped,LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers,DWORD dwReserved);
|
---|
| 73 |
|
---|
| 74 | #define WSAID_TRANSMITFILE {0xb5367df0,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}}
|
---|
| 75 |
|
---|
| 76 | typedef WINBOOL (WINAPI *LPFN_ACCEPTEX)(SOCKET sListenSocket,SOCKET sAcceptSocket,PVOID lpOutputBuffer,DWORD dwReceiveDataLength,DWORD dwLocalAddressLength,DWORD dwRemoteAddressLength,LPDWORD lpdwBytesReceived,LPOVERLAPPED lpOverlapped);
|
---|
| 77 |
|
---|
| 78 | #define WSAID_ACCEPTEX {0xb5367df1,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}}
|
---|
| 79 |
|
---|
| 80 | typedef VOID (WINAPI *LPFN_GETACCEPTEXSOCKADDRS)(PVOID lpOutputBuffer,DWORD dwReceiveDataLength,DWORD dwLocalAddressLength,DWORD dwRemoteAddressLength,struct sockaddr **LocalSockaddr,LPINT LocalSockaddrLength,struct sockaddr **RemoteSockaddr,LPINT RemoteSockaddrLength);
|
---|
| 81 |
|
---|
| 82 | #define WSAID_GETACCEPTEXSOCKADDRS {0xb5367df2,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}}
|
---|
| 83 |
|
---|
| 84 | typedef struct _TRANSMIT_PACKETS_ELEMENT {
|
---|
| 85 | ULONG dwElFlags;
|
---|
| 86 | #define TP_ELEMENT_MEMORY 1
|
---|
| 87 | #define TP_ELEMENT_FILE 2
|
---|
| 88 | #define TP_ELEMENT_EOP 4
|
---|
| 89 | ULONG cLength;
|
---|
| 90 | __C89_NAMELESS union {
|
---|
| 91 | __C89_NAMELESS struct {
|
---|
| 92 | LARGE_INTEGER nFileOffset;
|
---|
| 93 | HANDLE hFile;
|
---|
| 94 | };
|
---|
| 95 | PVOID pBuffer;
|
---|
| 96 | };
|
---|
| 97 | } TRANSMIT_PACKETS_ELEMENT,*PTRANSMIT_PACKETS_ELEMENT,*LPTRANSMIT_PACKETS_ELEMENT;
|
---|
| 98 |
|
---|
| 99 | #define TP_DISCONNECT TF_DISCONNECT
|
---|
| 100 | #define TP_REUSE_SOCKET TF_REUSE_SOCKET
|
---|
| 101 | #define TP_USE_DEFAULT_WORKER TF_USE_DEFAULT_WORKER
|
---|
| 102 | #define TP_USE_SYSTEM_THREAD TF_USE_SYSTEM_THREAD
|
---|
| 103 | #define TP_USE_KERNEL_APC TF_USE_KERNEL_APC
|
---|
| 104 |
|
---|
| 105 | typedef WINBOOL (WINAPI *LPFN_TRANSMITPACKETS) (SOCKET hSocket,LPTRANSMIT_PACKETS_ELEMENT lpPacketArray,DWORD nElementCount,DWORD nSendSize,LPOVERLAPPED lpOverlapped,DWORD dwFlags);
|
---|
| 106 |
|
---|
| 107 | #define WSAID_TRANSMITPACKETS {0xd9689da0,0x1f90,0x11d3,{0x99,0x71,0x00,0xc0,0x4f,0x68,0xc8,0x76}}
|
---|
| 108 |
|
---|
| 109 | typedef WINBOOL (WINAPI *LPFN_CONNECTEX)(SOCKET s,const struct sockaddr *name,int namelen,PVOID lpSendBuffer,DWORD dwSendDataLength,LPDWORD lpdwBytesSent,LPOVERLAPPED lpOverlapped);
|
---|
| 110 |
|
---|
| 111 | #define WSAID_CONNECTEX {0x25a207b9,0xddf3,0x4660,{0x8e,0xe9,0x76,0xe5,0x8c,0x74,0x06,0x3e}}
|
---|
| 112 |
|
---|
| 113 | typedef WINBOOL (WINAPI *LPFN_DISCONNECTEX)(SOCKET s,LPOVERLAPPED lpOverlapped,DWORD dwFlags,DWORD dwReserved);
|
---|
| 114 |
|
---|
| 115 | #define WSAID_DISCONNECTEX {0x7fda2e11,0x8630,0x436f,{0xa0,0x31,0xf5,0x36,0xa6,0xee,0xc1,0x57}}
|
---|
| 116 |
|
---|
| 117 | #define DE_REUSE_SOCKET TF_REUSE_SOCKET
|
---|
| 118 |
|
---|
| 119 | #define NLA_NAMESPACE_GUID {0x6642243a,0x3ba8,0x4aa6,{0xba,0xa5,0x2e,0xb,0xd7,0x1f,0xdd,0x83}}
|
---|
| 120 |
|
---|
| 121 | #define NLA_SERVICE_CLASS_GUID {0x37e515,0xb5c9,0x4a43,{0xba,0xda,0x8b,0x48,0xa8,0x7a,0xd2,0x39}}
|
---|
| 122 |
|
---|
| 123 | #define NLA_ALLUSERS_NETWORK 0x00000001
|
---|
| 124 | #define NLA_FRIENDLY_NAME 0x00000002
|
---|
| 125 |
|
---|
| 126 | typedef enum _NLA_BLOB_DATA_TYPE {
|
---|
| 127 | NLA_RAW_DATA = 0,NLA_INTERFACE = 1,NLA_802_1X_LOCATION = 2,NLA_CONNECTIVITY = 3,NLA_ICS = 4
|
---|
| 128 | } NLA_BLOB_DATA_TYPE,*PNLA_BLOB_DATA_TYPE;
|
---|
| 129 |
|
---|
| 130 | typedef enum _NLA_CONNECTIVITY_TYPE {
|
---|
| 131 | NLA_NETWORK_AD_HOC = 0,NLA_NETWORK_MANAGED = 1,NLA_NETWORK_UNMANAGED = 2,NLA_NETWORK_UNKNOWN = 3
|
---|
| 132 | } NLA_CONNECTIVITY_TYPE,*PNLA_CONNECTIVITY_TYPE;
|
---|
| 133 |
|
---|
| 134 | typedef enum _NLA_INTERNET {
|
---|
| 135 | NLA_INTERNET_UNKNOWN = 0,NLA_INTERNET_NO = 1,NLA_INTERNET_YES = 2
|
---|
| 136 | } NLA_INTERNET,*PNLA_INTERNET;
|
---|
| 137 |
|
---|
| 138 | typedef struct _NLA_BLOB {
|
---|
| 139 | struct {
|
---|
| 140 | NLA_BLOB_DATA_TYPE type;
|
---|
| 141 | DWORD dwSize;
|
---|
| 142 | DWORD nextOffset;
|
---|
| 143 | } header;
|
---|
| 144 | union {
|
---|
| 145 | CHAR rawData[1];
|
---|
| 146 | struct {
|
---|
| 147 | DWORD dwType;
|
---|
| 148 | DWORD dwSpeed;
|
---|
| 149 | CHAR adapterName[1];
|
---|
| 150 | } interfaceData;
|
---|
| 151 | struct {
|
---|
| 152 | CHAR information[1];
|
---|
| 153 | } locationData;
|
---|
| 154 | struct {
|
---|
| 155 | NLA_CONNECTIVITY_TYPE type;
|
---|
| 156 | NLA_INTERNET internet;
|
---|
| 157 | } connectivity;
|
---|
| 158 | struct {
|
---|
| 159 | struct {
|
---|
| 160 | DWORD speed;
|
---|
| 161 | DWORD type;
|
---|
| 162 | DWORD state;
|
---|
| 163 | WCHAR machineName[256];
|
---|
| 164 | WCHAR sharedAdapterName[256];
|
---|
| 165 | } remote;
|
---|
| 166 | } ICS;
|
---|
| 167 | } data;
|
---|
| 168 | } NLA_BLOB,*PNLA_BLOB,*LPNLA_BLOB;
|
---|
| 169 |
|
---|
| 170 | typedef struct _WSACMSGHDR {
|
---|
| 171 | SIZE_T cmsg_len;
|
---|
| 172 | INT cmsg_level;
|
---|
| 173 | INT cmsg_type;
|
---|
| 174 | } WSACMSGHDR,*PWSACMSGHDR,*LPWSACMSGHDR;
|
---|
| 175 |
|
---|
| 176 | #define WSA_CMSGHDR_ALIGN(length) (((length) + TYPE_ALIGNMENT(WSACMSGHDR)-1) & (~(TYPE_ALIGNMENT(WSACMSGHDR)-1)))
|
---|
| 177 | #define WSA_CMSGDATA_ALIGN(length) (((length) + MAX_NATURAL_ALIGNMENT-1) & (~(MAX_NATURAL_ALIGNMENT-1)))
|
---|
| 178 | #define WSA_CMSG_FIRSTHDR(msg) (((msg)->Control.len >= sizeof(WSACMSGHDR)) ? (LPWSACMSGHDR)(msg)->Control.buf : (LPWSACMSGHDR)NULL)
|
---|
| 179 | #define WSA_CMSG_NXTHDR(msg,cmsg) ((!(cmsg)) ? WSA_CMSG_FIRSTHDR(msg) : ((((u_char *)(cmsg) + WSA_CMSGHDR_ALIGN((cmsg)->cmsg_len) + sizeof(WSACMSGHDR)) > (u_char *)((msg)->Control.buf) + (msg)->Control.len) ? (LPWSACMSGHDR)NULL : (LPWSACMSGHDR)((u_char *)(cmsg) + WSA_CMSGHDR_ALIGN((cmsg)->cmsg_len))))
|
---|
| 180 | #define WSA_CMSG_DATA(cmsg) ((u_char *)(cmsg) + WSA_CMSGDATA_ALIGN(sizeof(WSACMSGHDR)))
|
---|
| 181 | #define WSA_CMSG_SPACE(length) (WSA_CMSGDATA_ALIGN(sizeof(WSACMSGHDR) + WSA_CMSGHDR_ALIGN(length)))
|
---|
| 182 | #define WSA_CMSG_LEN(length) (WSA_CMSGDATA_ALIGN(sizeof(WSACMSGHDR)) + length)
|
---|
| 183 |
|
---|
| 184 | #define MSG_TRUNC 0x0100
|
---|
| 185 | #define MSG_CTRUNC 0x0200
|
---|
| 186 | #define MSG_BCAST 0x0400
|
---|
| 187 | #define MSG_MCAST 0x0800
|
---|
| 188 |
|
---|
| 189 | typedef INT (WINAPI *LPFN_WSARECVMSG)(SOCKET s, LPWSAMSG lpMsg,
|
---|
| 190 | LPDWORD lpdwNumberOfBytesRecvd,
|
---|
| 191 | LPWSAOVERLAPPED lpOverlapped,
|
---|
| 192 | LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine);
|
---|
| 193 |
|
---|
| 194 | #define WSAID_WSARECVMSG {0xf689d7c8,0x6f1f,0x436b,{0x8a,0x53,0xe5,0x4f,0xe3,0x51,0xc3,0x22}}
|
---|
| 195 |
|
---|
| 196 | #if(_WIN32_WINNT >= 0x0600)
|
---|
| 197 | typedef struct {
|
---|
| 198 | int result;
|
---|
| 199 | ULONG fds;
|
---|
| 200 | INT timeout;
|
---|
| 201 | WSAPOLLFD fdArray[0];
|
---|
| 202 | } WSAPOLLDATA, *LPWSAPOLLDATA;
|
---|
| 203 |
|
---|
| 204 | typedef INT (WSAAPI *LPFN_WSAPOLL) (LPWSAPOLLFD fdarray, ULONG nfds, INT timeout);
|
---|
| 205 |
|
---|
| 206 | #define WSAID_WSAPOLL {0x18C76F85,0xDC66,0x4964,{0x97,0x2E,0x23,0xC2,0x72,0x38,0x31,0x2B}}
|
---|
| 207 |
|
---|
| 208 | typedef struct {
|
---|
| 209 | LPWSAMSG lpMsg;
|
---|
| 210 | DWORD dwFlags;
|
---|
| 211 | LPDWORD lpNumberOfBytesSent;
|
---|
| 212 | LPWSAOVERLAPPED lpOverlapped;
|
---|
| 213 | LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine;
|
---|
| 214 | } WSASENDMSG, *LPWSASENDMSG;
|
---|
| 215 |
|
---|
| 216 | typedef INT (WSAAPI *LPFN_WSASENDMSG)(SOCKET s, LPWSAMSG lpMsg, DWORD dwFlags,
|
---|
| 217 | LPDWORD lpNumberOfBytesSent,
|
---|
| 218 | LPWSAOVERLAPPED lpOverlapped,
|
---|
| 219 | LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine);
|
---|
| 220 |
|
---|
| 221 | #define WSAID_WSASENDMSG {0xa441e712,0x754f,0x43ca,{0x84,0xa7,0x0d,0xee,0x44,0xcf,0x60,0x6d}}
|
---|
| 222 |
|
---|
| 223 | #endif /* (_WIN32_WINNT >= 0x0600) */
|
---|
| 224 |
|
---|
| 225 | #ifdef __cplusplus
|
---|
| 226 | }
|
---|
| 227 | #endif
|
---|
| 228 |
|
---|
| 229 | #endif /* _MSWSOCK_ */
|
---|