Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Сети";
Текущий архив: 2002.02.11;
Скачать: [xml.tar.bz2];

Вниз

Инспектор сети   Найти похожие ветки 

 
Shark   (2001-09-27 18:24) [0]

Добрый день.
Не подскажете как узнать кто сидит у меня на компе и где.
Получить его IP и записать в лог.
Также чтоб определялось время когда человек подконектился.
Буду очень благодарен за любые советы.
С уважением Максим(Shark).


 
Коляныч   (2001-09-27 19:32) [1]

Такие вещи можно узнать с помощью команды nbtstat, только он не фиксирует время подключения, а только IP и объем переданной информации.
Если интересно, то можно поискать в инете как реализован nbtstat


 
Коляныч   (2001-09-27 19:39) [2]

Я поспешил с ответом, не уточнив что значит "сидит у меня на компе".
Выше приведенный ответ применим для соединений windowых машин по NetBIOS
А если тебя интересуют соединения по TCP/IP то есть команда netstat, как она реализована можно посмотреть на www.sysinternals.com


 
Andrey Klimov   (2001-09-27 20:59) [3]

uses Snmp, WinSock, ...

...

type
PTcpInfo = ^TTcpInfo;
TTcpInfo = packed record
prev: PTcpInfo;
next: PTcpInfo;
state: UINT;
localip: UINT;
localport: UINT;
remoteip: UINT;
remoteport: UINT;
end;

PIds = ^TIds;
TIds = array[0..9] of UINT;
const
TcpIdentifiers: TIds = (1, 3, 6, 1, 2, 1, 6, 13, 1, 0);
UdpIdentifiers: TIds = (1, 3, 6, 1, 2, 1, 7, 5, 1, 0);
TcpState: array[0..11] of string[13] = ("???",
"CLOSED",
"LISTENING",
"SYN_SENT",
"SEN_RECEIVED",
"ESTABLISHED",
"FIN_WAIT",
"FIN_WAIT2",
"CLOSE_WAIT",
"CLOSING",
"LAST_ACK",
"TIME_WAIT");

...
private
{ Private declarations }

FAscending: Boolean;
bName: Boolean;
bEndp: Boolean;
FHostName: array[0..255] of Char;
function GetPort(port: UINT; proto: PChar): string;
function GetHost(local: Boolean; ipaddr: UINT): string;
procedure GetTcpUdpInfo;
end;

procedure TForm1.FormCreate(Sender: TObject);
var
WSAData: TWSAData;
begin
if WSAStartup($0101, WSAData) <> 0 then
begin
MessageDlg("Could not initialize Winsock.", mtError, [mbOK], 0);
Form1.Close;
end;
GetHostName(FHostName, SizeOf(FHostName));
with TListView1 do
begin
with Columns.Add do
begin
Caption := "Protocol";
Width := 100;
end;
with Columns.Add do
begin
Caption := "Local Address";
Width := 150;
end;
with Columns.Add do
begin
Caption := "Remote Address";
Width := 150;
end;
with Columns.Add do
begin
Caption := "State";
Width := 100;
end;
end;
end;


procedure TForm1.TBtnRefreshClick(Sender: TObject);
begin
Application.ProcessMessages;
GetTcpUdpInfo;
end;

procedure TForm1.ListViewCompare(Sender: TObject; Item1,
Item2: TListItem; Data: Integer; var Compare: Integer);
function AlignAddress(const Address: string): string;
var
A: array[0..3] of string[4];
ip, port: string;
i: Integer;
begin
ip := Copy(Address, 1, Pos(":", Address) - 1);
port := Copy(Address, Pos(":", Address) + 2, Length(Address));
for i := 0 to High(A) do
begin
if Pos(".", ip) <> 0 then
A[i] := Copy(ip, 1, Pos(".", ip) - 1)
else
A[i] := ip;
Delete(ip, 1, Pos(".", ip));
end;
Result := Format("%3s.%3s.%3s.%3s: %5s", [A[0], A[1], A[2], A[3], port]);
end;
var
SortFlag: Integer;
s1, s2: string;
begin
if FAscending then SortFlag := 1 else SortFlag := -1;
case Data of
-1: Compare := SortFlag * AnsiCompareText(Item1.Caption, Item2.Caption);
0, 1: begin
if bName then
Compare := SortFlag * AnsiCompareText(Item1.SubItems[Data], Item2.SubItems[Data])
else
begin
s1 := AlignAddress(Item1.SubItems[Data]);
s2 := AlignAddress(Item2.SubItems[Data]);
Compare := SortFlag * AnsiCompareText(s1, s2);
end;
end;
2: Compare := SortFlag * AnsiCompareText(Item1.SubItems[Data], Item2.SubItems[Data]);
end;
end;

