1 // Licensed under the Apache License, Version 2.0 2 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license 3 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. 4 // All files in the project carrying such notice may not be copied, modified, or distributed 5 // except according to those terms. 6 use shared::ifdef::IF_INDEX; 7 use shared::ifmib::MAXLEN_PHYSADDR; 8 use shared::minwindef::DWORD; 9 use shared::nldef::NL_ROUTE_PROTOCOL; 10 use shared::ntdef::{PVOID, UCHAR, ULONG, USHORT}; 11 const ANY_SIZE: usize = 1; 12 STRUCT!{struct MIB_IPADDRROW_XP { 13 dwAddr: DWORD, 14 dwIndex: IF_INDEX, 15 dwMask: DWORD, 16 dwBCastAddr: DWORD, 17 dwReasmSize: DWORD, 18 unused1: USHORT, 19 wType: USHORT, 20 }} 21 pub type PMIB_IPADDRROW_XP = *mut MIB_IPADDRROW_XP; 22 STRUCT!{struct MIB_IPADDRROW_W2K { 23 dwAddr: DWORD, 24 dwIndex: DWORD, 25 dwMask: DWORD, 26 dwBCastAddr: DWORD, 27 dwReasmSize: DWORD, 28 unused1: USHORT, 29 unused2: USHORT, 30 }} 31 pub type PMIB_IPADDRROW_W2K = *mut MIB_IPADDRROW_W2K; 32 pub type MIB_IPADDRROW = MIB_IPADDRROW_XP; 33 pub type PMIB_IPADDRROW = *mut MIB_IPADDRROW; 34 STRUCT!{struct MIB_IPADDRTABLE { 35 dwNumEntries: DWORD, 36 table: [MIB_IPADDRROW; ANY_SIZE], 37 }} 38 pub type PMIB_IPADDRTABLE = *mut MIB_IPADDRTABLE; 39 // FIXME: SIZEOF_IPADDRTABLE(x) 40 STRUCT!{struct MIB_IPFORWARDNUMBER { 41 dwValue: DWORD, 42 }} 43 pub type PMIB_IPFORWARDNUMBER = *mut MIB_IPFORWARDNUMBER; 44 pub type MIB_IPFORWARD_PROTO = NL_ROUTE_PROTOCOL; 45 ENUM!{enum MIB_IPFORWARD_TYPE { 46 MIB_IPROUTE_TYPE_OTHER = 1, 47 MIB_IPROUTE_TYPE_INVALID = 2, 48 MIB_IPROUTE_TYPE_DIRECT = 3, 49 MIB_IPROUTE_TYPE_INDIRECT = 4, 50 }} 51 STRUCT!{struct MIB_IPFORWARDROW { 52 dwForwardDest: DWORD, 53 dwForwardMask: DWORD, 54 dwForwardPolicy: DWORD, 55 dwForwardNextHop: DWORD, 56 dwForwardIfIndex: IF_INDEX, 57 ForwardType: MIB_IPFORWARD_TYPE, 58 ForwardProto: MIB_IPFORWARD_PROTO, 59 dwForwardAge: DWORD, 60 dwForwardNextHopAS: DWORD, 61 dwForwardMetric1: DWORD, 62 dwForwardMetric2: DWORD, 63 dwForwardMetric3: DWORD, 64 dwForwardMetric4: DWORD, 65 dwForwardMetric5: DWORD, 66 }} 67 pub type PMIB_IPFORWARDROW = *mut MIB_IPFORWARDROW; 68 STRUCT!{struct MIB_IPFORWARDTABLE { 69 dwNumEntries: DWORD, 70 table: [MIB_IPFORWARDROW; ANY_SIZE], 71 }} 72 pub type PMIB_IPFORWARDTABLE = *mut MIB_IPFORWARDTABLE; 73 // FIXME: SIZEOF_IPFORWARDTABLE(x) 74 ENUM!{enum MIB_IPNET_TYPE { 75 MIB_IPNET_TYPE_OTHER = 1, 76 MIB_IPNET_TYPE_INVALID = 2, 77 MIB_IPNET_TYPE_DYNAMIC = 3, 78 MIB_IPNET_TYPE_STATIC = 4, 79 }} 80 STRUCT!{struct MIB_IPNETROW_LH { 81 dwIndex: IF_INDEX, 82 dwPhysAddrLen: DWORD, 83 bPhysAddr: [UCHAR; MAXLEN_PHYSADDR], 84 dwAddr: DWORD, 85 Type: MIB_IPNET_TYPE, 86 }} 87 pub type PMIB_IPNETROW_LH = *mut MIB_IPNETROW_LH; 88 STRUCT!{struct MIB_IPNETROW_W2K { 89 dwIndex: IF_INDEX, 90 dwPhysAddrLen: DWORD, 91 bPhysAddr: [UCHAR; MAXLEN_PHYSADDR], 92 dwAddr: DWORD, 93 dwType: DWORD, 94 }} 95 pub type PMIB_IPNETROW_W2K = *mut MIB_IPNETROW_W2K; 96 pub type MIB_IPNETROW = MIB_IPNETROW_LH; 97 pub type PMIB_IPNETROW = *mut MIB_IPNETROW; 98 STRUCT!{struct MIB_IPNETTABLE { 99 dwNumEntries: DWORD, 100 table: [MIB_IPNETROW; ANY_SIZE], 101 }} 102 pub type PMIB_IPNETTABLE = *mut MIB_IPNETTABLE; 103 // FIXME: SIZEOF_IPNETTABLE(x) 104 ENUM!{enum MIB_IPSTATS_FORWARDING { 105 MIB_IP_FORWARDING = 1, 106 MIB_IP_NOT_FORWARDING = 2, 107 }} 108 pub type PMIB_IPSTATS_FORWARDING = *mut MIB_IPSTATS_FORWARDING; 109 STRUCT!{struct MIB_IPSTATS_LH { 110 Forwarding: MIB_IPSTATS_FORWARDING, 111 dwDefaultTTL: DWORD, 112 dwInReceives: DWORD, 113 dwInHdrErrors: DWORD, 114 dwInAddrErrors: DWORD, 115 dwForwDatagrams: DWORD, 116 dwInUnknownProtos: DWORD, 117 dwInDiscards: DWORD, 118 dwInDelivers: DWORD, 119 dwOutRequests: DWORD, 120 dwRoutingDiscards: DWORD, 121 dwOutDiscards: DWORD, 122 dwOutNoRoutes: DWORD, 123 dwReasmTimeout: DWORD, 124 dwReasmReqds: DWORD, 125 dwReasmOks: DWORD, 126 dwReasmFails: DWORD, 127 dwFragOks: DWORD, 128 dwFragFails: DWORD, 129 dwFragCreates: DWORD, 130 dwNumIf: DWORD, 131 dwNumAddr: DWORD, 132 dwNumRoutes: DWORD, 133 }} 134 pub type PMIB_IPSTATS_LH = *mut MIB_IPSTATS_LH; 135 STRUCT!{struct MIB_IPSTATS_W2K { 136 dwForwarding: DWORD, 137 dwDefaultTTL: DWORD, 138 dwInReceives: DWORD, 139 dwInHdrErrors: DWORD, 140 dwInAddrErrors: DWORD, 141 dwForwDatagrams: DWORD, 142 dwInUnknownProtos: DWORD, 143 dwInDiscards: DWORD, 144 dwInDelivers: DWORD, 145 dwOutRequests: DWORD, 146 dwRoutingDiscards: DWORD, 147 dwOutDiscards: DWORD, 148 dwOutNoRoutes: DWORD, 149 dwReasmTimeout: DWORD, 150 dwReasmReqds: DWORD, 151 dwReasmOks: DWORD, 152 dwReasmFails: DWORD, 153 dwFragOks: DWORD, 154 dwFragFails: DWORD, 155 dwFragCreates: DWORD, 156 dwNumIf: DWORD, 157 dwNumAddr: DWORD, 158 dwNumRoutes: DWORD, 159 }} 160 pub type PMIB_IPSTATS_W2K = *mut MIB_IPSTATS_W2K; 161 pub type MIB_IPSTATS = MIB_IPSTATS_LH; 162 pub type PMIB_IPSTATS = *mut MIB_IPSTATS; 163 STRUCT!{struct MIBICMPSTATS { 164 dwMsgs: DWORD, 165 dwErrors: DWORD, 166 dwDestUnreachs: DWORD, 167 dwTimeExcds: DWORD, 168 dwParmProbs: DWORD, 169 dwSrcQuenchs: DWORD, 170 dwRedirects: DWORD, 171 dwEchos: DWORD, 172 dwEchoReps: DWORD, 173 dwTimestamps: DWORD, 174 dwTimestampReps: DWORD, 175 dwAddrMasks: DWORD, 176 dwAddrMaskReps: DWORD, 177 }} 178 pub type PMIBICMPSTATS = *mut MIBICMPSTATS; 179 STRUCT!{struct MIBICMPINFO { 180 icmpInStats: MIBICMPSTATS, 181 icmpOutStats: MIBICMPSTATS, 182 }} 183 STRUCT!{struct MIB_ICMP { 184 stats: MIBICMPINFO, 185 }} 186 pub type PMIB_ICMP = *mut MIB_ICMP; 187 STRUCT!{struct MIBICMPSTATS_EX_XPSP1 { 188 dwMsgs: DWORD, 189 dwErrors: DWORD, 190 rgdwTypeCount: [DWORD; 256], 191 }} 192 pub type PMIBICMPSTATS_EX_XPSP1 = *mut MIBICMPSTATS_EX_XPSP1; 193 pub type MIBICMPSTATS_EX = MIBICMPSTATS_EX_XPSP1; 194 pub type PMIBICMPSTATS_EX = *mut MIBICMPSTATS_EX_XPSP1; 195 STRUCT!{struct MIB_ICMP_EX_XPSP1 { 196 icmpInStats: MIBICMPSTATS_EX, 197 icmpOutStats: MIBICMPSTATS_EX, 198 }} 199 pub type PMIB_ICMP_EX_XPSP1 = *mut MIB_ICMP_EX_XPSP1; 200 pub type MIB_ICMP_EX = MIB_ICMP_EX_XPSP1; 201 pub type PMIB_ICMP_EX = *mut MIB_ICMP_EX_XPSP1; 202 ENUM!{enum ICMP6_TYPE { 203 ICMP6_DST_UNREACH = 1, 204 ICMP6_PACKET_TOO_BIG = 2, 205 ICMP6_TIME_EXCEEDED = 3, 206 ICMP6_PARAM_PROB = 4, 207 ICMP6_ECHO_REQUEST = 128, 208 ICMP6_ECHO_REPLY = 129, 209 ICMP6_MEMBERSHIP_QUERY = 130, 210 ICMP6_MEMBERSHIP_REPORT = 131, 211 ICMP6_MEMBERSHIP_REDUCTION = 132, 212 ND_ROUTER_SOLICIT = 133, 213 ND_ROUTER_ADVERT = 134, 214 ND_NEIGHBOR_SOLICIT = 135, 215 ND_NEIGHBOR_ADVERT = 136, 216 ND_REDIRECT = 137, 217 ICMP6_V2_MEMBERSHIP_REPORT = 143, 218 }} 219 pub type PICMP6_TYPE = *mut ICMP6_TYPE; 220 ENUM!{enum ICMP4_TYPE { 221 ICMP4_ECHO_REPLY = 0, 222 ICMP4_DST_UNREACH = 3, 223 ICMP4_SOURCE_QUENCH = 4, 224 ICMP4_REDIRECT = 5, 225 ICMP4_ECHO_REQUEST = 8, 226 ICMP4_ROUTER_ADVERT = 9, 227 ICMP4_ROUTER_SOLICIT = 10, 228 ICMP4_TIME_EXCEEDED = 11, 229 ICMP4_PARAM_PROB = 12, 230 ICMP4_TIMESTAMP_REQUEST = 13, 231 ICMP4_TIMESTAMP_REPLY = 14, 232 ICMP4_MASK_REQUEST = 17, 233 ICMP4_MASK_REPLY = 18, 234 }} 235 pub type PICMP4_TYPE = *mut ICMP4_TYPE; 236 STRUCT!{struct MIB_IPMCAST_OIF_XP { 237 dwOutIfIndex: DWORD, 238 dwNextHopAddr: DWORD, 239 dwReserved: DWORD, 240 dwReserved1: DWORD, 241 }} 242 pub type PMIB_IPMCAST_OIF_XP = *mut MIB_IPMCAST_OIF_XP; 243 STRUCT!{struct MIB_IPMCAST_OIF_W2K { 244 dwOutIfIndex: DWORD, 245 dwNextHopAddr: DWORD, 246 pvReserved: PVOID, 247 dwReserved: DWORD, 248 }} 249 pub type PMIB_IPMCAST_OIF_W2K = *mut MIB_IPMCAST_OIF_W2K; 250 pub type MIB_IPMCAST_OIF = MIB_IPMCAST_OIF_XP; 251 pub type PMIB_IPMCAST_OIF = *mut MIB_IPMCAST_OIF; 252 STRUCT!{struct MIB_IPMCAST_MFE { 253 dwGroup: DWORD, 254 dwSource: DWORD, 255 dwSrcMask: DWORD, 256 dwUpStrmNgbr: DWORD, 257 dwInIfIndex: DWORD, 258 dwInIfProtocol: DWORD, 259 dwRouteProtocol: DWORD, 260 dwRouteNetwork: DWORD, 261 dwRouteMask: DWORD, 262 ulUpTime: ULONG, 263 ulExpiryTime: ULONG, 264 ulTimeOut: ULONG, 265 ulNumOutIf: ULONG, 266 fFlags: DWORD, 267 dwReserved: DWORD, 268 rgmioOutInfo: [MIB_IPMCAST_OIF; ANY_SIZE], 269 }} 270 pub type PMIB_IPMCAST_MFE = *mut MIB_IPMCAST_MFE; 271 STRUCT!{struct MIB_MFE_TABLE { 272 dwNumEntries: DWORD, 273 table: [MIB_IPMCAST_MFE; ANY_SIZE], 274 }} 275 pub type PMIB_MFE_TABLE = *mut MIB_MFE_TABLE; 276 // FIXME: SIZEOF_BASIC_MIB_MFE 277 // FIXME: SIZEOF_MIB_MFE(x) 278 STRUCT!{struct MIB_IPMCAST_OIF_STATS_LH { 279 dwOutIfIndex: DWORD, 280 dwNextHopAddr: DWORD, 281 dwDialContext: DWORD, 282 ulTtlTooLow: ULONG, 283 ulFragNeeded: ULONG, 284 ulOutPackets: ULONG, 285 ulOutDiscards: ULONG, 286 }} 287 pub type PMIB_IPMCAST_OIF_STATS_LH = *mut MIB_IPMCAST_OIF_STATS_LH; 288 STRUCT!{struct MIB_IPMCAST_OIF_STATS_W2K { 289 dwOutIfIndex: DWORD, 290 dwNextHopAddr: DWORD, 291 pvDialContext: PVOID, 292 ulTtlTooLow: ULONG, 293 ulFragNeeded: ULONG, 294 ulOutPackets: ULONG, 295 ulOutDiscards: ULONG, 296 }} 297 pub type PMIB_IPMCAST_OIF_STATS_W2K = *mut MIB_IPMCAST_OIF_STATS_W2K; 298 pub type MIB_IPMCAST_OIF_STATS = MIB_IPMCAST_OIF_STATS_LH; 299 pub type PMIB_IPMCAST_OIF_STATS = *mut MIB_IPMCAST_OIF_STATS; 300 STRUCT!{struct MIB_IPMCAST_MFE_STATS { 301 dwGroup: DWORD, 302 dwSource: DWORD, 303 dwSrcMask: DWORD, 304 dwUpStrmNgbr: DWORD, 305 dwInIfIndex: DWORD, 306 dwInIfProtocol: DWORD, 307 dwRouteProtocol: DWORD, 308 dwRouteNetwork: DWORD, 309 dwRouteMask: DWORD, 310 ulUpTime: ULONG, 311 ulExpiryTime: ULONG, 312 ulNumOutIf: ULONG, 313 ulInPkts: ULONG, 314 ulInOctets: ULONG, 315 ulPktsDifferentIf: ULONG, 316 ulQueueOverflow: ULONG, 317 rgmiosOutStats: [MIB_IPMCAST_OIF_STATS; ANY_SIZE], 318 }} 319 pub type PMIB_IPMCAST_MFE_STATS = *mut MIB_IPMCAST_MFE_STATS; 320 STRUCT!{struct MIB_MFE_STATS_TABLE { 321 dwNumEntries: DWORD, 322 table: [MIB_IPMCAST_MFE_STATS; ANY_SIZE], 323 }} 324 pub type PMIB_MFE_STATS_TABLE = *mut MIB_MFE_STATS_TABLE; 325 // FIXME: SIZEOF_BASIC_MIB_MFE_STATS 326 // FIXME: SIZEOF_MIB_MFE_STATS(x) 327 STRUCT!{struct MIB_IPMCAST_MFE_STATS_EX_XP { 328 dwGroup: DWORD, 329 dwSource: DWORD, 330 dwSrcMask: DWORD, 331 dwUpStrmNgbr: DWORD, 332 dwInIfIndex: DWORD, 333 dwInIfProtocol: DWORD, 334 dwRouteProtocol: DWORD, 335 dwRouteNetwork: DWORD, 336 dwRouteMask: DWORD, 337 ulUpTime: ULONG, 338 ulExpiryTime: ULONG, 339 ulNumOutIf: ULONG, 340 ulInPkts: ULONG, 341 ulInOctets: ULONG, 342 ulPktsDifferentIf: ULONG, 343 ulQueueOverflow: ULONG, 344 ulUninitMfe: ULONG, 345 ulNegativeMfe: ULONG, 346 ulInDiscards: ULONG, 347 ulInHdrErrors: ULONG, 348 ulTotalOutPackets: ULONG, 349 rgmiosOutStats: [MIB_IPMCAST_OIF_STATS; ANY_SIZE], 350 }} 351 pub type PMIB_IPMCAST_MFE_STATS_EX_XP = *mut MIB_IPMCAST_MFE_STATS_EX_XP; 352 pub type MIB_IPMCAST_MFE_STATS_EX = MIB_IPMCAST_MFE_STATS_EX_XP; 353 pub type PMIB_IPMCAST_MFE_STATS_EX = *mut MIB_IPMCAST_MFE_STATS_EX; 354 STRUCT!{struct MIB_MFE_STATS_TABLE_EX_XP { 355 dwNumEntries: DWORD, 356 table: [PMIB_IPMCAST_MFE_STATS_EX_XP; ANY_SIZE], 357 }} 358 pub type PMIB_MFE_STATS_TABLE_EX_XP = *mut MIB_MFE_STATS_TABLE_EX_XP; 359 pub type MIB_MFE_STATS_TABLE_EX = MIB_MFE_STATS_TABLE_EX_XP; 360 pub type PMIB_MFE_STATS_TABLE_EX = *mut MIB_MFE_STATS_TABLE_EX; 361 // FIXME: SIZEOF_BASIC_MIB_MFE_STATS_EX 362 // FIXME: SIZEOF_MIB_MFE_STATS_EX(x) 363 STRUCT!{struct MIB_IPMCAST_GLOBAL { 364 dwEnable: DWORD, 365 }} 366 pub type PMIB_IPMCAST_GLOBAL = *mut MIB_IPMCAST_GLOBAL; 367 STRUCT!{struct MIB_IPMCAST_IF_ENTRY { 368 dwIfIndex: DWORD, 369 dwTtl: DWORD, 370 dwProtocol: DWORD, 371 dwRateLimit: DWORD, 372 ulInMcastOctets: ULONG, 373 ulOutMcastOctets: ULONG, 374 }} 375 pub type PMIB_IPMCAST_IF_ENTRY = *mut MIB_IPMCAST_IF_ENTRY; 376 STRUCT!{struct MIB_IPMCAST_IF_TABLE { 377 dwNumEntries: DWORD, 378 table: [MIB_IPMCAST_IF_ENTRY; ANY_SIZE], 379 }} 380 pub type PMIB_IPMCAST_IF_TABLE = *mut MIB_IPMCAST_IF_TABLE; 381 // FIXME: SIZEOF_MCAST_IF_TABLE(x) 382