MySnmpCrawler API

snmp.message.pdu
Class SnmpOid

java.lang.Object
  |
  +--org.opennms.protocols.snmp.SnmpObjectId
        |
        +--snmp.message.pdu.SnmpOid
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable, org.opennms.protocols.snmp.SnmpSyntax

public class SnmpOid
extends org.opennms.protocols.snmp.SnmpObjectId

The SnmpOid class represents an SNMP object identifier. It provides the ASN.1 syntax value of the object identifier and also the OID record in the MIB database matched to the object identifier.

Version:
$Revision: 0.1 $ $Date: 2004/03/09 06:03:52 $
Author:
Scott Cheng
See Also:
Serialized Form

Field Summary
private  java.lang.String oid
           
private  OidRecord oidRecord
           
private  SnmpVariable snmpVar
           
 
Fields inherited from class org.opennms.protocols.snmp.SnmpObjectId
ASNTYPE
 
Constructor Summary
(package private) SnmpOid()
          The default Constructor.
  SnmpOid(SnmpOid snmpOid)
          The copy Constructor constructs the SnmpOid object that is identical to the passed object.
  SnmpOid(SnmpVariable snmpVar)
          Constructs the SnmpOid object with the SnmpVariable object that contains it.
  SnmpOid(java.lang.String oid)
          Constructs the SnmpOid object with the OID string.
 
Method Summary
 int decode(byte[] buf, int offset, org.opennms.protocols.snmp.asn1.BerEncoder encoder)
          Decodes the object identifier from the passed buffer.
 int encode(byte[] buf, int offset, org.opennms.protocols.snmp.asn1.BerEncoder encoder)
          Encodes the object identifier using the passed encoder and stores the results in the passed buffer.
 java.lang.String getOid()
          Gets the OID string.
 OidRecord getOidRecord()
          Gets the OID record from the MIB database matched to the SnmpOid object.
 
Methods inherited from class org.opennms.protocols.snmp.SnmpObjectId
append, append, append, clone, compare, compare, compare, decodeASN, duplicate, encodeASN, equals, getIdentifiers, getLength, hashCode, isRootOf, prepend, prepend, prepend, setIdentifiers, setIdentifiers, toString, typeId
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

oid

private java.lang.String oid

oidRecord

private OidRecord oidRecord

snmpVar

private SnmpVariable snmpVar
Constructor Detail

SnmpOid

SnmpOid()
The default Constructor.


SnmpOid

public SnmpOid(SnmpVariable snmpVar)
Constructs the SnmpOid object with the SnmpVariable object that contains it.

Parameters:
snmpVar - The SnmpVariable object.

SnmpOid

public SnmpOid(SnmpOid snmpOid)
The copy Constructor constructs the SnmpOid object that is identical to the passed object.


SnmpOid

public SnmpOid(java.lang.String oid)
Constructs the SnmpOid object with the OID string.

Parameters:
oid - The oid string.
Method Detail

getOid

public java.lang.String getOid()
Gets the OID string.

Returns:
The oid string.

getOidRecord

public OidRecord getOidRecord()
                       throws SnmpException
Gets the OID record from the MIB database matched to the SnmpOid object.

Returns:
The OID record found in the MIB database.
Throws:
SnmpException - Thrown when any error occurs during retriving the OID reocrd from the MIB database.

decode

public int decode(byte[] buf,
                  int offset,
                  org.opennms.protocols.snmp.asn1.BerEncoder encoder)
           throws org.opennms.protocols.snmp.SnmpPduEncodingException,
                  org.opennms.protocols.snmp.asn1.AsnDecodingException
Decodes the object identifier from the passed buffer. If an error occurs during the decoding sequence then an AsnDecodingException is thrown by the method. The value is decoded using the AsnEncoder passed to the object.

Parameters:
buf - The encode buffer
offset - The offset byte to begin decoding
encoder - The decoder object.
Returns:
The index of the byte immediantly after the last decoded byte of information.
Throws:
org.opennms.protocols.snmp.asn1.AsnDecodingException - Thrown by the encoder if an error occurs trying to decode the data buffer.
org.opennms.protocols.snmp.SnmpPduEncodingException

encode

public int encode(byte[] buf,
                  int offset,
                  org.opennms.protocols.snmp.asn1.BerEncoder encoder)
           throws org.opennms.protocols.snmp.SnmpPduEncodingException,
                  org.opennms.protocols.snmp.asn1.AsnEncodingException
Encodes the object identifier using the passed encoder and stores the results in the passed buffer. An exception is thrown if an error occurs with the encoding of the information.

Parameters:
buf - The buffer to write the encoded information.
offset - The offset to start writing information
encoder - The encoder object.
Returns:
The offset of the byte immediantly after the last encoded byte.
Throws:
org.opennms.protocols.snmp.asn1.AsnEncodingException - Thrown if the encoder finds an error in the buffer.
org.opennms.protocols.snmp.SnmpPduEncodingException

MySnmpCrawler API