function TForm1.GetPort(port: UINT; proto: PChar): string;
var
ServEnt: PServEnt;
begin
if bName then
begin
Application.ProcessMessages;
ServEnt := GetServByPort(htons(port), proto);
if ServEnt <> nil then
Result := ServEnt^.s_name
else
Result := IntToStr(port);
end
else Result := IntToStr(port);
end;



 
Andrey Klimov   (2001-09-27 21:01) [4]

function TForm1.GetHost(local: Boolean; ipaddr: UINT): string;
var
HostEnt: PHostEnt;
InAddr: TInAddr;
begin
if ipaddr = 0 then
begin
if (local) and (bName) then
Result := FHostName
else
Result := "0.0.0.0";
end
else
if ipaddr = 16777343 then
begin
if bName then
begin
if local then
Result := FHostName
else
Result := "localhost";
end
else
Result := "127.0.0.1";
end
else
begin
if bName then
begin
if local then
Result := FHostName
else
begin
Application.ProcessMessages;
HostEnt := GetHostByAddr(@ipaddr, 4, PF_INET);
if HostEnt <> nil then
Result := HostEnt^.h_name
else
begin
InAddr.S_addr := ipaddr;
Result := Format("%d.%d.%d.%d",
[Byte(InAddr.s_un_b.s_b1),
Byte(InAddr.s_un_b.s_b2),
Byte(InAddr.s_un_b.s_b3),
Byte(InAddr.s_un_b.s_b4)]);
end;
end;
end
else
begin
InAddr.S_addr := ipaddr;
Result := Format("%d.%d.%d.%d",
[Byte(InAddr.s_un_b.s_b1),
Byte(InAddr.s_un_b.s_b2),
Byte(InAddr.s_un_b.s_b3),
Byte(InAddr.s_un_b.s_b4)]);
end;
end;
end;



 
Andrey Klimov   (2001-09-27 21:01) [5]

procedure TForm1.GetTcpUdpInfo;
var
TcpInfoTable, UdpInfoTable: TTcpInfo;
hTrapEvent: THandle;
hIdentifier, Oid: TAsnObjectIdentifier;
VarBindList: TSnmpVarBindList;
VarBind: TSnmpVarBind;
errorStatus, errorIndex: TAsnInteger32;
currentEntry, newEntry: PTcpInfo;
currentIndex: UINT;
localaddr, remoteaddr: string;
begin
if not SnmpExtensionInit(GetTickCount, @hTrapEvent, @hIdentifier) then Exit;
{ TCP connections }
FillChar(Oid, SizeOf(Oid), 0);
FillChar(VarBindList, SizeOf(VarBindList), 0);
FillChar(VarBind, SizeOf(VarBind), 0);
Oid.idLength := 10;
Oid.ids := @TcpIdentifiers;
SnmpUtilOidAppend(@VarBind.name, @Oid);
VarBind.value.asnType := ASN_NULL;
VarBindList.list := @VarBind;
VarBindList.len := 1;
FillChar(TcpInfoTable, SizeOf(TcpInfoTable), 0);
TcpInfoTable.prev := @TcpInfoTable;
TcpInfoTable.next := @TcpInfoTable;
currentIndex := 1;
currentEntry := @TcpInfoTable;
while True do
begin
if not SnmpExtensionQuery(SNMP_PDU_GETNEXT,
@VarBindList,
@errorStatus,
@errorIndex) then Exit;
if VarBind.name.idLength < 10 then Break;
if currentIndex <> PIds(VarBind.name.ids)^[9] then
begin
currentEntry := TcpInfoTable.next;
currentIndex := PIds(VarBind.name.ids)^[9];
end;
case currentIndex of
1: begin
newEntry := PTcpInfo(AllocMem(SizeOf(TTcpInfo)));
newEntry^.prev := currentEntry;
newEntry^.next := @TcpInfoTable;
currentEntry^.next := newEntry;
currentEntry := newEntry;
currentEntry^.state := VarBind.value.number;
end;
2: begin
currentEntry^.localip := (PUINT(VarBind.value.address.stream))^;
currentEntry := currentEntry^.next;
end;
3: begin
currentEntry^.localport := VarBind.value.number;
currentEntry := currentEntry^.next;
end;
4: begin
currentEntry^.remoteip := (PUINT(VarBind.value.address.stream))^;
currentEntry := currentEntry^.next;
end;
5: begin
currentEntry^.remoteport := VarBind.value.number;
currentEntry := currentEntry^.next;
end;
end;
end;
with ListView1.Items do
begin
BeginUpdate;
Clear;
EndUpdate;
end;
currentEntry := TcpInfoTable.next;
while currentEntry <> @TcpInfoTable do
begin
if not bEndp then
if currentEntry^.state <> 5 then
begin
currentEntry := currentEntry^.next;
Continue;
end;
localaddr := Format("%s: %s",
[GetHost(True, currentEntry^.localip),
GetPort(currentEntry^.localport, "tcp")]);
if currentEntry^.remoteip = 0 then
remoteaddr := Format("%s: %s",
[GetHost(False, currentEntry^.remoteip), "0"])
else
remoteaddr := Format("%s: %s",
[GetHost(False, currentEntry^.remoteip),
GetPort(currentEntry^.remoteport, "tcp")]);


 
Andrey Klimov   (2001-09-27 21:02) [6]

