com.amx.duet.tools.net.snmp.api
Class SNMPMessage

java.lang.Object
  extended bycom.amx.duet.tools.net.snmp.api.SNMPObject
      extended bycom.amx.duet.tools.net.snmp.api.SNMPSequence
          extended bycom.amx.duet.tools.net.snmp.api.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


Constructor Summary
SNMPMessage(int version, java.lang.String community, SNMPPDU pdu)
          Create an SNMP message with specified version, community, and pdu.
SNMPMessage(int version, java.lang.String community, SNMPv1TrapPDU pdu)
          Create an SNMP message with specified version, community, and trap pdu.
SNMPMessage(int version, java.lang.String community, SNMPv2TrapPDU pdu)
          Create an SNMP message with specified version, community, and v2 trap pdu.
 
Method Summary
 java.lang.String getCommunityName()
          Utility method which returns the community name contained in the SNMP message.
 SNMPPDU getPDU()
          Utility method which returns the PDU contained in the SNMP message.
 java.lang.Object getPDUAsObject()
          Utility method which returns the PDU contained in the SNMP message as a plain Java Object.
 SNMPv1TrapPDU getv1TrapPDU()
          Utility method which returns the PDU contained in the SNMP message as an SNMPv1TrapPDU.
 SNMPv2TrapPDU getv2TrapPDU()
          Utility method which returns the PDU contained in the SNMP message as an SNMPv2TrapPDU.
 
Methods inherited from class com.amx.duet.tools.net.snmp.api.SNMPSequence
addSNMPObject, getSNMPObjectAt, getValue, insertSNMPObjectAt, setValue, size, toString
 
Methods inherited from class com.amx.duet.tools.net.snmp.api.SNMPObject
equals, hashCode
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SNMPMessage

public SNMPMessage(int version,
                   java.lang.String community,
                   SNMPPDU pdu)
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(int version,
                   java.lang.String community,
                   SNMPv1TrapPDU pdu)
Create an SNMP message with specified version, community, and trap pdu. Use version = 0 for SNMP version 1, or version = 1 for enhanced capapbilities provided through RFC 1157.


SNMPMessage

public SNMPMessage(int version,
                   java.lang.String community,
                   SNMPv2TrapPDU pdu)
Create an SNMP message with specified version, community, and v2 trap pdu. Use version = 1.

Method Detail

getPDUAsObject

public java.lang.Object getPDUAsObject()
Utility method which returns the PDU contained in the SNMP message as a plain Java Object. The pdu is the third component of the sequence, after the version and community name.


getPDU

public SNMPPDU getPDU()
               throws SNMPBadValueException
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.

Throws:
SNMPBadValueException

getv1TrapPDU

public SNMPv1TrapPDU getv1TrapPDU()
                           throws SNMPBadValueException
Utility method which returns the PDU contained in the SNMP message as an SNMPv1TrapPDU. The pdu is the third component of the sequence, after the version and community name.

Throws:
SNMPBadValueException

getv2TrapPDU

public SNMPv2TrapPDU getv2TrapPDU()
                           throws SNMPBadValueException
Utility method which returns the PDU contained in the SNMP message as an SNMPv2TrapPDU. The pdu is the third component of the sequence, after the version and community name.

Throws:
SNMPBadValueException

getCommunityName

public java.lang.String getCommunityName()
                                  throws SNMPBadValueException
Utility method which returns the community name contained in the SNMP message. The community name is the second component of the sequence, after the version.

Throws:
SNMPBadValueException


Copyright © 2008 AMX LLC. All Rights Reserved.