summaryrefslogtreecommitdiffstats
path: root/third_party/rust/winapi/src/shared/tcpmib.rs
blob: 63ae7965a954d2fc62ea8e3b51e1201ca4abe90d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
// All files in the project carrying such notice may not be copied, modified, or distributed
// except according to those terms.
// #include <winapifamily.h>
use shared::basetsd::DWORD64;
use shared::in6addr::IN6_ADDR;
use shared::minwindef::DWORD;
use shared::ntdef::{LARGE_INTEGER, UCHAR, ULONGLONG};
const ANY_SIZE: usize = 1;
pub const TCPIP_OWNING_MODULE_SIZE: usize = 16;
ENUM!{enum MIB_TCP_STATE {
    MIB_TCP_STATE_CLOSED = 1,
    MIB_TCP_STATE_LISTEN = 2,
    MIB_TCP_STATE_SYN_SENT = 3,
    MIB_TCP_STATE_SYN_RCVD = 4,
    MIB_TCP_STATE_ESTAB = 5,
    MIB_TCP_STATE_FIN_WAIT1 = 6,
    MIB_TCP_STATE_FIN_WAIT2 = 7,
    MIB_TCP_STATE_CLOSE_WAIT = 8,
    MIB_TCP_STATE_CLOSING = 9,
    MIB_TCP_STATE_LAST_ACK = 10,
    MIB_TCP_STATE_TIME_WAIT = 11,
    MIB_TCP_STATE_DELETE_TCB = 12,
    MIB_TCP_STATE_RESERVED = 100,
}}
ENUM!{enum TCP_CONNECTION_OFFLOAD_STATE {
    TcpConnectionOffloadStateInHost = 0,
    TcpConnectionOffloadStateOffloading = 1,
    TcpConnectionOffloadStateOffloaded = 2,
    TcpConnectionOffloadStateUploading = 3,
    TcpConnectionOffloadStateMax = 4,
}}
pub type PTCP_CONNECTION_OFFLOAD_STATE = *mut TCP_CONNECTION_OFFLOAD_STATE;
STRUCT!{struct MIB_TCPROW_LH {
    State: MIB_TCP_STATE,
    dwLocalAddr: DWORD,
    dwLocalPort: DWORD,
    dwRemoteAddr: DWORD,
    dwRemotePort: DWORD,
}}
pub type PMIB_TCPROW_LH = *mut MIB_TCPROW_LH;
STRUCT!{struct MIB_TCPROW_W2K {
    dwState: DWORD,
    dwLocalAddr: DWORD,
    dwLocalPort: DWORD,
    dwRemoteAddr: DWORD,
    dwRemotePort: DWORD,
}}
pub type PMIB_TCPROW_W2K = *mut MIB_TCPROW_W2K;
pub type MIB_TCPROW = MIB_TCPROW_LH;
pub type PMIB_TCPROW = *mut MIB_TCPROW;
STRUCT!{struct MIB_TCPTABLE {
    dwNumEntries: DWORD,
    table: [MIB_TCPROW; ANY_SIZE],
}}
pub type PMIB_TCPTABLE = *mut MIB_TCPTABLE;
// FIXME: SIZEOF_TCPTABLE(x)
STRUCT!{struct MIB_TCPROW2 {
    dwState: DWORD,
    dwLocalAddr: DWORD,
    dwLocalPort: DWORD,
    dwRemoteAddr: DWORD,
    dwRemotePort: DWORD,
    dwOwningPid: DWORD,
    dwOffloadState: TCP_CONNECTION_OFFLOAD_STATE,
}}
pub type PMIB_TCPROW2 = *mut MIB_TCPROW2;
STRUCT!{struct MIB_TCPTABLE2 {
    dwNumEntries: DWORD,
    table: [MIB_TCPROW2; ANY_SIZE],
}}
pub type PMIB_TCPTABLE2 = *mut MIB_TCPTABLE2;
// FIXME: SIZEOF_TCPTABLE2(x)
STRUCT!{struct MIB_TCPROW_OWNER_PID {
    dwState: DWORD,
    dwLocalAddr: DWORD,
    dwLocalPort: DWORD,
    dwRemoteAddr: DWORD,
    dwRemotePort: DWORD,
    dwOwningPid: DWORD,
}}
pub type PMIB_TCPROW_OWNER_PID = *mut MIB_TCPROW_OWNER_PID;
STRUCT!{struct MIB_TCPTABLE_OWNER_PID {
    dwNumEntries: DWORD,
    table: [MIB_TCPROW_OWNER_PID; ANY_SIZE],
}}
pub type PMIB_TCPTABLE_OWNER_PID = *mut MIB_TCPTABLE_OWNER_PID;
// FIXME: SIZEOF_TCPTABLE_OWNER_PID(x)
STRUCT!{struct MIB_TCPROW_OWNER_MODULE {
    dwState: DWORD,
    dwLocalAddr: DWORD,
    dwLocalPort: DWORD,
    dwRemoteAddr: DWORD,
    dwRemotePort: DWORD,
    dwOwningPid: DWORD,
    liCreateTimestamp: LARGE_INTEGER,
    OwningModuleInfo: [ULONGLONG; TCPIP_OWNING_MODULE_SIZE],
}}
pub type PMIB_TCPROW_OWNER_MODULE = *mut MIB_TCPROW_OWNER_MODULE;
STRUCT!{struct MIB_TCPTABLE_OWNER_MODULE {
    dwNumEntries: DWORD,
    table: [MIB_TCPROW_OWNER_MODULE; ANY_SIZE],
}}
pub type PMIB_TCPTABLE_OWNER_MODULE = *mut MIB_TCPTABLE_OWNER_MODULE;
// FIXME: SIZEOF_TCPTABLE_OWNER_MODULE(x)
STRUCT!{struct MIB_TCP6ROW {
    State: MIB_TCP_STATE,
    LocalAddr: IN6_ADDR,
    dwLocalScopeId: DWORD,
    dwLocalPort: DWORD,
    RemoteAddr: IN6_ADDR,
    dwRemoteScopeId: DWORD,
    dwRemotePort: DWORD,
}}
pub type PMIB_TCP6ROW = *mut MIB_TCP6ROW;
STRUCT!{struct MIB_TCP6TABLE {
    dwNumEntries: DWORD,
    table: [MIB_TCP6ROW; ANY_SIZE],
}}
pub type PMIB_TCP6TABLE = *mut MIB_TCP6TABLE;
// FIXME: SIZEOF_TCP6TABLE(x)
STRUCT!{struct MIB_TCP6ROW2 {
    LocalAddr: IN6_ADDR,
    dwLocalScopeId: DWORD,
    dwLocalPort: DWORD,
    RemoteAddr: IN6_ADDR,
    dwRemoteScopeId: DWORD,
    dwRemotePort: DWORD,
    State: MIB_TCP_STATE,
    dwOwningPid: DWORD,
    dwOffloadState: TCP_CONNECTION_OFFLOAD_STATE,
}}
pub type PMIB_TCP6ROW2 = *mut MIB_TCP6ROW2;
STRUCT!{struct MIB_TCP6TABLE2 {
    dwNumEntries: DWORD,
    table: [MIB_TCP6ROW2; ANY_SIZE],
}}
pub type PMIB_TCP6TABLE2 = *mut MIB_TCP6TABLE2;
// FIXME: SIZEOF_TCP6TABLE2(x)
STRUCT!{struct MIB_TCP6ROW_OWNER_PID {
    ucLocalAddr: [UCHAR; 16],
    dwLocalScopeId: DWORD,
    dwLocalPort: DWORD,
    ucRemoteAddr: [UCHAR; 16],
    dwRemoteScopeId: DWORD,
    dwRemotePort: DWORD,
    dwState: DWORD,
    dwOwningPid: DWORD,
}}
pub type PMIB_TCP6ROW_OWNER_PID = *mut MIB_TCP6ROW_OWNER_PID;
STRUCT!{struct MIB_TCP6TABLE_OWNER_PID {
    dwNumEntries: DWORD,
    table: [MIB_TCP6ROW_OWNER_PID; ANY_SIZE],
}}
pub type PMIB_TCP6TABLE_OWNER_PID = *mut MIB_TCP6TABLE_OWNER_PID;
// FIXME: SIZEOF_TCP6TABLE_OWNER_PID(x)
STRUCT!{struct MIB_TCP6ROW_OWNER_MODULE {
    ucLocalAddr: [UCHAR; 16],
    dwLocalScopeId: DWORD,
    dwLocalPort: DWORD,
    ucRemoteAddr: [UCHAR; 16],
    dwRemoteScopeId: DWORD,
    dwRemotePort: DWORD,
    dwState: DWORD,
    dwOwningPid: DWORD,
    liCreateTimestamp: LARGE_INTEGER,
    OwningModuleInfo: [ULONGLONG; TCPIP_OWNING_MODULE_SIZE],
}}
pub type PMIB_TCP6ROW_OWNER_MODULE = *mut MIB_TCP6ROW_OWNER_MODULE;
STRUCT!{struct MIB_TCP6TABLE_OWNER_MODULE {
    dwNumEntries: DWORD,
    table: [MIB_TCP6ROW_OWNER_MODULE; ANY_SIZE],
}}
pub type PMIB_TCP6TABLE_OWNER_MODULE = *mut MIB_TCP6TABLE_OWNER_MODULE;
// FIXME: SIZEOF_TCP6TABLE_OWNER_MODULE(x)
ENUM!{enum TCP_RTO_ALGORITHM {
    TcpRtoAlgorithmOther = 1,
    TcpRtoAlgorithmConstant = 2,
    TcpRtoAlgorithmRsre = 3,
    TcpRtoAlgorithmVanj = 4,
    MIB_TCP_RTO_OTHER = 1,
    MIB_TCP_RTO_CONSTANT = 2,
    MIB_TCP_RTO_RSRE = 3,
    MIB_TCP_RTO_VANJ = 4,
}}
pub type PTCP_RTO_ALGORITHM = *mut TCP_RTO_ALGORITHM;
STRUCT!{struct MIB_TCPSTATS_LH {
    RtoAlgorithm: TCP_RTO_ALGORITHM,
    dwRtoMin: DWORD,
    dwRtoMax: DWORD,
    dwMaxConn: DWORD,
    dwActiveOpens: DWORD,
    dwPassiveOpens: DWORD,
    dwAttemptFails: DWORD,
    dwEstabResets: DWORD,
    dwCurrEstab: DWORD,
    dwInSegs: DWORD,
    dwOutSegs: DWORD,
    dwRetransSegs: DWORD,
    dwInErrs: DWORD,
    dwOutRsts: DWORD,
    dwNumConns: DWORD,
}}
pub type PMIB_TCPSTATS_LH = *mut MIB_TCPSTATS_LH;
STRUCT!{struct MIB_TCPSTATS_W2K {
    dwRtoAlgorithm: DWORD,
    dwRtoMin: DWORD,
    dwRtoMax: DWORD,
    dwMaxConn: DWORD,
    dwActiveOpens: DWORD,
    dwPassiveOpens: DWORD,
    dwAttemptFails: DWORD,
    dwEstabResets: DWORD,
    dwCurrEstab: DWORD,
    dwInSegs: DWORD,
    dwOutSegs: DWORD,
    dwRetransSegs: DWORD,
    dwInErrs: DWORD,
    dwOutRsts: DWORD,
    dwNumConns: DWORD,
}}
pub type PMIB_TCPSTATS_W2K = *mut MIB_TCPSTATS_W2K;
pub type MIB_TCPSTATS = MIB_TCPSTATS_LH;
pub type PMIB_TCPSTATS = *mut MIB_TCPSTATS;
STRUCT!{struct MIB_TCPSTATS2 {
    RtoAlgorithm: TCP_RTO_ALGORITHM,
    dwRtoMin: DWORD,
    dwRtoMax: DWORD,
    dwMaxConn: DWORD,
    dwActiveOpens: DWORD,
    dwPassiveOpens: DWORD,
    dwAttemptFails: DWORD,
    dwEstabResets: DWORD,
    dwCurrEstab: DWORD,
    dw64InSegs: DWORD64,
    dw64OutSegs: DWORD64,
    dwRetransSegs: DWORD,
    dwInErrs: DWORD,
    dwOutRsts: DWORD,
    dwNumConns: DWORD,
}}
pub type PMIB_TCPSTATS2 = *mut MIB_TCPSTATS2;