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

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

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

OID.size介绍

[英]Returns the number of sub-identifiers in this OID.
[中]返回此OID中的子标识符数。

代码示例

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

/**
 * Checks whether this {@code OID} can be BER encoded.
 * @return
 *    {@code true} if size() >= 2 and size() <= 128 and if the first
 *    two sub-identifiers are less than 3 and 40 respectively.
 */
public boolean isValid() {
 return ((size() >= 2) && (size() <= 128) &&
     ((value[0] & 0xFFFFFFFFL) <= 2l) &&
     ((value[1] & 0xFFFFFFFFL) < 40l));
}

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

/**
 * Checks whether this {@code OID} can be BER encoded.
 *
 * @return {@code true} if size() &gt;= 2 and size() &lt;= 128 and if the first
 * two sub-identifiers are less than 3 and 40 respectively.
 */
public boolean isValid() {
  return ((size() >= 2) && (size() <= 128) &&
      ((value[0] & 0xFFFFFFFFL) <= 2l) &&
      ((value[1] & 0xFFFFFFFFL) < 40l));
}

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

/**
 * Checks whether this <code>OID</code> can be BER encoded.
 * @return
 *    <code>true</code> if size() >= 2 and size() <= 128 and if the first
 *    two sub-identifiers are less than 3 and 40 respectively.
 */
public boolean isValid() {
 return ((size() >= 2) && (size() <= 128) &&
     ((value[0] & 0xFFFFFFFFL) <= 2l) &&
     ((value[1] & 0xFFFFFFFFL) < 40l));
}

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

private OID getCloneFromIndex(MOTableRow changeSet) {
 OID cloneFrom = (OID) changeSet.getValue(colUsmUserCloneFrom);
 if (cloneFrom == null) {
  cloneFrom = (OID) getValue(colUsmUserCloneFrom);
 }
 if ((cloneFrom == null) || (cloneFrom.size() <= usmUserEntryOID.size())) {
  return null;
 }
 return new OID(cloneFrom.getValue(), usmUserEntryOID.size()+1,
         cloneFrom.size() - (usmUserEntryOID.size()+1));
}

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

private static boolean checkIndexBytes(OID index, long start, long end) {
 if ((start < 0) || (start > MOTableIndex.MAX_INDEX_OID_LENGTH) ||
   (end < 0) || (end > MOTableIndex.MAX_INDEX_OID_LENGTH)) {
  return false;
 }
 for (int i=(int)start; ((i<index.size()) && (i<end)); i++) {
  if (index.getUnsigned(i) > 255) {
   return false;
  }
 }
 return true;
}

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

public final OID getIndexPart(OID anyOID) {
  int offset = oid.size() + 1;
  if ((anyOID.size() <= offset) || (!anyOID.startsWith(oid))) {
    return null;
  }
  return new OID(anyOID.getValue(), offset, anyOID.size() - offset);
}

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

public final void fromSubIndex(OID subIndex, boolean impliedLength) {
  int offset = 1;
  if (impliedLength) {
    offset = 0;
  }
  setValue(subIndex.getValue(), offset, subIndex.size() - offset);
}

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

@Override
public boolean isCovered(MOScope other) {
  return (other.getLowerBound().startsWith(oid) &&
      (other.getLowerBound().size() > oid.size() ||
          other.isLowerIncluded())) &&
      (other.getUpperBound().startsWith(oid) &&
          ((other.getUpperBound().size() > oid.size()) ||
              other.isUpperIncluded()));
}

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

public final void fromSubIndex(OID subIndex, boolean impliedLength) {
 int offset = 1;
 if (impliedLength) {
  offset = 0;
 }
 setValue(subIndex.getValue(), offset, subIndex.size()-offset);
}

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

@Override
public OID getLowerBound() {
  if (lowerBound == null) {
    lowerBound = new OID(oid.getValue(), 0, oid.size() - 1);
  }
  return lowerBound;
}

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

public OID getLowerBound() {
 if (lowerBound == null) {
  lowerBound = new OID(oid.getValue(), 0, oid.size()-1);
 }
 return lowerBound;
}

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

public final void fromSubIndex(OID subIndex, boolean impliedLength) {
 int offset = 1;
 if (impliedLength) {
  offset = 0;
 }
 setValue(subIndex.getValue(), offset, subIndex.size()-offset);
}

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

public final OID toSubIndex(boolean impliedLength) {
 if (impliedLength) {
  return new OID(value);
 }
 OID subIndex = new OID(new int[] { size() });
 subIndex.append(this);
 return subIndex;
}

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

public final OID toSubIndex(boolean impliedLength) {
  if (impliedLength) {
    return new OID(value);
  }
  OID subIndex = new OID(new int[]{size()});
  subIndex.append(this);
  return subIndex;
}

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

public void fromSubIndex(OID subIndex, boolean impliedLength) {
 if (impliedLength) {
  setValue(subIndex.toByteArray());
 }
 else {
  OID suffix = new OID(subIndex.getValue(), 1, subIndex.size() - 1);
  setValue(suffix.toByteArray());
 }
}

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

public void fromSubIndex(OID subIndex, boolean impliedLength) {
 if (impliedLength) {
  setValue(subIndex.toByteArray());
 }
 else {
  OID suffix = new OID(subIndex.getValue(), 1, subIndex.size() - 1);
  setValue(suffix.toByteArray());
 }
}

相关文章