source: Daodan/MSYS2/mingw32/i686-w64-mingw32/include/mstcpip.h

Last change on this file was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

File size: 11.8 KB
Line 
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#ifndef _MSTCPIP_
7#define _MSTCPIP_
8
9#include <_mingw_unicode.h>
10#include <winapifamily.h>
11
12#ifdef __LP64__
13#pragma push_macro("u_long")
14#undef u_long
15#define u_long __ms_u_long
16#endif
17
18#if NTDDI_VERSION >= NTDDI_WIN10_RS2
19typedef enum _TCPSTATE {
20 TCPSTATE_CLOSED,
21 TCPSTATE_LISTEN,
22 TCPSTATE_SYN_SENT,
23 TCPSTATE_SYN_RCVD,
24 TCPSTATE_ESTABLISHED,
25 TCPSTATE_FIN_WAIT_1,
26 TCPSTATE_FIN_WAIT_2,
27 TCPSTATE_CLOSE_WAIT,
28 TCPSTATE_CLOSING,
29 TCPSTATE_LAST_ACK,
30 TCPSTATE_TIME_WAIT,
31 TCPSTATE_MAX
32} TCPSTATE;
33#endif
34
35#ifndef _TRANSPORT_SETTING_COMMON_
36#define _TRANSPORT_SETTING_COMMON_
37typedef struct TRANSPORT_SETTING_ID {
38 GUID Guid;
39} TRANSPORT_SETTING_ID, *PTRANSPORT_SETTING_ID;
40#endif
41
42struct tcp_keepalive {
43 u_long onoff;
44 u_long keepalivetime;
45 u_long keepaliveinterval;
46};
47
48typedef enum {
49 CONTROL_CHANNEL_TRIGGER_STATUS_INVALID = 0,
50 CONTROL_CHANNEL_TRIGGER_STATUS_SOFTWARE_SLOT_ALLOCATED = 1,
51 CONTROL_CHANNEL_TRIGGER_STATUS_HARDWARE_SLOT_ALLOCATED = 2,
52 CONTROL_CHANNEL_TRIGGER_STATUS_POLICY_ERROR = 3,
53 CONTROL_CHANNEL_TRIGGER_STATUS_SYSTEM_ERROR = 4,
54 CONTROL_CHANNEL_TRIGGER_STATUS_TRANSPORT_DISCONNECTED = 5,
55 CONTROL_CHANNEL_TRIGGER_STATUS_SERVICE_UNAVAILABLE = 6
56} CONTROL_CHANNEL_TRIGGER_STATUS, *PCONTROL_CHANNEL_TRIGGER_STATUS;
57
58#define CONTROL_CHANNEL_TRIGGER_STATUS_MAX CONTROL_CHANNEL_TRIGGER_STATUS_SYSTEM_ERROR
59
60typedef struct _REAL_TIME_NOTIFICATION_SETTING_INPUT {
61 TRANSPORT_SETTING_ID TransportSettingId;
62 GUID BrokerEventGuid;
63} REAL_TIME_NOTIFICATION_SETTING_INPUT, *PREAL_TIME_NOTIFICATION_SETTING_INPUT;
64
65typedef struct _REAL_TIME_NOTIFICATION_SETTING_INPUT_EX {
66 TRANSPORT_SETTING_ID TransportSettingId;
67 GUID BrokerEventGuid;
68 BOOLEAN Unmark;
69} REAL_TIME_NOTIFICATION_SETTING_INPUT_EX, *PREAL_TIME_NOTIFICATION_SETTING_INPUT_EX;
70
71typedef struct _REAL_TIME_NOTIFICATION_SETTING_OUTPUT {
72 CONTROL_CHANNEL_TRIGGER_STATUS ChannelStatus;
73} REAL_TIME_NOTIFICATION_SETTING_OUTPUT, *PREAL_TIME_NOTIFICATION_SETTING_OUTPUT;
74
75typedef struct _ASSOCIATE_NAMERES_CONTEXT_INPUT {
76 TRANSPORT_SETTING_ID TransportSettingId;
77 UINT64 Handle;
78} ASSOCIATE_NAMERES_CONTEXT_INPUT, *PASSOCIATE_NAMERES_CONTEXT_INPUT;
79
80#define SIO_RCVALL _WSAIOW(IOC_VENDOR,1)
81#define SIO_RCVALL_MCAST _WSAIOW(IOC_VENDOR,2)
82#define SIO_RCVALL_IGMPMCAST _WSAIOW(IOC_VENDOR,3)
83#define SIO_KEEPALIVE_VALS _WSAIOW(IOC_VENDOR,4)
84#define SIO_ABSORB_RTRALERT _WSAIOW(IOC_VENDOR,5)
85#define SIO_UCAST_IF _WSAIOW(IOC_VENDOR,6)
86#define SIO_LIMIT_BROADCASTS _WSAIOW(IOC_VENDOR,7)
87#define SIO_INDEX_BIND _WSAIOW(IOC_VENDOR,8)
88#define SIO_INDEX_MCASTIF _WSAIOW(IOC_VENDOR,9)
89#define SIO_INDEX_ADD_MCAST _WSAIOW(IOC_VENDOR,10)
90#define SIO_INDEX_DEL_MCAST _WSAIOW(IOC_VENDOR,11)
91#define SIO_RCVALL_MCAST_IF _WSAIOW(IOC_VENDOR,13)
92#define SIO_RCVALL_IF _WSAIOW(IOC_VENDOR,14)
93#define SIO_LOOPBACK_FAST_PATH _WSAIOW(IOC_VENDOR,16)
94#define SIO_TCP_INITIAL_RTO _WSAIOW(IOC_VENDOR,17)
95#define SIO_APPLY_TRANSPORT_SETTING _WSAIOW(IOC_VENDOR,19)
96#define SIO_QUERY_TRANSPORT_SETTING _WSAIOW(IOC_VENDOR,20)
97#define SIO_TCP_SET_ICW _WSAIOW(IOC_VENDOR,22)
98#define SIO_TCP_SET_ACK_FREQUENCY _WSAIOW(IOC_VENDOR,23)
99#if NTDDI_VERSION >= NTDDI_WIN10_RS3
100#define SIO_SET_PRIORITY_HINT _WSAIOW(IOC_VENDOR,24)
101#endif
102#if NTDDI_VERSION >= NTDDI_WIN10_FE
103#define SIO_PRIORITY_HINT SIO_SET_PRIORITY_HINT
104#endif
105#if NTDDI_VERSION >= NTDDI_WIN10_RS2
106#define SIO_TCP_INFO _WSAIORW(IOC_VENDOR,39)
107#endif
108#if NTDDI_VERSION >= NTDDI_WIN10_VB
109#define SIO_CPU_AFFINITY _WSAIOW(IOC_VENDOR,21)
110#endif
111#if NTDDI_VERSION >= NTDDI_WIN10_FE
112
113#define SIO_TIMESTAMPING _WSAIOW(IOC_VENDOR, 235)
114
115typedef struct _TIMESTAMPING_CONFIG {
116 ULONG Flags;
117 USHORT TxTimestampsBuffered;
118} TIMESTAMPING_CONFIG, *PTIMESTAMPING_CONFIG;
119
120#define TIMESTAMPING_FLAG_RX 0x1
121#define TIMESTAMPING_FLAG_TX 0x2
122
123#define SO_TIMESTAMP 0x300A
124
125#define SO_TIMESTAMP_ID 0x300B
126
127#define SIO_GET_TX_TIMESTAMP _WSAIOW(IOC_VENDOR, 234)
128
129typedef enum {
130 SocketPriorityHintVeryLow = 0,
131 SocketPriorityHintLow,
132 SocketPriorityHintNormal,
133 SocketMaximumPriorityHintType
134} SOCKET_PRIORITY_HINT, *PSOCKET_PRIORITY_HINT;
135
136typedef struct _PRIORITY_STATUS {
137 SOCKET_PRIORITY_HINT Sender;
138 SOCKET_PRIORITY_HINT Receiver;
139} PRIORITY_STATUS, *PPRIORITY_STATUS;
140#endif /* NTDDI_WIN10_FE */
141
142typedef enum {
143 RCVALL_OFF = 0,
144 RCVALL_ON = 1,
145 RCVALL_SOCKETLEVELONLY = 2,
146 RCVALL_IPLEVEL = 3
147} RCVALL_VALUE, *PRCVALL_VALUE;
148
149#define RCVALL_MAX RCVALL_IPLEVEL
150
151typedef struct {
152 RCVALL_VALUE Mode;
153 ULONG Interface;
154} RCVALL_IF, *PRCVALL_IF;
155
156#define TCP_INITIAL_RTO_UNSPECIFIED_RTT ((USHORT) -1)
157#define TCP_INITIAL_RTO_UNSPECIFIED_MAX_SYN_RETRANSMISSIONS ((UCHAR) -1)
158
159#define TCP_INITIAL_RTO_DEFAULT_RTT (0)
160#define TCP_INITIAL_RTO_DEFAULT_MAX_SYN_RETRANSMISSIONS (0)
161#define TCP_INITIAL_RTO_NO_SYN_RETRANSMISSIONS ((UCHAR) -2)
162
163typedef struct _TCP_INITIAL_RTO_PARAMETERS {
164 USHORT Rtt;
165 UCHAR MaxSynRetransmissions;
166} TCP_INITIAL_RTO_PARAMETERS, *PTCP_INITIAL_RTO_PARAMETERS;
167
168typedef enum {
169 TCP_ICW_LEVEL_DEFAULT = 0,
170 TCP_ICW_LEVEL_HIGH = 1,
171 TCP_ICW_LEVEL_VERY_HIGH = 2,
172 TCP_ICW_LEVEL_AGGRESSIVE = 3,
173 TCP_ICW_LEVEL_EXPERIMENTAL = 4,
174 TCP_ICW_LEVEL_COMPAT = 254,
175 TCP_ICW_LEVEL_MAX = 255
176} TCP_ICW_LEVEL, *PTCP_ICW_LEVEL;
177
178typedef struct _TCP_ICW_PARAMETERS {
179 TCP_ICW_LEVEL Level;
180} TCP_ICW_PARAMETERS, *PTCP_ICW_PARAMETERS;
181
182typedef struct _TCP_ACK_FREQUENCY_PARAMETERS {
183 UCHAR TcpDelayedAckFrequency;
184} TCP_ACK_FREQUENCY_PARAMETERS, *PTCP_ACK_FREQUENCY_PARAMETERS;
185
186#if NTDDI_VERSION >= NTDDI_WIN10_RS2
187typedef struct _TCP_INFO_v0 {
188 TCPSTATE State;
189 ULONG Mss;
190 ULONG64 ConnectionTimeMs;
191 BOOLEAN TimestampsEnabled;
192 ULONG RttUs;
193 ULONG MinRttUs;
194 ULONG BytesInFlight;
195 ULONG Cwnd;
196 ULONG SndWnd;
197 ULONG RcvWnd;
198 ULONG RcvBuf;
199 ULONG64 BytesOut;
200 ULONG64 BytesIn;
201 ULONG BytesReordered;
202 ULONG BytesRetrans;
203 ULONG FastRetrans;
204 ULONG DupAcksIn;
205 ULONG TimeoutEpisodes;
206 UCHAR SynRetrans;
207} TCP_INFO_v0, *PTCP_INFO_v0;
208#endif
209
210#if NTDDI_VERSION >= NTDDI_WIN10_RS5
211typedef struct _TCP_INFO_v1 {
212 TCPSTATE State;
213 ULONG Mss;
214 ULONG64 ConnectionTimeMs;
215 BOOLEAN TimestampsEnabled;
216 ULONG RttUs;
217 ULONG MinRttUs;
218 ULONG BytesInFlight;
219 ULONG Cwnd;
220 ULONG SndWnd;
221 ULONG RcvWnd;
222 ULONG RcvBuf;
223 ULONG64 BytesOut;
224 ULONG64 BytesIn;
225 ULONG BytesReordered;
226 ULONG BytesRetrans;
227 ULONG FastRetrans;
228 ULONG DupAcksIn;
229 ULONG TimeoutEpisodes;
230 UCHAR SynRetrans;
231 ULONG SndLimTransRwin;
232 ULONG SndLimTimeRwin;
233 ULONG64 SndLimBytesRwin;
234 ULONG SndLimTransCwnd;
235 ULONG SndLimTimeCwnd;
236 ULONG64 SndLimBytesCwnd;
237 ULONG SndLimTransSnd;
238 ULONG SndLimTimeSnd;
239 ULONG64 SndLimBytesSnd;
240} TCP_INFO_v1, *PTCP_INFO_v1;
241#endif
242
243#define SIO_ACQUIRE_PORT_RESERVATION _WSAIOW(IOC_VENDOR, 100)
244#define SIO_RELEASE_PORT_RESERVATION _WSAIOW(IOC_VENDOR, 101)
245#define SIO_ASSOCIATE_PORT_RESERVATION _WSAIOW(IOC_VENDOR, 102)
246
247typedef struct _INET_PORT_RANGE {
248 USHORT StartPort;
249 USHORT NumberOfPorts;
250} INET_PORT_RANGE, *PINET_PORT_RANGE;
251
252typedef struct _INET_PORT_RANGE INET_PORT_RESERVATION, *PINET_PORT_RESERVATION;
253
254typedef struct {
255 ULONG64 Token;
256} INET_PORT_RESERVATION_TOKEN, *PINET_PORT_RESERVATION_TOKEN;
257
258#define INVALID_PORT_RESERVATION_TOKEN ((ULONG64)0)
259
260typedef struct {
261#ifdef __cplusplus
262 INET_PORT_RESERVATION Reservation;
263 INET_PORT_RESERVATION_TOKEN Token;
264#else
265 INET_PORT_RESERVATION;
266 INET_PORT_RESERVATION_TOKEN;
267#endif
268} INET_PORT_RESERVATION_INSTANCE, *PINET_PORT_RESERVATION_INSTANCE;
269
270typedef struct {
271 ULONG OwningPid;
272} INET_PORT_RESERVATION_INFORMATION, *PINET_PORT_RESERVATION_INFORMATION;
273
274#if (_WIN32_WINNT >= 0x0502)
275typedef enum _SOCKET_SECURITY_PROTOCOL {
276 SOCKET_SECURITY_PROTOCOL_DEFAULT,
277 SOCKET_SECURITY_PROTOCOL_IPSEC,
278#if NTDDI_VERSION >= NTDDI_WIN7
279 SOCKET_SECURITY_PROTOCOL_IPSEC2,
280#endif
281 SOCKET_SECURITY_PROTOCOL_INVALID
282} SOCKET_SECURITY_PROTOCOL;
283
284#define SOCKET_SETTINGS_GUARANTEE_ENCRYPTION 0x1
285#define SOCKET_SETTINGS_ALLOW_INSECURE 0x2
286
287typedef enum _SOCKET_USAGE_TYPE {
288 SYSTEM_CRITICAL_SOCKET = 1
289} SOCKET_USAGE_TYPE;
290
291typedef struct _SOCKET_PEER_TARGET_NAME {
292 SOCKET_SECURITY_PROTOCOL SecurityProtocol;
293 SOCKADDR_STORAGE PeerAddress;
294 ULONG PeerTargetNameStringLen;
295 wchar_t AllStrings[];
296} SOCKET_PEER_TARGET_NAME;
297
298#define SOCKET_INFO_CONNECTION_SECURED 0x00000001
299#define SOCKET_INFO_CONNECTION_ENCRYPTED 0x00000002
300#define SOCKET_INFO_CONNECTION_IMPERSONATED 0x00000004
301
302typedef struct _SOCKET_SECURITY_QUERY_INFO {
303 SOCKET_SECURITY_PROTOCOL SecurityProtocol;
304 ULONG Flags;
305 UINT64 PeerApplicationAccessTokenHandle;
306 UINT64 PeerMachineAccessTokenHandle;
307} SOCKET_SECURITY_QUERY_INFO;
308
309typedef struct _SOCKET_SECURITY_QUERY_TEMPLATE {
310 SOCKET_SECURITY_PROTOCOL SecurityProtocol;
311 SOCKADDR_STORAGE PeerAddress;
312 ULONG PeerTokenAccessMask;
313} SOCKET_SECURITY_QUERY_TEMPLATE;
314
315typedef struct _SOCKET_SECURITY_SETTINGS {
316 SOCKET_SECURITY_PROTOCOL SecurityProtocol;
317 ULONG SecurityFlags;
318} SOCKET_SECURITY_SETTINGS;
319
320#define SOCKET_SETTINGS_IPSEC_SKIP_FILTER_INSTANTIATION 0x00000001
321
322typedef struct _SOCKET_SECURITY_SETTINGS_IPSEC {
323 SOCKET_SECURITY_PROTOCOL SecurityProtocol;
324 ULONG SecurityFlags;
325 ULONG IpsecFlags;
326 GUID AuthipMMPolicyKey;
327 GUID AuthipQMPolicyKey;
328 GUID Reserved;
329 UINT64 Reserved2;
330 ULONG UserNameStringLen;
331 ULONG DomainNameStringLen;
332 ULONG PasswordStringLen;
333 wchar_t AllStrings[];
334} SOCKET_SECURITY_SETTINGS_IPSEC;
335
336#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
337
338#define RtlIpv6AddressToString __MINGW_NAME_AW(RtlIpv6AddressToString)
339#define RtlIpv6AddressToStringEx __MINGW_NAME_AW(RtlIpv6AddressToStringEx)
340
341#ifdef _WS2IPDEF_
342
343LPSTR NTAPI RtlIpv6AddressToStringA(const IN6_ADDR *Addr, LPSTR S);
344LPWSTR NTAPI RtlIpv6AddressToStringW(const IN6_ADDR *Addr, LPWSTR S);
345
346LONG NTAPI RtlIpv6AddressToStringExA(const IN6_ADDR *Address, ULONG ScopeId, USHORT Port, LPSTR AddressString, PULONG AddressStringLength);
347LONG NTAPI RtlIpv6AddressToStringExW(const IN6_ADDR *Address, ULONG ScopeId, USHORT Port, LPWSTR AddressString, PULONG AddressStringLength);
348
349#define RtlIpv4AddressToString __MINGW_NAME_AW(RtlIpv4AddressToString)
350LPSTR NTAPI RtlIpv4AddressToStringA(const IN_ADDR *Addr, LPSTR S);
351LPWSTR NTAPI RtlIpv4AddressToStringW(const IN_ADDR *Addr, LPWSTR S);
352
353#define RtlIpv4AddressToStringEx __MINGW_NAME_AW(RtlIpv4AddressToStringEx)
354LONG NTAPI RtlIpv4AddressToStringExA(const IN_ADDR *Address, USHORT Port, LPSTR AddressString, PULONG AddressStringLength);
355LONG NTAPI RtlIpv4AddressToStringExW(const IN_ADDR *Address, USHORT Port, LPWSTR AddressString, PULONG AddressStringLength);
356
357#define RtlIpv4StringToAddress __MINGW_NAME_AW(RtlIpv4StringToAddress)
358LONG NTAPI RtlIpv4StringToAddressA(PCSTR S, BOOLEAN Strict, LPSTR *Terminator, IN_ADDR *Addr);
359LONG NTAPI RtlIpv4StringToAddressW(PCWSTR S, BOOLEAN Strict, LPWSTR *Terminator, IN_ADDR *Addr);
360
361#define RtlIpv4StringToAddressEx __MINGW_NAME_AW(RtlIpv4StringToAddressEx)
362LONG NTAPI RtlIpv4StringToAddressExA(PCSTR AddressString, BOOLEAN Strict, IN_ADDR *Address, PUSHORT Port);
363LONG NTAPI RtlIpv4StringToAddressExW(PCWSTR AddressString, BOOLEAN Strict, IN_ADDR *Address, PUSHORT Port);
364
365#define RtlIpv6StringToAddressEx __MINGW_NAME_AW(RtlIpv6StringToAddressEx)
366LONG NTAPI RtlIpv6StringToAddressExA(PCSTR AddressString, IN6_ADDR *Address, PULONG ScopeId, PUSHORT Port);
367LONG NTAPI RtlIpv6StringToAddressExW(PCWSTR AddressString, IN6_ADDR *Address, PULONG ScopeId, PUSHORT Port);
368
369#endif /* _WS2IPDEF_ */
370
371#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */
372#endif /*(_WIN32_WINNT >= 0x0502)*/
373
374#ifdef __LP64__
375#pragma pop_macro("u_long")
376#endif
377
378#endif /* _MSTCPIP_ */
379
Note: See TracBrowser for help on using the repository browser.