public SnmpPdu decodeSnmpPdu()
throws SnmpStatusException {
SnmpScopedPduPacket pdu = null;
BerDecoder bdec = new BerDecoder(data) ;
try {
int type = bdec.getTag() ;
bdec.openSequence(type) ;
switch(type) {
case pduGetRequestPdu :
case pduGetNextRequestPdu :
case pduInformRequestPdu :
case pduGetResponsePdu :
case pduSetRequestPdu :
case pduV2TrapPdu :
case pduReportPdu :
SnmpScopedPduRequest reqPdu = new SnmpScopedPduRequest() ;
reqPdu.requestId = bdec.fetchInteger() ;
reqPdu.setErrorStatus(bdec.fetchInteger());
reqPdu.setErrorIndex(bdec.fetchInteger());
pdu = reqPdu ;
break ;
case pduGetBulkRequestPdu :
SnmpScopedPduBulk bulkPdu = new SnmpScopedPduBulk() ;
bulkPdu.requestId = bdec.fetchInteger() ;
bulkPdu.setNonRepeaters(bdec.fetchInteger());
bulkPdu.setMaxRepetitions(bdec.fetchInteger());
pdu = bulkPdu ;
break ;
default:
throw new SnmpStatusException(snmpRspWrongEncoding) ;
}
pdu.type = type;
pdu.varBindList = decodeVarBindList(bdec);
bdec.closeSequence() ;
} catch(BerException e) {
if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
SNMP_LOGGER.logp(Level.FINEST, SnmpV3Message.class.getName(),
"decodeSnmpPdu", "BerException", e);
}