|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.management.snmp.SnmpPduFactoryBER
public class SnmpPduFactoryBER
Default implementation of the SnmpPduFactory
interface.
It uses the BER (basic encoding rules) standardized encoding scheme associated with ASN.1.
This implementation of the SnmpPduFactory
is very
basic: it simply calls encoding and decoding methods from
SnmpMsg
.
To implement your own object, you can implementpublic SnmpPdu decodeSnmpPdu(SnmpMsg msg) throws SnmpStatusException { return msg.decodeSnmpPdu() ; } public SnmpMsg encodeSnmpPdu(SnmpPdu pdu, int maxPktSize) throws SnmpStatusException, SnmpTooBigException { SnmpMsg result = new SnmpMessage() ; // for SNMP v1/v2 or SnmpMsg result = new SnmpV3Message() ; // for SNMP v3 result.encodeSnmpPdu(pdu, maxPktSize) ; return result ; }
SnmpPduFactory
or extend SnmpPduFactoryBER
.
Constructor Summary | |
---|---|
SnmpPduFactoryBER()
|
Method Summary | |
---|---|
SnmpPdu |
decodeSnmpPdu(SnmpMsg msg)
Calls SnmpMsg.decodeSnmpPdu
on the specified message and returns the resulting SnmpPdu . |
SnmpMsg |
encodeSnmpPdu(SnmpPdu pdu,
int maxPktSize)
Encodes the specified SnmpPdu and
returns the resulting SnmpMsg . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SnmpPduFactoryBER()
Method Detail |
---|
public SnmpPdu decodeSnmpPdu(SnmpMsg msg) throws SnmpStatusException
SnmpMsg.decodeSnmpPdu
on the specified message and returns the resulting SnmpPdu
.
decodeSnmpPdu
in interface SnmpPduFactory
msg
- The SNMP message to be decoded.
SnmpStatusException
- If the encoding is invalid.public SnmpMsg encodeSnmpPdu(SnmpPdu pdu, int maxPktSize) throws SnmpStatusException, SnmpTooBigException
SnmpPdu
and
returns the resulting SnmpMsg
. If this
method returns null, the specified SnmpPdu
will be dropped and the current SNMP request will be
aborted.
encodeSnmpPdu
in interface SnmpPduFactory
pdu
- The SnmpPdu
to be encoded.maxPktSize
- The size limit of the resulting encoding.
SnmpMsg
.
SnmpStatusException
- If pdu
contains
illegal values and cannot be encoded.
SnmpTooBigException
- If the resulting encoding does not
fit into maxPktSize
bytes.
|
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 |