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

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

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

PDU.set介绍

[英]Sets the variable binding at the specified position.
[中]在指定位置设置变量绑定。

代码示例

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

response.setErrorStatus(PDU.noSuchName);
response.setErrorIndex(i+1);
response.set(i, new VariableBinding(vb.getOid()));
return;

代码示例来源:origin: OpenNMS/opennms

/**
 * @param request
 * @return
 */
private PDU processGetNext(PDU request) {
  PDU response = request;
  response.setErrorIndex(0);
  response.setErrorStatus(0);
  response.setType(PDU.RESPONSE);
  
  Vector<? extends VariableBinding> varBinds = response.getVariableBindings();
  for(int i = 0; i < varBinds.size(); i++) {
    VariableBinding varBind = varBinds.get(i);
    VariableBinding nextVarBind = m_agent.getNext(varBind.getOid());
    if (nextVarBind == null) {
      if (response instanceof PDUv1) {
        if (response.getErrorIndex() == 0) {
          response.setErrorIndex(i+1);
          response.setErrorStatus(PDU.noSuchName);
        } 
      } else {
        varBind.setVariable(Null.endOfMibView);
      }
    } else {
      response.set(i, nextVarBind);
    }
  }
  
  return response;
}

代码示例来源:origin: org.openscada.atlantis/org.openscada.da.server.snmp

request.set ( 0, new VariableBinding ( currentOID ) );
request.setRequestID ( new Integer32 ( 0 ) );
ResponseEvent responseEvent;

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

(VariableBinding) respPDU.get(respPDU.size() - 1).clone();
next.setVariable(new Null());
request.set(0, next);
request.setRequestID(new Integer32(0));
send();

代码示例来源:origin: OpenNMS/opennms

/**
 * @param request
 * @return
 */
private PDU processGet(PDU request) {
  PDU response = request;
  response.setErrorIndex(0);
  response.setErrorStatus(0);
  response.setType(PDU.RESPONSE);
  
  Vector<? extends VariableBinding> varBinds = response.getVariableBindings();
  for(int i = 0; i < varBinds.size(); i++) {
    VariableBinding varBind = varBinds.get(i);
    VariableBinding nextVarBind = m_agent.get(varBind.getOid());
    if (nextVarBind == null) {
      if (response instanceof PDUv1) {
        if (response.getErrorIndex() == 0) {
          response.setErrorIndex(i+1);
          response.setErrorStatus(PDU.noSuchName);
        } 
      } else {
        varBind.setVariable(Null.endOfMibView);
      }
    } else {
      response.set(i, nextVarBind);
    }
  }
  
  return response;
}

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

response.setErrorStatus(PDU.noSuchName);
response.setErrorIndex(i+1);
response.set(i, new VariableBinding(vb.getOid()));
return;

相关文章