ListView1.Items.BeginUpdate;
with ListView1.Items.Add do
begin
ImageIndex := 0;
Caption := "TCP";
SubItems.Add(localaddr);
SubItems.Add(remoteaddr);
SubItems.Add(TcpState[currentEntry^.state]);
end;
ListView1.Items.EndUpdate;
currentEntry := currentEntry^.next;
end;
{ UDP connections }

if bEndp then
begin
FillChar(Oid, SizeOf(Oid), 0);
FillChar(VarBindList, SizeOf(VarBindList), 0);
FillChar(VarBind, SizeOf(VarBind), 0);
Oid.idLength := 10;
Oid.ids := @UdpIdentifiers;
SnmpUtilOidAppend(@VarBind.name, @Oid);
VarBind.value.asnType := ASN_NULL;
VarBindList.list := @VarBind;
VarBindList.len := 1;
FillChar(UdpInfoTable, SizeOf(UdpInfoTable), 0);
UdpInfoTable.prev := @UdpInfoTable;
UdpInfoTable.next := @UdpInfoTable;
currentIndex := 1;
currentEntry := @UdpInfoTable;
while True do
begin
if not SnmpExtensionQuery(SNMP_PDU_GETNEXT,
@VarBindList,
@errorStatus,
@errorIndex) then Exit;
if VarBind.name.idLength < 10 then Break;
if currentIndex <> PIds(VarBind.name.ids)^[9] then
begin
currentEntry := UdpInfoTable.next;
currentIndex := PIds(VarBind.name.ids)^[9];
end;
case currentIndex of
1: begin
newEntry := PTcpInfo(AllocMem(SizeOf(TTcpInfo)));
newEntry^.prev := currentEntry;
newEntry^.next := @UdpInfoTable;
currentEntry^.next := newEntry;
currentEntry := newEntry;
currentEntry^.localip := (PUINT(VarBind.value.address.stream))^;
end;
2: begin
currentEntry^.localport := VarBind.value.number;
currentEntry := currentEntry^.next;
end;
end;
end;
currentEntry := UdpInfoTable.next;
while currentEntry <> @UdpInfoTable do
begin
localaddr := Format("%s: %s",
[GetHost(True, currentEntry^.localip),
GetPort(currentEntry^.localport, "udp")]);
remoteaddr := "*.*.*.*: *";

ListView1.Items.BeginUpdate;
with ListView1.Items.Add do
begin
ImageIndex := 0;
Caption := "UDP";
SubItems.Add(localaddr);
SubItems.Add(remoteaddr);
SubItems.Add("");
end;
ListView1.Items.EndUpdate;

currentEntry := currentEntry^.next;
end;
end;
end;


