snmp
Class SNMPBERCodec

java.lang.Object
  |
  +--snmp.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 SNMPUINTEGER32
           
static byte SNMPUNKNOWNOBJECT
           
static byte SNMPv2pAUTHORIZEDMESSAGE
           
static byte SNMPv2pCOMMUNICATION
           
static byte SNMPv2pENCRYPTEDDATA
           
static byte SNMPv2pENCRYPTEDMESSAGE
           
 
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

SNMPBITSTRING

public static final byte SNMPBITSTRING

SNMPOCTETSTRING

public static final byte SNMPOCTETSTRING

SNMPNULL

public static final byte SNMPNULL

SNMPOBJECTIDENTIFIER

public static final byte SNMPOBJECTIDENTIFIER

SNMPSEQUENCE

public static final byte SNMPSEQUENCE

SNMPIPADDRESS

public static final byte SNMPIPADDRESS

SNMPCOUNTER32

public static final byte SNMPCOUNTER32

SNMPGAUGE32

public static final byte SNMPGAUGE32

SNMPTIMETICKS

public static final byte SNMPTIMETICKS

SNMPOPAQUE

public static final byte SNMPOPAQUE

SNMPNSAPADDRESS

public static final byte SNMPNSAPADDRESS

SNMPCOUNTER64

public static final byte SNMPCOUNTER64

SNMPUINTEGER32

public static final byte SNMPUINTEGER32

SNMPGETREQUEST

public static final byte SNMPGETREQUEST

SNMPGETNEXTREQUEST

public static final byte SNMPGETNEXTREQUEST

SNMPGETRESPONSE

public static final byte SNMPGETRESPONSE

SNMPSETREQUEST

public static final byte SNMPSETREQUEST

SNMPv2pCOMMUNICATION

public static final byte SNMPv2pCOMMUNICATION

SNMPv2pAUTHORIZEDMESSAGE

public static final byte SNMPv2pAUTHORIZEDMESSAGE

SNMPv2pENCRYPTEDMESSAGE

public static final byte SNMPv2pENCRYPTEDMESSAGE

SNMPv2pENCRYPTEDDATA

public static final byte SNMPv2pENCRYPTEDDATA

SNMPUNKNOWNOBJECT

public static final byte SNMPUNKNOWNOBJECT
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)
Extracts the type, length and value of the SNMP object whose BER encoding begins at the specified position in the given byte array. (??what about errors??)

encodeLength

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