com.sun.jmx.snmp.SnmpPduPacket Java Examples
The following examples show how to use
com.sun.jmx.snmp.SnmpPduPacket.
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: SnmpRequestHandler.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private SnmpPduPacket mergeResponses(SnmpPduRequest req) { if (req.type == pduGetNextRequestPdu) { return mergeNextResponses(req); } SnmpVarBind[] result= req.varBindList; // Go through the list of subrequests and concatenate. // Hopefully, by now all the sub-requests should be finished // for(Enumeration<SnmpSubRequestHandler> e= subs.elements(); e.hasMoreElements();) { SnmpSubRequestHandler sub= e.nextElement(); sub.updateResult(result); } return newValidResponsePdu(req,result); }
Example #2
Source File: SnmpRequestHandler.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
SnmpPduPacket makeErrorVarbindPdu(SnmpPduPacket req, int statusTag) { final SnmpVarBind[] vblist = req.varBindList; final int length = vblist.length; switch (statusTag) { case SnmpDataTypeEnums.errEndOfMibViewTag: for (int i=0 ; i<length ; i++) vblist[i].value = SnmpVarBind.endOfMibView; break; case SnmpDataTypeEnums.errNoSuchObjectTag: for (int i=0 ; i<length ; i++) vblist[i].value = SnmpVarBind.noSuchObject; break; case SnmpDataTypeEnums.errNoSuchInstanceTag: for (int i=0 ; i<length ; i++) vblist[i].value = SnmpVarBind.noSuchInstance; break; default: return newErrorResponsePdu(req,snmpRspGenErr,1); } return newValidResponsePdu(req,vblist); }
Example #3
Source File: SnmpRequestHandler.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Make a response pdu with the specified error status and index. * NOTE: the response pdu share its varBindList with the request pdu. */ private SnmpPduRequest newValidResponsePdu(SnmpPduPacket reqPdu, SnmpVarBind[] varBindList) { SnmpPduRequest result = new SnmpPduRequest() ; result.address = reqPdu.address ; result.port = reqPdu.port ; result.version = reqPdu.version ; result.community = reqPdu.community ; result.type = SnmpPduRequest.pduGetResponsePdu ; result.requestId = reqPdu.requestId ; result.errorStatus = SnmpDefinitions.snmpRspNoError ; result.errorIndex = 0 ; result.varBindList = varBindList ; ((SnmpAdaptorServer)adaptorServer). updateErrorCounters(result.errorStatus) ; return result ; }
Example #4
Source File: SnmpRequestHandler.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Check the type of the pdu: only the get/set/bulk request * are accepted. */ private boolean checkPduType(SnmpPduPacket pdu) { boolean result; switch(pdu.type) { case SnmpDefinitions.pduGetRequestPdu: case SnmpDefinitions.pduGetNextRequestPdu: case SnmpDefinitions.pduSetRequestPdu: case SnmpDefinitions.pduGetBulkRequestPdu: result = true ; break; default: if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, dbgTag, "checkPduType", "cannot respond to this kind of PDU"); } result = false ; break; } return result ; }
Example #5
Source File: SnmpRequestHandler.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private SnmpPduPacket mergeResponses(SnmpPduRequest req) { if (req.type == pduGetNextRequestPdu) { return mergeNextResponses(req); } SnmpVarBind[] result= req.varBindList; // Go through the list of subrequests and concatenate. // Hopefully, by now all the sub-requests should be finished // for(Enumeration<SnmpSubRequestHandler> e= subs.elements(); e.hasMoreElements();) { SnmpSubRequestHandler sub= e.nextElement(); sub.updateResult(result); } return newValidResponsePdu(req,result); }
Example #6
Source File: SnmpRequestHandler.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Make a response pdu with the specified error status and index. * NOTE: the response pdu share its varBindList with the request pdu. */ private SnmpPduRequest newValidResponsePdu(SnmpPduPacket reqPdu, SnmpVarBind[] varBindList) { SnmpPduRequest result = new SnmpPduRequest() ; result.address = reqPdu.address ; result.port = reqPdu.port ; result.version = reqPdu.version ; result.community = reqPdu.community ; result.type = SnmpPduRequest.pduGetResponsePdu ; result.requestId = reqPdu.requestId ; result.errorStatus = SnmpDefinitions.snmpRspNoError ; result.errorIndex = 0 ; result.varBindList = varBindList ; ((SnmpAdaptorServer)adaptorServer). updateErrorCounters(result.errorStatus) ; return result ; }
Example #7
Source File: SnmpRequestHandler.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
/** * Make a response pdu with the specified error status and index. * NOTE: the response pdu share its varBindList with the request pdu. */ private SnmpPduRequest newValidResponsePdu(SnmpPduPacket reqPdu, SnmpVarBind[] varBindList) { SnmpPduRequest result = new SnmpPduRequest() ; result.address = reqPdu.address ; result.port = reqPdu.port ; result.version = reqPdu.version ; result.community = reqPdu.community ; result.type = SnmpPduRequest.pduGetResponsePdu ; result.requestId = reqPdu.requestId ; result.errorStatus = SnmpDefinitions.snmpRspNoError ; result.errorIndex = 0 ; result.varBindList = varBindList ; ((SnmpAdaptorServer)adaptorServer). updateErrorCounters(result.errorStatus) ; return result ; }
Example #8
Source File: SnmpRequestHandler.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
SnmpPduPacket makeErrorVarbindPdu(SnmpPduPacket req, int statusTag) { final SnmpVarBind[] vblist = req.varBindList; final int length = vblist.length; switch (statusTag) { case SnmpDataTypeEnums.errEndOfMibViewTag: for (int i=0 ; i<length ; i++) vblist[i].value = SnmpVarBind.endOfMibView; break; case SnmpDataTypeEnums.errNoSuchObjectTag: for (int i=0 ; i<length ; i++) vblist[i].value = SnmpVarBind.noSuchObject; break; case SnmpDataTypeEnums.errNoSuchInstanceTag: for (int i=0 ; i<length ; i++) vblist[i].value = SnmpVarBind.noSuchInstance; break; default: return newErrorResponsePdu(req,snmpRspGenErr,1); } return newValidResponsePdu(req,vblist); }
Example #9
Source File: SnmpRequestHandler.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Check the type of the pdu: only the get/set/bulk request * are accepted. */ private boolean checkPduType(SnmpPduPacket pdu) { boolean result; switch(pdu.type) { case SnmpDefinitions.pduGetRequestPdu: case SnmpDefinitions.pduGetNextRequestPdu: case SnmpDefinitions.pduSetRequestPdu: case SnmpDefinitions.pduGetBulkRequestPdu: result = true ; break; default: if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, dbgTag, "checkPduType", "cannot respond to this kind of PDU"); } result = false ; break; } return result ; }
Example #10
Source File: SnmpRequestHandler.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * Check the type of the pdu: only the get/set/bulk request * are accepted. */ private boolean checkPduType(SnmpPduPacket pdu) { boolean result; switch(pdu.type) { case SnmpDefinitions.pduGetRequestPdu: case SnmpDefinitions.pduGetNextRequestPdu: case SnmpDefinitions.pduSetRequestPdu: case SnmpDefinitions.pduGetBulkRequestPdu: result = true ; break; default: if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, dbgTag, "checkPduType", "cannot respond to this kind of PDU"); } result = false ; break; } return result ; }
Example #11
Source File: SnmpRequestHandler.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * Make a response pdu with the specified error status and index. * NOTE: the response pdu share its varBindList with the request pdu. */ private SnmpPduRequest newValidResponsePdu(SnmpPduPacket reqPdu, SnmpVarBind[] varBindList) { SnmpPduRequest result = new SnmpPduRequest() ; result.address = reqPdu.address ; result.port = reqPdu.port ; result.version = reqPdu.version ; result.community = reqPdu.community ; result.type = SnmpPduRequest.pduGetResponsePdu ; result.requestId = reqPdu.requestId ; result.errorStatus = SnmpDefinitions.snmpRspNoError ; result.errorIndex = 0 ; result.varBindList = varBindList ; ((SnmpAdaptorServer)adaptorServer). updateErrorCounters(result.errorStatus) ; return result ; }
Example #12
Source File: SnmpRequestHandler.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
SnmpPduPacket makeErrorVarbindPdu(SnmpPduPacket req, int statusTag) { final SnmpVarBind[] vblist = req.varBindList; final int length = vblist.length; switch (statusTag) { case SnmpDataTypeEnums.errEndOfMibViewTag: for (int i=0 ; i<length ; i++) vblist[i].value = SnmpVarBind.endOfMibView; break; case SnmpDataTypeEnums.errNoSuchObjectTag: for (int i=0 ; i<length ; i++) vblist[i].value = SnmpVarBind.noSuchObject; break; case SnmpDataTypeEnums.errNoSuchInstanceTag: for (int i=0 ; i<length ; i++) vblist[i].value = SnmpVarBind.noSuchInstance; break; default: return newErrorResponsePdu(req,snmpRspGenErr,1); } return newValidResponsePdu(req,vblist); }
Example #13
Source File: SnmpRequestHandler.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * Make a response pdu with the specified error status and index. * NOTE: the response pdu share its varBindList with the request pdu. */ private SnmpPduRequest newValidResponsePdu(SnmpPduPacket reqPdu, SnmpVarBind[] varBindList) { SnmpPduRequest result = new SnmpPduRequest() ; result.address = reqPdu.address ; result.port = reqPdu.port ; result.version = reqPdu.version ; result.community = reqPdu.community ; result.type = SnmpPduRequest.pduGetResponsePdu ; result.requestId = reqPdu.requestId ; result.errorStatus = SnmpDefinitions.snmpRspNoError ; result.errorIndex = 0 ; result.varBindList = varBindList ; ((SnmpAdaptorServer)adaptorServer). updateErrorCounters(result.errorStatus) ; return result ; }
Example #14
Source File: SnmpRequestHandler.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * Check the type of the pdu: only the get/set/bulk request * are accepted. */ private boolean checkPduType(SnmpPduPacket pdu) { boolean result; switch(pdu.type) { case SnmpDefinitions.pduGetRequestPdu: case SnmpDefinitions.pduGetNextRequestPdu: case SnmpDefinitions.pduSetRequestPdu: case SnmpDefinitions.pduGetBulkRequestPdu: result = true ; break; default: if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, dbgTag, "checkPduType", "cannot respond to this kind of PDU"); } result = false ; break; } return result ; }
Example #15
Source File: SnmpRequestHandler.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
SnmpPduPacket makeErrorVarbindPdu(SnmpPduPacket req, int statusTag) { final SnmpVarBind[] vblist = req.varBindList; final int length = vblist.length; switch (statusTag) { case SnmpDataTypeEnums.errEndOfMibViewTag: for (int i=0 ; i<length ; i++) vblist[i].value = SnmpVarBind.endOfMibView; break; case SnmpDataTypeEnums.errNoSuchObjectTag: for (int i=0 ; i<length ; i++) vblist[i].value = SnmpVarBind.noSuchObject; break; case SnmpDataTypeEnums.errNoSuchInstanceTag: for (int i=0 ; i<length ; i++) vblist[i].value = SnmpVarBind.noSuchInstance; break; default: return newErrorResponsePdu(req,snmpRspGenErr,1); } return newValidResponsePdu(req,vblist); }
Example #16
Source File: SnmpRequestHandler.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
private SnmpPduPacket mergeResponses(SnmpPduRequest req) { if (req.type == pduGetNextRequestPdu) { return mergeNextResponses(req); } SnmpVarBind[] result= req.varBindList; // Go through the list of subrequests and concatenate. // Hopefully, by now all the sub-requests should be finished // for(Enumeration<SnmpSubRequestHandler> e= subs.elements(); e.hasMoreElements();) { SnmpSubRequestHandler sub= e.nextElement(); sub.updateResult(result); } return newValidResponsePdu(req,result); }
Example #17
Source File: SnmpRequestHandler.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private SnmpPduPacket mergeNextResponses(SnmpPduRequest req) { int max= req.varBindList.length; SnmpVarBind[] result= new SnmpVarBind[max]; // Go through the list of subrequests and concatenate. // Hopefully, by now all the sub-requests should be finished // for(Enumeration<SnmpSubRequestHandler> e= subs.elements(); e.hasMoreElements();) { SnmpSubRequestHandler sub= e.nextElement(); sub.updateResult(result); } if (req.version == snmpVersionTwo) { return newValidResponsePdu(req,result); } // In v1 make sure there is no endOfMibView ... // for(int i=0; i < max; i++) { SnmpValue val= result[i].value; if (val == SnmpVarBind.endOfMibView) return newErrorResponsePdu(req, SnmpDefinitions.snmpRspNoSuchName, i+1); } // So far so good ... // return newValidResponsePdu(req,result); }
Example #18
Source File: SnmpAdaptorServer.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * Send the specified trap PDU to the passed <CODE>SnmpPeer</CODE>. * @param peer The destination peer. The Read community string is used of * <CODE>SnmpParameters</CODE> is used as the trap community string. * @param pdu The pdu to send. * @exception IOException An I/O error occurred while sending the trap. * @exception SnmpStatusException If the trap exceeds the limit defined * by <CODE>bufferSize</CODE>. * @since 1.5 */ @Override public void snmpPduTrap(SnmpPeer peer, SnmpPduPacket pdu) throws IOException, SnmpStatusException { if(peer != null) { pdu.port = peer.getDestPort(); sendTrapPdu(peer.getDestAddr(), pdu); } else { pdu.port = getTrapPort().intValue(); sendTrapPdu(pdu); } }
Example #19
Source File: SnmpRequestHandler.java From JDKSourceCode1.8 with MIT License | 5 votes |
SnmpPduPacket makeNoMibErrorPdu(SnmpPduRequest req, Object userData) { // There is no agent registered // if (req.version == SnmpDefinitions.snmpVersionOne) { // Version 1: => NoSuchName return newErrorResponsePdu(req,snmpRspNoSuchName,1); } else if (req.version == SnmpDefinitions.snmpVersionTwo) { // Version 2: => depends on PDU type switch (req.type) { case pduSetRequestPdu : case pduWalkRequest : // SET request => NoAccess return newErrorResponsePdu(req,snmpRspNoAccess,1); case pduGetRequestPdu : // GET request => NoSuchObject return makeErrorVarbindPdu(req,SnmpDataTypeEnums. errNoSuchObjectTag); case pduGetNextRequestPdu : case pduGetBulkRequestPdu : // GET-NEXT or GET-BULK => EndOfMibView return makeErrorVarbindPdu(req,SnmpDataTypeEnums. errEndOfMibViewTag); default: } } // Something wrong here: => snmpRspGenErr return newErrorResponsePdu(req,snmpRspGenErr,1); }
Example #20
Source File: SnmpRequestHandler.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Make a response pdu with the specified error status and index. * NOTE: the response pdu share its varBindList with the request pdu. */ private SnmpPduRequest newErrorResponsePdu(SnmpPduPacket req,int s,int i) { SnmpPduRequest result = newValidResponsePdu(req, null) ; result.errorStatus = s ; result.errorIndex = i ; result.varBindList = req.varBindList ; ((SnmpAdaptorServer)adaptorServer). updateErrorCounters(result.errorStatus) ; return result ; }
Example #21
Source File: SnmpRequestHandler.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private SnmpPduPacket mergeNextResponses(SnmpPduRequest req) { int max= req.varBindList.length; SnmpVarBind[] result= new SnmpVarBind[max]; // Go through the list of subrequests and concatenate. // Hopefully, by now all the sub-requests should be finished // for(Enumeration<SnmpSubRequestHandler> e= subs.elements(); e.hasMoreElements();) { SnmpSubRequestHandler sub= e.nextElement(); sub.updateResult(result); } if (req.version == snmpVersionTwo) { return newValidResponsePdu(req,result); } // In v1 make sure there is no endOfMibView ... // for(int i=0; i < max; i++) { SnmpValue val= result[i].value; if (val == SnmpVarBind.endOfMibView) return newErrorResponsePdu(req, SnmpDefinitions.snmpRspNoSuchName, i+1); } // So far so good ... // return newValidResponsePdu(req,result); }
Example #22
Source File: SnmpAdaptorServer.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Send the specified trap PDU to the passed <CODE>SnmpPeer</CODE>. * @param peer The destination peer. The Read community string is used of * <CODE>SnmpParameters</CODE> is used as the trap community string. * @param pdu The pdu to send. * @exception IOException An I/O error occurred while sending the trap. * @exception SnmpStatusException If the trap exceeds the limit defined * by <CODE>bufferSize</CODE>. * @since 1.5 */ @Override public void snmpPduTrap(SnmpPeer peer, SnmpPduPacket pdu) throws IOException, SnmpStatusException { if(peer != null) { pdu.port = peer.getDestPort(); sendTrapPdu(peer.getDestAddr(), pdu); } else { pdu.port = getTrapPort().intValue(); sendTrapPdu(pdu); } }
Example #23
Source File: SnmpRequestHandler.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
SnmpPduPacket makeNoMibErrorPdu(SnmpPduRequest req, Object userData) { // There is no agent registered // if (req.version == SnmpDefinitions.snmpVersionOne) { // Version 1: => NoSuchName return newErrorResponsePdu(req,snmpRspNoSuchName,1); } else if (req.version == SnmpDefinitions.snmpVersionTwo) { // Version 2: => depends on PDU type switch (req.type) { case pduSetRequestPdu : case pduWalkRequest : // SET request => NoAccess return newErrorResponsePdu(req,snmpRspNoAccess,1); case pduGetRequestPdu : // GET request => NoSuchObject return makeErrorVarbindPdu(req,SnmpDataTypeEnums. errNoSuchObjectTag); case pduGetNextRequestPdu : case pduGetBulkRequestPdu : // GET-NEXT or GET-BULK => EndOfMibView return makeErrorVarbindPdu(req,SnmpDataTypeEnums. errEndOfMibViewTag); default: } } // Something wrong here: => snmpRspGenErr return newErrorResponsePdu(req,snmpRspGenErr,1); }
Example #24
Source File: SnmpRequestHandler.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private SnmpPduPacket mergeNextResponses(SnmpPduRequest req) { int max= req.varBindList.length; SnmpVarBind[] result= new SnmpVarBind[max]; // Go through the list of subrequests and concatenate. // Hopefully, by now all the sub-requests should be finished // for(Enumeration<SnmpSubRequestHandler> e= subs.elements(); e.hasMoreElements();) { SnmpSubRequestHandler sub= e.nextElement(); sub.updateResult(result); } if (req.version == snmpVersionTwo) { return newValidResponsePdu(req,result); } // In v1 make sure there is no endOfMibView ... // for(int i=0; i < max; i++) { SnmpValue val= result[i].value; if (val == SnmpVarBind.endOfMibView) return newErrorResponsePdu(req, SnmpDefinitions.snmpRspNoSuchName, i+1); } // So far so good ... // return newValidResponsePdu(req,result); }
Example #25
Source File: SnmpRequestHandler.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
SnmpPduPacket makeNoMibErrorPdu(SnmpPduRequest req, Object userData) { // There is no agent registered // if (req.version == SnmpDefinitions.snmpVersionOne) { // Version 1: => NoSuchName return newErrorResponsePdu(req,snmpRspNoSuchName,1); } else if (req.version == SnmpDefinitions.snmpVersionTwo) { // Version 2: => depends on PDU type switch (req.type) { case pduSetRequestPdu : case pduWalkRequest : // SET request => NoAccess return newErrorResponsePdu(req,snmpRspNoAccess,1); case pduGetRequestPdu : // GET request => NoSuchObject return makeErrorVarbindPdu(req,SnmpDataTypeEnums. errNoSuchObjectTag); case pduGetNextRequestPdu : case pduGetBulkRequestPdu : // GET-NEXT or GET-BULK => EndOfMibView return makeErrorVarbindPdu(req,SnmpDataTypeEnums. errEndOfMibViewTag); default: } } // Something wrong here: => snmpRspGenErr return newErrorResponsePdu(req,snmpRspGenErr,1); }
Example #26
Source File: SnmpRequestHandler.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private SnmpPduPacket mergeNextResponses(SnmpPduRequest req) { int max= req.varBindList.length; SnmpVarBind[] result= new SnmpVarBind[max]; // Go through the list of subrequests and concatenate. // Hopefully, by now all the sub-requests should be finished // for(Enumeration<SnmpSubRequestHandler> e= subs.elements(); e.hasMoreElements();) { SnmpSubRequestHandler sub= e.nextElement(); sub.updateResult(result); } if (req.version == snmpVersionTwo) { return newValidResponsePdu(req,result); } // In v1 make sure there is no endOfMibView ... // for(int i=0; i < max; i++) { SnmpValue val= result[i].value; if (val == SnmpVarBind.endOfMibView) return newErrorResponsePdu(req, SnmpDefinitions.snmpRspNoSuchName, i+1); } // So far so good ... // return newValidResponsePdu(req,result); }
Example #27
Source File: SnmpRequestHandler.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Make a response pdu with the specified error status and index. * NOTE: the response pdu share its varBindList with the request pdu. */ private SnmpPduRequest newErrorResponsePdu(SnmpPduPacket req,int s,int i) { SnmpPduRequest result = newValidResponsePdu(req, null) ; result.errorStatus = s ; result.errorIndex = i ; result.varBindList = req.varBindList ; ((SnmpAdaptorServer)adaptorServer). updateErrorCounters(result.errorStatus) ; return result ; }
Example #28
Source File: SnmpRequestHandler.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private SnmpPduPacket mergeNextResponses(SnmpPduRequest req) { int max= req.varBindList.length; SnmpVarBind[] result= new SnmpVarBind[max]; // Go through the list of subrequests and concatenate. // Hopefully, by now all the sub-requests should be finished // for(Enumeration<SnmpSubRequestHandler> e= subs.elements(); e.hasMoreElements();) { SnmpSubRequestHandler sub= e.nextElement(); sub.updateResult(result); } if (req.version == snmpVersionTwo) { return newValidResponsePdu(req,result); } // In v1 make sure there is no endOfMibView ... // for(int i=0; i < max; i++) { SnmpValue val= result[i].value; if (val == SnmpVarBind.endOfMibView) return newErrorResponsePdu(req, SnmpDefinitions.snmpRspNoSuchName, i+1); } // So far so good ... // return newValidResponsePdu(req,result); }
Example #29
Source File: SnmpRequestHandler.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private SnmpPduPacket mergeNextResponses(SnmpPduRequest req) { int max= req.varBindList.length; SnmpVarBind[] result= new SnmpVarBind[max]; // Go through the list of subrequests and concatenate. // Hopefully, by now all the sub-requests should be finished // for(Enumeration<SnmpSubRequestHandler> e= subs.elements(); e.hasMoreElements();) { SnmpSubRequestHandler sub= e.nextElement(); sub.updateResult(result); } if (req.version == snmpVersionTwo) { return newValidResponsePdu(req,result); } // In v1 make sure there is no endOfMibView ... // for(int i=0; i < max; i++) { SnmpValue val= result[i].value; if (val == SnmpVarBind.endOfMibView) return newErrorResponsePdu(req, SnmpDefinitions.snmpRspNoSuchName, i+1); } // So far so good ... // return newValidResponsePdu(req,result); }
Example #30
Source File: SnmpRequestHandler.java From JDKSourceCode1.8 with MIT License | 5 votes |
private SnmpPduPacket mergeNextResponses(SnmpPduRequest req) { int max= req.varBindList.length; SnmpVarBind[] result= new SnmpVarBind[max]; // Go through the list of subrequests and concatenate. // Hopefully, by now all the sub-requests should be finished // for(Enumeration<SnmpSubRequestHandler> e= subs.elements(); e.hasMoreElements();) { SnmpSubRequestHandler sub= e.nextElement(); sub.updateResult(result); } if (req.version == snmpVersionTwo) { return newValidResponsePdu(req,result); } // In v1 make sure there is no endOfMibView ... // for(int i=0; i < max; i++) { SnmpValue val= result[i].value; if (val == SnmpVarBind.endOfMibView) return newErrorResponsePdu(req, SnmpDefinitions.snmpRspNoSuchName, i+1); } // So far so good ... // return newValidResponsePdu(req,result); }