|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.management.snmp.SnmpMsg com.sun.management.snmp.SnmpMessage
public class SnmpMessage
Is a partially decoded representation of an SNMP packet.
You will not normally need to use this class unless you decide to
implement your own SnmpPduFactory
object.
The SnmpMessage
class is directly mapped onto the
Message
syntax defined in RFC1157 and RFC1902.
Message ::= SEQUENCE { version INTEGER { version(1) }, -- for SNMPv2 community OCTET STRING, -- community name data ANY -- an SNMPv2 PDU }
SnmpPduFactory
,
SnmpPduPacket
Field Summary | |
---|---|
byte[] |
community
Community name. |
Fields inherited from class com.sun.management.snmp.SnmpMsg |
---|
address, data, dataLength, port, securityParameters, version |
Constructor Summary | |
---|---|
SnmpMessage()
|
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[] inputBytes)
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 byte[] community
Constructor Detail |
---|
public SnmpMessage()
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 int getRequestId(byte[] inputBytes) throws SnmpStatusException
getRequestId
in class SnmpMsg
inputBytes
- The flat message.
SnmpStatusException
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 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 |