|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.management.snmp.SnmpMsg
public abstract class SnmpMsg
A partially decoded representation of an SNMP packet. It contains the information contained in any SNMP message (SNMPv1, SNMPv2 or SNMPv3).
Field Summary | |
---|---|
InetAddress |
address
Source or destination address. |
byte[] |
data
Encoding of the PDU. |
int |
dataLength
Number of useful bytes in the data field. |
int |
port
Source or destination port. |
SnmpSecurityParameters |
securityParameters
Security parameters. |
int |
version
The protocol version. |
Constructor Summary | |
---|---|
SnmpMsg()
|
Method Summary | |
---|---|
abstract void |
decodeMessage(byte[] inputBytes,
int byteCount)
Decodes the specified bytes and initializes this message. |
abstract SnmpPdu |
decodeSnmpPdu()
Gets the PDU encoded in this message. |
SnmpVarBind[] |
decodeVarBindList(BerDecoder bdec)
For Java DMK private use only. |
static String |
dumpHexBuffer(byte[] b,
int offset,
int len)
Dumps the content of a byte buffer using hexadecimal form. |
abstract int |
encodeMessage(byte[] outputBytes)
Encodes this message and puts the result in the specified byte array. |
abstract void |
encodeSnmpPdu(SnmpPdu pdu,
int maxDataLength)
Initializes this message with the specified pdu . |
void |
encodeVarBindList(BerEncoder benc,
SnmpVarBind[] varBindList)
For Java DMK private use only. |
static int |
getProtocolVersion(byte[] data)
Returns the encoded SNMP version present in the passed byte array. |
abstract int |
getRequestId(byte[] data)
Returns the associated request ID. |
String |
printMessage()
Dumps this message in a string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public int version
decodeMessage
and encodeMessage
do not
perform any check on this value.
decodeSnmpPdu
and encodeSnmpPdu
only
accept the values 0 (for SNMPv1), 1 (for SNMPv2) and 3 (for SNMPv3).
public byte[] data
This is usually the BER encoding of the PDU's syntax
defined in RFC1157 and RFC1902. However, this can be authenticated
or encrypted data (but you need to implemented your own
SnmpPduFactory
class).
public int dataLength
data
field.
public InetAddress address
public int port
public SnmpSecurityParameters securityParameters
Constructor Detail |
---|
public SnmpMsg()
Method Detail |
---|
public static int getProtocolVersion(byte[] data) throws SnmpStatusException
data
- The unmarshalled SNMP message.
SnmpStatusException
public abstract int getRequestId(byte[] data) throws SnmpStatusException
data
- The flat message.
SnmpStatusException
public abstract int encodeMessage(byte[] outputBytes) throws SnmpTooBigException
outputBytes
- An array to receive the resulting encoding.
ArrayIndexOutOfBoundsException
- If the result does not fit
into the specified array.
SnmpTooBigException
public abstract void decodeMessage(byte[] inputBytes, int byteCount) throws SnmpStatusException
inputBytes
- The bytes to be decoded.
SnmpStatusException
- If the specified bytes are not a valid encoding.public abstract 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.
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 abstract SnmpPdu decodeSnmpPdu() throws SnmpStatusException
This method decodes the data field and returns the resulting PDU.
SnmpStatusException
- If the encoding is not valid.public static String dumpHexBuffer(byte[] b, int offset, int len)
b
- The buffer to dump.offset
- The position of the first byte to be dumped.len
- The number of bytes to be dumped starting from offset.
public String printMessage()
public void encodeVarBindList(BerEncoder benc, SnmpVarBind[] varBindList) throws SnmpStatusException, SnmpTooBigException
SnmpStatusException
SnmpTooBigException
public SnmpVarBind[] decodeVarBindList(BerDecoder bdec) throws BerException
BerException
|
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 |