⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iprtrmib.pas

📁 这是一个用VC++编写的网络嗅探器
💻 PAS
📖 第 1 页 / 共 3 页
字号:
{******************************************************************************}
{                                                       	               }
{ Management Information Base API interface Unit for Object Pascal             }
{                                                       	               }
{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
{ Corporation. All Rights Reserved.                                            }
{ 								               }
{ The original file is: iprtrmib.h, released July 2000. The original Pascal    }
{ code is: IpRtrMib.pas, released September 2000. The initial developer of the }
{ Pascal code is Marcel van Brakel (brakelm@chello.nl).                        }
{                                                                              }
{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
{ Marcel van Brakel. All Rights Reserved.                                      }
{ 								               }
{ Contributor(s): John C. Penman (jcp@craiglockhart.com)                       }
{                 Vladimir Vassiliev (voldemarv@hotpop.com)                    }
{ 								               }
{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
{								               }
{ You may retrieve the latest version of this file at the Project JEDI home    }
{ page, located at http://delphi-jedi.org or my personal homepage located at   }
{ http://members.chello.nl/m.vanbrakel2                                        }
{								               }
{ The contents of this file are used with permission, subject to the Mozilla   }
{ Public License Version 1.1 (the "License"); you may not use this file except }
{ in compliance with the License. You may obtain a copy of the License at      }
{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
{                                                                              }
{ Software distributed under the License is distributed on an "AS IS" basis,   }
{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
{ the specific language governing rights and limitations under the License.    }
{                                                                              }
{ Alternatively, the contents of this file may be used under the terms of the  }
{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
{ provisions of the LGPL License are applicable instead of those above.        }
{ If you wish to allow use of your version of this file only under the terms   }
{ of the LGPL License and not to allow others to use your version of this file }
{ under the MPL, indicate your decision by deleting  the provisions above and  }
{ replace  them with the notice and other provisions required by the LGPL      }
{ License.  If you do not delete the provisions above, a recipient may use     }
{ your version of this file under either the MPL or the LGPL License.          }
{ 								               }
{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
{ 								               }
{******************************************************************************}

unit IpRtrMib;

{$WEAKPACKAGEUNIT}

{$HPPEMIT ''}
{$HPPEMIT '#include "iprtrmib.h"'}
{$HPPEMIT ''}

//{$I WINDEFINES.INC}

interface

uses
  Windows;

//////////////////////////////////////////////////////////////////////////////
//                                                                          //
// Included to get the value of MAX_INTERFACE_NAME_LEN                      //
//                                                                          //
//////////////////////////////////////////////////////////////////////////////

// #include <mprapi.h>

//////////////////////////////////////////////////////////////////////////////
//                                                                          //
// Included to get the necessary constants                                  //
//                                                                          //
//////////////////////////////////////////////////////////////////////////////

// #include <ipifcons.h>

//////////////////////////////////////////////////////////////////////////////
//                                                                          //
// This is the Id for IP Router Manager.  The Router Manager handles        //
// MIB-II, Forwarding MIB and some enterprise specific information.         //
// Calls made with any other ID are passed on to the corresponding protocol //
// For example, an MprAdminMIBXXX call with a protocol ID of PID_IP and    //
// a routing Id of 0xD will be sent to the IP Router Manager and then       //
// forwarded to OSPF                                                        //
// This lives in the same number space as the protocol Ids of RIP, OSPF     //
// etc, so any change made to it should be done keeping this in mind        //
//                                                                          //
//////////////////////////////////////////////////////////////////////////////

const
  MAX_INTERFACE_NAME_LEN = 256; // MPRAPI.H
  {$EXTERNALSYM MAX_INTERFACE_NAME_LEN}
  
  IPRTRMGR_PID = 10000;
  {$EXTERNALSYM IPRTRMGR_PID}

  ANY_SIZE = 1;
  {$EXTERNALSYM ANY_SIZE}

//////////////////////////////////////////////////////////////////////////////
//                                                                          //
// The following #defines are the Ids of the MIB variables made accessible  //
// to the user via MprAdminMIBXXX Apis.  It will be noticed that these are  //
// not the same as RFC 1213, since the MprAdminMIBXXX APIs work on rows and //
// groups instead of scalar variables                                       //
//                                                                          //
//////////////////////////////////////////////////////////////////////////////

  IF_NUMBER        = 0;
  {$EXTERNALSYM IF_NUMBER}
  IF_TABLE         = IF_NUMBER + 1;
  {$EXTERNALSYM IF_TABLE}
  IF_ROW           = IF_TABLE + 1;
  {$EXTERNALSYM IF_ROW}
  IP_STATS         = IF_ROW + 1;
  {$EXTERNALSYM IP_STATS}
  IP_ADDRTABLE     = IP_STATS + 1;
  {$EXTERNALSYM IP_ADDRTABLE}
  IP_ADDRROW       = IP_ADDRTABLE + 1;
  {$EXTERNALSYM IP_ADDRROW}
  IP_FORWARDNUMBER = IP_ADDRROW + 1;
  {$EXTERNALSYM IP_FORWARDNUMBER}
  IP_FORWARDTABLE  = IP_FORWARDNUMBER + 1;
  {$EXTERNALSYM IP_FORWARDTABLE}
  IP_FORWARDROW    = IP_FORWARDTABLE + 1;
  {$EXTERNALSYM IP_FORWARDROW}
  IP_NETTABLE      = IP_FORWARDROW + 1;
  {$EXTERNALSYM IP_NETTABLE}
  IP_NETROW        = IP_NETTABLE + 1;
  {$EXTERNALSYM IP_NETROW}
  ICMP_STATS       = IP_NETROW + 1;
  {$EXTERNALSYM ICMP_STATS}
  TCP_STATS        = ICMP_STATS + 1;
  {$EXTERNALSYM TCP_STATS}
  TCP_TABLE        = TCP_STATS + 1;
  {$EXTERNALSYM TCP_TABLE}
  TCP_ROW          = TCP_TABLE + 1;
  {$EXTERNALSYM TCP_ROW}
  UDP_STATS        = TCP_ROW + 1;
  {$EXTERNALSYM UDP_STATS}
  UDP_TABLE        = UDP_STATS + 1;
  {$EXTERNALSYM UDP_TABLE}
  UDP_ROW          = UDP_TABLE + 1;
  {$EXTERNALSYM UDP_ROW}
  MCAST_MFE        = UDP_ROW + 1;
  {$EXTERNALSYM MCAST_MFE}
  MCAST_MFE_STATS  = MCAST_MFE + 1;
  {$EXTERNALSYM MCAST_MFE_STATS}
  BEST_IF          = MCAST_MFE_STATS + 1;
  {$EXTERNALSYM BEST_IF}
  BEST_ROUTE       = BEST_IF + 1;
  {$EXTERNALSYM BEST_ROUTE}
  PROXY_ARP        = BEST_ROUTE + 1;
  {$EXTERNALSYM PROXY_ARP}
  MCAST_IF_ENTRY   = PROXY_ARP + 1;
  {$EXTERNALSYM MCAST_IF_ENTRY}
  MCAST_GLOBAL     = MCAST_IF_ENTRY + 1;
  {$EXTERNALSYM MCAST_GLOBAL}
  IF_STATUS        = MCAST_GLOBAL + 1;
  {$EXTERNALSYM IF_STATUS}
  MCAST_BOUNDARY   = IF_STATUS + 1;
  {$EXTERNALSYM MCAST_BOUNDARY}
  MCAST_SCOPE      = MCAST_BOUNDARY + 1;
  {$EXTERNALSYM MCAST_SCOPE}
  DEST_MATCHING    = MCAST_SCOPE + 1;
  {$EXTERNALSYM DEST_MATCHING}
  DEST_LONGER      = DEST_MATCHING + 1;
  {$EXTERNALSYM DEST_LONGER}
  DEST_SHORTER     = DEST_LONGER + 1;
  {$EXTERNALSYM DEST_SHORTER}
  ROUTE_MATCHING   = DEST_SHORTER + 1;
  {$EXTERNALSYM ROUTE_MATCHING}
  ROUTE_LONGER     = ROUTE_MATCHING + 1;
  {$EXTERNALSYM ROUTE_LONGER}
  ROUTE_SHORTER    = ROUTE_LONGER + 1;
  {$EXTERNALSYM ROUTE_SHORTER}
  ROUTE_STATE      = ROUTE_SHORTER + 1;
  {$EXTERNALSYM ROUTE_STATE}

  NUMBER_OF_EXPORTED_VARIABLES = ROUTE_STATE + 1;
  {$EXTERNALSYM NUMBER_OF_EXPORTED_VARIABLES}

//////////////////////////////////////////////////////////////////////////////
//                                                                          //
// MIB_OPAQUE_QUERY is the structure filled in by the user to identify a    //
// MIB variable                                                             //
//                                                                          //
//  dwVarId     ID of MIB Variable (One of the Ids #defined above)          //
//  dwVarIndex  Variable sized array containing the indices needed to       //
//              identify a variable. NOTE: Unlike SNMP we dont require that //
//              a scalar variable be indexed by 0                           //
//                                                                          //
//////////////////////////////////////////////////////////////////////////////

type
  PMIB_OPAQUE_QUERY = ^MIB_OPAQUE_QUERY;
  {$EXTERNALSYM PMIB_OPAQUE_QUERY}
  _MIB_OPAQUE_QUERY = record
    dwVarId: DWORD;
    rgdwVarIndex: array [0..ANY_SIZE - 1] of DWORD;
  end;
  {$EXTERNALSYM _MIB_OPAQUE_QUERY}
  MIB_OPAQUE_QUERY = _MIB_OPAQUE_QUERY;
  {$EXTERNALSYM MIB_OPAQUE_QUERY}
  TMibOpaqueQuery = MIB_OPAQUE_QUERY;
  PMibOpaqueQuery = PMIB_OPAQUE_QUERY;

//////////////////////////////////////////////////////////////////////////////
//                                                                          //
// The following are the structures which are filled in and returned to the //
// user when a query is made, OR  are filled in BY THE USER when a set is   //
// done                                                                     //
//                                                                          //
//////////////////////////////////////////////////////////////////////////////

type
  PMIB_IFNUMBER = ^MIB_IFNUMBER;
  {$EXTERNALSYM PMIB_IFNUMBER}
  _MIB_IFNUMBER = record
    dwValue: DWORD;
  end;
  {$EXTERNALSYM _MIB_IFNUMBER}
  MIB_IFNUMBER = _MIB_IFNUMBER;
  {$EXTERNALSYM MIB_IFNUMBER}
  TMibIfnumber = MIB_IFNUMBER;
  PMibIfnumber = PMIB_IFNUMBER;

const
  MAXLEN_IFDESCR  = 256;
  {$EXTERNALSYM MAXLEN_IFDESCR}
  MAXLEN_PHYSADDR = 8;
  {$EXTERNALSYM MAXLEN_PHYSADDR}

type
  PMIB_IFROW = ^MIB_IFROW;
  {$EXTERNALSYM PMIB_IFROW}
  _MIB_IFROW = record
    wszName: array [0..MAX_INTERFACE_NAME_LEN - 1] of WCHAR;
    dwIndex: DWORD;
    dwType: DWORD;
    dwMtu: DWORD;
    dwSpeed: DWORD;
    dwPhysAddrLen: DWORD;
    bPhysAddr: array [0..MAXLEN_PHYSADDR - 1] of BYTE;
    dwAdminStatus: DWORD;
    dwOperStatus: DWORD;
    dwLastChange: DWORD;
    dwInOctets: DWORD;
    dwInUcastPkts: DWORD;
    dwInNUcastPkts: DWORD;
    dwInDiscards: DWORD;
    dwInErrors: DWORD;
    dwInUnknownProtos: DWORD;
    dwOutOctets: DWORD;
    dwOutUcastPkts: DWORD;
    dwOutNUcastPkts: DWORD;
    dwOutDiscards: DWORD;
    dwOutErrors: DWORD;
    dwOutQLen: DWORD;
    dwDescrLen: DWORD;
    bDescr: array[0..MAXLEN_IFDESCR - 1] of BYTE;
  end;
  {$EXTERNALSYM _MIB_IFROW}
  MIB_IFROW = _MIB_IFROW;
  {$EXTERNALSYM MIB_IFROW}
  TMibIfRow = MIB_IFROW;
  PMibIfRow = PMIB_IFROW;

  PMIB_IFTABLE = ^MIB_IFTABLE;
  {$EXTERNALSYM PMIB_IFTABLE}
  _MIB_IFTABLE = record
    dwNumEntries: DWORD;
    table: array [0..ANY_SIZE - 1] of MIB_IFROW;
  end;
  {$EXTERNALSYM _MIB_IFTABLE}
  MIB_IFTABLE = _MIB_IFTABLE;
  {$EXTERNALSYM MIB_IFTABLE}
  TMibIftable = MIB_IFTABLE;
  PMibIftable = PMIB_IFTABLE;

// #define SIZEOF_IFTABLE(X) (FIELD_OFFSET(MIB_IFTABLE,table[0]) + ((X) * sizeof(MIB_IFROW)) + ALIGN_SIZE)

type
  PMibIcmpStats = ^TMibIcmpStats;
  _MIBICMPSTATS = record
    dwMsgs: DWORD;
    dwErrors: DWORD;
    dwDestUnreachs: DWORD;
    dwTimeExcds: DWORD;
    dwParmProbs: DWORD;
    dwSrcQuenchs: DWORD;
    dwRedirects: DWORD;
    dwEchos: DWORD;
    dwEchoReps: DWORD;
    dwTimestamps: DWORD;
    dwTimestampReps: DWORD;
    dwAddrMasks: DWORD;
    dwAddrMaskReps: DWORD;
  end;
  {$EXTERNALSYM _MIBICMPSTATS}
  MIBICMPSTATS = _MIBICMPSTATS;
  {$EXTERNALSYM MIBICMPSTATS}
  TMibIcmpStats = _MIBICMPSTATS;

  PMibIcmpInfo = ^TMibIcmpInfo;
  _MIBICMPINFO = record
    icmpInStats: MIBICMPSTATS;
    icmpOutStats: MIBICMPSTATS;
  end;
  {$EXTERNALSYM _MIBICMPINFO}
  MIBICMPINFO = _MIBICMPINFO;
  {$EXTERNALSYM MIBICMPINFO}
  TMibIcmpInfo = MIBICMPINFO;

  PMIB_ICMP = ^MIB_ICMP;
  {$EXTERNALSYM PMIB_ICMP}
  _MIB_ICMP = record
    stats: MIBICMPINFO;
  end;
  {$EXTERNALSYM _MIB_ICMP}
  MIB_ICMP = _MIB_ICMP;
  {$EXTERNALSYM MIB_ICMP}
  TMibIcmp = MIB_ICMP;
  PMibIcmp = PMIB_ICMP;

  PMIB_UDPSTATS = ^MIB_UDPSTATS;
  {$EXTERNALSYM PMIB_UDPSTATS}
  _MIB_UDPSTATS = record
    dwInDatagrams: DWORD;
    dwNoPorts: DWORD;
    dwInErrors: DWORD;
    dwOutDatagrams: DWORD;
    dwNumAddrs: DWORD;
  end;
  {$EXTERNALSYM _MIB_UDPSTATS}
  MIB_UDPSTATS = _MIB_UDPSTATS;
  {$EXTERNALSYM MIB_UDPSTATS}
  TMibUdpStats = MIB_UDPSTATS;
  PMibUdpStats = PMIB_UDPSTATS;

  PMIB_UDPROW = ^MIB_UDPROW;
  {$EXTERNALSYM PMIB_UDPROW}
  _MIB_UDPROW = record
    dwLocalAddr: DWORD;
    dwLocalPort: DWORD;
  end;
  {$EXTERNALSYM _MIB_UDPROW}
  MIB_UDPROW = _MIB_UDPROW;
  {$EXTERNALSYM MIB_UDPROW}
  TMibUdpRow = MIB_UDPROW;
  PMibUdpRow = PMIB_UDPROW;

  PMIB_UDPTABLE = ^MIB_UDPTABLE;
  {$EXTERNALSYM PMIB_UDPTABLE}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -