|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.adventnet.snmp.snmp2.ASN1Parser
Implements the ASN1Parser that contains the decode and encode methods. You need to instantiate this class to decode/encode an SNMP message.
An instance of the ASN1Parser is instantiated when a SNMP message is created. Each instance of the SNMP message consists of an SnmpPDU and an ASN1Parser. The ASN1Parser keeps track of the state how far a message is decoded.
and SnmpPDU
, Serialized FormMethod Summary | |
int |
decodeInteger()
Decodes an ASN.1 Integer Only the least significant 4 bytes are retained |
int |
decodeLength()
Decodes an ASN.1 length field of an SNMP packet. |
long[] |
decodeLong()
Decodes an ASN.1 Long Only the least significant 8 bytes are retained |
byte[] |
decodeOctetString()
Decodes an ASN.1 Octet string. |
int[] |
decodeOID()
Decodes an ASN.1 Object Identifier. |
void |
decodeVarBindList(java.util.Vector variables)
|
void |
decrypt(byte[] key,
byte[] privParms,
int protocol,
SecurityModelEntry utils)
Decrypts the data. |
void |
encodeCommand(byte command)
Encodes the command. |
void |
encodeEnterprise(SnmpOID enterprise)
Encodes the enterprise. |
void |
encodeInt(int value)
Encodes the data type int. |
void |
encodeIPAddress(SnmpString addr)
Encodes the IPAddress. |
void |
encodeOctets(byte[] buf,
int length)
Encodes the octets specified. |
void |
encodeSequence()
This method encodes the sequence. |
void |
encodeSequence(byte type)
This method encodes the sequence. |
void |
encodeSequence(int length)
This method encodes the sequence. |
void |
encodeSequence(int length,
byte type)
This method encodes the sequence. |
void |
encodeString(java.lang.String str)
Encodes the data type string. |
void |
encodeUInt(int value)
Encodes the data type unsigned int. |
void |
encodeVarBindList(java.util.Vector variables)
Encodes the VarBindList. |
void |
encrypt(byte[] key,
byte[] privParms,
int protocol,
SecurityModelEntry utils)
Encrypts the data. |
int |
getBookMark()
This method returns the bookmark value. |
byte[] |
getData()
Returns the data. |
int |
getIndex()
Returns the message index value. |
int |
getPosition()
This method returns the position in the buffer where the the data will be encoded/decoded. |
byte[] |
getReceivedData()
Returns the data. |
byte |
getTag()
This method is used to get the tag from a received SNMP message. |
boolean |
isInteger()
This method is used to check whether the tag is an integer. |
boolean |
isIPAddress()
This method is used to check whether the tag is an IP address. |
boolean |
isMessageSequence()
This method is used to check whether the tag is a message sequence. |
boolean |
isOctetString()
This method is used to check whether the tag is an octet string. |
boolean |
isOID()
This method is used to check whether the tag is an OID. |
boolean |
isTimeTicks()
This method is used to check whether the tag is a TimeTicks. |
void |
setBookMark()
This method sets the bookmark. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public int decodeLength() throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
- When there is insufficient space in buffer.public int decodeInteger() throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
- When there is insufficient space in buffer.public long[] decodeLong() throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
- When there is insufficient space in buffer.public byte[] decodeOctetString() throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
- When there is insufficient space in buffer.public int[] decodeOID() throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
- When there is insufficient space in buffer.public boolean isMessageSequence()
public boolean isInteger()
public boolean isOctetString()
public boolean isOID()
public boolean isIPAddress()
public boolean isTimeTicks()
public byte getTag()
public void decodeVarBindList(java.util.Vector variables) throws SnmpException
SnmpException
- is thrown whenever an error occurs.public void encodeSequence()
public void setBookMark()
public int getBookMark()
public int getPosition()
public int getIndex()
public void encodeSequence(byte type)
type
- the datatypepublic void encodeSequence(int length)
public void encodeSequence(int length, byte type)
type
- the datatypelength
- the length of data.public void encodeInt(int value)
value
- the int value.public void encodeUInt(int value)
value
- the unsigned int value.public void encodeString(java.lang.String str)
str
- the string value.public void encodeOctets(byte[] buf, int length)
buf
- the value to be encoded.length
- the length of the value to be encoded.public void encodeIPAddress(SnmpString addr)
addr
- The value to be encoded.public void encodeEnterprise(SnmpOID enterprise)
enterprise
- The value to be encoded.public void encodeCommand(byte command)
command
- The value to be encoded.public void encodeVarBindList(java.util.Vector variables)
variables
- The value to be encoded.public void encrypt(byte[] key, byte[] privParms, int protocol, SecurityModelEntry utils) throws SnmpException
key
- The key value used in encryption.privParms
- The privacy params used in encryption.protocol
- The protocol used in encryption.utils
- The SecurityModelEntry implementation instance.SnmpException
- if errors were encountered while encryption.public void decrypt(byte[] key, byte[] privParms, int protocol, SecurityModelEntry utils) throws SnmpException
key
- The key value used in decryption.privParms
- The privacy params used in decryption.protocol
- The protocol used in decryption.utils
- The SecurityModelEntry implementation instance.SnmpException
- if errors were encountered while decryption.public byte[] getReceivedData()
public byte[] getData()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |