1 /***********************************************************************\
2 *                               iprtrmib.d                              *
3 *                                                                       *
4 *                       Windows API header module                       *
5 *                                                                       *
6 *                 Translated from MinGW Windows headers                 *
7 *                           by Stewart Gordon                           *
8 *                                                                       *
9 *                       Placed into public domain                       *
10 \***********************************************************************/
11 module windows.iprtrmib;
12 nothrow:
13 import windows.ipifcons;
14 private import windows.windef;
15 
16 // FIXME: check types of constants
17 
18 const size_t
19 	MAXLEN_PHYSADDR        =   8,
20 	MAXLEN_IFDESCR         = 256,
21 	MAX_INTERFACE_NAME_LEN = 256;
22 
23 enum {
24 	MIB_IPNET_TYPE_OTHER = 1,
25 	MIB_IPNET_TYPE_INVALID,
26 	MIB_IPNET_TYPE_DYNAMIC,
27 	MIB_IPNET_TYPE_STATIC
28 }
29 
30 enum {
31 	MIB_TCP_RTO_OTHER = 1,
32 	MIB_TCP_RTO_CONSTANT,
33 	MIB_TCP_RTO_RSRE,
34 	MIB_TCP_RTO_VANJ
35 }
36 
37 enum {
38 	MIB_TCP_STATE_CLOSED = 1,
39 	MIB_TCP_STATE_LISTEN,
40 	MIB_TCP_STATE_SYN_SENT,
41 	MIB_TCP_STATE_SYN_RCVD,
42 	MIB_TCP_STATE_ESTAB,
43 	MIB_TCP_STATE_FIN_WAIT1,
44 	MIB_TCP_STATE_FIN_WAIT2,
45 	MIB_TCP_STATE_CLOSE_WAIT,
46 	MIB_TCP_STATE_CLOSING,
47 	MIB_TCP_STATE_LAST_ACK,
48 	MIB_TCP_STATE_TIME_WAIT,
49 	MIB_TCP_STATE_DELETE_TCB // = 12
50 }
51 
52 const DWORD
53 	MIB_USE_CURRENT_TTL        = -1,
54 	MIB_USE_CURRENT_FORWARDING = -1,
55 	MIB_TCP_MAXCONN_DYNAMIC    = -1;
56 
57 struct MIB_IPADDRROW {
58 	DWORD  dwAddr;
59 	DWORD  dwIndex;
60 	DWORD  dwMask;
61 	DWORD  dwBCastAddr;
62 	DWORD  dwReasmSize;
63 	ushort unused1;
64 	ushort unused2;
65 }
66 alias MIB_IPADDRROW* PMIB_IPADDRROW;
67 
68 struct MIB_IPADDRTABLE {
69 	DWORD            dwNumEntries;
70 	MIB_IPADDRROW[1] _table;
71 
72 	MIB_IPADDRROW* table() { return _table.ptr; }
73 }
74 alias MIB_IPADDRTABLE* PMIB_IPADDRTABLE;
75 
76 struct MIB_IPFORWARDROW {
77 	DWORD dwForwardDest;
78 	DWORD dwForwardMask;
79 	DWORD dwForwardPolicy;
80 	DWORD dwForwardNextHop;
81 	DWORD dwForwardIfIndex;
82 	DWORD dwForwardType;
83 	DWORD dwForwardProto;
84 	DWORD dwForwardAge;
85 	DWORD dwForwardNextHopAS;
86 	DWORD dwForwardMetric1;
87 	DWORD dwForwardMetric2;
88 	DWORD dwForwardMetric3;
89 	DWORD dwForwardMetric4;
90 	DWORD dwForwardMetric5;
91 }
92 alias MIB_IPFORWARDROW* PMIB_IPFORWARDROW;
93 
94 struct MIB_IPFORWARDTABLE {
95 	DWORD               dwNumEntries;
96 	MIB_IPFORWARDROW[1] _table;
97 
98 	MIB_IPFORWARDROW* table() { return _table.ptr; }
99 }
100 alias MIB_IPFORWARDTABLE* PMIB_IPFORWARDTABLE;
101 
102 struct MIB_IPNETROW {
103 	DWORD dwIndex;
104 	DWORD dwPhysAddrLen;
105 	BYTE[MAXLEN_PHYSADDR] bPhysAddr;
106 	DWORD dwAddr;
107 	DWORD dwType;
108 }
109 alias MIB_IPNETROW* PMIB_IPNETROW;
110 
111 struct MIB_IPNETTABLE {
112 	DWORD           dwNumEntries;
113 	MIB_IPNETROW[1] _table;
114 
115 	MIB_IPNETROW* table() { return _table.ptr; }
116 }
117 alias MIB_IPNETTABLE* PMIB_IPNETTABLE;
118 
119 struct MIBICMPSTATS {
120 	DWORD dwMsgs;
121 	DWORD dwErrors;
122 	DWORD dwDestUnreachs;
123 	DWORD dwTimeExcds;
124 	DWORD dwParmProbs;
125 	DWORD dwSrcQuenchs;
126 	DWORD dwRedirects;
127 	DWORD dwEchos;
128 	DWORD dwEchoReps;
129 	DWORD dwTimestamps;
130 	DWORD dwTimestampReps;
131 	DWORD dwAddrMasks;
132 	DWORD dwAddrMaskReps;
133 }
134 alias MIBICMPSTATS* PMIBICMPSTATS;
135 
136 struct MIBICMPINFO {
137 	MIBICMPSTATS icmpInStats;
138 	MIBICMPSTATS icmpOutStats;
139 }
140 alias MIBICMPINFO* PMIBICMPINFO;
141 
142 struct MIB_ICMP {
143 	MIBICMPINFO stats;
144 }
145 alias MIB_ICMP* PMIB_ICMP;
146 
147 struct MIB_IFROW {
148 	WCHAR[MAX_INTERFACE_NAME_LEN] wszName;
149 	DWORD dwIndex;
150 	DWORD dwType;
151 	DWORD dwMtu;
152 	DWORD dwSpeed;
153 	DWORD dwPhysAddrLen;
154 	BYTE[MAXLEN_PHYSADDR] bPhysAddr;
155 	DWORD dwAdminStatus;
156 	DWORD dwOperStatus;
157 	DWORD dwLastChange;
158 	DWORD dwInOctets;
159 	DWORD dwInUcastPkts;
160 	DWORD dwInNUcastPkts;
161 	DWORD dwInDiscards;
162 	DWORD dwInErrors;
163 	DWORD dwInUnknownProtos;
164 	DWORD dwOutOctets;
165 	DWORD dwOutUcastPkts;
166 	DWORD dwOutNUcastPkts;
167 	DWORD dwOutDiscards;
168 	DWORD dwOutErrors;
169 	DWORD dwOutQLen;
170 	DWORD dwDescrLen;
171 	BYTE[MAXLEN_IFDESCR] bDescr;
172 }
173 alias MIB_IFROW* PMIB_IFROW;
174 
175 struct MIB_IFTABLE {
176 	DWORD        dwNumEntries;
177 	MIB_IFROW[1] _table;
178 
179 	MIB_IFROW* table() { return _table.ptr; }
180 }
181 alias MIB_IFTABLE* PMIB_IFTABLE;
182 
183 struct MIB_IPSTATS {
184 	DWORD dwForwarding;
185 	DWORD dwDefaultTTL;
186 	DWORD dwInReceives;
187 	DWORD dwInHdrErrors;
188 	DWORD dwInAddrErrors;
189 	DWORD dwForwDatagrams;
190 	DWORD dwInUnknownProtos;
191 	DWORD dwInDiscards;
192 	DWORD dwInDelivers;
193 	DWORD dwOutRequests;
194 	DWORD dwRoutingDiscards;
195 	DWORD dwOutDiscards;
196 	DWORD dwOutNoRoutes;
197 	DWORD dwReasmTimeout;
198 	DWORD dwReasmReqds;
199 	DWORD dwReasmOks;
200 	DWORD dwReasmFails;
201 	DWORD dwFragOks;
202 	DWORD dwFragFails;
203 	DWORD dwFragCreates;
204 	DWORD dwNumIf;
205 	DWORD dwNumAddr;
206 	DWORD dwNumRoutes;
207 }
208 alias MIB_IPSTATS* PMIB_IPSTATS;
209 
210 struct MIB_TCPSTATS {
211 	DWORD dwRtoAlgorithm;
212 	DWORD dwRtoMin;
213 	DWORD dwRtoMax;
214 	DWORD dwMaxConn;
215 	DWORD dwActiveOpens;
216 	DWORD dwPassiveOpens;
217 	DWORD dwAttemptFails;
218 	DWORD dwEstabResets;
219 	DWORD dwCurrEstab;
220 	DWORD dwInSegs;
221 	DWORD dwOutSegs;
222 	DWORD dwRetransSegs;
223 	DWORD dwInErrs;
224 	DWORD dwOutRsts;
225 	DWORD dwNumConns;
226 }
227 alias MIB_TCPSTATS* PMIB_TCPSTATS;
228 
229 struct MIB_TCPROW {
230 	DWORD dwState;
231 	DWORD dwLocalAddr;
232 	DWORD dwLocalPort;
233 	DWORD dwRemoteAddr;
234 	DWORD dwRemotePort;
235 }
236 alias MIB_TCPROW* PMIB_TCPROW;
237 
238 struct MIB_TCPTABLE {
239 	DWORD         dwNumEntries;
240 	MIB_TCPROW[1] _table;
241 
242 	MIB_TCPROW* table() { return _table.ptr; }
243 }
244 alias MIB_TCPTABLE* PMIB_TCPTABLE;
245 
246 struct MIB_UDPSTATS {
247 	DWORD dwInDatagrams;
248 	DWORD dwNoPorts;
249 	DWORD dwInErrors;
250 	DWORD dwOutDatagrams;
251 	DWORD dwNumAddrs;
252 }
253 alias MIB_UDPSTATS* PMIB_UDPSTATS;
254 
255 struct MIB_UDPROW {
256 	DWORD dwLocalAddr;
257 	DWORD dwLocalPort;
258 }
259 alias MIB_UDPROW* PMIB_UDPROW;
260 
261 struct MIB_UDPTABLE {
262 	DWORD         dwNumEntries;
263 	MIB_UDPROW[1] _table;
264 
265 	MIB_UDPROW* table() { return _table.ptr; }
266 }
267 alias MIB_UDPTABLE* PMIB_UDPTABLE;