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

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

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

PDU.toArray介绍

[英]Returns an array with the variable bindings of this PDU.
[中]返回包含此PDU的变量绑定的数组。

代码示例

代码示例来源:origin: fbacchella/jrds

private void parsePDU(CommandResponderEvent ev) {
  log(Level.DEBUG, "trap received: %s", ev);
  PassiveProbe<OID> pp = findProbe(ev);
  Map<OID, Object> vars = new SnmpVars(ev.getPDU().toArray());
  Map<OID, Number> oids = new HashMap<OID, Number>(vars.size());
  for(Map.Entry<OID, Object> e: vars.entrySet()) {
    if(e.getValue() instanceof Number) {
      oids.put(e.getKey(), (Number) e.getValue());
    }
  }
  pp.store(new Date(), oids);
}

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

translatedResponse.addAll(respPDU.toArray());
translatedResponse.setErrorIndex(respPDU.getErrorIndex());
translatedResponse.setErrorStatus(respPDU.getErrorStatus());

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

translatedResponse.addAll(respPDU.toArray());
translatedResponse.setErrorIndex(respPDU.getErrorIndex());
translatedResponse.setErrorStatus(respPDU.getErrorStatus());

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

sourceV1.getGenericTrap(),
        sourceV1.getSpecificTrap())));
target.addAll(source.toArray());
target.add(new VariableBinding(SnmpConstants.snmpTrapAddress,
    sourceV1.getAgentAddress()));
  targetV1.setSpecificTrap(0);
target.addAll(source.toArray());
if (request.getCommandEvent().getPeerAddress() instanceof IpAddress) {
  InetAddress agentAddress = ((IpAddress)
target.addAll(source.toArray());

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

sourceV1.getGenericTrap(),
                  sourceV1.getSpecificTrap())));
target.addAll(source.toArray());
target.add(new VariableBinding(SnmpConstants.snmpTrapAddress,
                sourceV1.getAgentAddress()));
 targetV1.setSpecificTrap(0);
target.addAll(source.toArray());
if (request.getCommandEvent().getPeerAddress() instanceof IpAddress) {
 InetAddress agentAddress = ((IpAddress)
target.addAll(source.toArray());

相关文章