Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

802 lines
25 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. iprtrmib.h
  5. Abstract:
  6. This file contains:
  7. o Definitions of the MIB_XX structures passed to and from the IP Router Manager
  8. to query and set MIB variables handled by the IP Router Manager
  9. o The #defines for the MIB variables IDs handled by the IP Router Manager
  10. and made accessible by the MprAdminMIBXXX APIs
  11. o The Routing PID of the IP Router Manager (as mentioned in ipinfoid.h)
  12. --*/
  13. #ifndef __ROUTING_IPRTRMIB_H__
  14. #define __ROUTING_IPRTRMIB_H__
  15. #if _MSC_VER > 1000
  16. #pragma once
  17. #endif
  18. #if _MSC_VER >= 1200
  19. #pragma warning(push)
  20. #endif
  21. #pragma warning(disable:4201)
  22. //////////////////////////////////////////////////////////////////////////////
  23. // //
  24. // Included to get the value of MAX_INTERFACE_NAME_LEN //
  25. // //
  26. //////////////////////////////////////////////////////////////////////////////
  27. #include <mprapi.h>
  28. //////////////////////////////////////////////////////////////////////////////
  29. // //
  30. // Included to get the necessary constants //
  31. // //
  32. //////////////////////////////////////////////////////////////////////////////
  33. #include <ipifcons.h>
  34. //////////////////////////////////////////////////////////////////////////////
  35. // //
  36. // This is the Id for IP Router Manager. The Router Manager handles //
  37. // MIB-II, Forwarding MIB and some enterprise specific information. //
  38. // Calls made with any other ID are passed on to the corresponding protocol //
  39. // For example, an MprAdminMIBXXX call with a protocol ID of PID_IP and //
  40. // a routing Id of 0xD will be sent to the IP Router Manager and then //
  41. // forwarded to OSPF //
  42. // This lives in the same number space as the protocol Ids of RIP, OSPF //
  43. // etc, so any change made to it should be done keeping this in mind //
  44. // //
  45. //////////////////////////////////////////////////////////////////////////////
  46. #define IPRTRMGR_PID 10000
  47. #ifndef ANY_SIZE
  48. #define ANY_SIZE 1
  49. #endif
  50. //////////////////////////////////////////////////////////////////////////////
  51. // //
  52. // The following #defines are the Ids of the MIB variables made accessible //
  53. // to the user via MprAdminMIBXXX Apis. It will be noticed that these are //
  54. // not the same as RFC 1213, since the MprAdminMIBXXX APIs work on rows and //
  55. // groups instead of scalar variables //
  56. // //
  57. //////////////////////////////////////////////////////////////////////////////
  58. #define IF_NUMBER 0
  59. #define IF_TABLE (IF_NUMBER + 1)
  60. #define IF_ROW (IF_TABLE + 1)
  61. #define IP_STATS (IF_ROW + 1)
  62. #define IP_ADDRTABLE (IP_STATS + 1)
  63. #define IP_ADDRROW (IP_ADDRTABLE + 1)
  64. #define IP_FORWARDNUMBER (IP_ADDRROW + 1)
  65. #define IP_FORWARDTABLE (IP_FORWARDNUMBER + 1)
  66. #define IP_FORWARDROW (IP_FORWARDTABLE + 1)
  67. #define IP_NETTABLE (IP_FORWARDROW + 1)
  68. #define IP_NETROW (IP_NETTABLE + 1)
  69. #define ICMP_STATS (IP_NETROW + 1)
  70. #define TCP_STATS (ICMP_STATS + 1)
  71. #define TCP_TABLE (TCP_STATS + 1)
  72. #define TCP_ROW (TCP_TABLE + 1)
  73. #define UDP_STATS (TCP_ROW + 1)
  74. #define UDP_TABLE (UDP_STATS + 1)
  75. #define UDP_ROW (UDP_TABLE + 1)
  76. #define MCAST_MFE (UDP_ROW + 1)
  77. #define MCAST_MFE_STATS (MCAST_MFE + 1)
  78. #define BEST_IF (MCAST_MFE_STATS + 1)
  79. #define BEST_ROUTE (BEST_IF + 1)
  80. #define PROXY_ARP (BEST_ROUTE + 1)
  81. #define MCAST_IF_ENTRY (PROXY_ARP + 1)
  82. #define MCAST_GLOBAL (MCAST_IF_ENTRY + 1)
  83. #define IF_STATUS (MCAST_GLOBAL + 1)
  84. #define MCAST_BOUNDARY (IF_STATUS + 1)
  85. #define MCAST_SCOPE (MCAST_BOUNDARY + 1)
  86. #define DEST_MATCHING (MCAST_SCOPE + 1)
  87. #define DEST_LONGER (DEST_MATCHING + 1)
  88. #define DEST_SHORTER (DEST_LONGER + 1)
  89. #define ROUTE_MATCHING (DEST_SHORTER + 1)
  90. #define ROUTE_LONGER (ROUTE_MATCHING + 1)
  91. #define ROUTE_SHORTER (ROUTE_LONGER + 1)
  92. #define ROUTE_STATE (ROUTE_SHORTER + 1)
  93. #define MCAST_MFE_STATS_EX (ROUTE_STATE + 1)
  94. #define IP6_STATS (MCAST_MFE_STATS_EX + 1)
  95. #define UDP6_STATS (IP6_STATS + 1)
  96. #define TCP6_STATS (UDP6_STATS + 1)
  97. #define NUMBER_OF_EXPORTED_VARIABLES (TCP6_STATS + 1)
  98. //////////////////////////////////////////////////////////////////////////////
  99. // //
  100. // MIB_OPAQUE_QUERY is the structure filled in by the user to identify a //
  101. // MIB variable //
  102. // //
  103. // dwVarId ID of MIB Variable (One of the Ids #defined above) //
  104. // dwVarIndex Variable sized array containing the indices needed to //
  105. // identify a variable. NOTE: Unlike SNMP we dont require that //
  106. // a scalar variable be indexed by 0 //
  107. // //
  108. //////////////////////////////////////////////////////////////////////////////
  109. typedef struct _MIB_OPAQUE_QUERY
  110. {
  111. DWORD dwVarId;
  112. DWORD rgdwVarIndex[ANY_SIZE];
  113. }MIB_OPAQUE_QUERY, *PMIB_OPAQUE_QUERY;
  114. //////////////////////////////////////////////////////////////////////////////
  115. // //
  116. // The following are the structures which are filled in and returned to the //
  117. // user when a query is made, OR are filled in BY THE USER when a set is //
  118. // done //
  119. // //
  120. //////////////////////////////////////////////////////////////////////////////
  121. typedef struct _MIB_IFNUMBER
  122. {
  123. DWORD dwValue;
  124. } MIB_IFNUMBER, *PMIB_IFNUMBER;
  125. #define MAXLEN_IFDESCR 256
  126. #define MAXLEN_PHYSADDR 8
  127. typedef struct _MIB_IFROW
  128. {
  129. WCHAR wszName[MAX_INTERFACE_NAME_LEN];
  130. DWORD dwIndex;
  131. DWORD dwType;
  132. DWORD dwMtu;
  133. DWORD dwSpeed;
  134. DWORD dwPhysAddrLen;
  135. BYTE bPhysAddr[MAXLEN_PHYSADDR];
  136. DWORD dwAdminStatus;
  137. DWORD dwOperStatus;
  138. DWORD dwLastChange;
  139. DWORD dwInOctets;
  140. DWORD dwInUcastPkts;
  141. DWORD dwInNUcastPkts;
  142. DWORD dwInDiscards;
  143. DWORD dwInErrors;
  144. DWORD dwInUnknownProtos;
  145. DWORD dwOutOctets;
  146. DWORD dwOutUcastPkts;
  147. DWORD dwOutNUcastPkts;
  148. DWORD dwOutDiscards;
  149. DWORD dwOutErrors;
  150. DWORD dwOutQLen;
  151. DWORD dwDescrLen;
  152. BYTE bDescr[MAXLEN_IFDESCR];
  153. } MIB_IFROW,*PMIB_IFROW;
  154. typedef struct _MIB_IFTABLE
  155. {
  156. DWORD dwNumEntries;
  157. MIB_IFROW table[ANY_SIZE];
  158. } MIB_IFTABLE, *PMIB_IFTABLE;
  159. #define SIZEOF_IFTABLE(X) (FIELD_OFFSET(MIB_IFTABLE,table[0]) + ((X) * sizeof(MIB_IFROW)) + ALIGN_SIZE)
  160. typedef struct _MIBICMPSTATS
  161. {
  162. DWORD dwMsgs;
  163. DWORD dwErrors;
  164. DWORD dwDestUnreachs;
  165. DWORD dwTimeExcds;
  166. DWORD dwParmProbs;
  167. DWORD dwSrcQuenchs;
  168. DWORD dwRedirects;
  169. DWORD dwEchos;
  170. DWORD dwEchoReps;
  171. DWORD dwTimestamps;
  172. DWORD dwTimestampReps;
  173. DWORD dwAddrMasks;
  174. DWORD dwAddrMaskReps;
  175. } MIBICMPSTATS, *PMIBICMPSTATS;
  176. typedef struct _MIBICMPINFO
  177. {
  178. MIBICMPSTATS icmpInStats;
  179. MIBICMPSTATS icmpOutStats;
  180. } MIBICMPINFO;
  181. typedef struct _MIB_ICMP
  182. {
  183. MIBICMPINFO stats;
  184. } MIB_ICMP,*PMIB_ICMP;
  185. //
  186. // ICMPv6 Type Values from RFC 2292.
  187. //
  188. typedef enum {
  189. ICMP6_DST_UNREACH = 1,
  190. ICMP6_PACKET_TOO_BIG = 2,
  191. ICMP6_TIME_EXCEEDED = 3,
  192. ICMP6_PARAM_PROB = 4,
  193. ICMP6_ECHO_REQUEST = 128,
  194. ICMP6_ECHO_REPLY = 129,
  195. ICMP6_MEMBERSHIP_QUERY = 130,
  196. ICMP6_MEMBERSHIP_REPORT = 131,
  197. ICMP6_MEMBERSHIP_REDUCTION = 132,
  198. ND_ROUTER_SOLICIT = 133,
  199. ND_ROUTER_ADVERT = 134,
  200. ND_NEIGHBOR_SOLICIT = 135,
  201. ND_NEIGHBOR_ADVERT = 136,
  202. ND_REDIRECT = 137,
  203. } ICMP6_TYPE, *PICMP6_TYPE;
  204. //
  205. // There are no RFC-specified defines for ICMPv4 message types, so we try to
  206. // use the ICMP6 values from RFC 2292 modified to be prefixed with ICMP4.
  207. //
  208. typedef enum {
  209. ICMP4_ECHO_REPLY = 0, // Echo Reply
  210. ICMP4_DST_UNREACH = 3, // Destination Unreachable
  211. ICMP4_SOURCE_QUENCH = 4, // Source Quench
  212. ICMP4_REDIRECT = 5, // Redirect
  213. ICMP4_ECHO_REQUEST = 8, // Echo Request
  214. ICMP4_ROUTER_ADVERT = 9, // Router Advertisement
  215. ICMP4_ROUTER_SOLICIT = 10, // Router Solicitation
  216. ICMP4_TIME_EXCEEDED = 11, // Time Exceeded
  217. ICMP4_PARAM_PROB = 12, // Parameter Problem
  218. ICMP4_TIMESTAMP_REQUEST = 13, // Timestamp Request
  219. ICMP4_TIMESTAMP_REPLY = 14, // Timestamp Reply
  220. ICMP4_MASK_REQUEST = 17, // Address Mask Request
  221. ICMP4_MASK_REPLY = 18, // Address Mask Reply
  222. } ICMP4_TYPE, *PICMP4_TYPE;
  223. typedef struct _MIBICMPSTATS_EX
  224. {
  225. DWORD dwMsgs;
  226. DWORD dwErrors;
  227. DWORD rgdwTypeCount[256];
  228. } MIBICMPSTATS_EX, *PMIBICMPSTATS_EX;
  229. typedef struct _MIB_ICMP_EX
  230. {
  231. MIBICMPSTATS_EX icmpInStats;
  232. MIBICMPSTATS_EX icmpOutStats;
  233. } MIB_ICMP_EX,*PMIB_ICMP_EX;
  234. typedef struct _MIB_UDPSTATS
  235. {
  236. DWORD dwInDatagrams;
  237. DWORD dwNoPorts;
  238. DWORD dwInErrors;
  239. DWORD dwOutDatagrams;
  240. DWORD dwNumAddrs;
  241. } MIB_UDPSTATS,*PMIB_UDPSTATS;
  242. typedef struct _MIB_UDPROW
  243. {
  244. DWORD dwLocalAddr;
  245. DWORD dwLocalPort;
  246. } MIB_UDPROW, *PMIB_UDPROW;
  247. typedef struct _MIB_UDPTABLE
  248. {
  249. DWORD dwNumEntries;
  250. MIB_UDPROW table[ANY_SIZE];
  251. } MIB_UDPTABLE, *PMIB_UDPTABLE;
  252. #define SIZEOF_UDPTABLE(X) (FIELD_OFFSET(MIB_UDPTABLE, table[0]) + ((X) * sizeof(MIB_UDPROW)) + ALIGN_SIZE)
  253. typedef struct _MIB_TCPSTATS
  254. {
  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. #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. #define MIB_TCP_MAXCONN_DYNAMIC (DWORD)-1
  276. typedef struct _MIB_TCPROW
  277. {
  278. DWORD dwState;
  279. DWORD dwLocalAddr;
  280. DWORD dwLocalPort;
  281. DWORD dwRemoteAddr;
  282. DWORD dwRemotePort;
  283. } MIB_TCPROW, *PMIB_TCPROW;
  284. #define MIB_TCP_STATE_CLOSED 1
  285. #define MIB_TCP_STATE_LISTEN 2
  286. #define MIB_TCP_STATE_SYN_SENT 3
  287. #define MIB_TCP_STATE_SYN_RCVD 4
  288. #define MIB_TCP_STATE_ESTAB 5
  289. #define MIB_TCP_STATE_FIN_WAIT1 6
  290. #define MIB_TCP_STATE_FIN_WAIT2 7
  291. #define MIB_TCP_STATE_CLOSE_WAIT 8
  292. #define MIB_TCP_STATE_CLOSING 9
  293. #define MIB_TCP_STATE_LAST_ACK 10
  294. #define MIB_TCP_STATE_TIME_WAIT 11
  295. #define MIB_TCP_STATE_DELETE_TCB 12
  296. typedef struct _MIB_TCPTABLE
  297. {
  298. DWORD dwNumEntries;
  299. MIB_TCPROW table[ANY_SIZE];
  300. } MIB_TCPTABLE, *PMIB_TCPTABLE;
  301. #define SIZEOF_TCPTABLE(X) (FIELD_OFFSET(MIB_TCPTABLE,table[0]) + ((X) * sizeof(MIB_TCPROW)) + ALIGN_SIZE)
  302. #define MIB_USE_CURRENT_TTL ((DWORD)-1)
  303. #define MIB_USE_CURRENT_FORWARDING ((DWORD)-1)
  304. typedef struct _MIB_IPSTATS
  305. {
  306. DWORD dwForwarding;
  307. DWORD dwDefaultTTL;
  308. DWORD dwInReceives;
  309. DWORD dwInHdrErrors;
  310. DWORD dwInAddrErrors;
  311. DWORD dwForwDatagrams;
  312. DWORD dwInUnknownProtos;
  313. DWORD dwInDiscards;
  314. DWORD dwInDelivers;
  315. DWORD dwOutRequests;
  316. DWORD dwRoutingDiscards;
  317. DWORD dwOutDiscards;
  318. DWORD dwOutNoRoutes;
  319. DWORD dwReasmTimeout;
  320. DWORD dwReasmReqds;
  321. DWORD dwReasmOks;
  322. DWORD dwReasmFails;
  323. DWORD dwFragOks;
  324. DWORD dwFragFails;
  325. DWORD dwFragCreates;
  326. DWORD dwNumIf;
  327. DWORD dwNumAddr;
  328. DWORD dwNumRoutes;
  329. } MIB_IPSTATS, *PMIB_IPSTATS;
  330. #define MIB_IP_FORWARDING 1
  331. #define MIB_IP_NOT_FORWARDING 2
  332. // Note: These addr types have dependency on ipdef.h
  333. #define MIB_IPADDR_PRIMARY 0x0001 // Primary ipaddr
  334. #define MIB_IPADDR_DYNAMIC 0x0004 // Dynamic ipaddr
  335. #define MIB_IPADDR_DISCONNECTED 0x0008 // Address is on disconnected interface
  336. #define MIB_IPADDR_DELETED 0x0040 // Address being deleted
  337. #define MIB_IPADDR_TRANSIENT 0x0080 // Transient address
  338. typedef struct _MIB_IPADDRROW
  339. {
  340. DWORD dwAddr;
  341. DWORD dwIndex;
  342. DWORD dwMask;
  343. DWORD dwBCastAddr;
  344. DWORD dwReasmSize;
  345. unsigned short unused1;
  346. unsigned short wType;
  347. } MIB_IPADDRROW, *PMIB_IPADDRROW;
  348. typedef struct _MIB_IPADDRTABLE
  349. {
  350. DWORD dwNumEntries;
  351. MIB_IPADDRROW table[ANY_SIZE];
  352. } MIB_IPADDRTABLE, *PMIB_IPADDRTABLE;
  353. #define SIZEOF_IPADDRTABLE(X) (FIELD_OFFSET(MIB_IPADDRTABLE,table[0]) + ((X) * sizeof(MIB_IPADDRROW)) + ALIGN_SIZE)
  354. typedef struct _MIB_IPFORWARDNUMBER
  355. {
  356. DWORD dwValue;
  357. }MIB_IPFORWARDNUMBER,*PMIB_IPFORWARDNUMBER;
  358. typedef struct _MIB_IPFORWARDROW
  359. {
  360. DWORD dwForwardDest;
  361. DWORD dwForwardMask;
  362. DWORD dwForwardPolicy;
  363. DWORD dwForwardNextHop;
  364. DWORD dwForwardIfIndex;
  365. DWORD dwForwardType;
  366. DWORD dwForwardProto;
  367. DWORD dwForwardAge;
  368. DWORD dwForwardNextHopAS;
  369. DWORD dwForwardMetric1;
  370. DWORD dwForwardMetric2;
  371. DWORD dwForwardMetric3;
  372. DWORD dwForwardMetric4;
  373. DWORD dwForwardMetric5;
  374. }MIB_IPFORWARDROW, *PMIB_IPFORWARDROW;
  375. #define MIB_IPROUTE_TYPE_OTHER 1
  376. #define MIB_IPROUTE_TYPE_INVALID 2
  377. #define MIB_IPROUTE_TYPE_DIRECT 3
  378. #define MIB_IPROUTE_TYPE_INDIRECT 4
  379. #define MIB_IPROUTE_METRIC_UNUSED (DWORD)-1
  380. //
  381. // THESE MUST MATCH the ids in routprot.h
  382. //
  383. #define MIB_IPPROTO_OTHER 1
  384. #define MIB_IPPROTO_LOCAL 2
  385. #define MIB_IPPROTO_NETMGMT 3
  386. #define MIB_IPPROTO_ICMP 4
  387. #define MIB_IPPROTO_EGP 5
  388. #define MIB_IPPROTO_GGP 6
  389. #define MIB_IPPROTO_HELLO 7
  390. #define MIB_IPPROTO_RIP 8
  391. #define MIB_IPPROTO_IS_IS 9
  392. #define MIB_IPPROTO_ES_IS 10
  393. #define MIB_IPPROTO_CISCO 11
  394. #define MIB_IPPROTO_BBN 12
  395. #define MIB_IPPROTO_OSPF 13
  396. #define MIB_IPPROTO_BGP 14
  397. #define MIB_IPPROTO_NT_AUTOSTATIC 10002
  398. #define MIB_IPPROTO_NT_STATIC 10006
  399. #define MIB_IPPROTO_NT_STATIC_NON_DOD 10007
  400. typedef struct _MIB_IPFORWARDTABLE
  401. {
  402. DWORD dwNumEntries;
  403. MIB_IPFORWARDROW table[ANY_SIZE];
  404. }MIB_IPFORWARDTABLE, *PMIB_IPFORWARDTABLE;
  405. #define SIZEOF_IPFORWARDTABLE(X) (FIELD_OFFSET(MIB_IPFORWARDTABLE,table[0]) + ((X) * sizeof(MIB_IPFORWARDROW)) + ALIGN_SIZE)
  406. typedef struct _MIB_IPNETROW
  407. {
  408. DWORD dwIndex;
  409. DWORD dwPhysAddrLen;
  410. BYTE bPhysAddr[MAXLEN_PHYSADDR];
  411. DWORD dwAddr;
  412. DWORD dwType;
  413. } MIB_IPNETROW, *PMIB_IPNETROW;
  414. #define MIB_IPNET_TYPE_OTHER 1
  415. #define MIB_IPNET_TYPE_INVALID 2
  416. #define MIB_IPNET_TYPE_DYNAMIC 3
  417. #define MIB_IPNET_TYPE_STATIC 4
  418. typedef struct _MIB_IPNETTABLE
  419. {
  420. DWORD dwNumEntries;
  421. MIB_IPNETROW table[ANY_SIZE];
  422. } MIB_IPNETTABLE, *PMIB_IPNETTABLE;
  423. #define SIZEOF_IPNETTABLE(X) (FIELD_OFFSET(MIB_IPNETTABLE, table[0]) + ((X) * sizeof(MIB_IPNETROW)) + ALIGN_SIZE)
  424. typedef struct _MIB_IPMCAST_OIF
  425. {
  426. DWORD dwOutIfIndex;
  427. DWORD dwNextHopAddr;
  428. DWORD dwReserved;
  429. DWORD dwReserved1;
  430. }MIB_IPMCAST_OIF, *PMIB_IPMCAST_OIF;
  431. typedef struct _MIB_IPMCAST_MFE
  432. {
  433. DWORD dwGroup;
  434. DWORD dwSource;
  435. DWORD dwSrcMask;
  436. DWORD dwUpStrmNgbr;
  437. DWORD dwInIfIndex;
  438. DWORD dwInIfProtocol;
  439. DWORD dwRouteProtocol;
  440. DWORD dwRouteNetwork;
  441. DWORD dwRouteMask;
  442. ULONG ulUpTime;
  443. ULONG ulExpiryTime;
  444. ULONG ulTimeOut;
  445. ULONG ulNumOutIf;
  446. DWORD fFlags;
  447. DWORD dwReserved;
  448. MIB_IPMCAST_OIF rgmioOutInfo[ANY_SIZE];
  449. }MIB_IPMCAST_MFE, *PMIB_IPMCAST_MFE;
  450. typedef struct _MIB_MFE_TABLE
  451. {
  452. DWORD dwNumEntries;
  453. MIB_IPMCAST_MFE table[ANY_SIZE];
  454. }MIB_MFE_TABLE, *PMIB_MFE_TABLE;
  455. #define SIZEOF_BASIC_MIB_MFE \
  456. (ULONG)(FIELD_OFFSET(MIB_IPMCAST_MFE, rgmioOutInfo[0]))
  457. #define SIZEOF_MIB_MFE(X) \
  458. (SIZEOF_BASIC_MIB_MFE + ((X) * sizeof(MIB_IPMCAST_OIF)))
  459. typedef struct _MIB_IPMCAST_OIF_STATS
  460. {
  461. DWORD dwOutIfIndex;
  462. DWORD dwNextHopAddr;
  463. DWORD dwDialContext;
  464. ULONG ulTtlTooLow;
  465. ULONG ulFragNeeded;
  466. ULONG ulOutPackets;
  467. ULONG ulOutDiscards;
  468. }MIB_IPMCAST_OIF_STATS, *PMIB_IPMCAST_OIF_STATS;
  469. typedef struct _MIB_IPMCAST_MFE_STATS
  470. {
  471. DWORD dwGroup;
  472. DWORD dwSource;
  473. DWORD dwSrcMask;
  474. DWORD dwUpStrmNgbr;
  475. DWORD dwInIfIndex;
  476. DWORD dwInIfProtocol;
  477. DWORD dwRouteProtocol;
  478. DWORD dwRouteNetwork;
  479. DWORD dwRouteMask;
  480. ULONG ulUpTime;
  481. ULONG ulExpiryTime;
  482. ULONG ulNumOutIf;
  483. ULONG ulInPkts;
  484. ULONG ulInOctets;
  485. ULONG ulPktsDifferentIf;
  486. ULONG ulQueueOverflow;
  487. MIB_IPMCAST_OIF_STATS rgmiosOutStats[ANY_SIZE];
  488. }MIB_IPMCAST_MFE_STATS, *PMIB_IPMCAST_MFE_STATS;
  489. typedef struct _MIB_MFE_STATS_TABLE
  490. {
  491. DWORD dwNumEntries;
  492. MIB_IPMCAST_MFE_STATS table[ANY_SIZE];
  493. }MIB_MFE_STATS_TABLE, *PMIB_MFE_STATS_TABLE;
  494. #define SIZEOF_BASIC_MIB_MFE_STATS \
  495. (ULONG)(FIELD_OFFSET(MIB_IPMCAST_MFE_STATS, rgmiosOutStats[0]))
  496. #define SIZEOF_MIB_MFE_STATS(X) \
  497. (SIZEOF_BASIC_MIB_MFE_STATS + ((X) * sizeof(MIB_IPMCAST_OIF_STATS)))
  498. typedef struct _MIB_IPMCAST_MFE_STATS_EX
  499. {
  500. DWORD dwGroup;
  501. DWORD dwSource;
  502. DWORD dwSrcMask;
  503. DWORD dwUpStrmNgbr;
  504. DWORD dwInIfIndex;
  505. DWORD dwInIfProtocol;
  506. DWORD dwRouteProtocol;
  507. DWORD dwRouteNetwork;
  508. DWORD dwRouteMask;
  509. ULONG ulUpTime;
  510. ULONG ulExpiryTime;
  511. ULONG ulNumOutIf;
  512. ULONG ulInPkts;
  513. ULONG ulInOctets;
  514. ULONG ulPktsDifferentIf;
  515. ULONG ulQueueOverflow;
  516. ULONG ulUninitMfe;
  517. ULONG ulNegativeMfe;
  518. ULONG ulInDiscards;
  519. ULONG ulInHdrErrors;
  520. ULONG ulTotalOutPackets;
  521. MIB_IPMCAST_OIF_STATS rgmiosOutStats[ANY_SIZE];
  522. }MIB_IPMCAST_MFE_STATS_EX, *PMIB_IPMCAST_MFE_STATS_EX;
  523. typedef struct _MIB_MFE_STATS_TABLE_EX
  524. {
  525. DWORD dwNumEntries;
  526. MIB_IPMCAST_MFE_STATS_EX table[ANY_SIZE];
  527. }MIB_MFE_STATS_TABLE_EX, *PMIB_MFE_STATS_TABLE_EX;
  528. #define SIZEOF_BASIC_MIB_MFE_STATS_EX \
  529. (ULONG)(FIELD_OFFSET(MIB_IPMCAST_MFE_STATS_EX, rgmiosOutStats[0]))
  530. #define SIZEOF_MIB_MFE_STATS_EX(X) \
  531. (SIZEOF_BASIC_MIB_MFE_STATS_EX + ((X) * sizeof(MIB_IPMCAST_OIF_STATS)))
  532. typedef struct _MIB_IPMCAST_GLOBAL {
  533. DWORD dwEnable;
  534. }MIB_IPMCAST_GLOBAL, *PMIB_IPMCAST_GLOBAL;
  535. typedef struct _MIB_IPMCAST_IF_ENTRY
  536. {
  537. DWORD dwIfIndex;
  538. DWORD dwTtl;
  539. DWORD dwProtocol;
  540. DWORD dwRateLimit;
  541. ULONG ulInMcastOctets;
  542. ULONG ulOutMcastOctets;
  543. }MIB_IPMCAST_IF_ENTRY, *PMIB_IPMCAST_IF_ENTRY;
  544. typedef struct _MIB_IPMCAST_IF_TABLE
  545. {
  546. DWORD dwNumEntries;
  547. MIB_IPMCAST_IF_ENTRY table[ANY_SIZE];
  548. }MIB_IPMCAST_IF_TABLE, *PMIB_IPMCAST_IF_TABLE;
  549. #define SIZEOF_MCAST_IF_TABLE(X) (FIELD_OFFSET(MIB_IPMCAST_IF_TABLE,table[0]) + ((X) * sizeof(MIB_IPMCAST_IF_ENTRY)) + ALIGN_SIZE)
  550. typedef struct _MIB_IPMCAST_BOUNDARY
  551. {
  552. DWORD dwIfIndex;
  553. DWORD dwGroupAddress;
  554. DWORD dwGroupMask;
  555. DWORD dwStatus;
  556. }MIB_IPMCAST_BOUNDARY, *PMIB_IPMCAST_BOUNDARY;
  557. typedef struct _MIB_IPMCAST_BOUNDARY_TABLE
  558. {
  559. DWORD dwNumEntries;
  560. MIB_IPMCAST_BOUNDARY table[ANY_SIZE];
  561. }MIB_IPMCAST_BOUNDARY_TABLE, *PMIB_IPMCAST_BOUNDARY_TABLE;
  562. #define SIZEOF_BOUNDARY_TABLE(X) (FIELD_OFFSET(MIB_IPMCAST_BOUNDARY_TABLE,table[0]) + ((X) * sizeof(MIB_IPMCAST_BOUNDARY)) + ALIGN_SIZE)
  563. typedef struct {
  564. DWORD dwGroupAddress;
  565. DWORD dwGroupMask;
  566. } MIB_BOUNDARYROW, *PMIB_BOUNDARYROW;
  567. // Structure matching what goes in the registry in a block of type
  568. // IP_MCAST_LIMIT_INFO. This contains the fields of
  569. // MIB_IPMCAST_IF_ENTRY which are configurable.
  570. typedef struct {
  571. DWORD dwTtl;
  572. DWORD dwRateLimit;
  573. } MIB_MCAST_LIMIT_ROW, *PMIB_MCAST_LIMIT_ROW;
  574. #define MAX_SCOPE_NAME_LEN 255
  575. //
  576. // Scope names are unicode. SNMP and MZAP use UTF-8 encoding.
  577. //
  578. #define SN_UNICODE
  579. typedef WCHAR SN_CHAR;
  580. typedef SN_CHAR SCOPE_NAME_BUFFER[MAX_SCOPE_NAME_LEN+1], *SCOPE_NAME;
  581. typedef struct _MIB_IPMCAST_SCOPE
  582. {
  583. DWORD dwGroupAddress;
  584. DWORD dwGroupMask;
  585. SCOPE_NAME_BUFFER snNameBuffer;
  586. DWORD dwStatus;
  587. }MIB_IPMCAST_SCOPE, *PMIB_IPMCAST_SCOPE;
  588. typedef struct _MIB_IPDESTROW
  589. {
  590. #ifdef __cplusplus
  591. MIB_IPFORWARDROW ForwardRow;
  592. #else
  593. MIB_IPFORWARDROW;
  594. #endif
  595. DWORD dwForwardPreference;
  596. DWORD dwForwardViewSet;
  597. }MIB_IPDESTROW, *PMIB_IPDESTROW;
  598. typedef struct _MIB_IPDESTTABLE
  599. {
  600. DWORD dwNumEntries;
  601. MIB_IPDESTROW table[ANY_SIZE];
  602. }MIB_IPDESTTABLE, *PMIB_IPDESTTABLE;
  603. typedef struct _MIB_BEST_IF
  604. {
  605. DWORD dwDestAddr;
  606. DWORD dwIfIndex;
  607. }MIB_BEST_IF, *PMIB_BEST_IF;
  608. typedef struct _MIB_PROXYARP
  609. {
  610. DWORD dwAddress;
  611. DWORD dwMask;
  612. DWORD dwIfIndex;
  613. }MIB_PROXYARP, *PMIB_PROXYARP;
  614. typedef struct _MIB_IFSTATUS
  615. {
  616. DWORD dwIfIndex;
  617. DWORD dwAdminStatus;
  618. DWORD dwOperationalStatus;
  619. BOOL bMHbeatActive;
  620. BOOL bMHbeatAlive;
  621. }MIB_IFSTATUS, *PMIB_IFSTATUS;
  622. typedef struct _MIB_ROUTESTATE
  623. {
  624. BOOL bRoutesSetToStack;
  625. }MIB_ROUTESTATE, *PMIB_ROUTESTATE;
  626. //////////////////////////////////////////////////////////////////////////////
  627. // //
  628. // All the info passed to (SET/CREATE) and from (GET/GETNEXT/GETFIRST) //
  629. // IP Router Manager is encapsulated in the following "discriminated" //
  630. // union. To pass, say MIB_IFROW, use the following code //
  631. // //
  632. // PMIB_OPAQUE_INFO pInfo; //
  633. // PMIB_IFROW pIfRow; //
  634. // DWORD rgdwBuff[(MAX_MIB_OFFSET + sizeof(MIB_IFROW))/sizeof(DWORD) + 1]; //
  635. // //
  636. // pInfo = (PMIB_OPAQUE_INFO)rgdwBuffer; //
  637. // pIfRow = (MIB_IFROW *)(pInfo->rgbyData); //
  638. // //
  639. // This can also be accomplished by using the following macro //
  640. // //
  641. // DEFINE_MIB_BUFFER(pInfo,MIB_IFROW, pIfRow); //
  642. // //
  643. //////////////////////////////////////////////////////////////////////////////
  644. typedef struct _MIB_OPAQUE_INFO
  645. {
  646. DWORD dwId;
  647. union
  648. {
  649. ULONGLONG ullAlign;
  650. BYTE rgbyData[1];
  651. };
  652. }MIB_OPAQUE_INFO, *PMIB_OPAQUE_INFO;
  653. #define MAX_MIB_OFFSET 8
  654. #define MIB_INFO_SIZE(S) \
  655. (MAX_MIB_OFFSET + sizeof(S))
  656. #define MIB_INFO_SIZE_IN_DWORDS(S) \
  657. ((MIB_INFO_SIZE(S))/sizeof(DWORD) + 1)
  658. #define DEFINE_MIB_BUFFER(X,Y,Z) \
  659. DWORD __rgdwBuff[MIB_INFO_SIZE_IN_DWORDS(Y)]; \
  660. PMIB_OPAQUE_INFO X = (PMIB_OPAQUE_INFO)__rgdwBuff; \
  661. Y * Z = (Y *)(X->rgbyData)
  662. #define CAST_MIB_INFO(X,Y,Z) Z = (Y)(X->rgbyData)
  663. #if _MSC_VER >= 1200
  664. #pragma warning(pop)
  665. #else
  666. #pragma warning(default:4201)
  667. #endif
  668. #endif //__ROUTING_IPRTRMIB_H__