procedure TForm1.FormDestroy(Sender: TObject);
begin
WSACleanup;
end;


 
Andrey Klimov   (2001-09-27 21:03) [7]

Самый простой пример. Говорят можно сделать еще изящнее. Не забудь положить на форму TListView и кнопку Refresh....


 
Коляныч   (2001-09-28 09:57) [8]

А где взять этот модуль snmp.pas???
Дайте ссылку!


 
Andrey Klimov   (2001-09-28 16:11) [9]


{*******************************************************}
{ }
{ Delphi Runtime Library }
{ SNMP Interface Unit }
{ }
{ Copyright (c) 1999 Vadim Crits }
{ }
{*******************************************************}

unit Snmp;

{$ALIGN ON}
{$MINENUMSIZE 4}

interface

uses
Windows;

{ SNMP Type Definitions }

type
PAsnOctetString = ^TAsnOctetString;
TAsnOctetString = packed record
stream: PBYTE;
length: UINT;
dynam: BOOL;
end;

PAsnObjectIdentifier = ^TAsnObjectIdentifier;
TAsnObjectIdentifier = packed record
idLength: UINT;
ids: PUINT;
end;

PAsnInteger32 = ^TAsnInteger32;
TAsnInteger32 = Longint;

PAsnUnsigned32 = ^TAsnUnsigned32;
TAsnUnsigned32 = ULONG;

PTAsnCounter64 = ^TAsnCounter64;
TAsnCounter64 = ULARGE_INTEGER;

PAsnCounter32 = ^TAsnCounter32;
TAsnCounter32 = TAsnUnsigned32;

PAsnGauge32 = ^TAsnGauge32;
TAsnGauge32 = TAsnUnsigned32;

PAsnTimeticks = ^TAsnTimeticks;
TAsnTimeticks = TAsnUnsigned32;

PAsnBits = ^TAsnBits;
TAsnBits = TAsnOctetString;

PAsnSequence = ^TAsnSequence;
TAsnSequence = TAsnOctetString;

PAsnImplicitSequence = ^TAsnImplicitSequence;
TAsnImplicitSequence = TAsnOctetString;

PAsnIPAddress = ^TAsnIPAddress;
TAsnIPAddress = TAsnOctetString;

PAsnNetworkAddress = ^TAsnNetworkAddress;
TAsnNetworkAddress = TAsnOctetString;

PAsnDisplayString = ^TAsnDisplayString;
TAsnDisplayString = TAsnOctetString;

PAsnOpaque = ^TAsnOpaque;
TAsnOpaque = TAsnOctetString;

PAsnAny = ^TAsnAny;
TAsnAny = record
asnType: BYTE;
case Integer of
0: (number: TAsnInteger32);
1: (unsigned32: TAsnUnsigned32);
2: (counter64: TAsnCounter64);
3: (str: TAsnOctetString);
4: (bits: TAsnBits);
5: (obj: TAsnObjectIdentifier);
6: (sequence: TAsnSequence);
7: (address: TAsnIPAddress);
8: (counter: TAsnCounter32);
9: (gauge: TAsnGauge32);
10: (ticks: TAsnTimeticks);
11: (arbitrary: TAsnOpaque);
end;



 
Andrey Klimov   (2001-09-28 16:12) [10]

TAsnObjectName = TAsnObjectIdentifier;
TAsnObjectSyntax = TAsnAny;

PSnmpVarBind = ^TSnmpVarBind;
TSnmpVarBind = packed record
name: TAsnObjectName;
value: TAsnObjectSyntax;
end;

PSnmpVarBindList = ^TSnmpVarBindList;
TSnmpVarBindList = packed record
list: PSnmpVarBind;
len: UINT;
end;

{ ASN/BER Base Types }

const
ASN_UNIVERSAL = $00;
ASN_APPLICATION = $40;
ASN_CONTEXT = $80;
ASN_PRIVATE = $C0;

ASN_PRIMITIVE = $00;
ASN_CONSTRUCTOR = $20;

{ PDU Type Values }

