unit netioapi;

interface

uses
  Windows;

  type

{$Z4}
  NDIS_MEDIUM = (
    NdisMedium802_3,
    NdisMedium802_5,
    NdisMediumFddi,
    NdisMediumWan,
    NdisMediumLocalTalk,
    NdisMediumDix, // defined for convenience, not a real medium
    NdisMediumArcnetRaw,
    NdisMediumArcnet878_2,
    NdisMediumAtm,
    NdisMediumWirelessWan,
    NdisMediumIrda,
    NdisMediumBpc,
    NdisMediumCoWan,
    NdisMedium1394,
    NdisMediumInfiniBand,
    NdisMediumMax // Not a real medium, defined as an upper-bound
  );
  NDIS_PHYSICAL_MEDIUM = (
    NdisPhysicalMediumUnspecified,
    NdisPhysicalMediumWirelessLan,
    NdisPhysicalMediumCableModem,
    NdisPhysicalMediumPhoneLine,
    NdisPhysicalMediumPowerLine,
    NdisPhysicalMediumDSL, // includes ADSL and UADSL (G.Lite)
    NdisPhysicalMediumFibreChannel,
    NdisPhysicalMedium1394,
    NdisPhysicalMediumWirelessWan,
    NdisPhysicalMediumNative802_11,
    NdisPhysicalMediumBluetooth,
    NdisPhysicalMediumInfiniband,
    NdisPhysicalMediumWiMax,
    NdisPhysicalMediumUWB,
    NdisPhysicalMedium802_3,
    NdisPhysicalMedium802_5,
    NdisPhysicalMediumIrda,
    NdisPhysicalMediumWiredWAN,
    NdisPhysicalMediumWiredCoWan,
    NdisPhysicalMediumOther,
    NdisPhysicalMediumMax // Not a real physical type, defined as an upper-bound
  );

  NET_IF_ACCESS_TYPE = (
    NET_IF_ACCESS_LOOPBACK = 1,
    NET_IF_ACCESS_BROADCAST = 2,
    NET_IF_ACCESS_POINT_TO_POINT = 3,
    NET_IF_ACCESS_POINT_TO_MULTI_POINT = 4,
    NET_IF_ACCESS_MAXIMUM = 5
  );

  TUNNEL_TYPE = (
    TUNNEL_TYPE_NONE = 0,
    TUNNEL_TYPE_OTHER = 1,
    TUNNEL_TYPE_DIRECT = 2,
    TUNNEL_TYPE_6TO4 = 11,
    TUNNEL_TYPE_ISATAP = 13,
    TUNNEL_TYPE_TEREDO = 14
  );

  NET_IF_DIRECTION_TYPE = (
    NET_IF_DIRECTION_SENDRECEIVE,
    NET_IF_DIRECTION_SENDONLY,
    NET_IF_DIRECTION_RECEIVEONLY,
    NET_IF_DIRECTION_MAXIMUM
  );

  NET_IF_ADMIN_STATUS = (
    NET_IF_ADMIN_STATUS_UP = 1,
    NET_IF_ADMIN_STATUS_DOWN = 2,
    NET_IF_ADMIN_STATUS_TESTING = 3
  );

  IF_OPER_STATUS = (
    IfOperStatusUp,
    IfOperStatusDown,
    IfOperStatusTesting,
    IfOperStatusUnknown,
    IfOperStatusDormant,
    IfOperStatusNotPresent,
    IfOperStatusLowerLayerDown
  );
  TIfOperStatus = IF_OPER_STATUS;

  NET_IF_MEDIA_CONNECT_STATE = (
    MediaConnectStateUnknown,
    MediaConnectStateConnected,
    MediaConnectStateDisconnected
  );

  NET_IF_CONNECTION_TYPE = (
    NET_IF_CONNECTION_DEDICATED = 1,
    NET_IF_CONNECTION_PASSIVE = 2,
    NET_IF_CONNECTION_DEMAND = 3,
    NET_IF_CONNECTION_MAXIMUM = 4
  );
{$Z-}

  TInterfaceAndOperStatusFlags = (
    HardwareInterface = $1,
    FilterInterface = $2,
    ConnectorPresent = $4,
    NotAuthenticated = $8,
    NotMediaConnected = $16,
    Paused = $32,
    LowPower = $64,
    EndPointInterface = $128
  );

  TInterfaceLuid = packed record
    Value: ULONG64;
  end;

  PMibIfRow2 = ^TMibIfRow2;
  TMibIfRow2 =  record
    InterfaceLuid: TInterfaceLuid;
    InterfaceIndex: ULONG;
    InterfaceGuid: TGUID;
    Alias:array[0..256] of WCHAR;
    Description:array[0..256] of WCHAR;
    PhysicalAddressLength: ULONG;
    PhysicalAddress: array[0..31] of UCHAR;
    PermanentPhysicalAddress:array[0..31] of UCHAR;
    Mtu: ULONG;
    Typet: ULONG;
    TunnelType: TUNNEL_TYPE;
    MediaType: NDIS_MEDIUM;
    PhysicalMediumType: NDIS_PHYSICAL_MEDIUM;
    AccessType: NET_IF_ACCESS_TYPE;
    DirectionType: NET_IF_DIRECTION_TYPE;
    InterfaceAndOperStatusFlags: Byte; { TInterfaceAndOperStatusFlags }
    OperStatus: IF_OPER_STATUS;
    AdminStatus: NET_IF_ADMIN_STATUS;
    MediaConnectState: NET_IF_MEDIA_CONNECT_STATE;
    NetworkGuid: TGUID;
    ConnectionType: NET_IF_CONNECTION_TYPE;

    TransmitLinkSpeed: ULONG64;
    ReceiveLinkSpeed: ULONG64;
    InOctets: ULONG64;
    InUcastPkts: ULONG64;
    InNUcastPkts: ULONG64;
    InDiscards: ULONG64;
    InErrors: ULONG64;
    InUnknownProtos: ULONG64;
    InUcastOctets: ULONG64;
    InMulticastOctets: ULONG64;
    InBroadcastOctets: ULONG64;
    OutOctets: ULONG64;
    OutUcastPkts: ULONG64;
    OutNUcastPkts: ULONG64;
    OutDiscards: ULONG64;
    OutErrors: ULONG64;
    OutUcastOctets: ULONG64;
    OutMulticastOctets: ULONG64;
    OutBroadcastOctets: ULONG64;
    OutQLen: ULONG64;
  end;

  function GetIfEntry2(Mib: PMibIfRow2): DWORD; stdcall; external 'Iphlpapi.dll';

implementation

end.

  

posted on 2014-03-16 11:47  各种皮皮  阅读(802)  评论(0编辑  收藏  举报