Unit snmpsend

DescriptionusesClasses, Interfaces, Objects and RecordsFunctions and ProceduresTypesConstantsVariables

Description

SNMP client

Supports SNMPv1 include traps, SNMPv2c and SNMPv3 include authorization and privacy encryption.

Used RFC: RFC-1157, RFC-1901, RFC-3412, RFC-3414, RFC-3416, RFC-3826

Supported Authorization hashes: MD5, SHA1 Supported Privacy encryptions: DES, 3DES, AES

uses

Overview

Classes, Interfaces, Objects and Records

Name Description
Class TSNMPMib Data object with one record of MIB OID and corresponding values.
record TV3Sync It holding all information for SNMPv3 agent synchronization
Class TSNMPRec Data object abstracts SNMP data packet
Class TSNMPSend Implementation of SNMP protocol.

Functions and Procedures

function SNMPGet(const OID, Community, SNMPHost: AnsiString; var Value: AnsiString): Boolean;
function SNMPSet(const OID, Community, SNMPHost, Value: AnsiString; ValueType: Integer): Boolean;
function SNMPGetNext(var OID: AnsiString; const Community, SNMPHost: AnsiString; var Value: AnsiString): Boolean;
function SNMPGetTable(const BaseOID, Community, SNMPHost: AnsiString; const Value: TStrings): Boolean;
function SNMPGetTableElement(const BaseOID, RowID, ColID, Community, SNMPHost: AnsiString; var Value: AnsiString): Boolean;
function SendTrap(const Dest, Source, Enterprise, Community: AnsiString; Generic, Specific, Seconds: Integer; const MIBName, MIBValue: AnsiString; MIBtype: Integer): Integer;
function RecvTrap(var Dest, Source, Enterprise, Community: AnsiString; var Generic, Specific, Seconds: Integer; const MIBName, MIBValue: TStringList): Integer;

Types

TV3Flags = (...);
TV3Auth = (...);
TV3Priv = (...);

Constants

cSnmpProtocol = '161';
cSnmpTrapProtocol = '162';
SNMP_V1 = 0;
SNMP_V2C = 1;
SNMP_V3 = 3;
PDUGetRequest = $A0;
PDUGetNextRequest = $A1;
PDUGetResponse = $A2;
PDUSetRequest = $A3;
PDUTrap = $A4;
PDUGetBulkRequest = $A5;
PDUInformRequest = $A6;
PDUTrapV2 = $A7;
PDUReport = $A8;
ENoError = 0;
ETooBig = 1;
ENoSuchName = 2;
EBadValue = 3;
EReadOnly = 4;
EGenErr = 5;
ENoAccess = 6;
EWrongType = 7;
EWrongLength = 8;
EWrongEncoding = 9;
EWrongValue = 10;
ENoCreation = 11;
EInconsistentValue = 12;
EResourceUnavailable = 13;
ECommitFailed = 14;
EUndoFailed = 15;
EAuthorizationError = 16;
ENotWritable = 17;
EInconsistentName = 18;

Description

Functions and Procedures

function SNMPGet(const OID, Community, SNMPHost: AnsiString; var Value: AnsiString): Boolean;

A very useful function and example of its use would be found in the TSNMPSend object. It implements basic GET method of the SNMP protocol. The MIB value is located in the "OID" variable, and is sent to the requested "SNMPHost" with the proper "Community" access identifier. Upon a successful retrieval, "Value" will contain the information requested. If the SNMP operation is successful, the result returns True.

function SNMPSet(const OID, Community, SNMPHost, Value: AnsiString; ValueType: Integer): Boolean;

This is useful function and example of use TSNMPSend object. It implements the basic SET method of the SNMP protocol. If the SNMP operation is successful, the result is True. "Value" is value of MIB Oid for "SNMPHost" with "Community" access identifier. You must specify "ValueType" too.

function SNMPGetNext(var OID: AnsiString; const Community, SNMPHost: AnsiString; var Value: AnsiString): Boolean;

A very useful function and example of its use would be found in the TSNMPSend object. It implements basic GETNEXT method of the SNMP protocol. The MIB value is located in the "OID" variable, and is sent to the requested "SNMPHost" with the proper "Community" access identifier. Upon a successful retrieval, "Value" will contain the information requested. If the SNMP operation is successful, the result returns True.

function SNMPGetTable(const BaseOID, Community, SNMPHost: AnsiString; const Value: TStrings): Boolean;

A very useful function and example of its use would be found in the TSNMPSend object. It implements basic read of SNMP MIB tables. As BaseOID you must specify basic MIB OID of requested table (base IOD is OID without row and column specificator!) Table is readed into stringlist, where each string is comma delimited string.

Warning: this function is not have best performance. For better performance you must write your own function. best performace you can get by knowledge of structuture of table and by more then one MIB on one query.

function SNMPGetTableElement(const BaseOID, RowID, ColID, Community, SNMPHost: AnsiString; var Value: AnsiString): Boolean;

A very useful function and example of its use would be found in the TSNMPSend object. It implements basic read of SNMP MIB table element. As BaseOID you must specify basic MIB OID of requested table (base IOD is OID without row and column specificator!) As next you must specify identificator of row and column for specify of needed field of table.

function SendTrap(const Dest, Source, Enterprise, Community: AnsiString; Generic, Specific, Seconds: Integer; const MIBName, MIBValue: AnsiString; MIBtype: Integer): Integer;

A very useful function and example of its use would be found in the TSNMPSend object. It implements a TRAPv1 to send with all data in the parameters.

function RecvTrap(var Dest, Source, Enterprise, Community: AnsiString; var Generic, Specific, Seconds: Integer; const MIBName, MIBValue: TStringList): Integer;

A very useful function and example of its use would be found in the TSNMPSend object. It receives a TRAPv1 and returns all the data that comes with it.

Types

TV3Flags = (...);

Possible values for SNMPv3 flags.

This flags specify level of authorization and encryption.

TV3Auth = (...);

Type of SNMPv3 authorization

TV3Priv = (...);

Type of SNMPv3 privacy

Constants

cSnmpProtocol = '161';
 
cSnmpTrapProtocol = '162';
 
SNMP_V1 = 0;
 
SNMP_V2C = 1;
 
SNMP_V3 = 3;
 
PDUGetRequest = $A0;
 
PDUGetNextRequest = $A1;
 
PDUGetResponse = $A2;
 
PDUSetRequest = $A3;
 
PDUTrap = $A4;
 
PDUGetBulkRequest = $A5;
 
PDUInformRequest = $A6;
 
PDUTrapV2 = $A7;
 
PDUReport = $A8;
 
ENoError = 0;
 
ETooBig = 1;
 
ENoSuchName = 2;
 
EBadValue = 3;
 
EReadOnly = 4;
 
EGenErr = 5;
 
ENoAccess = 6;
 
EWrongType = 7;
 
EWrongLength = 8;
 
EWrongEncoding = 9;
 
EWrongValue = 10;
 
ENoCreation = 11;
 
EInconsistentValue = 12;
 
EResourceUnavailable = 13;
 
ECommitFailed = 14;
 
EUndoFailed = 15;
 
EAuthorizationError = 16;
 
ENotWritable = 17;
 
EInconsistentName = 18;
 
Generated by PasDoc 0.9.0 on 2012-04-23 21:38:51