org.snmp4j.smi.OID.get()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(154)

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

OID.get介绍

[英]Gets the sub-identifier value at the specified position.
[中]

代码示例

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

public void fromSubIndex(OID subIndex, boolean impliedLength) {
 byte[] rawValue = new byte[4];
 for (int i=0; i<rawValue.length; i++) {
  rawValue[i] = (byte)(subIndex.get(i) & 0xFF);
 }
 try {
  setAddress(rawValue);
 }
 catch (UnknownHostException ex) {
  throw new RuntimeException(ex);
 }
}

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

public void fromSubIndex(OID subIndex, boolean impliedLength) {
  setValue(subIndex.get(0));
 }
}

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

public void fromSubIndex(OID subIndex, boolean impliedLength) {
 byte[] rawValue = new byte[4];
 for (int i=0; i<rawValue.length; i++) {
  rawValue[i] = (byte)(subIndex.get(i) & 0xFF);
 }
 try {
  setAddress(rawValue);
 }
 catch (UnknownHostException ex) {
  throw new RuntimeException(ex);
 }
}

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

public void fromSubIndex(OID subIndex, boolean impliedLength) {
 byte[] rawValue = new byte[4];
 for (int i=0; i<rawValue.length; i++) {
  rawValue[i] = (byte)(subIndex.get(i) & 0xFF);
 }
 try {
  setAddress(rawValue);
 }
 catch (UnknownHostException ex) {
  throw new RuntimeException(ex);
 }
}

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

public void fromSubIndex(OID subIndex, boolean impliedLength) {
 setValue(subIndex.get(0));
}

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

public void fromSubIndex(OID subIndex, boolean impliedLength) {
 setValue(subIndex.get(0));
}

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

public OID getUpperBound() {
  OID upperBound = new OID(oid);
  int lastID = oid.size() - 1;
  /**
   * This is not quite correct because we would have to search up the tree
   * if the last sub ID is 0xFFFFFFFF, but since a table OID must end on 1
   * by SMI rules we should be on the safe side here.
   */
  upperBound.set(lastID, oid.get(lastID) + 1);
  return upperBound;
}

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

public OID getUpperBound() {
 OID upperBound = new OID(oid);
 int lastID = oid.size()-1;
 /**
  * This is not quite correct because we would have to search up the tree
  * if the last sub ID is 0xFFFFFFFF, but since a table OID must end on 1
  * by SMI rules we should be on the safe side here.
  */
 upperBound.set(lastID, oid.get(lastID)+1);
 return upperBound;
}

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

public boolean isValidIndex(OID index) {
  boolean ok = super.isValidIndex(index);
  int securityModel = index.get(0);
  if (ok && (securityModel > SecurityModel.SECURITY_MODEL_SNMPv2c)) {
   SecurityModels secModels = SecurityModels.getInstance();
   if (secModels.getSecurityModel(new Integer32(securityModel)) == null) {
    return false;
   }
  }
  return ok;
 }
};

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

public boolean isValidIndex(OID index) {
  boolean ok = super.isValidIndex(index);
  if (ok) {
   SecurityModels secModels = SecurityModels.getInstance();
   if (secModels.getSecurityModel(new Integer32(index.get(0))) == null) {
    return false;
   }
  }
  return ok;
 }
};

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

public boolean isValidIndex(OID index) {
  boolean ok = super.isValidIndex(index);
  if (ok) {
   SecurityModels secModels = SecurityModels.getInstance();
   Integer32 secModel = new Integer32(index.get(index.size()-2));
   if ((secModel.getValue() != SecurityModel.SECURITY_MODEL_ANY) &&
     (secModels.getSecurityModel(secModel) == null)) {
    return false;
   }
   int secLevel = index.get(index.size()-1);
   if ((secLevel < 1) || (secLevel > 3)) {
    return false;
   }
  }
  return ok;
 }
};

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

