Home | History | Annotate | Download | only in include
      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 __ROUTING_IPRTRMIB_H__
      7 #define __ROUTING_IPRTRMIB_H__
      8 
      9 #include <mprapi.h>
     10 #include <ipmib.h>
     11 #include <ipifcons.h>
     12 #include <udpmib.h>
     13 #include <tcpmib.h>
     14 
     15 #define IPRTRMGR_PID 10000
     16 
     17 #ifndef ANY_SIZE
     18 #define ANY_SIZE 1
     19 #endif
     20 
     21 #define TCPIP_OWNING_MODULE_SIZE 16
     22 
     23 #define IF_NUMBER 0
     24 #define IF_TABLE (IF_NUMBER + 1)
     25 #define IF_ROW (IF_TABLE + 1)
     26 #define IP_STATS (IF_ROW + 1)
     27 #define IP_ADDRTABLE (IP_STATS + 1)
     28 #define IP_ADDRROW (IP_ADDRTABLE + 1)
     29 #define IP_FORWARDNUMBER (IP_ADDRROW + 1)
     30 #define IP_FORWARDTABLE (IP_FORWARDNUMBER + 1)
     31 #define IP_FORWARDROW (IP_FORWARDTABLE + 1)
     32 #define IP_NETTABLE (IP_FORWARDROW + 1)
     33 #define IP_NETROW (IP_NETTABLE + 1)
     34 #define ICMP_STATS (IP_NETROW + 1)
     35 #define TCP_STATS (ICMP_STATS + 1)
     36 #define TCP_TABLE (TCP_STATS + 1)
     37 #define TCP_ROW (TCP_TABLE + 1)
     38 #define UDP_STATS (TCP_ROW + 1)
     39 #define UDP_TABLE (UDP_STATS + 1)
     40 #define UDP_ROW (UDP_TABLE + 1)
     41 #define MCAST_MFE (UDP_ROW + 1)
     42 #define MCAST_MFE_STATS (MCAST_MFE + 1)
     43 #define BEST_IF (MCAST_MFE_STATS + 1)
     44 #define BEST_ROUTE (BEST_IF + 1)
     45 #define PROXY_ARP (BEST_ROUTE + 1)
     46 #define MCAST_IF_ENTRY (PROXY_ARP + 1)
     47 #define MCAST_GLOBAL (MCAST_IF_ENTRY + 1)
     48 #define IF_STATUS (MCAST_GLOBAL + 1)
     49 #define MCAST_BOUNDARY (IF_STATUS + 1)
     50 #define MCAST_SCOPE (MCAST_BOUNDARY + 1)
     51 #define DEST_MATCHING (MCAST_SCOPE + 1)
     52 #define DEST_LONGER (DEST_MATCHING + 1)
     53 #define DEST_SHORTER (DEST_LONGER + 1)
     54 #define ROUTE_MATCHING (DEST_SHORTER + 1)
     55 #define ROUTE_LONGER (ROUTE_MATCHING + 1)
     56 #define ROUTE_SHORTER (ROUTE_LONGER + 1)
     57 #define ROUTE_STATE (ROUTE_SHORTER + 1)
     58 #define MCAST_MFE_STATS_EX (ROUTE_STATE + 1)
     59 #define IP6_STATS (MCAST_MFE_STATS_EX + 1)
     60 #define UDP6_STATS (IP6_STATS + 1)
     61 #define TCP6_STATS (UDP6_STATS + 1)
     62 
     63 #define NUMBER_OF_EXPORTED_VARIABLES (TCP6_STATS + 1)
     64 
     65 typedef struct _MIB_OPAQUE_QUERY {
     66   DWORD dwVarId;
     67   DWORD rgdwVarIndex[ANY_SIZE];
     68 } MIB_OPAQUE_QUERY,*PMIB_OPAQUE_QUERY;
     69 
     70 typedef struct _MIB_IFNUMBER {
     71   DWORD dwValue;
     72 } MIB_IFNUMBER,*PMIB_IFNUMBER;
     73 
     74 #define MAXLEN_IFDESCR 256
     75 #define MAXLEN_PHYSADDR 8
     76 
     77 typedef struct _MIB_IFROW {
     78   WCHAR wszName[MAX_INTERFACE_NAME_LEN];
     79   DWORD dwIndex;
     80   DWORD dwType;
     81   DWORD dwMtu;
     82   DWORD dwSpeed;
     83   DWORD dwPhysAddrLen;
     84   BYTE bPhysAddr[MAXLEN_PHYSADDR];
     85   DWORD dwAdminStatus;
     86   DWORD dwOperStatus;
     87   DWORD dwLastChange;
     88   DWORD dwInOctets;
     89   DWORD dwInUcastPkts;
     90   DWORD dwInNUcastPkts;
     91   DWORD dwInDiscards;
     92   DWORD dwInErrors;
     93   DWORD dwInUnknownProtos;
     94   DWORD dwOutOctets;
     95   DWORD dwOutUcastPkts;
     96   DWORD dwOutNUcastPkts;
     97   DWORD dwOutDiscards;
     98   DWORD dwOutErrors;
     99   DWORD dwOutQLen;
    100   DWORD dwDescrLen;
    101   BYTE bDescr[MAXLEN_IFDESCR];
    102 } MIB_IFROW,*PMIB_IFROW;
    103 
    104 typedef struct _MIB_IFTABLE {
    105   DWORD dwNumEntries;
    106   MIB_IFROW table[ANY_SIZE];
    107 } MIB_IFTABLE,*PMIB_IFTABLE;
    108 
    109 #define SIZEOF_IFTABLE(X) (FIELD_OFFSET(MIB_IFTABLE,table[0]) + ((X) *sizeof(MIB_IFROW)) + ALIGN_SIZE)
    110 
    111 typedef struct _MIBICMPSTATS {
    112   DWORD dwMsgs;
    113   DWORD dwErrors;
    114   DWORD dwDestUnreachs;
    115   DWORD dwTimeExcds;
    116   DWORD dwParmProbs;
    117   DWORD dwSrcQuenchs;
    118   DWORD dwRedirects;
    119   DWORD dwEchos;
    120   DWORD dwEchoReps;
    121   DWORD dwTimestamps;
    122   DWORD dwTimestampReps;
    123   DWORD dwAddrMasks;
    124   DWORD dwAddrMaskReps;
    125 } MIBICMPSTATS,*PMIBICMPSTATS;
    126 
    127 typedef struct _MIBICMPINFO {
    128   MIBICMPSTATS icmpInStats;
    129   MIBICMPSTATS icmpOutStats;
    130 } MIBICMPINFO;
    131 
    132 typedef struct _MIB_ICMP {
    133   MIBICMPINFO stats;
    134 } MIB_ICMP,*PMIB_ICMP;
    135 
    136 typedef enum {
    137   ICMP6_DST_UNREACH = 1,ICMP6_PACKET_TOO_BIG = 2,ICMP6_TIME_EXCEEDED = 3,ICMP6_PARAM_PROB = 4,ICMP6_ECHO_REQUEST = 128,
    138   ICMP6_ECHO_REPLY = 129,ICMP6_MEMBERSHIP_QUERY = 130,ICMP6_MEMBERSHIP_REPORT = 131,ICMP6_MEMBERSHIP_REDUCTION = 132,
    139   ND_ROUTER_SOLICIT = 133,ND_ROUTER_ADVERT = 134,ND_NEIGHBOR_SOLICIT = 135,ND_NEIGHBOR_ADVERT = 136,ND_REDIRECT = 137
    140 } ICMP6_TYPE,*PICMP6_TYPE;
    141 
    142 typedef enum {
    143   ICMP4_ECHO_REPLY = 0,ICMP4_DST_UNREACH = 3,ICMP4_SOURCE_QUENCH = 4,ICMP4_REDIRECT = 5,ICMP4_ECHO_REQUEST = 8,ICMP4_ROUTER_ADVERT = 9,
    144   ICMP4_ROUTER_SOLICIT = 10,ICMP4_TIME_EXCEEDED = 11,ICMP4_PARAM_PROB = 12,ICMP4_TIMESTAMP_REQUEST = 13,ICMP4_TIMESTAMP_REPLY = 14,
    145   ICMP4_MASK_REQUEST = 17,ICMP4_MASK_REPLY = 18
    146 } ICMP4_TYPE,*PICMP4_TYPE;
    147 
    148 typedef struct _MIBICMPSTATS_EX {
    149   DWORD dwMsgs;
    150   DWORD dwErrors;
    151   DWORD rgdwTypeCount[256];
    152 } MIBICMPSTATS_EX,*PMIBICMPSTATS_EX;
    153 
    154 typedef struct _MIB_ICMP_EX {
    155   MIBICMPSTATS_EX icmpInStats;
    156   MIBICMPSTATS_EX icmpOutStats;
    157 } MIB_ICMP_EX,*PMIB_ICMP_EX;
    158 
    159 typedef struct _MIB_UDPSTATS {
    160   DWORD dwInDatagrams;
    161   DWORD dwNoPorts;
    162   DWORD dwInErrors;
    163   DWORD dwOutDatagrams;
    164   DWORD dwNumAddrs;
    165 } MIB_UDPSTATS,*PMIB_UDPSTATS;
    166 
    167 typedef struct _MIB_UDPROW {
    168   DWORD dwLocalAddr;
    169   DWORD dwLocalPort;
    170 } MIB_UDPROW,*PMIB_UDPROW;
    171 
    172 typedef MIB_UDPROW MIB_UDPROW_BASIC,*PMIB_UDPROW_BASIC;
    173 
    174 typedef struct _MIB_UDPROW_OWNER_PID {
    175   DWORD dwLocalAddr;
    176   DWORD dwLocalPort;
    177   DWORD dwOwningPid;
    178 } MIB_UDPROW_OWNER_PID,*PMIB_UDPROW_OWNER_PID;
    179 
    180 typedef struct _MIB_UDPROW_OWNER_MODULE {
    181   DWORD dwLocalAddr;
    182   DWORD dwLocalPort;
    183   DWORD dwOwningPid;
    184   LARGE_INTEGER liCreateTimestamp;
    185   __C89_NAMELESS union {
    186     __C89_NAMELESS struct {
    187       DWORD SpecificPortBind : 1;
    188     };
    189     DWORD dwFlags;
    190   };
    191   ULONGLONG OwningModuleInfo[TCPIP_OWNING_MODULE_SIZE];
    192 } MIB_UDPROW_OWNER_MODULE,*PMIB_UDPROW_OWNER_MODULE;
    193 
    194 typedef struct _MIB_UDP6ROW_OWNER_PID {
    195   UCHAR ucLocalAddr[16];
    196   DWORD dwLocalScopeId;
    197   DWORD dwLocalPort;
    198   DWORD dwOwningPid;
    199 } MIB_UDP6ROW_OWNER_PID,*PMIB_UDP6ROW_OWNER_PID;
    200 
    201 typedef struct _MIB_UDP6ROW_OWNER_MODULE {
    202   UCHAR ucLocalAddr[16];
    203   DWORD dwLocalScopeId;
    204   DWORD dwLocalPort;
    205   DWORD dwOwningPid;
    206   LARGE_INTEGER liCreateTimestamp;
    207   __C89_NAMELESS union {
    208     __C89_NAMELESS struct {
    209       DWORD SpecificPortBind : 1;
    210     };
    211     DWORD dwFlags;
    212   };
    213   ULONGLONG OwningModuleInfo[TCPIP_OWNING_MODULE_SIZE];
    214 } MIB_UDP6ROW_OWNER_MODULE,*PMIB_UDP6ROW_OWNER_MODULE;
    215 
    216 typedef struct _MIB_UDPTABLE {
    217   DWORD dwNumEntries;
    218   MIB_UDPROW table[ANY_SIZE];
    219 } MIB_UDPTABLE,*PMIB_UDPTABLE;
    220 
    221 typedef MIB_UDPTABLE MIB_UDPTABLE_BASIC,*PMIB_UDPTABLE_BASIC;
    222 
    223 #define SIZEOF_UDPTABLE(X) (FIELD_OFFSET(MIB_UDPTABLE,table[0]) + ((X) *sizeof(MIB_UDPROW)) + ALIGN_SIZE)
    224 #define SIZEOF_UDPTABLE_BASIC(X) SIZEOF_UDPTABLE(X)
    225 
    226 typedef struct _MIB_UDPTABLE_OWNER_PID {
    227   DWORD dwNumEntries;
    228   MIB_UDPROW_OWNER_PID table[ANY_SIZE];
    229 } MIB_UDPTABLE_OWNER_PID,*PMIB_UDPTABLE_OWNER_PID;
    230 
    231 #define SIZEOF_UDPTABLE_OWNER_PID(X) (FIELD_OFFSET(MIB_UDPTABLE_OWNER_PID,table[0]) + ((X) *sizeof(MIB_UDPROW_OWNER_PID)) + ALIGN_SIZE)
    232 
    233 typedef struct _MIB_UDPTABLE_OWNER_MODULE {
    234   DWORD dwNumEntries;
    235   MIB_UDPROW_OWNER_MODULE table[ANY_SIZE];
    236 } MIB_UDPTABLE_OWNER_MODULE,*PMIB_UDPTABLE_OWNER_MODULE;
    237 
    238 #define SIZEOF_UDPTABLE_OWNER_MODULE(X) (FIELD_OFFSET(MIB_UDPTABLE_OWNER_MODULE,table[0]) + ((X) *sizeof(MIB_UDPROW_OWNER_MODULE)) + ALIGN_SIZE)
    239 
    240 typedef struct _MIB_UDP6TABLE_OWNER_PID {
    241   DWORD dwNumEntries;
    242   MIB_UDP6ROW_OWNER_PID table[ANY_SIZE];
    243 } MIB_UDP6TABLE_OWNER_PID,*PMIB_UDP6TABLE_OWNER_PID;
    244 
    245 #define SIZEOF_UDP6TABLE_OWNER_PID(X) (FIELD_OFFSET(MIB_UDP6TABLE_OWNER_PID,table[0]) + ((X) *sizeof(MIB_UDP6ROW_OWNER_PID)) + ALIGN_SIZE)
    246 
    247 typedef struct _MIB_UDP6TABLE_OWNER_MODULE {
    248   DWORD dwNumEntries;
    249   MIB_UDP6ROW_OWNER_MODULE table[ANY_SIZE];
    250 } MIB_UDP6TABLE_OWNER_MODULE,*PMIB_UDP6TABLE_OWNER_MODULE;
    251 
    252 #define SIZEOF_UDP6TABLE_OWNER_MODULE(X) (FIELD_OFFSET(MIB_UDP6TABLE_OWNER_MODULE,table[0]) + ((X) *sizeof(MIB_UDP6ROW_OWNER_MODULE)) + ALIGN_SIZE)
    253 
    254 typedef struct _MIB_TCPSTATS {
    255   DWORD dwRtoAlgorithm;
    256   DWORD dwRtoMin;
    257   DWORD dwRtoMax;
    258   DWORD dwMaxConn;
    259   DWORD dwActiveOpens;
    260   DWORD dwPassiveOpens;
    261   DWORD dwAttemptFails;
    262   DWORD dwEstabResets;
    263   DWORD dwCurrEstab;
    264   DWORD dwInSegs;
    265   DWORD dwOutSegs;
    266   DWORD dwRetransSegs;
    267   DWORD dwInErrs;
    268   DWORD dwOutRsts;
    269   DWORD dwNumConns;
    270 } MIB_TCPSTATS,*PMIB_TCPSTATS;
    271 
    272 #define MIB_TCP_RTO_OTHER 1
    273 #define MIB_TCP_RTO_CONSTANT 2
    274 #define MIB_TCP_RTO_RSRE 3
    275 #define MIB_TCP_RTO_VANJ 4
    276 
    277 #define MIB_TCP_MAXCONN_DYNAMIC (DWORD)-1
    278 
    279 typedef enum _TCP_TABLE_CLASS {
    280   TCP_TABLE_BASIC_LISTENER,
    281   TCP_TABLE_BASIC_CONNECTIONS,
    282   TCP_TABLE_BASIC_ALL,
    283   TCP_TABLE_OWNER_PID_LISTENER,
    284   TCP_TABLE_OWNER_PID_CONNECTIONS,
    285   TCP_TABLE_OWNER_PID_ALL,
    286   TCP_TABLE_OWNER_MODULE_LISTENER,
    287   TCP_TABLE_OWNER_MODULE_CONNECTIONS,
    288   TCP_TABLE_OWNER_MODULE_ALL
    289 } TCP_TABLE_CLASS, *PTCP_TABLE_CLASS;
    290 
    291 typedef struct _MIB_TCPROW {
    292   DWORD dwState;
    293   DWORD dwLocalAddr;
    294   DWORD dwLocalPort;
    295   DWORD dwRemoteAddr;
    296   DWORD dwRemotePort;
    297 } MIB_TCPROW,*PMIB_TCPROW;
    298 
    299 typedef MIB_TCPROW MIB_TCPROW_BASIC,*PMIB_TCPROW_BASIC;
    300 
    301 typedef struct _MIB_TCPROW_OWNER_PID {
    302   DWORD dwState;
    303   DWORD dwLocalAddr;
    304   DWORD dwLocalPort;
    305   DWORD dwRemoteAddr;
    306   DWORD dwRemotePort;
    307   DWORD dwOwningPid;
    308 } MIB_TCPROW_OWNER_PID,*PMIB_TCPROW_OWNER_PID;
    309 
    310 typedef struct _MIB_TCPROW_OWNER_MODULE {
    311   DWORD dwState;
    312   DWORD dwLocalAddr;
    313   DWORD dwLocalPort;
    314   DWORD dwRemoteAddr;
    315   DWORD dwRemotePort;
    316   DWORD dwOwningPid;
    317   LARGE_INTEGER liCreateTimestamp;
    318   ULONGLONG OwningModuleInfo[TCPIP_OWNING_MODULE_SIZE];
    319 } MIB_TCPROW_OWNER_MODULE,*PMIB_TCPROW_OWNER_MODULE;
    320 
    321 typedef struct _MIB_TCP6ROW_OWNER_PID {
    322   UCHAR ucLocalAddr[16];
    323   DWORD dwLocalScopeId;
    324   DWORD dwLocalPort;
    325   UCHAR ucRemoteAddr[16];
    326   DWORD dwRemoteScopeId;
    327   DWORD dwRemotePort;
    328   DWORD dwState;
    329   DWORD dwOwningPid;
    330 } MIB_TCP6ROW_OWNER_PID,*PMIB_TCP6ROW_OWNER_PID;
    331 
    332 typedef struct _MIB_TCP6ROW_OWNER_MODULE {
    333   UCHAR ucLocalAddr[16];
    334   DWORD dwLocalScopeId;
    335   DWORD dwLocalPort;
    336   UCHAR ucRemoteAddr[16];
    337   DWORD dwRemoteScopeId;
    338   DWORD dwRemotePort;
    339   DWORD dwState;
    340   DWORD dwOwningPid;
    341   LARGE_INTEGER liCreateTimestamp;
    342   ULONGLONG OwningModuleInfo[TCPIP_OWNING_MODULE_SIZE];
    343 } MIB_TCP6ROW_OWNER_MODULE,*PMIB_TCP6ROW_OWNER_MODULE;
    344 
    345 #define MIB_TCP_STATE_CLOSED 1
    346 #define MIB_TCP_STATE_LISTEN 2
    347 #define MIB_TCP_STATE_SYN_SENT 3
    348 #define MIB_TCP_STATE_SYN_RCVD 4
    349 #define MIB_TCP_STATE_ESTAB 5
    350 #define MIB_TCP_STATE_FIN_WAIT1 6
    351 #define MIB_TCP_STATE_FIN_WAIT2 7
    352 #define MIB_TCP_STATE_CLOSE_WAIT 8
    353 #define MIB_TCP_STATE_CLOSING 9
    354 #define MIB_TCP_STATE_LAST_ACK 10
    355 #define MIB_TCP_STATE_TIME_WAIT 11
    356 #define MIB_TCP_STATE_DELETE_TCB 12
    357 
    358 typedef struct _MIB_TCPTABLE {
    359   DWORD dwNumEntries;
    360   MIB_TCPROW table[ANY_SIZE];
    361 } MIB_TCPTABLE,*PMIB_TCPTABLE;
    362 
    363 typedef MIB_TCPTABLE MIB_TCPTABLE_BASIC,*PMIB_TCPTABLE_BASIC;
    364 
    365 #define SIZEOF_TCPTABLE(X) (FIELD_OFFSET(MIB_TCPTABLE,table[0]) + ((X) *sizeof(MIB_TCPROW)) + ALIGN_SIZE)
    366 #define SIZEOF_TCPTABLE_BASIC(X) SIZEOF_TCPTABLE(X)
    367 
    368 typedef struct _MIB_TCPTABLE_OWNER_PID {
    369   DWORD dwNumEntries;
    370   MIB_TCPROW_OWNER_PID table[ANY_SIZE];
    371 } MIB_TCPTABLE_OWNER_PID,*PMIB_TCPTABLE_OWNER_PID;
    372 
    373 #define SIZEOF_TCPTABLE_OWNER_PID(X) (FIELD_OFFSET(MIB_TCPTABLE_OWNER_PID,table[0]) + ((X) *sizeof(MIB_TCPROW_OWNER_PID)) + ALIGN_SIZE)
    374 
    375 typedef struct _MIB_TCPTABLE_OWNER_MODULE {
    376   DWORD dwNumEntries;
    377   MIB_TCPROW_OWNER_MODULE table[ANY_SIZE];
    378 } MIB_TCPTABLE_OWNER_MODULE,*PMIB_TCPTABLE_OWNER_MODULE;
    379 
    380 #define SIZEOF_TCPTABLE_OWNER_MODULE(X) (FIELD_OFFSET(MIB_TCPTABLE_OWNER_MODULE,table[0]) + ((X) *sizeof(MIB_TCPROW_OWNER_MODULE)) + ALIGN_SIZE)
    381 
    382 typedef struct _MIB_TCP6TABLE_OWNER_PID {
    383   DWORD dwNumEntries;
    384   MIB_TCP6ROW_OWNER_PID table[ANY_SIZE];
    385 } MIB_TCP6TABLE_OWNER_PID,*PMIB_TCP6TABLE_OWNER_PID;
    386 
    387 #define SIZEOF_TCP6TABLE_OWNER_PID(X) (FIELD_OFFSET(MIB_TCP6TABLE_OWNER_PID,table[0]) + ((X) *sizeof(MIB_TCP6ROW_OWNER_PID)) + ALIGN_SIZE)
    388 
    389 typedef struct _MIB_TCP6TABLE_OWNER_MODULE {
    390   DWORD dwNumEntries;
    391   MIB_TCP6ROW_OWNER_MODULE table[ANY_SIZE];
    392 } MIB_TCP6TABLE_OWNER_MODULE,*PMIB_TCP6TABLE_OWNER_MODULE;
    393 
    394 #define SIZEOF_TCP6TABLE_OWNER_MODULE(X) (FIELD_OFFSET(MIB_TCP6TABLE_OWNER_MODULE,table[0]) + ((X) *sizeof(MIB_TCP6ROW_OWNER_PID)) + ALIGN_SIZE)
    395 
    396 #define MIB_SECURITY_TCP_SYN_ATTACK 0x00000001
    397 
    398 #define MIB_USE_CURRENT_TTL ((DWORD)-1)
    399 #define MIB_USE_CURRENT_FORWARDING ((DWORD)-1)
    400 
    401 typedef struct _MIB_IPSTATS {
    402   DWORD dwForwarding;
    403   DWORD dwDefaultTTL;
    404   DWORD dwInReceives;
    405   DWORD dwInHdrErrors;
    406   DWORD dwInAddrErrors;
    407   DWORD dwForwDatagrams;
    408   DWORD dwInUnknownProtos;
    409   DWORD dwInDiscards;
    410   DWORD dwInDelivers;
    411   DWORD dwOutRequests;
    412   DWORD dwRoutingDiscards;
    413   DWORD dwOutDiscards;
    414   DWORD dwOutNoRoutes;
    415   DWORD dwReasmTimeout;
    416   DWORD dwReasmReqds;
    417   DWORD dwReasmOks;
    418   DWORD dwReasmFails;
    419   DWORD dwFragOks;
    420   DWORD dwFragFails;
    421   DWORD dwFragCreates;
    422   DWORD dwNumIf;
    423   DWORD dwNumAddr;
    424   DWORD dwNumRoutes;
    425 } MIB_IPSTATS,*PMIB_IPSTATS;
    426 
    427 #define MIB_IP_FORWARDING 1
    428 #define MIB_IP_NOT_FORWARDING 2
    429 
    430 #define MIB_IPADDR_PRIMARY 0x0001
    431 #define MIB_IPADDR_DYNAMIC 0x0004
    432 #define MIB_IPADDR_DISCONNECTED 0x0008
    433 #define MIB_IPADDR_DELETED 0x0040
    434 #define MIB_IPADDR_TRANSIENT 0x0080
    435 
    436 typedef struct _MIB_IPADDRROW {
    437   DWORD dwAddr;
    438   DWORD dwIndex;
    439   DWORD dwMask;
    440   DWORD dwBCastAddr;
    441   DWORD dwReasmSize;
    442   unsigned short unused1;
    443   unsigned short wType;
    444 } MIB_IPADDRROW,*PMIB_IPADDRROW;
    445 
    446 typedef struct _MIB_IPADDRTABLE {
    447   DWORD dwNumEntries;
    448   MIB_IPADDRROW table[ANY_SIZE];
    449 } MIB_IPADDRTABLE,*PMIB_IPADDRTABLE;
    450 
    451 #define SIZEOF_IPADDRTABLE(X) (FIELD_OFFSET(MIB_IPADDRTABLE,table[0]) + ((X) *sizeof(MIB_IPADDRROW)) + ALIGN_SIZE)
    452 
    453 typedef struct _MIB_IPFORWARDNUMBER {
    454   DWORD dwValue;
    455 } MIB_IPFORWARDNUMBER,*PMIB_IPFORWARDNUMBER;
    456 
    457 typedef struct _MIB_IPFORWARDROW {
    458   DWORD dwForwardDest;
    459   DWORD dwForwardMask;
    460   DWORD dwForwardPolicy;
    461   DWORD dwForwardNextHop;
    462   DWORD dwForwardIfIndex;
    463   DWORD dwForwardType;
    464   DWORD dwForwardProto;
    465   DWORD dwForwardAge;
    466   DWORD dwForwardNextHopAS;
    467   DWORD dwForwardMetric1;
    468   DWORD dwForwardMetric2;
    469   DWORD dwForwardMetric3;
    470   DWORD dwForwardMetric4;
    471   DWORD dwForwardMetric5;
    472 } MIB_IPFORWARDROW,*PMIB_IPFORWARDROW;
    473 
    474 #define MIB_IPROUTE_TYPE_OTHER 1
    475 #define MIB_IPROUTE_TYPE_INVALID 2
    476 #define MIB_IPROUTE_TYPE_DIRECT 3
    477 #define MIB_IPROUTE_TYPE_INDIRECT 4
    478 
    479 #define MIB_IPROUTE_METRIC_UNUSED (DWORD)-1
    480 
    481 #define MIB_IPPROTO_OTHER 1
    482 #define MIB_IPPROTO_LOCAL 2
    483 #define MIB_IPPROTO_NETMGMT 3
    484 #define MIB_IPPROTO_ICMP 4
    485 #define MIB_IPPROTO_EGP 5
    486 #define MIB_IPPROTO_GGP 6
    487 #define MIB_IPPROTO_HELLO 7
    488 #define MIB_IPPROTO_RIP 8
    489 #define MIB_IPPROTO_IS_IS 9
    490 #define MIB_IPPROTO_ES_IS 10
    491 #define MIB_IPPROTO_CISCO 11
    492 #define MIB_IPPROTO_BBN 12
    493 #define MIB_IPPROTO_OSPF 13
    494 #define MIB_IPPROTO_BGP 14
    495 
    496 #define MIB_IPPROTO_NT_AUTOSTATIC 10002
    497 #define MIB_IPPROTO_NT_STATIC 10006
    498 #define MIB_IPPROTO_NT_STATIC_NON_DOD 10007
    499 
    500 typedef struct _MIB_IPFORWARDTABLE {
    501   DWORD dwNumEntries;
    502   MIB_IPFORWARDROW table[ANY_SIZE];
    503 } MIB_IPFORWARDTABLE,*PMIB_IPFORWARDTABLE;
    504 
    505 #define SIZEOF_IPFORWARDTABLE(X) (FIELD_OFFSET(MIB_IPFORWARDTABLE,table[0]) + ((X) *sizeof(MIB_IPFORWARDROW)) + ALIGN_SIZE)
    506 
    507 typedef struct _MIB_IPNETROW {
    508   DWORD dwIndex;
    509   DWORD dwPhysAddrLen;
    510   BYTE bPhysAddr[MAXLEN_PHYSADDR];
    511   DWORD dwAddr;
    512   DWORD dwType;
    513 } MIB_IPNETROW,*PMIB_IPNETROW;
    514 
    515 #define MIB_IPNET_TYPE_OTHER 1
    516 #define MIB_IPNET_TYPE_INVALID 2
    517 #define MIB_IPNET_TYPE_DYNAMIC 3
    518 #define MIB_IPNET_TYPE_STATIC 4
    519 
    520 typedef struct _MIB_IPNETTABLE {
    521   DWORD dwNumEntries;
    522   MIB_IPNETROW table[ANY_SIZE];
    523 } MIB_IPNETTABLE,*PMIB_IPNETTABLE;
    524 
    525 #define SIZEOF_IPNETTABLE(X) (FIELD_OFFSET(MIB_IPNETTABLE,table[0]) + ((X) *sizeof(MIB_IPNETROW)) + ALIGN_SIZE)
    526 
    527 typedef struct _MIB_IPMCAST_OIF {
    528   DWORD dwOutIfIndex;
    529   DWORD dwNextHopAddr;
    530   DWORD dwReserved;
    531   DWORD dwReserved1;
    532 } MIB_IPMCAST_OIF,*PMIB_IPMCAST_OIF;
    533 
    534 typedef struct _MIB_IPMCAST_MFE {
    535   DWORD dwGroup;
    536   DWORD dwSource;
    537   DWORD dwSrcMask;
    538   DWORD dwUpStrmNgbr;
    539   DWORD dwInIfIndex;
    540   DWORD dwInIfProtocol;
    541   DWORD dwRouteProtocol;
    542   DWORD dwRouteNetwork;
    543   DWORD dwRouteMask;
    544   ULONG ulUpTime;
    545   ULONG ulExpiryTime;
    546   ULONG ulTimeOut;
    547   ULONG ulNumOutIf;
    548   DWORD fFlags;
    549   DWORD dwReserved;
    550   MIB_IPMCAST_OIF rgmioOutInfo[ANY_SIZE];
    551 } MIB_IPMCAST_MFE,*PMIB_IPMCAST_MFE;
    552 
    553 typedef struct _MIB_MFE_TABLE {
    554   DWORD dwNumEntries;
    555   MIB_IPMCAST_MFE table[ANY_SIZE];
    556 } MIB_MFE_TABLE,*PMIB_MFE_TABLE;
    557 
    558 #define SIZEOF_BASIC_MIB_MFE (ULONG)(FIELD_OFFSET(MIB_IPMCAST_MFE,rgmioOutInfo[0]))
    559 
    560 #define SIZEOF_MIB_MFE(X) (SIZEOF_BASIC_MIB_MFE + ((X) *sizeof(MIB_IPMCAST_OIF)))
    561 
    562 typedef struct _MIB_IPMCAST_OIF_STATS {
    563   DWORD dwOutIfIndex;
    564   DWORD dwNextHopAddr;
    565   DWORD dwDialContext;
    566   ULONG ulTtlTooLow;
    567   ULONG ulFragNeeded;
    568   ULONG ulOutPackets;
    569   ULONG ulOutDiscards;
    570 } MIB_IPMCAST_OIF_STATS,*PMIB_IPMCAST_OIF_STATS;
    571 
    572 typedef struct _MIB_IPMCAST_MFE_STATS {
    573   DWORD dwGroup;
    574   DWORD dwSource;
    575   DWORD dwSrcMask;
    576   DWORD dwUpStrmNgbr;
    577   DWORD dwInIfIndex;
    578   DWORD dwInIfProtocol;
    579   DWORD dwRouteProtocol;
    580   DWORD dwRouteNetwork;
    581   DWORD dwRouteMask;
    582   ULONG ulUpTime;
    583   ULONG ulExpiryTime;
    584   ULONG ulNumOutIf;
    585   ULONG ulInPkts;
    586   ULONG ulInOctets;
    587   ULONG ulPktsDifferentIf;
    588   ULONG ulQueueOverflow;
    589   MIB_IPMCAST_OIF_STATS rgmiosOutStats[ANY_SIZE];
    590 } MIB_IPMCAST_MFE_STATS,*PMIB_IPMCAST_MFE_STATS;
    591 
    592 typedef struct _MIB_MFE_STATS_TABLE {
    593   DWORD dwNumEntries;
    594   MIB_IPMCAST_MFE_STATS table[ANY_SIZE];
    595 } MIB_MFE_STATS_TABLE,*PMIB_MFE_STATS_TABLE;
    596 
    597 #define SIZEOF_BASIC_MIB_MFE_STATS (ULONG)(FIELD_OFFSET(MIB_IPMCAST_MFE_STATS,rgmiosOutStats[0]))
    598 #define SIZEOF_MIB_MFE_STATS(X) (SIZEOF_BASIC_MIB_MFE_STATS + ((X) *sizeof(MIB_IPMCAST_OIF_STATS)))
    599 
    600 typedef struct _MIB_IPMCAST_MFE_STATS_EX {
    601   DWORD dwGroup;
    602   DWORD dwSource;
    603   DWORD dwSrcMask;
    604   DWORD dwUpStrmNgbr;
    605   DWORD dwInIfIndex;
    606   DWORD dwInIfProtocol;
    607   DWORD dwRouteProtocol;
    608   DWORD dwRouteNetwork;
    609   DWORD dwRouteMask;
    610   ULONG ulUpTime;
    611   ULONG ulExpiryTime;
    612   ULONG ulNumOutIf;
    613   ULONG ulInPkts;
    614   ULONG ulInOctets;
    615   ULONG ulPktsDifferentIf;
    616   ULONG ulQueueOverflow;
    617   ULONG ulUninitMfe;
    618   ULONG ulNegativeMfe;
    619   ULONG ulInDiscards;
    620   ULONG ulInHdrErrors;
    621   ULONG ulTotalOutPackets;
    622   MIB_IPMCAST_OIF_STATS rgmiosOutStats[ANY_SIZE];
    623 } MIB_IPMCAST_MFE_STATS_EX,*PMIB_IPMCAST_MFE_STATS_EX;
    624 
    625 typedef struct _MIB_MFE_STATS_TABLE_EX {
    626   DWORD dwNumEntries;
    627   MIB_IPMCAST_MFE_STATS_EX table[ANY_SIZE];
    628 } MIB_MFE_STATS_TABLE_EX,*PMIB_MFE_STATS_TABLE_EX;
    629 
    630 #define SIZEOF_BASIC_MIB_MFE_STATS_EX (ULONG)(FIELD_OFFSET(MIB_IPMCAST_MFE_STATS_EX,rgmiosOutStats[0]))
    631 #define SIZEOF_MIB_MFE_STATS_EX(X) (SIZEOF_BASIC_MIB_MFE_STATS_EX + ((X) *sizeof(MIB_IPMCAST_OIF_STATS)))
    632 
    633 typedef struct _MIB_IPMCAST_GLOBAL {
    634   DWORD dwEnable;
    635 } MIB_IPMCAST_GLOBAL,*PMIB_IPMCAST_GLOBAL;
    636 
    637 typedef struct _MIB_IPMCAST_IF_ENTRY {
    638   DWORD dwIfIndex;
    639   DWORD dwTtl;
    640   DWORD dwProtocol;
    641   DWORD dwRateLimit;
    642   ULONG ulInMcastOctets;
    643   ULONG ulOutMcastOctets;
    644 } MIB_IPMCAST_IF_ENTRY,*PMIB_IPMCAST_IF_ENTRY;
    645 
    646 typedef struct _MIB_IPMCAST_IF_TABLE {
    647   DWORD dwNumEntries;
    648   MIB_IPMCAST_IF_ENTRY table[ANY_SIZE];
    649 } MIB_IPMCAST_IF_TABLE,*PMIB_IPMCAST_IF_TABLE;
    650 
    651 #define SIZEOF_MCAST_IF_TABLE(X) (FIELD_OFFSET(MIB_IPMCAST_IF_TABLE,table[0]) + ((X) *sizeof(MIB_IPMCAST_IF_ENTRY)) + ALIGN_SIZE)
    652 
    653 typedef struct _MIB_IPMCAST_BOUNDARY {
    654   DWORD dwIfIndex;
    655   DWORD dwGroupAddress;
    656   DWORD dwGroupMask;
    657   DWORD dwStatus;
    658 } MIB_IPMCAST_BOUNDARY,*PMIB_IPMCAST_BOUNDARY;
    659 
    660 typedef struct _MIB_IPMCAST_BOUNDARY_TABLE {
    661   DWORD dwNumEntries;
    662   MIB_IPMCAST_BOUNDARY table[ANY_SIZE];
    663 } MIB_IPMCAST_BOUNDARY_TABLE,*PMIB_IPMCAST_BOUNDARY_TABLE;
    664 
    665 #define SIZEOF_BOUNDARY_TABLE(X) (FIELD_OFFSET(MIB_IPMCAST_BOUNDARY_TABLE,table[0]) + ((X) *sizeof(MIB_IPMCAST_BOUNDARY)) + ALIGN_SIZE)
    666 
    667 typedef struct {
    668   DWORD dwGroupAddress;
    669   DWORD dwGroupMask;
    670 } MIB_BOUNDARYROW,*PMIB_BOUNDARYROW;
    671 
    672 typedef struct {
    673   DWORD dwTtl;
    674   DWORD dwRateLimit;
    675 } MIB_MCAST_LIMIT_ROW,*PMIB_MCAST_LIMIT_ROW;
    676 
    677 #define MAX_SCOPE_NAME_LEN 255
    678 
    679 #define SN_UNICODE
    680 typedef WCHAR SN_CHAR;
    681 typedef SN_CHAR SCOPE_NAME_BUFFER[MAX_SCOPE_NAME_LEN+1],*SCOPE_NAME;
    682 
    683 typedef struct _MIB_IPMCAST_SCOPE {
    684   DWORD dwGroupAddress;
    685   DWORD dwGroupMask;
    686   SCOPE_NAME_BUFFER snNameBuffer;
    687   DWORD dwStatus;
    688 } MIB_IPMCAST_SCOPE,*PMIB_IPMCAST_SCOPE;
    689 
    690 typedef struct _MIB_IPDESTROW {
    691 #ifdef __cplusplus
    692   MIB_IPFORWARDROW ForwardRow;
    693 #else
    694   __C89_NAMELESS union {
    695     DWORD dwForwardDest;
    696     DWORD dwForwardMask;
    697     DWORD dwForwardPolicy;
    698     DWORD dwForwardNextHop;
    699     DWORD dwForwardIfIndex;
    700     DWORD dwForwardType;
    701     DWORD dwForwardProto;
    702     DWORD dwForwardAge;
    703     DWORD dwForwardNextHopAS;
    704     DWORD dwForwardMetric1;
    705     DWORD dwForwardMetric2;
    706     DWORD dwForwardMetric3;
    707     DWORD dwForwardMetric4;
    708     DWORD dwForwardMetric5;
    709   }; /* see MIB_IPFORWARDROW */
    710 #endif
    711   DWORD dwForwardPreference;
    712   DWORD dwForwardViewSet;
    713 } MIB_IPDESTROW,*PMIB_IPDESTROW;
    714 
    715 typedef struct _MIB_IPDESTTABLE {
    716   DWORD dwNumEntries;
    717   MIB_IPDESTROW table[ANY_SIZE];
    718 } MIB_IPDESTTABLE,*PMIB_IPDESTTABLE;
    719 
    720 typedef struct _MIB_BEST_IF {
    721   DWORD dwDestAddr;
    722   DWORD dwIfIndex;
    723 } MIB_BEST_IF,*PMIB_BEST_IF;
    724 
    725 typedef struct _MIB_PROXYARP {
    726   DWORD dwAddress;
    727   DWORD dwMask;
    728   DWORD dwIfIndex;
    729 } MIB_PROXYARP,*PMIB_PROXYARP;
    730 
    731 typedef struct _MIB_IFSTATUS {
    732   DWORD dwIfIndex;
    733   DWORD dwAdminStatus;
    734   DWORD dwOperationalStatus;
    735   WINBOOL bMHbeatActive;
    736   WINBOOL bMHbeatAlive;
    737 } MIB_IFSTATUS,*PMIB_IFSTATUS;
    738 
    739 typedef struct _MIB_ROUTESTATE {
    740   WINBOOL bRoutesSetToStack;
    741 } MIB_ROUTESTATE,*PMIB_ROUTESTATE;
    742 
    743 typedef struct _MIB_OPAQUE_INFO {
    744   DWORD dwId;
    745   __C89_NAMELESS union {
    746     ULONGLONG ullAlign;
    747     BYTE rgbyData[1];
    748   };
    749 } MIB_OPAQUE_INFO,*PMIB_OPAQUE_INFO;
    750 
    751 typedef struct _TCPIP_OWNER_MODULE_BASIC_INFO {
    752   PWCHAR pModuleName;
    753   PWCHAR pModulePath;
    754 } TCPIP_OWNER_MODULE_BASIC_INFO, *PTCPIP_OWNER_MODULE_BASIC_INFO;
    755 
    756 typedef enum _UDP_TABLE_CLASS {
    757   UDP_TABLE_BASIC,
    758   UDP_TABLE_OWNER_PID,
    759   UDP_TABLE_OWNER_MODULE
    760 } UDP_TABLE_CLASS, *PUDP_TABLE_CLASS;
    761 
    762 typedef enum _TCPIP_OWNER_MODULE_INFO_CLASS {
    763   TCPIP_OWNER_MODULE_INFO_BASIC
    764 } TCPIP_OWNER_MODULE_INFO_CLASS, *PTCPIP_OWNER_MODULE_INFO_CLASS;
    765 
    766 #define MAX_MIB_OFFSET 8
    767 
    768 #define MIB_INFO_SIZE(S) (MAX_MIB_OFFSET + sizeof(S))
    769 #define MIB_INFO_SIZE_IN_DWORDS(S) ((MIB_INFO_SIZE(S))/sizeof(DWORD) + 1)
    770 
    771 #define DEFINE_MIB_BUFFER(X,Y,Z) DWORD __rgdwBuff[MIB_INFO_SIZE_IN_DWORDS(Y)]; PMIB_OPAQUE_INFO X = (PMIB_OPAQUE_INFO)__rgdwBuff; Y *Z = (Y *)(X->rgbyData)
    772 
    773 #define CAST_MIB_INFO(X,Y,Z) Z = (Y)(X->rgbyData)
    774 
    775 #endif /* __ROUTING_IPRTRMIB_H__ */
    776