Java Code Examples for com.sun.jmx.snmp.SnmpScopedPduBulk#setMaxRepetitions()
The following examples show how to use
com.sun.jmx.snmp.SnmpScopedPduBulk#setMaxRepetitions() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SnmpV3Message.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
/** * Gets the PDU encoded in this message. * <P> * This method decodes the data field and returns the resulting PDU. * * @return The resulting PDU. * @exception SnmpStatusException If the encoding is not valid. */ 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); } throw new SnmpStatusException(snmpRspWrongEncoding); } // // The easy work. // pdu.address = address; pdu.port = port; pdu.msgFlags = msgFlags; pdu.version = version; pdu.msgId = msgId; pdu.msgMaxSize = msgMaxSize; pdu.msgSecurityModel = msgSecurityModel; pdu.contextEngineId = contextEngineId; pdu.contextName = contextName; pdu.securityParameters = securityParameters; if (SNMP_LOGGER.isLoggable(Level.FINER)) { final StringBuilder strb = new StringBuilder() .append("Unmarshalled PDU : \n") .append("type : ").append(pdu.type) .append("\n") .append("version : ").append(pdu.version) .append("\n") .append("requestId : ").append(pdu.requestId) .append("\n") .append("msgId : ").append(pdu.msgId) .append("\n") .append("msgMaxSize : ").append(pdu.msgMaxSize) .append("\n") .append("msgFlags : ").append(pdu.msgFlags) .append("\n") .append("msgSecurityModel : ").append(pdu.msgSecurityModel) .append("\n") .append("contextEngineId : ").append(pdu.contextEngineId) .append("\n") .append("contextName : ").append(pdu.contextName) .append("\n"); SNMP_LOGGER.logp(Level.FINER, SnmpV3Message.class.getName(), "decodeSnmpPdu", strb.toString()); } return pdu ; }
Example 2
Source File: SnmpV3Message.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
/** * Gets the PDU encoded in this message. * <P> * This method decodes the data field and returns the resulting PDU. * * @return The resulting PDU. * @exception SnmpStatusException If the encoding is not valid. */ 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); } throw new SnmpStatusException(snmpRspWrongEncoding); } // // The easy work. // pdu.address = address; pdu.port = port; pdu.msgFlags = msgFlags; pdu.version = version; pdu.msgId = msgId; pdu.msgMaxSize = msgMaxSize; pdu.msgSecurityModel = msgSecurityModel; pdu.contextEngineId = contextEngineId; pdu.contextName = contextName; pdu.securityParameters = securityParameters; if (SNMP_LOGGER.isLoggable(Level.FINER)) { final StringBuilder strb = new StringBuilder() .append("Unmarshalled PDU : \n") .append("type : ").append(pdu.type) .append("\n") .append("version : ").append(pdu.version) .append("\n") .append("requestId : ").append(pdu.requestId) .append("\n") .append("msgId : ").append(pdu.msgId) .append("\n") .append("msgMaxSize : ").append(pdu.msgMaxSize) .append("\n") .append("msgFlags : ").append(pdu.msgFlags) .append("\n") .append("msgSecurityModel : ").append(pdu.msgSecurityModel) .append("\n") .append("contextEngineId : ").append(pdu.contextEngineId) .append("\n") .append("contextName : ").append(pdu.contextName) .append("\n"); SNMP_LOGGER.logp(Level.FINER, SnmpV3Message.class.getName(), "decodeSnmpPdu", strb.toString()); } return pdu ; }
Example 3
Source File: SnmpV3Message.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * Gets the PDU encoded in this message. * <P> * This method decodes the data field and returns the resulting PDU. * * @return The resulting PDU. * @exception SnmpStatusException If the encoding is not valid. */ 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); } throw new SnmpStatusException(snmpRspWrongEncoding); } // // The easy work. // pdu.address = address; pdu.port = port; pdu.msgFlags = msgFlags; pdu.version = version; pdu.msgId = msgId; pdu.msgMaxSize = msgMaxSize; pdu.msgSecurityModel = msgSecurityModel; pdu.contextEngineId = contextEngineId; pdu.contextName = contextName; pdu.securityParameters = securityParameters; if (SNMP_LOGGER.isLoggable(Level.FINER)) { final StringBuilder strb = new StringBuilder() .append("Unmarshalled PDU : \n") .append("type : ").append(pdu.type) .append("\n") .append("version : ").append(pdu.version) .append("\n") .append("requestId : ").append(pdu.requestId) .append("\n") .append("msgId : ").append(pdu.msgId) .append("\n") .append("msgMaxSize : ").append(pdu.msgMaxSize) .append("\n") .append("msgFlags : ").append(pdu.msgFlags) .append("\n") .append("msgSecurityModel : ").append(pdu.msgSecurityModel) .append("\n") .append("contextEngineId : ").append(pdu.contextEngineId) .append("\n") .append("contextName : ").append(pdu.contextName) .append("\n"); SNMP_LOGGER.logp(Level.FINER, SnmpV3Message.class.getName(), "decodeSnmpPdu", strb.toString()); } return pdu ; }
Example 4
Source File: SnmpV3Message.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * Gets the PDU encoded in this message. * <P> * This method decodes the data field and returns the resulting PDU. * * @return The resulting PDU. * @exception SnmpStatusException If the encoding is not valid. */ 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); } throw new SnmpStatusException(snmpRspWrongEncoding); } // // The easy work. // pdu.address = address; pdu.port = port; pdu.msgFlags = msgFlags; pdu.version = version; pdu.msgId = msgId; pdu.msgMaxSize = msgMaxSize; pdu.msgSecurityModel = msgSecurityModel; pdu.contextEngineId = contextEngineId; pdu.contextName = contextName; pdu.securityParameters = securityParameters; if (SNMP_LOGGER.isLoggable(Level.FINER)) { final StringBuilder strb = new StringBuilder() .append("Unmarshalled PDU : \n") .append("type : ").append(pdu.type) .append("\n") .append("version : ").append(pdu.version) .append("\n") .append("requestId : ").append(pdu.requestId) .append("\n") .append("msgId : ").append(pdu.msgId) .append("\n") .append("msgMaxSize : ").append(pdu.msgMaxSize) .append("\n") .append("msgFlags : ").append(pdu.msgFlags) .append("\n") .append("msgSecurityModel : ").append(pdu.msgSecurityModel) .append("\n") .append("contextEngineId : ").append(pdu.contextEngineId) .append("\n") .append("contextName : ").append(pdu.contextName) .append("\n"); SNMP_LOGGER.logp(Level.FINER, SnmpV3Message.class.getName(), "decodeSnmpPdu", strb.toString()); } return pdu ; }
Example 5
Source File: SnmpV3Message.java From JDKSourceCode1.8 with MIT License | 4 votes |
/** * Gets the PDU encoded in this message. * <P> * This method decodes the data field and returns the resulting PDU. * * @return The resulting PDU. * @exception SnmpStatusException If the encoding is not valid. */ 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); } throw new SnmpStatusException(snmpRspWrongEncoding); } // // The easy work. // pdu.address = address; pdu.port = port; pdu.msgFlags = msgFlags; pdu.version = version; pdu.msgId = msgId; pdu.msgMaxSize = msgMaxSize; pdu.msgSecurityModel = msgSecurityModel; pdu.contextEngineId = contextEngineId; pdu.contextName = contextName; pdu.securityParameters = securityParameters; if (SNMP_LOGGER.isLoggable(Level.FINER)) { final StringBuilder strb = new StringBuilder() .append("Unmarshalled PDU : \n") .append("type : ").append(pdu.type) .append("\n") .append("version : ").append(pdu.version) .append("\n") .append("requestId : ").append(pdu.requestId) .append("\n") .append("msgId : ").append(pdu.msgId) .append("\n") .append("msgMaxSize : ").append(pdu.msgMaxSize) .append("\n") .append("msgFlags : ").append(pdu.msgFlags) .append("\n") .append("msgSecurityModel : ").append(pdu.msgSecurityModel) .append("\n") .append("contextEngineId : ").append(pdu.contextEngineId) .append("\n") .append("contextName : ").append(pdu.contextName) .append("\n"); SNMP_LOGGER.logp(Level.FINER, SnmpV3Message.class.getName(), "decodeSnmpPdu", strb.toString()); } return pdu ; }
Example 6
Source File: SnmpV3Message.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * Gets the PDU encoded in this message. * <P> * This method decodes the data field and returns the resulting PDU. * * @return The resulting PDU. * @exception SnmpStatusException If the encoding is not valid. */ 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); } throw new SnmpStatusException(snmpRspWrongEncoding); } // // The easy work. // pdu.address = address; pdu.port = port; pdu.msgFlags = msgFlags; pdu.version = version; pdu.msgId = msgId; pdu.msgMaxSize = msgMaxSize; pdu.msgSecurityModel = msgSecurityModel; pdu.contextEngineId = contextEngineId; pdu.contextName = contextName; pdu.securityParameters = securityParameters; if (SNMP_LOGGER.isLoggable(Level.FINER)) { final StringBuilder strb = new StringBuilder() .append("Unmarshalled PDU : \n") .append("type : ").append(pdu.type) .append("\n") .append("version : ").append(pdu.version) .append("\n") .append("requestId : ").append(pdu.requestId) .append("\n") .append("msgId : ").append(pdu.msgId) .append("\n") .append("msgMaxSize : ").append(pdu.msgMaxSize) .append("\n") .append("msgFlags : ").append(pdu.msgFlags) .append("\n") .append("msgSecurityModel : ").append(pdu.msgSecurityModel) .append("\n") .append("contextEngineId : ").append(pdu.contextEngineId) .append("\n") .append("contextName : ").append(pdu.contextName) .append("\n"); SNMP_LOGGER.logp(Level.FINER, SnmpV3Message.class.getName(), "decodeSnmpPdu", strb.toString()); } return pdu ; }
Example 7
Source File: SnmpV3Message.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * Gets the PDU encoded in this message. * <P> * This method decodes the data field and returns the resulting PDU. * * @return The resulting PDU. * @exception SnmpStatusException If the encoding is not valid. */ 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); } throw new SnmpStatusException(snmpRspWrongEncoding); } // // The easy work. // pdu.address = address; pdu.port = port; pdu.msgFlags = msgFlags; pdu.version = version; pdu.msgId = msgId; pdu.msgMaxSize = msgMaxSize; pdu.msgSecurityModel = msgSecurityModel; pdu.contextEngineId = contextEngineId; pdu.contextName = contextName; pdu.securityParameters = securityParameters; if (SNMP_LOGGER.isLoggable(Level.FINER)) { final StringBuilder strb = new StringBuilder() .append("Unmarshalled PDU : \n") .append("type : ").append(pdu.type) .append("\n") .append("version : ").append(pdu.version) .append("\n") .append("requestId : ").append(pdu.requestId) .append("\n") .append("msgId : ").append(pdu.msgId) .append("\n") .append("msgMaxSize : ").append(pdu.msgMaxSize) .append("\n") .append("msgFlags : ").append(pdu.msgFlags) .append("\n") .append("msgSecurityModel : ").append(pdu.msgSecurityModel) .append("\n") .append("contextEngineId : ").append(pdu.contextEngineId) .append("\n") .append("contextName : ").append(pdu.contextName) .append("\n"); SNMP_LOGGER.logp(Level.FINER, SnmpV3Message.class.getName(), "decodeSnmpPdu", strb.toString()); } return pdu ; }
Example 8
Source File: SnmpV3Message.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * Gets the PDU encoded in this message. * <P> * This method decodes the data field and returns the resulting PDU. * * @return The resulting PDU. * @exception SnmpStatusException If the encoding is not valid. */ 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); } throw new SnmpStatusException(snmpRspWrongEncoding); } // // The easy work. // pdu.address = address; pdu.port = port; pdu.msgFlags = msgFlags; pdu.version = version; pdu.msgId = msgId; pdu.msgMaxSize = msgMaxSize; pdu.msgSecurityModel = msgSecurityModel; pdu.contextEngineId = contextEngineId; pdu.contextName = contextName; pdu.securityParameters = securityParameters; if (SNMP_LOGGER.isLoggable(Level.FINER)) { final StringBuilder strb = new StringBuilder() .append("Unmarshalled PDU : \n") .append("type : ").append(pdu.type) .append("\n") .append("version : ").append(pdu.version) .append("\n") .append("requestId : ").append(pdu.requestId) .append("\n") .append("msgId : ").append(pdu.msgId) .append("\n") .append("msgMaxSize : ").append(pdu.msgMaxSize) .append("\n") .append("msgFlags : ").append(pdu.msgFlags) .append("\n") .append("msgSecurityModel : ").append(pdu.msgSecurityModel) .append("\n") .append("contextEngineId : ").append(pdu.contextEngineId) .append("\n") .append("contextName : ").append(pdu.contextName) .append("\n"); SNMP_LOGGER.logp(Level.FINER, SnmpV3Message.class.getName(), "decodeSnmpPdu", strb.toString()); } return pdu ; }
Example 9
Source File: SnmpV3Message.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * Gets the PDU encoded in this message. * <P> * This method decodes the data field and returns the resulting PDU. * * @return The resulting PDU. * @exception SnmpStatusException If the encoding is not valid. */ 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); } throw new SnmpStatusException(snmpRspWrongEncoding); } // // The easy work. // pdu.address = address; pdu.port = port; pdu.msgFlags = msgFlags; pdu.version = version; pdu.msgId = msgId; pdu.msgMaxSize = msgMaxSize; pdu.msgSecurityModel = msgSecurityModel; pdu.contextEngineId = contextEngineId; pdu.contextName = contextName; pdu.securityParameters = securityParameters; if (SNMP_LOGGER.isLoggable(Level.FINER)) { final StringBuilder strb = new StringBuilder() .append("Unmarshalled PDU : \n") .append("type : ").append(pdu.type) .append("\n") .append("version : ").append(pdu.version) .append("\n") .append("requestId : ").append(pdu.requestId) .append("\n") .append("msgId : ").append(pdu.msgId) .append("\n") .append("msgMaxSize : ").append(pdu.msgMaxSize) .append("\n") .append("msgFlags : ").append(pdu.msgFlags) .append("\n") .append("msgSecurityModel : ").append(pdu.msgSecurityModel) .append("\n") .append("contextEngineId : ").append(pdu.contextEngineId) .append("\n") .append("contextName : ").append(pdu.contextName) .append("\n"); SNMP_LOGGER.logp(Level.FINER, SnmpV3Message.class.getName(), "decodeSnmpPdu", strb.toString()); } return pdu ; }
Example 10
Source File: SnmpV3Message.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * Gets the PDU encoded in this message. * <P> * This method decodes the data field and returns the resulting PDU. * * @return The resulting PDU. * @exception SnmpStatusException If the encoding is not valid. */ 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); } throw new SnmpStatusException(snmpRspWrongEncoding); } // // The easy work. // pdu.address = address; pdu.port = port; pdu.msgFlags = msgFlags; pdu.version = version; pdu.msgId = msgId; pdu.msgMaxSize = msgMaxSize; pdu.msgSecurityModel = msgSecurityModel; pdu.contextEngineId = contextEngineId; pdu.contextName = contextName; pdu.securityParameters = securityParameters; if (SNMP_LOGGER.isLoggable(Level.FINER)) { final StringBuilder strb = new StringBuilder() .append("Unmarshalled PDU : \n") .append("type : ").append(pdu.type) .append("\n") .append("version : ").append(pdu.version) .append("\n") .append("requestId : ").append(pdu.requestId) .append("\n") .append("msgId : ").append(pdu.msgId) .append("\n") .append("msgMaxSize : ").append(pdu.msgMaxSize) .append("\n") .append("msgFlags : ").append(pdu.msgFlags) .append("\n") .append("msgSecurityModel : ").append(pdu.msgSecurityModel) .append("\n") .append("contextEngineId : ").append(pdu.contextEngineId) .append("\n") .append("contextName : ").append(pdu.contextName) .append("\n"); SNMP_LOGGER.logp(Level.FINER, SnmpV3Message.class.getName(), "decodeSnmpPdu", strb.toString()); } return pdu ; }
Example 11
Source File: SnmpV3Message.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * Gets the PDU encoded in this message. * <P> * This method decodes the data field and returns the resulting PDU. * * @return The resulting PDU. * @exception SnmpStatusException If the encoding is not valid. */ 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); } throw new SnmpStatusException(snmpRspWrongEncoding); } // // The easy work. // pdu.address = address; pdu.port = port; pdu.msgFlags = msgFlags; pdu.version = version; pdu.msgId = msgId; pdu.msgMaxSize = msgMaxSize; pdu.msgSecurityModel = msgSecurityModel; pdu.contextEngineId = contextEngineId; pdu.contextName = contextName; pdu.securityParameters = securityParameters; if (SNMP_LOGGER.isLoggable(Level.FINER)) { final StringBuilder strb = new StringBuilder() .append("Unmarshalled PDU : \n") .append("type : ").append(pdu.type) .append("\n") .append("version : ").append(pdu.version) .append("\n") .append("requestId : ").append(pdu.requestId) .append("\n") .append("msgId : ").append(pdu.msgId) .append("\n") .append("msgMaxSize : ").append(pdu.msgMaxSize) .append("\n") .append("msgFlags : ").append(pdu.msgFlags) .append("\n") .append("msgSecurityModel : ").append(pdu.msgSecurityModel) .append("\n") .append("contextEngineId : ").append(pdu.contextEngineId) .append("\n") .append("contextName : ").append(pdu.contextName) .append("\n"); SNMP_LOGGER.logp(Level.FINER, SnmpV3Message.class.getName(), "decodeSnmpPdu", strb.toString()); } return pdu ; }
Example 12
Source File: SnmpV3Message.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
/** * Gets the PDU encoded in this message. * <P> * This method decodes the data field and returns the resulting PDU. * * @return The resulting PDU. * @exception SnmpStatusException If the encoding is not valid. */ 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); } throw new SnmpStatusException(snmpRspWrongEncoding); } // // The easy work. // pdu.address = address; pdu.port = port; pdu.msgFlags = msgFlags; pdu.version = version; pdu.msgId = msgId; pdu.msgMaxSize = msgMaxSize; pdu.msgSecurityModel = msgSecurityModel; pdu.contextEngineId = contextEngineId; pdu.contextName = contextName; pdu.securityParameters = securityParameters; if (SNMP_LOGGER.isLoggable(Level.FINER)) { final StringBuilder strb = new StringBuilder() .append("Unmarshalled PDU : \n") .append("type : ").append(pdu.type) .append("\n") .append("version : ").append(pdu.version) .append("\n") .append("requestId : ").append(pdu.requestId) .append("\n") .append("msgId : ").append(pdu.msgId) .append("\n") .append("msgMaxSize : ").append(pdu.msgMaxSize) .append("\n") .append("msgFlags : ").append(pdu.msgFlags) .append("\n") .append("msgSecurityModel : ").append(pdu.msgSecurityModel) .append("\n") .append("contextEngineId : ").append(pdu.contextEngineId) .append("\n") .append("contextName : ").append(pdu.contextName) .append("\n"); SNMP_LOGGER.logp(Level.FINER, SnmpV3Message.class.getName(), "decodeSnmpPdu", strb.toString()); } return pdu ; }
Example 13
Source File: SnmpV3Message.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * Gets the PDU encoded in this message. * <P> * This method decodes the data field and returns the resulting PDU. * * @return The resulting PDU. * @exception SnmpStatusException If the encoding is not valid. */ 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); } throw new SnmpStatusException(snmpRspWrongEncoding); } // // The easy work. // pdu.address = address; pdu.port = port; pdu.msgFlags = msgFlags; pdu.version = version; pdu.msgId = msgId; pdu.msgMaxSize = msgMaxSize; pdu.msgSecurityModel = msgSecurityModel; pdu.contextEngineId = contextEngineId; pdu.contextName = contextName; pdu.securityParameters = securityParameters; if (SNMP_LOGGER.isLoggable(Level.FINER)) { final StringBuilder strb = new StringBuilder() .append("Unmarshalled PDU : \n") .append("type : ").append(pdu.type) .append("\n") .append("version : ").append(pdu.version) .append("\n") .append("requestId : ").append(pdu.requestId) .append("\n") .append("msgId : ").append(pdu.msgId) .append("\n") .append("msgMaxSize : ").append(pdu.msgMaxSize) .append("\n") .append("msgFlags : ").append(pdu.msgFlags) .append("\n") .append("msgSecurityModel : ").append(pdu.msgSecurityModel) .append("\n") .append("contextEngineId : ").append(pdu.contextEngineId) .append("\n") .append("contextName : ").append(pdu.contextName) .append("\n"); SNMP_LOGGER.logp(Level.FINER, SnmpV3Message.class.getName(), "decodeSnmpPdu", strb.toString()); } return pdu ; }
Example 14
Source File: SnmpV3Message.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
/** * Gets the PDU encoded in this message. * <P> * This method decodes the data field and returns the resulting PDU. * * @return The resulting PDU. * @exception SnmpStatusException If the encoding is not valid. */ 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); } throw new SnmpStatusException(snmpRspWrongEncoding); } // // The easy work. // pdu.address = address; pdu.port = port; pdu.msgFlags = msgFlags; pdu.version = version; pdu.msgId = msgId; pdu.msgMaxSize = msgMaxSize; pdu.msgSecurityModel = msgSecurityModel; pdu.contextEngineId = contextEngineId; pdu.contextName = contextName; pdu.securityParameters = securityParameters; if (SNMP_LOGGER.isLoggable(Level.FINER)) { final StringBuilder strb = new StringBuilder() .append("Unmarshalled PDU : \n") .append("type : ").append(pdu.type) .append("\n") .append("version : ").append(pdu.version) .append("\n") .append("requestId : ").append(pdu.requestId) .append("\n") .append("msgId : ").append(pdu.msgId) .append("\n") .append("msgMaxSize : ").append(pdu.msgMaxSize) .append("\n") .append("msgFlags : ").append(pdu.msgFlags) .append("\n") .append("msgSecurityModel : ").append(pdu.msgSecurityModel) .append("\n") .append("contextEngineId : ").append(pdu.contextEngineId) .append("\n") .append("contextName : ").append(pdu.contextName) .append("\n"); SNMP_LOGGER.logp(Level.FINER, SnmpV3Message.class.getName(), "decodeSnmpPdu", strb.toString()); } return pdu ; }