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

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

本文整理了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

  1. @Override
  2. public void poll() throws Exception {
  3. this.pdu.clear();
  4. this.pdu.setType(PDU.GET);
  5. // prepare the request items
  6. for (OID oid : oids) {
  7. this.pdu.add(new VariableBinding(oid));
  8. }
  9. // send the request
  10. snmp.send(pdu, target, null, this);
  11. }

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

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

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

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

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

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

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

  1. private PDU createResponse() {
  2. PDU resp = (PDU) requestEvent.getPDU().clone();
  3. resp.clear();
  4. resp.setType(PDU.RESPONSE);
  5. resp.setRequestID(requestEvent.getPDU().getRequestID());
  6. resp.setErrorIndex(0);
  7. resp.setErrorStatus(PDU.noError);
  8. return resp;
  9. }

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

  1. private PDU createResponse() {
  2. PDU resp = (PDU) source.getPDU().clone();
  3. resp.clear();
  4. resp.setType(PDU.RESPONSE);
  5. resp.setRequestID(source.getPDU().getRequestID());
  6. resp.setErrorIndex(0);
  7. resp.setErrorStatus(PDU.noError);
  8. return resp;
  9. }

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

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

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

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

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

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

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

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

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

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

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

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

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

  1. if ((resp.getErrorStatus() == PDU.tooBig) &&
  2. (reqPDU.getType() != PDU.GETBULK)) {
  3. response.getResponse().clear();
  4. response.getResponse().setErrorStatus(PDU.noError);
  5. response.getResponse().setErrorIndex(0);
  6. response.getResponse().clear();
  7. response.getResponse().setErrorStatus(PDU.noError);
  8. response.getResponse().setErrorIndex(0);

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

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

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

  1. if ((resp.getErrorStatus() == PDU.tooBig) &&
  2. (reqPDU.getType() != PDU.GETBULK)) {
  3. response.getResponse().clear();
  4. response.getResponse().setErrorStatus(PDU.noError);
  5. response.getResponse().setErrorIndex(0);
  6. response.getResponse().clear();
  7. response.getResponse().setErrorStatus(PDU.noError);
  8. response.getResponse().setErrorIndex(0);

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

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

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

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

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

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

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

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

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

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

相关文章