public boolean isValidIndex(OID index) {
  boolean ok = super.isValidIndex(index);
  if (ok) {
   SecurityModels secModels = SecurityModels.getInstance();
   Integer32 secModel = new Integer32(index.get(index.size()-2));
   int secModelID = secModel.getValue();
   if ((secModelID != SecurityModel.SECURITY_MODEL_ANY) && (secModelID > SecurityModel.SECURITY_MODEL_SNMPv2c) &&
     (secModels.getSecurityModel(secModel) == null)) {
    return false;
   }
   int secLevel = index.get(index.size()-1);
   if ((secLevel < 1) || (secLevel > 3)) {
    return false;
   }
  }
  return ok;
 }
};

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

public CellInfo(DefaultMOTable table, OID oid) {
  this.table = table;
  this.index = table.getIndexPart(oid);
  if ((oid.size() > table.oid.size()) &&
      (oid.startsWith(table.oid))) {
    id = oid.get(table.oid.size());
  }
}

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

public CellInfo(OID oid) {
   this.index = getIndexPart(oid);
   if ((oid.size() > DefaultMOTable.this.oid.size()) &&
     (oid.startsWith(DefaultMOTable.this.oid))) {
    id = oid.get(DefaultMOTable.this.oid.size());
   }
/*
   else {
    id = columns[0].getColumnID();
   }
*/
  }

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

/**
 * Gets the generic trap ID from a notification OID.
 * @param oid
 *    an OID.
 * @return
 *    -1 if the supplied OID is not a generic trap, otherwise a zero or positive value
 *    will be returned that denotes the generic trap ID.
 */
public static int getGenericTrapID(OID oid) {
 if ((oid == null) || (oid.size() != snmpTraps.size()+1)) {
  return -1;
 }
 if (oid.leftMostCompare(snmpTraps.size(), snmpTraps) == 0) {
  return oid.get(oid.size() - 1) - 1;
 }
 return -1;
}

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

/**
 * Gets the generic trap ID from a notification OID.
 * @param oid
 *    an OID.
 * @return
 *    -1 if the supplied OID is not a generic trap, otherwise a zero or positive value
 *    will be returned that denotes the generic trap ID.
 */
public static int getGenericTrapID(OID oid) {
 if ((oid == null) || (oid.size() != snmpTraps.size()+1)) {
  return -1;
 }
 if (oid.leftMostCompare(snmpTraps.size(), snmpTraps) == 0) {
  return oid.get(oid.size() - 1) - 1;
 }
 return -1;
}

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

/**
 * Gets the generic trap ID from a notification OID.
 * @param oid
 *    an OID.
 * @return
 *    -1 if the supplied OID is not a generic trap, otherwise a value >= 0
 *    will be returned that denotes the generic trap ID.
 */
public static int getGenericTrapID(OID oid) {
 if ((oid == null) || (oid.size() != snmpTraps.size()+1)) {
  return -1;
 }
 if (oid.leftMostCompare(snmpTraps.size(), snmpTraps) == 0) {
  return oid.get(oid.size() - 1) - 1;
 }
 return -1;
}

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

public void incrementCounter(CounterEvent event) {
 if ((event.getOid().startsWith(usmStatsPrefix)) &&
   (event.getOid().size() > usmStatsPrefix.size())) {
  Counter32 current = (Counter32)
     usmStats[event.getOid().get(usmStatsPrefix.size())-1].getValue();
  current.increment();
  event.setCurrentValue((Counter32)current.clone());
 }
}

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

public void incrementCounter(CounterEvent event) {
 if ((event.getOid().startsWith(usmStatsPrefix)) &&
   (event.getOid().size() > usmStatsPrefix.size())) {
  Counter32 current = (Counter32)
     usmStats[event.getOid().get(usmStatsPrefix.size())-1].getValue();
  current.increment();
  event.setCurrentValue((Counter32)current.clone());
 }
}

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

public void incrementCounter(CounterEvent event) {
 if ((event.getOid().startsWith(snmpStatsPrefix)) &&
   (event.getOid().size() > snmpStatsPrefix.size())) {
  int suffix = event.getOid().get(snmpStatsPrefix.size());
  for (int i=0; i<snmpStatsOIDs.length; i++) {
   if (suffix == snmpStatsOIDs[i].get(snmpStatsPrefix.size())) {
    Counter32 current = (Counter32) snmpStats[i].getValue();
    current.increment();

相关文章