Package org.opennms.protocols.snmp
Class SnmpV2Error
- java.lang.Object
-
- org.opennms.protocols.snmp.SnmpV2Error
-
- All Implemented Interfaces:
Serializable
,Cloneable
,SnmpSyntax
- Direct Known Subclasses:
SnmpEndOfMibView
,SnmpNoSuchInstance
,SnmpNoSuchObject
public abstract class SnmpV2Error extends Object implements SnmpSyntax, Cloneable, Serializable
This class provides the base class for the SNMP V2 error class. In SNMPv2 an agent may respond to individual variables with one of three errors: End-of-Mib-View, No-Such-Instance, or No-Such-Object. Each of the error conditions are derived from this base class. By responding to error in this way the agent can still return valid variables while informing the manager of the variables in error. For more information see "SNMP, SNMPv2, SNMPv3, and RMON 1 and 2, 3rd Ed" by William Stallings. (ISBN 0-201-48534-6)- Version:
- 1.1.1.1
- Author:
- Brian Weaver
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SnmpV2Error()
Default constructor.SnmpV2Error(SnmpV2Error second)
Copy constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Object
clone()
Returns a duplicate of the current object.int
decodeASN(byte[] buf, int offset, AsnEncoder encoder)
Decodes the passed buffer and updates the object to match the encoded information.abstract SnmpSyntax
duplicate()
Returns a duplicate of the current object.int
encodeASN(byte[] buf, int offset, AsnEncoder encoder)
Encodes the SNMPv2 error into the passed buffer using the encoder object.abstract byte
typeId()
Returns the ASN.1 type identifier for the SNMPv2 error.
-
-
-
Constructor Detail
-
SnmpV2Error
public SnmpV2Error()
Default constructor. Provided to give the derived classes a meaningful way to initialize themself by calling super(). The method performs no useful function.
-
SnmpV2Error
public SnmpV2Error(SnmpV2Error second)
Copy constructor. Provided to give the derived classes a meaningful way to initialize themself by calling super(second). The method performs no useful fuction.- Parameters:
second
- The object to copy to self
-
-
Method Detail
-
typeId
public abstract byte typeId()
Returns the ASN.1 type identifier for the SNMPv2 error. Defined abstract to fulfill the interface contract.- Specified by:
typeId
in interfaceSnmpSyntax
- Returns:
- The ASN.1 type identifier
-
encodeASN
public int encodeASN(byte[] buf, int offset, AsnEncoder encoder) throws AsnEncodingException
Encodes the SNMPv2 error into the passed buffer using the encoder object. If an encoding exception occurs then an exception is thrown.- Specified by:
encodeASN
in interfaceSnmpSyntax
- Parameters:
buf
- The buffer to store encoded bytesoffset
- The start of the encoding locationencoder
- The encoding object- Returns:
- The index of the byte immedantly after the last encoded byte.
- Throws:
AsnEncodingException
- Thrown if an encoding error occurs
-
decodeASN
public int decodeASN(byte[] buf, int offset, AsnEncoder encoder) throws AsnDecodingException
Decodes the passed buffer and updates the object to match the encoded information. The encoded information is recovered using the encoder object.- Specified by:
decodeASN
in interfaceSnmpSyntax
- Parameters:
buf
- The encoded bufferoffset
- The offset of the first byte of encoded dataencoder
- The object used to decode the data.- Returns:
- The index of the byte immedantly after the last encoded byte.
- Throws:
AsnDecodingException
- Thrown if an encoding error occurs
-
duplicate
public abstract SnmpSyntax duplicate()
Returns a duplicate of the current object. The duplicate object is a new object and any changes will not be reflected in the source object. This is identical to creating a new object using the copy constructor.- Specified by:
duplicate
in interfaceSnmpSyntax
- Returns:
- A newly created object that is a duplicate of self.
-
clone
public abstract Object clone()
Returns a duplicate of the current object. The duplicate object is a newly created object and any changes made to the returned object will not be reflected in the source.
-
-