SNMP_PDU_GET = (ASN_CONTEXT or ASN_CONSTRUCTOR or $0);
SNMP_PDU_GETNEXT = (ASN_CONTEXT or ASN_CONSTRUCTOR or $1);
SNMP_PDU_RESPONSE = (ASN_CONTEXT or ASN_CONSTRUCTOR or $2);
SNMP_PDU_SET = (ASN_CONTEXT or ASN_CONSTRUCTOR or $3);
SNMP_PDU_V1TRAP = (ASN_CONTEXT or ASN_CONSTRUCTOR or $4);
SNMP_PDU_GETBULK = (ASN_CONTEXT or ASN_CONSTRUCTOR or $5);
SNMP_PDU_INFORM = (ASN_CONTEXT or ASN_CONSTRUCTOR or $6);
SNMP_PDU_TRAP = (ASN_CONTEXT or ASN_CONSTRUCTOR or $7);

{ SNMP Simple Syntax Values }

ASN_INTEGER = (ASN_UNIVERSAL or ASN_PRIMITIVE or $02);
ASN_BITS = (ASN_UNIVERSAL or ASN_PRIMITIVE or $03);
ASN_OCTETSTRING = (ASN_UNIVERSAL or ASN_PRIMITIVE or $04);
ASN_NULL = (ASN_UNIVERSAL or ASN_PRIMITIVE or $05);
ASN_OBJECTIDENTIFIER = (ASN_UNIVERSAL or ASN_PRIMITIVE or $06);
ASN_INTEGER32 = ASN_INTEGER;

{ SNMP Constructor Syntax Values }

ASN_SEQUENCE = (ASN_UNIVERSAL or ASN_CONSTRUCTOR or $10);
ASN_SEQUENCEOF = ASN_SEQUENCE;



 
Andrey Klimov   (2001-09-28 16:12) [11]

{ SNMP Application Syntax Values }

ASN_IPADDRESS = (ASN_APPLICATION or ASN_PRIMITIVE or $00);
ASN_COUNTER32 = (ASN_APPLICATION or ASN_PRIMITIVE or $01);
ASN_GAUGE32 = (ASN_APPLICATION or ASN_PRIMITIVE or $02);
ASN_TIMETICKS = (ASN_APPLICATION or ASN_PRIMITIVE or $03);
ASN_OPAQUE = (ASN_APPLICATION or ASN_PRIMITIVE or $04);
ASN_COUNTER64 = (ASN_APPLICATION or ASN_PRIMITIVE or $06);
ASN_UNSIGNED32 = (ASN_APPLICATION or ASN_PRIMITIVE or $07);

{ SNMP Exception Conditions }

SNMP_EXCEPTION_NOSUCHOBJECT = (ASN_CONTEXT or ASN_PRIMITIVE or $00);
SNMP_EXCEPTION_NOSUCHINSTANCE = (ASN_CONTEXT or ASN_PRIMITIVE or $01);
SNMP_EXCEPTION_ENDOFMIBVIEW = (ASN_CONTEXT or ASN_PRIMITIVE or $02);

{ SNMP Request Types (used in SnmpExtensionQueryEx) }

SNMP_EXTENSION_GET = SNMP_PDU_GET;
SNMP_EXTENSION_GET_NEXT = SNMP_PDU_GETNEXT;
SNMP_EXTENSION_GET_BULK = SNMP_PDU_GETBULK;
SNMP_EXTENSION_SET_TEST = (ASN_PRIVATE or ASN_CONSTRUCTOR or $0);
SNMP_EXTENSION_SET_COMMIT = SNMP_PDU_SET;
SNMP_EXTENSION_SET_UNDO = (ASN_PRIVATE or ASN_CONSTRUCTOR or $1);
SNMP_EXTENSION_SET_CLEANUP = (ASN_PRIVATE or ASN_CONSTRUCTOR or $2);

{ SNMP Error Codes }

