本文整理汇总了Java中com.sun.jmx.snmp.SnmpPduPacket.pduSetRequestPdu方法的典型用法代码示例。如果您正苦于以下问题:Java SnmpPduPacket.pduSetRequestPdu方法的具体用法?Java SnmpPduPacket.pduSetRequestPdu怎么用?Java SnmpPduPacket.pduSetRequestPdu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.jmx.snmp.SnmpPduPacket
的用法示例。
在下文中一共展示了SnmpPduPacket.pduSetRequestPdu方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeResponsePdu
import com.sun.jmx.snmp.SnmpPduPacket; //导入方法依赖的package包/类
/**
* Here we make a response pdu from a request pdu.
* We return null if there is no pdu to reply.
*/
private SnmpPduPacket makeResponsePdu(SnmpPduPacket reqPdu,
Object userData) {
SnmpAdaptorServer snmpServer = (SnmpAdaptorServer)adaptorServer ;
SnmpPduPacket respPdu = null ;
snmpServer.updateRequestCounters(reqPdu.type) ;
if (reqPdu.varBindList != null)
snmpServer.updateVarCounters(reqPdu.type,
reqPdu.varBindList.length) ;
if (checkPduType(reqPdu)) {
respPdu = checkAcl(reqPdu) ;
if (respPdu == null) { // reqPdu is accepted by ACLs
if (mibs.size() < 1) {
if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) {
SNMP_ADAPTOR_LOGGER.logp(Level.FINER, dbgTag,
"makeResponsePdu", "Request " + reqPdu.requestId +
" received but no MIB registered.");
}
return makeNoMibErrorPdu((SnmpPduRequest)reqPdu, userData);
}
switch(reqPdu.type) {
case SnmpPduPacket.pduGetRequestPdu:
case SnmpPduPacket.pduGetNextRequestPdu:
case SnmpPduPacket.pduSetRequestPdu:
respPdu = makeGetSetResponsePdu((SnmpPduRequest)reqPdu,
userData) ;
break ;
case SnmpPduPacket.pduGetBulkRequestPdu:
respPdu = makeGetBulkResponsePdu((SnmpPduBulk)reqPdu,
userData) ;
break ;
}
}
else { // reqPdu is rejected by ACLs
// respPdu contains the error response to be sent.
// We send this response only if authResEnabled is true.
if (!snmpServer.getAuthRespEnabled()) { // No response should be sent
respPdu = null ;
}
if (snmpServer.getAuthTrapEnabled()) { // A trap must be sent
try {
snmpServer.snmpV1Trap(SnmpPduTrap.
trapAuthenticationFailure, 0,
new SnmpVarBindList()) ;
}
catch(Exception x) {
if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, dbgTag,
"makeResponsePdu", "Failure when sending authentication trap", x);
}
}
}
}
}
return respPdu ;
}