snmp
Class SNMPBERCodec

java.lang.Object
  extended bysnmp.SNMPBERCodec

public class SNMPBERCodec
extends java.lang.Object

SNMPBERCodec defines methods for converting from ASN.1 BER encoding to SNMPObject subclasses. The extraction process usually produces a tree structure of objects with an SNMPSequence object at the root; this is the usual behavior when a received encoded message is received from an SNMP device.


Field Summary
static byte SNMPBITSTRING
           
static byte SNMPCOUNTER32
           
static byte SNMPCOUNTER64
           
static byte SNMPGAUGE32
           
static byte SNMPGETNEXTREQUEST
           
static byte SNMPGETREQUEST
           
static byte SNMPGETRESPONSE
           
static byte SNMPINTEGER
           
static byte SNMPIPADDRESS
           
static byte SNMPNSAPADDRESS
           
static byte SNMPNULL
           
static byte SNMPOBJECTIDENTIFIER
           
static byte SNMPOCTETSTRING
           
static byte SNMPOPAQUE
           
static byte SNMPSEQUENCE
           
static byte SNMPSETREQUEST
           
static byte SNMPTIMETICKS
           
static byte SNMPTRAP
           
static byte SNMPUINTEGER32
           
static byte SNMPUNKNOWNOBJECT
           
static byte SNMPv2BULKREQUEST
           
static byte SNMPv2INFORMREQUEST
           
static byte SNMPv2pAUTHORIZEDMESSAGE
           
static byte SNMPv2pCOMMUNICATION
           
static byte SNMPv2pENCRYPTEDDATA
           
static byte SNMPv2pENCRYPTEDMESSAGE
           
static byte SNMPv2TRAP
           
 
Constructor Summary
SNMPBERCodec()
           
 
Method Summary
static byte[] encodeLength(int length)
          Utility function for encoding a length as a BER byte sequence
static SNMPObject extractEncoding(snmp.SNMPTLV theTLV)
          Extracts an SNMP object given its type, length, value triple as an SNMPTLV object.
static snmp.SNMPTLV extractNextTLV(byte[] enc, int position)
          Extracts the type, length and value of the SNMP object whose BER encoding begins at the specified position in the given byte array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SNMPINTEGER

public static final byte SNMPINTEGER
See Also:
Constant Field Values

SNMPBITSTRING

public static final byte SNMPBITSTRING
See Also:
Constant Field Values

SNMPOCTETSTRING

public static final byte SNMPOCTETSTRING
See Also:
Constant Field Values

SNMPNULL

public static final byte SNMPNULL
See Also:
Constant Field Values

SNMPOBJECTIDENTIFIER

public static final byte SNMPOBJECTIDENTIFIER
See Also:
Constant Field Values

SNMPSEQUENCE

public static final byte SNMPSEQUENCE
See Also:
Constant Field Values

SNMPIPADDRESS

public static final byte SNMPIPADDRESS
See Also:
Constant Field Values

SNMPCOUNTER32

public static final byte SNMPCOUNTER32
See Also:
Constant Field Values

SNMPGAUGE32

public static final byte SNMPGAUGE32
See Also:
Constant Field Values

SNMPTIMETICKS

public static final byte SNMPTIMETICKS
See Also:
Constant Field Values

SNMPOPAQUE

public static final byte SNMPOPAQUE
See Also:
Constant Field Values

SNMPNSAPADDRESS

public static final byte SNMPNSAPADDRESS
See Also:
Constant Field Values

SNMPCOUNTER64

public static final byte SNMPCOUNTER64
See Also:
Constant Field Values

SNMPUINTEGER32

public static final byte SNMPUINTEGER32
See Also:
Constant Field Values

SNMPGETREQUEST

public static final byte SNMPGETREQUEST
See Also:
Constant Field Values

SNMPGETNEXTREQUEST

public static final byte SNMPGETNEXTREQUEST
See Also:
Constant Field Values

SNMPGETRESPONSE

public static final byte SNMPGETRESPONSE
See Also:
Constant Field Values

SNMPSETREQUEST

public static final byte SNMPSETREQUEST
See Also:
Constant Field Values

SNMPTRAP

public static final byte SNMPTRAP
See Also:
Constant Field Values

SNMPv2pCOMMUNICATION

public static final byte SNMPv2pCOMMUNICATION
See Also:
Constant Field Values

SNMPv2pAUTHORIZEDMESSAGE

public static final byte SNMPv2pAUTHORIZEDMESSAGE
See Also:
Constant Field Values

SNMPv2pENCRYPTEDMESSAGE

public static final byte SNMPv2pENCRYPTEDMESSAGE
See Also:
Constant Field Values

SNMPv2BULKREQUEST

public static final byte SNMPv2BULKREQUEST
See Also:
Constant Field Values

SNMPv2INFORMREQUEST

public static final byte SNMPv2INFORMREQUEST
See Also:
Constant Field Values

SNMPv2TRAP

public static final byte SNMPv2TRAP
See Also:
Constant Field Values

SNMPv2pENCRYPTEDDATA

public static final byte SNMPv2pENCRYPTEDDATA
See Also:
Constant Field Values

SNMPUNKNOWNOBJECT

public static final byte SNMPUNKNOWNOBJECT
See Also:
Constant Field Values
Constructor Detail

SNMPBERCodec

public SNMPBERCodec()
Method Detail

extractEncoding

public static SNMPObject extractEncoding(snmp.SNMPTLV theTLV)
                                  throws SNMPBadValueException
Extracts an SNMP object given its type, length, value triple as an SNMPTLV object. Called by SNMPObject subclass constructors.

Throws:
SNMPBadValueException - Indicates byte array in value field is uninterprettable for specified SNMP object type.

extractNextTLV

public static snmp.SNMPTLV extractNextTLV(byte[] enc,
                                          int position)
                                   throws SNMPBadValueException
Extracts the type, length and value of the SNMP object whose BER encoding begins at the specified position in the given byte array. Throws an SNMPBadValueException if there's any problem with the extraction.

Throws:
SNMPBadValueException

encodeLength

public static byte[] encodeLength(int length)
Utility function for encoding a length as a BER byte sequence