class SNMP::SNMPv2_Trap
The PDU
class for traps in SNMPv2c. Methods are provided for retrieving the values of the mandatory varbinds: the system uptime and the OID of the trap. The complete varbind list is available through the usual varbind_list method. The first two varbinds in this list will always be the uptime and trap OID varbinds.
Attributes
Returns the source IP address for the trap, usually derived from the source IP address of the packet that delivered the trap.
Public Instance Methods
Source
# File lib/snmp/pdu.rb, line 271 def encode encode_pdu(BER::SNMPv2_Trap_PDU_TAG) end
Source
# File lib/snmp/pdu.rb, line 286 def sys_up_time varbind = @varbind_list[0] if varbind && (varbind.name == SYS_UP_TIME_OID) return varbind.value else raise InvalidTrapVarbind, "Expected sysUpTime.0, found " + varbind.to_s end end
Returns the value of the mandatory sysUpTime varbind for this trap.
Throws InvalidTrapVarbind
if the sysUpTime varbind is not present.
Source
# File lib/snmp/pdu.rb, line 300 def trap_oid varbind = @varbind_list[1] if varbind && (varbind.name == SNMP_TRAP_OID_OID) return varbind.value else raise InvalidTrapVarbind, "Expected snmpTrapOID.0, found " + varbind.to_s end end
Returns the value of the mandatory snmpTrapOID varbind for this trap.
Throws InvalidTrapVarbind
if the snmpTrapOID varbind is not present.