snmp
Class SNMPv2TrapPDU

java.lang.Object
  extended bysnmp.SNMPObject
      extended bysnmp.SNMPSequence
          extended bysnmp.SNMPPDU
              extended bysnmp.SNMPv2TrapPDU

public class SNMPv2TrapPDU
extends SNMPPDU

The SNMPv2TrapPDU class represents an SNMPv2 Trap PDU from RFC 1448, as indicated below. This forms the payload of an SNMPv2 Trap message. -- protocol data units 3. Definitions SNMPv2-PDU DEFINITIONS ::= BEGIN IMPORTS ObjectName, ObjectSyntax, Integer32 FROM SNMPv2-SMI; -- protocol data units PDUs ::= CHOICE { get-request GetRequest-PDU, get-next-request GetNextRequest-PDU, get-bulk-request GetBulkRequest-PDU, response Response-PDU, set-request SetRequest-PDU, inform-request InformRequest-PDU, snmpV2-trap SNMPv2-Trap-PDU } -- PDUs GetRequest-PDU ::= [0] IMPLICIT PDU GetNextRequest-PDU ::= [1] IMPLICIT PDU Response-PDU ::= [2] IMPLICIT PDU SetRequest-PDU ::= [3] IMPLICIT PDU -- [4] is obsolete GetBulkRequest-PDU ::= [5] IMPLICIT BulkPDU InformRequest-PDU ::= [6] IMPLICIT PDU SNMPv2-Trap-PDU ::= [7] IMPLICIT PDU max-bindings INTEGER ::= 2147483647 PDU ::= SEQUENCE { request-id Integer32, error-status -- sometimes ignored INTEGER { noError(0), tooBig(1), noSuchName(2), -- for proxy compatibility badValue(3), -- for proxy compatibility readOnly(4), -- for proxy compatibility genErr(5), noAccess(6), wrongType(7), wrongLength(8), wrongEncoding(9), wrongValue(10), noCreation(11), inconsistentValue(12), resourceUnavailable(13), commitFailed(14), undoFailed(15), authorizationError(16), notWritable(17), inconsistentName(18) }, error-index -- sometimes ignored INTEGER (0..max-bindings), variable-bindings -- values are sometimes ignored VarBindList }


Field Summary
 
Fields inherited from class snmp.SNMPSequence
sequence, tag
 
Constructor Summary
protected SNMPv2TrapPDU(byte[] enc)
          Create a new PDU of the specified type from the supplied BER encoding.
  SNMPv2TrapPDU(SNMPObjectIdentifier snmpTrapOID, SNMPTimeTicks sysUptime)
          Create a new Trap PDU with given trapOID and sysUptime, and containing an empty SNMP sequence (VarBindList) as additional data.
  SNMPv2TrapPDU(SNMPTimeTicks sysUptime, SNMPObjectIdentifier snmpTrapOID, SNMPSequence varList)
          Create a new Trap PDU with given trapOID and sysUptime, and containing the supplied SNMP sequence as data.
 
Method Summary
 SNMPObjectIdentifier getSNMPTrapOID()
          A utility method that extracts the snmpTrapOID from the variable bind list (it's the second of the variable pairs).
 SNMPTimeTicks getSysUptime()
          A utility method that extracts the sysUptime from the variable bind list (it's the first of the variable pairs).
 
Methods inherited from class snmp.SNMPPDU
getErrorIndex, getErrorStatus, getPDUType, getRequestID, getVarBindList
 
Methods inherited from class snmp.SNMPSequence
addSNMPObject, extractFromBEREncoding, getBEREncoding, getSNMPObjectAt, getValue, insertSNMPObjectAt, setValue, size, toString
 
Methods inherited from class snmp.SNMPObject
equals, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SNMPv2TrapPDU

public SNMPv2TrapPDU(SNMPTimeTicks sysUptime,
                     SNMPObjectIdentifier snmpTrapOID,
                     SNMPSequence varList)
              throws SNMPBadValueException
Create a new Trap PDU with given trapOID and sysUptime, and containing the supplied SNMP sequence as data.


SNMPv2TrapPDU

public SNMPv2TrapPDU(SNMPObjectIdentifier snmpTrapOID,
                     SNMPTimeTicks sysUptime)
              throws SNMPBadValueException
Create a new Trap PDU with given trapOID and sysUptime, and containing an empty SNMP sequence (VarBindList) as additional data.


SNMPv2TrapPDU

protected SNMPv2TrapPDU(byte[] enc)
                 throws SNMPBadValueException
Create a new PDU of the specified type from the supplied BER encoding.

Throws:
SNMPBadValueException - Indicates invalid SNMP PDU encoding supplied in enc.
Method Detail

getSNMPTrapOID

public SNMPObjectIdentifier getSNMPTrapOID()
A utility method that extracts the snmpTrapOID from the variable bind list (it's the second of the variable pairs).


getSysUptime

public SNMPTimeTicks getSysUptime()
A utility method that extracts the sysUptime from the variable bind list (it's the first of the variable pairs).