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