org.snmp4j.PDU.clear()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中org.snmp4j.PDU.clear()方法的一些代码示例,展示了PDU.clear()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。PDU.clear()方法的具体详情如下:
包路径:org.snmp4j.PDU
类名称:PDU
方法名:clear

PDU.clear介绍

[英]Removes all variable bindings from the PDU and sets the request ID to zero. This can be used to reuse a PDU for another request.
[中]从PDU中删除所有变量绑定,并将请求ID设置为零。这可用于将PDU重新用于另一个请求。

代码示例

代码示例来源:origin: org.apache.servicemix/servicemix-snmp

@Override
public void poll() throws Exception {
  this.pdu.clear();
  this.pdu.setType(PDU.GET);
  // prepare the request items
  for (OID oid : oids) {
    this.pdu.add(new VariableBinding(oid));
  }
  // send the request
  snmp.send(pdu, target, null, this);
}

代码示例来源:origin: org.mobicents.tools.snmp.adaptor/core

/** This utility method is used to construct an error PDU. This code
 * was repeated so many times it was prudent to give it it's own method.
 * @param response This PDU is the one being modified into an error PDU.
 * @param oid The OID to contain the error Null instance.
 * @param errorIndex the VariableBinding in the PDU that caused the error. 
 * @param err The error number defined in the PDU class that indicates a given failure
 */
private void makeErrorPdu(PDU response, PDU pdu, int errorIndex, int err){
  response.clear();
  response.addAll(pdu.toArray());
  response.setErrorIndex(errorIndex);
  response.setErrorStatus(err);
}

代码示例来源:origin: org.jboss.jbossas/jboss-snmp

/** This utility method is used to construct an error PDU. This code
 * was repeated so many times it was prudent to give it it's own method.
 * @param response This PDU is the one being modified into an error PDU.
 * @param oid The OID to contain the error Null instance.
 * @param errorIndex the VariableBinding in the PDU that caused the error. 
 * @param err The error number defined in the PDU class that indicates a given failure
 */
private void makeErrorPdu(PDU response, PDU pdu, int errorIndex, int err){
  response.clear();
  response.addAll(pdu.toArray());
  response.setErrorIndex(errorIndex);
  response.setErrorStatus(err);
}

代码示例来源:origin: com.rogueai/snmp2bean

response.setType(PDU.RESPONSE);
response.clear(); // remove all the varbinds

代码示例来源: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.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.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j

ResponseEvent response) throws
 IOException {
pdu.clear();
OID effLevelOID = new OID(SNMP4J_LOGGER_OIDS[1]);
effLevelOID.append(loggerIndex);

代码示例来源:origin: org.snmp4j/snmp4j

ResponseEvent response) throws
 IOException {
pdu.clear();
OID effLevelOID = new OID(SNMP4J_LOGGER_OIDS[1]);
effLevelOID.append(loggerIndex);

代码示例来源:origin: org.kaazing/snmp4j

ResponseEvent response) throws
 IOException {
pdu.clear();
OID effLevelOID = new OID(SNMP4J_LOGGER_OIDS[1]);
effLevelOID.append(loggerIndex);

代码示例来源:origin: org.apache.camel/camel-snmp

@Override
protected int poll() throws Exception {
  this.pdu.clear();

代码示例来源:origin: org.kaazing/snmp4j

tooBigPDU.clear();
tooBigPDU.setRequestID(pdu.getRequestID());
tooBigPDU.setErrorStatus(SnmpConstants.SNMP_ERROR_TOO_BIG);

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j

tooBigPDU.clear();
tooBigPDU.setRequestID(pdu.getRequestID());
tooBigPDU.setErrorStatus(SnmpConstants.SNMP_ERROR_TOO_BIG);

代码示例来源:origin: org.kaazing/snmp4j-agent

if ((resp.getErrorStatus() == PDU.tooBig) &&
  (reqPDU.getType() != PDU.GETBULK)) {
 response.getResponse().clear();
 response.getResponse().setErrorStatus(PDU.noError);
 response.getResponse().setErrorIndex(0);
  response.getResponse().clear();
  response.getResponse().setErrorStatus(PDU.noError);
  response.getResponse().setErrorIndex(0);

代码示例来源:origin: org.snmp4j/snmp4j

tooBigPDU.clear();
tooBigPDU.setRequestID(pdu.getRequestID());
tooBigPDU.setErrorStatus(SnmpConstants.SNMP_ERROR_TOO_BIG);

代码示例来源:origin: org.snmp4j/snmp4j-agent

if ((resp.getErrorStatus() == PDU.tooBig) &&
    (reqPDU.getType() != PDU.GETBULK)) {
  response.getResponse().clear();
  response.getResponse().setErrorStatus(PDU.noError);
  response.getResponse().setErrorIndex(0);
    response.getResponse().clear();
    response.getResponse().setErrorStatus(PDU.noError);
    response.getResponse().setErrorIndex(0);

代码示例来源:origin: org.snmp4j/snmp4j

pdu.clear();
OID rowStatusOID = new OID(SNMP4J_LOGGER_OIDS[2]);
rowStatusOID.append(loggerIndex);

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j

pdu.clear();
OID rowStatusOID = new OID(SNMP4J_LOGGER_OIDS[2]);
rowStatusOID.append(loggerIndex);

代码示例来源:origin: org.kaazing/snmp4j

pdu.clear();
OID rowStatusOID = new OID(SNMP4J_LOGGER_OIDS[2]);
rowStatusOID.append(loggerIndex);

代码示例来源:origin: org.snmp4j/snmp4j-agent

response.clear();
response.setRequestID(requestEvent.getPDU().getRequestID());
response.setErrorStatus(PDU.tooBig);

代码示例来源:origin: org.kaazing/snmp4j-agent

response.clear();
response.setRequestID(requestEvent.getPDU().getRequestID());
response.setErrorStatus(PDU.tooBig);

相关文章