|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.management.snmp.SnmpMsg
com.sun.management.snmp.SnmpV3Message
public class SnmpV3Message
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) }
Field Summary | |
---|---|
byte[] |
contextEngineId
The context engine Id in which the pdu must be handled (Generally the local engine Id). |
byte[] |
contextName
The context name in which the OID has to be interpreted. |
byte[] |
encryptedPdu
The encrypted form of the scoped pdu (Only relevant when dealing with privacy). |
byte |
msgFlags
Message flags. |
int |
msgId
Message identifier. |
int |
msgMaxSize
Message max size the pdu sender can deal with. |
int |
msgSecurityModel
The security model the security sub system MUST use in order to deal with this pdu (e.g. |
byte[] |
msgSecurityParameters
The unmarshalled security parameters. |
Fields inherited from class com.sun.management.snmp.SnmpMsg |
---|
address, data, dataLength, port, securityParameters, version |
Constructor Summary | |
---|---|
SnmpV3Message()
Constructor. |
Method Summary | |
---|---|
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 pdu,
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. |
Methods inherited from class com.sun.management.snmp.SnmpMsg |
---|
decodeVarBindList, dumpHexBuffer, encodeVarBindList, getProtocolVersion |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public int msgId
public int msgMaxSize
public byte msgFlags
-- .... ...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 msgSecurityModel
public byte[] msgSecurityParameters
public byte[] contextEngineId
public byte[] contextName
public byte[] encryptedPdu
Constructor Detail |
---|
public SnmpV3Message()
Method Detail |
---|
public int encodeMessage(byte[] outputBytes) throws SnmpTooBigException
encodeMessage
in class SnmpMsg
outputBytes
- An array to receive the resulting encoding.
ArrayIndexOutOfBoundsException
- If the result does not fit
into the specified array.
SnmpTooBigException
public void decodeMessage(byte[] inputBytes, int byteCount) throws SnmpStatusException
decodeMessage
in class SnmpMsg
inputBytes
- The bytes to be decoded.
SnmpStatusException
- If the specified bytes are not a valid encoding.public int getRequestId(byte[] data) throws SnmpStatusException
getRequestId
in class SnmpMsg
data
- The flat message.
SnmpStatusException
public void encodeSnmpPdu(SnmpPdu pdu, int maxDataLength) throws SnmpStatusException, SnmpTooBigException
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.
encodeSnmpPdu
in class SnmpMsg
pdu
- The PDU to be encoded.maxDataLength
- The maximum length permitted for the data field.
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 SnmpPdu decodeSnmpPdu() throws SnmpStatusException
This method decodes the data field and returns the resulting PDU.
decodeSnmpPdu
in class SnmpMsg
SnmpStatusException
- If the encoding is not valid.public String printMessage()
printMessage
in class SnmpMsg
|
Open Source build 02 opendmk-1.0-b02 2007.10.01_19:17:46_MEST |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |