MySnmpCrawler API

snmp.message
Class SnmpMessage

java.lang.Object
  |
  +--snmp.message.SnmpMessage

public class SnmpMessage
extends java.lang.Object

This class represents the top-level SNMP message. It encapsulates the SnmpMessageHeader and SnmpPdu. The SnmpMessageHeader class provides the header information. The SnmpPdu provides the protocol data unit(s).

Version:
$Revision: 0.1 $ $Date: 2004/03/09 06:03:52 $
Author:
Scott Cheng

Field Summary
static org.opennms.protocols.snmp.asn1.BerEncoder encoder
           
private  SnmpMessageHeader header
           
private  SnmpPdu pdu
           
 
Constructor Summary
SnmpMessage(java.net.DatagramPacket packet)
          Constructs the SnmpMessage object with the received SNMP datagram packet.
 
Method Summary
 void decodeMessage(java.net.DatagramPacket packet)
          Decodes the datagram packet and creates the SnmpMessageHeader and SnmpPdu objects.
 byte[] encodeMessage()
          Encodes the encapsulated SnmpMessageHeader and SnmpPdu objects.
 SnmpMessageHeader getSnmpMessageHeader()
          Gets the encapsulated SnmpMessageHeader object.
 SnmpPdu getSnmpPdu()
          Gets the encapsulated SnmpPdu object.
 java.lang.String toString()
          Gets the string representation of the SnmpMessage object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

encoder

public static final org.opennms.protocols.snmp.asn1.BerEncoder encoder

header

private SnmpMessageHeader header

pdu

private SnmpPdu pdu
Constructor Detail

SnmpMessage

public SnmpMessage(java.net.DatagramPacket packet)
            throws java.io.IOException,
                   org.opennms.protocols.snmp.SnmpPduEncodingException,
                   org.opennms.protocols.snmp.asn1.AsnDecodingException
Constructs the SnmpMessage object with the received SNMP datagram packet.

Parameters:
packet - The received SNMP datagram packet.
Method Detail

decodeMessage

public void decodeMessage(java.net.DatagramPacket packet)
                   throws org.opennms.protocols.snmp.SnmpPduEncodingException,
                          org.opennms.protocols.snmp.asn1.AsnDecodingException
Decodes the datagram packet and creates the SnmpMessageHeader and SnmpPdu objects.

org.opennms.protocols.snmp.SnmpPduEncodingException
org.opennms.protocols.snmp.asn1.AsnDecodingException

encodeMessage

public byte[] encodeMessage()
                     throws org.opennms.protocols.snmp.SnmpPduEncodingException,
                            org.opennms.protocols.snmp.asn1.AsnEncodingException
Encodes the encapsulated SnmpMessageHeader and SnmpPdu objects.

Returns:
The encoded data buffer
org.opennms.protocols.snmp.SnmpPduEncodingException
org.opennms.protocols.snmp.asn1.AsnEncodingException

getSnmpMessageHeader

public SnmpMessageHeader getSnmpMessageHeader()
Gets the encapsulated SnmpMessageHeader object.

Returns:
The SnmpMessageHeader object.

getSnmpPdu

public SnmpPdu getSnmpPdu()
Gets the encapsulated SnmpPdu object.

Returns:
The SnmpPdu object.

toString

public java.lang.String toString()
Gets the string representation of the SnmpMessage object.

Overrides:
toString in class java.lang.Object
Returns:
The string representation of the SnmpMessage object.

MySnmpCrawler API