SYNAPSE - Synchronous TCP/IP Library for Delphi
Other related information can be found at http://www.ararat.cz/synapse/
Class: TSNMPMib (data object with one record of MIB Oid and their value)
- Properties:
- Oid:string
Oid number in string format.
- Value:string
Value of Oid object in string format.
- ValueType: integer
Define type of Value. Supported values are: ASN1_INT, ASN1_OCTSTR, ASN1_NULL, ASN1_OBJID, ASN1_SEQ, ASN1_IPADDR, ASN1_COUNTER, ASN1_GAUGE, ASN1_TIMETICKS. For queries use ASN1_NULL, becouse you don't know type in response.
Class: TSNMPrec (data object abstracts SNMP data packet)
- Properties:
- version:integer
Version of SNMP packet. Default value is 0 (SNMP ver. 1).
- community:string
Community string for autorize access to SNMP server. (Case sensitive!)
- PDUType:integer
Define type of SNMP operation. Supported values are: PDUGetRequest, PDUGetNextRequest, PDUSetRequest.
- ID:integer
Contains ID number. Not need to use.
- ErrorStatus
vhen packet is reply, contains error code. Supported values are: ENoError, ETooBig, ENoSuchName, EBadValue, EReadOnly, EGenErr.
- ErrorIndex:integer
Point to error position in reply packet. Not usefull for users.
- SNMPMibList: TList
List of TSNMPMib objects.
- Methods:
- Procedure DecodeBuf(Buffer:string)
Decode SNMP packet in buffer to object properties.
- Function EncodeBuf:string
Encode obejct properties to SNMP packet.
- Procedure Clear
Clears all object properties to default values.
- Procedure MIBAdd(MIB,Value:string;ValueType:integer)
Add entry to SNMPMibList. For query use value as empty string, and ValueType as ASN1_NULL.
- Procedure MIBdelete(Index:integer)
Delete entry from SNMPMibList.
- Function MIBGet(MIB:string):string
Search SNMPMibList list for MIB and return correspond value.
Class: TSNMPSend
- Properties:
- Timeout:integer
Define timeout in millisecond for all SNMP operations. Default value is 5 seconds.
- host:String
Address of SNMP server (IP address or domain name) where you want to connect.
- Query:TSNMPrec
Data object contains SNMP query.
- Reply:TSNMPrec
Data object contains SNMP reply.
- Methods:
- Function DoIt:boolean
Connects to a Host and send there query. If in timeout SNMP server send back query, result is true.
- Not class (but cohere) functions:
- Function SNMPget (Oid, Community, SNMPHost:string; var Value:string):Boolean
This is useful function and example of use TSNMPSend object. It implement basic GET method of SNMP protocol. If SNMP operation successful, result is true. Then value is readed value of requested MIB Oid from Host with Community access identifier.
- Function SNMPSet(Oid, Community, SNMPHost, Value: string; ValueType: integer): boolean
This is useful function and example of use TSNMPSend object. It implement basic SET method of SNMP protocol. If SNMP operation successful, result is true. Value is value of MIB Oid for Host with Community access identifier. You must specify ValueType too.