public class

SnmpV3Message

extends SnmpMsg
java.lang.Object
   ↳ com.sun.jmx.snmp.SnmpMsg
     ↳ com.sun.jmx.snmp.SnmpV3Message

Class Overview

Is a partially decoded representation of an SNMP V3 packet.

This class can be used when developing customized manager or agent.

The SnmpV3Message class is directly mapped onto the message syntax defined in RFC 2572.

 SNMPv3Message ::= SEQUENCE {
          msgVersion INTEGER ( 0 .. 2147483647 ),
          -- administrative parameters
          msgGlobalData HeaderData,
          -- security model-specific parameters
          -- format defined by Security Model
          msgSecurityParameters OCTET STRING,
          msgData  ScopedPduData
      }
     HeaderData ::= SEQUENCE {
         msgID      INTEGER (0..2147483647),
         msgMaxSize INTEGER (484..2147483647),

         msgFlags   OCTET STRING (SIZE(1)),
                    --  .... ...1   authFlag
                    --  .... ..1.   privFlag
                    --  .... .1..   reportableFlag
                    --              Please observe:
                    --  .... ..00   is OK, means noAuthNoPriv
                    --  .... ..01   is OK, means authNoPriv
                    --  .... ..10   reserved, must NOT be used.
                    --  .... ..11   is OK, means authPriv

         msgSecurityModel INTEGER (1..2147483647)
     }
 

This API is a Sun Microsystems internal API and is subject to change without notice.

Summary

[Expand]
Inherited Constants
From interface com.sun.jmx.snmp.SnmpDefinitions
Fields
public byte[] contextEngineId The context engine Id in which the pdu must be handled (Generaly the local engine Id).
public byte[] contextName The context name in which the OID has to be interpreted.
public byte[] encryptedPdu The encrypted form of the scoped pdu (Only relevant when dealing with privacy).
public byte msgFlags Message flags.
public int msgId Message identifier.
public int msgMaxSize Message max size the pdu sender can deal with.
public int msgSecurityModel The security model the security sub system MUST use in order to deal with this pdu (eg: User based Security Model Id = 3).
public byte[] msgSecurityParameters The unmarshalled security parameters.
[Expand]
Inherited Fields
From class com.sun.jmx.snmp.SnmpMsg
Public Constructors
SnmpV3Message()
Constructor.
Public Methods
void decodeMessage(byte[] inputBytes, int byteCount)
Decodes the specified bytes and initializes this message.
SnmpPdu decodeSnmpPdu()
Gets the PDU encoded in this message.
int encodeMessage(byte[] outputBytes)
Encodes this message and puts the result in the specified byte array.
void encodeSnmpPdu(SnmpPdu p, int maxDataLength)
Initializes this message with the specified pdu.
int getRequestId(byte[] data)
Returns the associated request Id.
String printMessage()
Dumps this message in a string.
[Expand]
Inherited Methods
From class com.sun.jmx.snmp.SnmpMsg
From class java.lang.Object

Fields

public byte[] contextEngineId

The context engine Id in which the pdu must be handled (Generaly the local engine Id).

public byte[] contextName

The context name in which the OID has to be interpreted.

public byte[] encryptedPdu

The encrypted form of the scoped pdu (Only relevant when dealing with privacy).

public byte msgFlags

Message flags. Reportable flag and security level.

 --  .... ...1   authFlag
 --  .... ..1.   privFlag
 --  .... .1..   reportableFlag
 --              Please observe:
 --  .... ..00   is OK, means noAuthNoPriv
 --  .... ..01   is OK, means authNoPriv
 --  .... ..10   reserved, must NOT be used.
 --  .... ..11   is OK, means authPriv

public int msgId

Message identifier.

public int msgMaxSize

Message max size the pdu sender can deal with.

public int msgSecurityModel

The security model the security sub system MUST use in order to deal with this pdu (eg: User based Security Model Id = 3).

public byte[] msgSecurityParameters

The unmarshalled security parameters.

Public Constructors

public SnmpV3Message ()

Constructor.

Public Methods

public void decodeMessage (byte[] inputBytes, int byteCount)

Decodes the specified bytes and initializes this message. For internal use only.

Parameters
inputBytes The bytes to be decoded.
Throws
SnmpStatusException If the specified bytes are not a valid encoding.

public SnmpPdu decodeSnmpPdu ()

Gets the PDU encoded in this message.

This method decodes the data field and returns the resulting PDU.

Returns
  • The resulting PDU.
Throws
SnmpStatusException If the encoding is not valid.

public int encodeMessage (byte[] outputBytes)

Encodes this message and puts the result in the specified byte array. For internal use only.

Parameters
outputBytes An array to receive the resulting encoding.
Throws
ArrayIndexOutOfBoundsException If the result does not fit into the specified array.
SnmpTooBigException

public void encodeSnmpPdu (SnmpPdu p, int maxDataLength)

Initializes this message with the specified pdu.

This method initializes the data field with an array of maxDataLength bytes. It encodes the pdu. The resulting encoding is stored in the data field and the length of the encoding is stored in dataLength.

If the encoding length exceeds maxDataLength, the method throws an exception.

Parameters
p The PDU to be encoded.
maxDataLength The maximum length permitted for the data field.
Throws
SnmpStatusException If the specified pdu is not valid.
SnmpTooBigException If the resulting encoding does not fit into maxDataLength bytes.
ArrayIndexOutOfBoundsException If the encoding exceeds maxDataLength.

public int getRequestId (byte[] data)

Returns the associated request Id.

Parameters
data The flat message.
Returns
  • The request Id.

public String printMessage ()

Dumps this message in a string.

Returns
  • The string containing the dump.