SNMP_ERRORSTATUS_NOERROR = 0;
SNMP_ERRORSTATUS_TOOBIG = 1;
SNMP_ERRORSTATUS_NOSUCHNAME = 2;
SNMP_ERRORSTATUS_BADVALUE = 3;
SNMP_ERRORSTATUS_READONLY = 4;
SNMP_ERRORSTATUS_GENERR = 5;
SNMP_ERRORSTATUS_NOACCESS = 6;
SNMP_ERRORSTATUS_WRONGTYPE = 7;
SNMP_ERRORSTATUS_WRONGLENGTH = 8;
SNMP_ERRORSTATUS_WRONGENCODING = 9;
SNMP_ERRORSTATUS_WRONGVALUE = 10;
SNMP_ERRORSTATUS_NOCREATION = 11;
SNMP_ERRORSTATUS_INCONSISTENTVALUE = 12;
SNMP_ERRORSTATUS_RESOURCEUNAVAILABLE = 13;
SNMP_ERRORSTATUS_COMMITFAILED = 14;
SNMP_ERRORSTATUS_UNDOFAILED = 15;
SNMP_ERRORSTATUS_AUTHORIZATIONERROR = 16;
SNMP_ERRORSTATUS_NOTWRITABLE = 17;
SNMP_ERRORSTATUS_INCONSISTENTNAME = 18;

{ SNMPv1 Trap Types }

SNMP_GENERICTRAP_COLDSTART = 0;
SNMP_GENERICTRAP_WARMSTART = 1;
SNMP_GENERICTRAP_LINKDOWN = 2;
SNMP_GENERICTRAP_LINKUP = 3;
SNMP_GENERICTRAP_AUTHFAILURE = 4;
SNMP_GENERICTRAP_EGPNEIGHLOSS = 5;
SNMP_GENERICTRAP_ENTERSPECIFIC = 6;

{ SNMP Access Types }

SNMP_ACCESS_NONE = 0;
SNMP_ACCESS_NOTIFY = 1;
SNMP_ACCESS_READ_ONLY = 2;
SNMP_ACCESS_READ_WRITE = 3;
SNMP_ACCESS_READ_CREATE = 4;



 
Andrey Klimov   (2001-09-28 16:13) [12]

{ SNMP API Return Code Definitions }

SNMPAPI_NOERROR = BOOL(TRUE);
SNMPAPI_ERROR = BOOL(FALSE);

{ SNMP Extension API Prototypes }

function SnmpExtensionInit(dwUptimeReference: DWORD; phSubagentTrapEvent: PHandle;
pFirstSupportedRegion: PAsnObjectIdentifier): BOOL; stdcall;

function SnmpExtensionInitEx(pNextSupportedRegion: PAsnObjectIdentifier): BOOL; stdcall;

function SnmpExtensionQuery(bPduType: BYTE; pVarBindList: PSnmpVarBindList;
pErrorStatus, pErrorIndex: PAsnInteger32): BOOL; stdcall;

function SnmpExtensionQueryEx(nRequestType, nTransactionId: UINT;
pVarBindList: PSnmpVarBindList; pContextInfo: PAsnOctetString;
pErrorStatus, pErrorIndex: PAsnInteger32): BOOL; stdcall;

function SnmpExtensionTrap(pEnterpriseOid: PAsnObjectIdentifier;
pGenericTrapId, pSpecificTrapId: PAsnInteger32; pTimeStamp: PAsnTimeticks;
pVarBindList: PSnmpVarBindList): BOOL; stdcall;

procedure SnmpExtensionClose; stdcall;

{ SNMP Extension API Type Definitions }

type
TSnmpExtensionInit = function(dwUptimeReference: DWORD; phSubagentTrapEvent: PHandle;
pFirstSupportedRegion: PAsnObjectIdentifier): BOOL; stdcall;

TSnmpExtensionInitEx = function(pNextSupportedRegion: PAsnObjectIdentifier): BOOL; stdcall;

TSnmpExtensionQuery = function(bPduType: BYTE; pVarBindList: PSnmpVarBindList;
pErrorStatus, pErrorIndex: PAsnInteger32): BOOL; stdcall;

TSnmpExtensionQueryEx = function(nRequestType, nTransactionId: UINT;
pVarBindList: PSnmpVarBindList; pContextInfo: PAsnOctetString;
pErrorStatus, pErrorIndex: PAsnInteger32): BOOL; stdcall;

TSnmpExtensionTrap = function(pEnterpriseOid: PAsnObjectIdentifier;
pGenericTrapId, pSpecificTrapId: PAsnInteger32; pTimeStamp: PAsnTimeticks;
pVarBindList: PSnmpVarBindList): BOOL; stdcall;

TSnmpExtensionClose = procedure; stdcall;



 
Andrey Klimov   (2001-09-28 16:13) [13]

{ SNMP API Prototypes }

