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.
# File lib/snmp/pdu.rb, line 246 def encode encode_pdu(SNMPv2_Trap_PDU_TAG) end
Returns the value of the mandatory sysUpTime varbind for this trap.
Throws InvalidTrapVarbind if the sysUpTime varbind is not present.
# File lib/snmp/pdu.rb, line 261 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 snmpTrapOID varbind for this trap.
Throws InvalidTrapVarbind if the snmpTrapOID varbind is not present.
# File lib/snmp/pdu.rb, line 275 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
Generated with the Darkfish Rdoc Generator 2.