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