本文整理了Java中org.snmp4j.PDU.clone()
方法的一些代码示例,展示了PDU.clone()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。PDU.clone()
方法的具体详情如下:
包路径:org.snmp4j.PDU
类名称:PDU
方法名:clone
暂无
代码示例来源:origin: org.snmp4j/snmp4j-agent
private PDU createResponse() {
PDU resp = (PDU) source.getPDU().clone();
resp.clear();
resp.setType(PDU.RESPONSE);
resp.setRequestID(source.getPDU().getRequestID());
resp.setErrorIndex(0);
resp.setErrorStatus(PDU.noError);
return resp;
}
代码示例来源:origin: org.kaazing/snmp4j-agent
private PDU createResponse() {
PDU resp = (PDU) requestEvent.getPDU().clone();
resp.clear();
resp.setType(PDU.RESPONSE);
resp.setRequestID(requestEvent.getPDU().getRequestID());
resp.setErrorIndex(0);
resp.setErrorStatus(PDU.noError);
return resp;
}
代码示例来源:origin: org.kaazing/snmp4j
/**
* Sends a RESPONSE PDU to the source address of a INFORM request.
* @param event
* the <code>CommandResponderEvent</code> with the INFORM request.
* @throws
* MessageException if the response could not be created and sent.
*/
protected void sendInformResponse(CommandResponderEvent event) throws
MessageException {
PDU responsePDU = (PDU) event.getPDU().clone();
responsePDU.setType(PDU.RESPONSE);
responsePDU.setErrorStatus(PDU.noError);
responsePDU.setErrorIndex(0);
messageDispatcher.returnResponsePdu(event.getMessageProcessingModel(),
event.getSecurityModel(),
event.getSecurityName(),
event.getSecurityLevel(),
responsePDU,
event.getMaxSizeResponsePDU(),
event.getStateReference(),
new StatusInformation());
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j
/**
* Sends a RESPONSE PDU to the source address of a INFORM request.
* @param event
* the <code>CommandResponderEvent</code> with the INFORM request.
* @throws
* MessageException if the response could not be created and sent.
*/
protected void sendInformResponse(CommandResponderEvent event) throws
MessageException {
PDU responsePDU = (PDU) event.getPDU().clone();
responsePDU.setType(PDU.RESPONSE);
responsePDU.setErrorStatus(PDU.noError);
responsePDU.setErrorIndex(0);
messageDispatcher.returnResponsePdu(event.getMessageProcessingModel(),
event.getSecurityModel(),
event.getSecurityName(),
event.getSecurityLevel(),
responsePDU,
event.getMaxSizeResponsePDU(),
event.getStateReference(),
new StatusInformation());
}
}
代码示例来源:origin: org.snmp4j/snmp4j
/**
* Sends a RESPONSE PDU to the source address of a INFORM request.
*
* @param event
* the <code>CommandResponderEvent</code> with the INFORM request.
*
* @throws MessageException
* if the response could not be created and sent.
*/
protected void sendInformResponse(CommandResponderEvent event) throws
MessageException {
PDU responsePDU = (PDU) event.getPDU().clone();
responsePDU.setType(PDU.RESPONSE);
responsePDU.setErrorStatus(PDU.noError);
responsePDU.setErrorIndex(0);
messageDispatcher.returnResponsePdu(event.getMessageProcessingModel(),
event.getSecurityModel(),
event.getSecurityName(),
event.getSecurityLevel(),
responsePDU,
event.getMaxSizeResponsePDU(),
event.getStateReference(),
new StatusInformation());
}
}
代码示例来源:origin: org.kaazing/snmp4j-agent
private void sendUnknownPDUHandlersReport(CommandResponderEvent command) {
logger.info("No PDU handler found for request "+command);
CounterEvent counter =
new CounterEvent(this, SnmpConstants.snmpUnknownPDUHandlers);
fireIncrementCounter(counter);
if ((command.getMessageProcessingModel() == MessageProcessingModel.MPv3) &&
(command.getPDU() instanceof ScopedPDU)) {
ScopedPDU request = (ScopedPDU) command.getPDU();
ScopedPDU report = new ScopedPDU();
report.setContextEngineID(request.getContextEngineID());
report.setContextName(request.getContextName());
report.setType(PDU.REPORT);
report.add(new VariableBinding(counter.getOid(),
counter.getCurrentValue()));
sendResponse(command, report);
}
else {
PDU resp = (PDU) command.getPDU().clone();
resp.setErrorStatus(PDU.genErr);
sendResponse(command, resp);
}
}
代码示例来源:origin: org.snmp4j/snmp4j-agent
private void sendUnknownPDUHandlersReport(CommandResponderEvent command) {
logger.info("No PDU handler found for request " + command);
CounterEvent counter =
new CounterEvent(this, SnmpConstants.snmpUnknownPDUHandlers);
fireIncrementCounter(counter);
if ((command.getMessageProcessingModel() == MessageProcessingModel.MPv3) &&
(command.getPDU() instanceof ScopedPDU)) {
ScopedPDU request = (ScopedPDU) command.getPDU();
ScopedPDU report = new ScopedPDU();
report.setContextEngineID(request.getContextEngineID());
report.setContextName(request.getContextName());
report.setType(PDU.REPORT);
report.add(new VariableBinding(counter.getOid(),
counter.getCurrentValue()));
sendResponse(command, report);
} else {
PDU resp = (PDU) command.getPDU().clone();
resp.setErrorStatus(PDU.genErr);
sendResponse(command, resp);
}
}
内容来源于网络,如有侵权,请联系作者删除!