snmp
Class SNMPMessage

java.lang.Object
  |
  +--snmp.SNMPObject
        |
        +--snmp.SNMPSequence
              |
              +--snmp.SNMPMessage

public class SNMPMessage
extends SNMPSequence

Defines the SNMPMessage class as a special case of SNMPSequence. Defines a top-level SNMP message, as per the following definitions from RFC 1157 and RFC 1901. RFC1157-SNMP DEFINITIONS IMPORTS FROM RFC1155-SMI; -- top-level message Message ::= SEQUENCE { version -- version-1 for this RFC INTEGER { version-1(0) }, community -- community name OCTET STRING, data -- e.g., PDUs if trivial ANY -- authentication is being used } -- From RFC 1901: COMMUNITY-BASED-SNMPv2 DEFINITIONS ::= BEGIN -- top-level message Message ::= SEQUENCE { version INTEGER { version(1) -- modified from RFC 1157 }, community -- community name OCTET STRING, data -- PDUs as defined in [4] ANY } } END


Fields inherited from class snmp.SNMPSequence
sequence, type
 
Constructor Summary
SNMPMessage(byte[] enc)
          Construct an SNMPMessage from a received ASN.1 byte representation.
SNMPMessage(int version, java.lang.String community, SNMPPDU pdu)
          Create an SNMP message with specified version, community, and pdu.
 
Method Summary
 SNMPPDU getPDU()
          Utility method which returns the PDU contained in the SNMP message.
 
Methods inherited from class snmp.SNMPSequence
addSNMPObject, extractFromBEREncoding, getBEREncoding, getSNMPObjectAt, getValue, setValue, size, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SNMPMessage

public SNMPMessage(int version,
                   java.lang.String community,
                   SNMPPDU pdu)
            throws SNMPBadValueException
Create an SNMP message with specified version, community, and pdu. Use version = 0 for SNMP version 1, or version = 1 for enhanced capapbilities provided through RFC 1157.

SNMPMessage

public SNMPMessage(byte[] enc)
            throws SNMPBadValueException
Construct an SNMPMessage from a received ASN.1 byte representation.
Throws:
SNMPBadValueException - Indicates invalid SNMP message encoding supplied.
Method Detail

getPDU

public SNMPPDU getPDU()
Utility method which returns the PDU contained in the SNMP message. The pdu is the third component of the sequence, after the version and community name.