function SnmpUtilOidCpy(pOidDst, pOidSrc: PAsnObjectIdentifier): Integer; stdcall;
function SnmpUtilOidAppend(pOidDst, pOidSrc: PAsnObjectIdentifier): Integer; stdcall;
function SnmpUtilOidNCmp(pOid1, pOid2: PAsnObjectIdentifier; nSubIds: UINT): Integer; stdcall;
function SnmpUtilOidCmp(pOid1, pOid2: PAsnObjectIdentifier): Integer; stdcall;
procedure SnmpUtilOidFree(pOid: PAsnObjectIdentifier); stdcall;
function SnmpUtilOctetsCmp(pOctets1, pOctets2: PAsnOctetString): Integer; stdcall;
function SnmpUtilOctetsNCmp(pOctets1, pOctets2: PAsnOctetString; nChars: UINT): Integer; stdcall;
function SnmpUtilOctetsCpy(pOctetsDst, pOctetsSrc: PAsnOctetString): Integer; stdcall;
procedure SnmpUtilOctetsFree(pOctets: PAsnOctetString); stdcall;
function SnmpUtilAsnAnyCpy(pAnyDst, pAnySrc: PAsnAny): Integer; stdcall;
procedure SnmpUtilAsnAnyFree(pAny: PAsnAny); stdcall;
function SnmpUtilVarBindCpy(pVbDst, pVbSrc: PSnmpVarBind): Integer; stdcall;
procedure SnmpUtilVarBindFree(pVb: PSnmpVarBind); stdcall;
function SnmpUtilVarBindListCpy(pVblDst, pVblSrc: PSnmpVarBindList): Integer; stdcall;
procedure SnmpUtilVarBindListFree(pVbl: PSnmpVarBindList); stdcall;
procedure SnmpUtilMemFree(pMem: Pointer); stdcall;
function SnmpUtilMemAlloc(nBytes: UINT): Pointer; stdcall;
function SnmpUtilMemReAlloc(pMem: Pointer; nBytes: UINT): Pointer; stdcall;
function SnmpUtilOidToA(Oid: PAsnObjectIdentifier): LPSTR; stdcall;
function SnmpUtilIdsToA(Ids: PUINT; IdLength: UINT): LPSTR; stdcall;
procedure SnmpUtilPrintOid(Oid: PAsnObjectIdentifier); stdcall;
procedure SnmpUtilPrintAsnAny(pAny: PAsnAny); stdcall;
function SnmpSvcGetUptime: DWORD; stdcall;
procedure SnmpSvcSetLogLevel(nLogLevel: Integer); stdcall;
procedure SnmpSvcSetLogType(nLogType: Integer); stdcall;

{ SNMP Debugging Definitions }

const
SNMP_LOG_SILENT = $0;
SNMP_LOG_FATAL = $1;
SNMP_LOG_ERROR = $2;
SNMP_LOG_WARNING = $3;
SNMP_LOG_TRACE = $4;
SNMP_LOG_VERBOSE = $5;

SNMP_OUTPUT_TO_CONSOLE = $1;
SNMP_OUTPUT_TO_LOGFILE = $2;
SNMP_OUTPUT_TO_EVENTLOG = $4;
SNMP_OUTPUT_TO_DEBUGGER = $8;

{ Miscellaneous definitions }

DEFAULT_SNMP_PORT_UDP = 161;
DEFAULT_SNMP_PORT_IPX = 36879;
DEFAULT_SNMPTRAP_PORT_UDP = 162;
DEFAULT_SNMPTRAP_PORT_IPX = 36880;

SNMP_MAX_OID_LEN = 128;

{ API Error Code Definitions }

SNMP_MEM_ALLOC_ERROR = 1;
SNMP_BERAPI_INVALID_LENGTH = 10;
SNMP_BERAPI_INVALID_TAG = 11;
SNMP_BERAPI_OVERFLOW = 12;
SNMP_BERAPI_SHORT_BUFFER = 13;
SNMP_BERAPI_INVALID_OBJELEM = 14;
SNMP_PDUAPI_UNRECOGNIZED_PDU = 20;
SNMP_PDUAPI_INVALID_ES = 21;
SNMP_PDUAPI_INVALID_GT = 22;
SNMP_AUTHAPI_INVALID_VERSION = 30;
SNMP_AUTHAPI_INVALID_MSG_TYPE = 31;
SNMP_AUTHAPI_TRIV_AUTH_FAILED = 32;

