org.opennms.protocols.snmp
Class SnmpV2Error
java.lang.Object
|
+--org.opennms.protocols.snmp.SnmpV2Error
- All Implemented Interfaces:
- Cloneable, Serializable, 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:
- $Revision: 1.6 $
- Author:
- Brian Weaver
- See Also:
- Serialized Form
Field Summary |
(package private) static long |
serialVersionUID
Changes to define new serialzation formats. |
Method Summary |
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. |
Methods inherited from class java.lang.Object |
, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
serialVersionUID
static final long serialVersionUID
- Changes to define new serialzation formats.
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
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 interface SnmpSyntax
- 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 interface SnmpSyntax
- 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.
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 interface SnmpSyntax
- 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.
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 interface SnmpSyntax
- 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.
- Overrides:
clone
in class Object
- Returns:
- A newly created object that is a duplicate
of self