implementation


 
Andrey Klimov   (2001-09-28 16:14) [14]


const
miblib = "inetmib1.dll"; //Import Library: User-defined.
snmpapi = "snmpapi.dll";

function SnmpExtensionInit; external miblib name "SnmpExtensionInit";
function SnmpExtensionInitEx; external miblib name "SnmpExtensionInitEx";
function SnmpExtensionQuery; external miblib name "SnmpExtensionQuery";
function SnmpExtensionQueryEx; external miblib name "SnmpExtensionQueryEx";
function SnmpExtensionTrap; external miblib name "SnmpExtensionTrap";
procedure SnmpExtensionClose; external miblib name "SnmpExtensionClose";

function SnmpUtilOidCpy; external snmpapi name "SnmpUtilOidCpy";
function SnmpUtilOidAppend; external snmpapi name "SnmpUtilOidAppend";
function SnmpUtilOidNCmp; external snmpapi name "SnmpUtilOidNCmp";
function SnmpUtilOidCmp; external snmpapi name "SnmpUtilOidCmp";
procedure SnmpUtilOidFree; external snmpapi name "SnmpUtilOidFree";
function SnmpUtilOctetsCmp; external snmpapi name "SnmpUtilOctetsCmp";
function SnmpUtilOctetsNCmp; external snmpapi name "SnmpUtilOctetsNCmp";
function SnmpUtilOctetsCpy; external snmpapi name "SnmpUtilOctetsCpy";
procedure SnmpUtilOctetsFree; external snmpapi name "SnmpUtilOctetsFree";
function SnmpUtilAsnAnyCpy; external snmpapi name "SnmpUtilAsnAnyCpy";
procedure SnmpUtilAsnAnyFree; external snmpapi name "SnmpUtilAsnAnyFree";
function SnmpUtilVarBindCpy; external snmpapi name "SnmpUtilVarBindCpy";
procedure SnmpUtilVarBindFree; external snmpapi name "SnmpUtilVarBindFree";
function SnmpUtilVarBindListCpy; external snmpapi name "SnmpUtilVarBindListCpy";
procedure SnmpUtilVarBindListFree; external snmpapi name "SnmpUtilVarBindListFree";
procedure SnmpUtilMemFree; external snmpapi name "SnmpUtilMemFree";
function SnmpUtilMemAlloc; external snmpapi name "SnmpUtilMemAlloc";
function SnmpUtilMemReAlloc; external snmpapi name "SnmpUtilMemReAlloc";
function SnmpUtilOidToA; external snmpapi name "SnmpUtilOidToA";
function SnmpUtilIdsToA; external snmpapi name "SnmpUtilIdsToA";
procedure SnmpUtilPrintOid; external snmpapi name "SnmpUtilPrintOid";
procedure SnmpUtilPrintAsnAny; external snmpapi name "SnmpUtilPrintAsnAny";
function SnmpSvcGetUptime; external snmpapi name "SnmpSvcGetUptime";
procedure SnmpSvcSetLogLevel; external snmpapi name "SnmpSvcSetLogLevel";
procedure SnmpSvcSetLogType; external snmpapi name "SnmpSvcSetLogType";

end.


 
Giga-Byte   (2001-11-22 02:44) [15]

Ого, а выложить ссылку на текствик не мог??? Так бы легче было всем, в том числе и админу сыйта!!!!!!!!



Страницы: 1 вся ветка

Форум: "Сети";
Текущий архив: 2002.02.11;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.52 MB
Время: 0.006 c
3-32120
olban
2002-01-15 12:50
2002.02.11
Трехзвенная система


1-32210
VictorT
2002-01-25 17:26
2002.02.11
TMaskEdit


3-32144
Doctor Vrach
2002-01-15 20:09
2002.02.11
Помогите плиз - надо чтобы во время сложного запроса основное окно программы реагировало


14-32340
DarK sPiRiT
2001-12-22 18:26
2002.02.11
Бинарная очередь в Делфи


3-32131
Yakudza
2002-01-14 20:17
2002.02.11
Как узнать что строчка в DBGrid последняя ?





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский