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

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

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

OID.getValue介绍

[英]Gets all sub-identifiers as an int array.
[中]以int数组的形式获取所有子标识符。

代码示例

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

/**
 * Copy constructor.
 * @param other OID
 */
public OID(OID other) {
 this(other.getValue());
}

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

/**
 * Copy constructor.
 * @param other OID
 */
public OID(OID other) {
 this(other.getValue());
}

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

public SnmpObjId toSnmpObjId() {
  switch (m_value.getSyntax()) {
  case SMIConstants.SYNTAX_OBJECT_IDENTIFIER:
    return SnmpObjId.get(((OID)m_value).getValue());
  default:
      throw new IllegalArgumentException("cannot convert "+m_value+" to an SnmpObjId");
  }
}

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

@Override
public SnmpObjId toSnmpObjId() {
  switch (m_value.getSyntax()) {
  case SMIConstants.SYNTAX_OBJECT_IDENTIFIER:
    return SnmpObjId.get(((OID)m_value).getValue());
  default:
      throw new IllegalArgumentException("cannot convert "+m_value+" to an SnmpObjId");
  }
}

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

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

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

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

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

public String toDisplayString() {
  switch (m_value.getSyntax()) {
  case SMIConstants.SYNTAX_OBJECT_IDENTIFIER :
    return SnmpObjId.get(((OID)m_value).getValue()).toString();
  case SMIConstants.SYNTAX_TIMETICKS :
    return Long.toString(toLong());
  case SMIConstants.SYNTAX_OCTET_STRING :
    return toStringDottingCntrlChars(((OctetString)m_value).getValue());
  default :
    return m_value.toString();
  }
}

代码示例来源: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.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());
 }
}

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

@Override
public TrapIdentity getTrapIdentity() {
  OID snmpTrapOid = (OID) getVarBindAt(SNMP_TRAP_OID_INDEX).getVariable();
  OID lastVarBindOid = getVarBindAt(getPduLength() - 1).getOid();
  Variable lastVarBindValue = getVarBindAt(getPduLength() - 1).getVariable();
  return new TrapIdentity(SnmpObjId.get(snmpTrapOid.getValue()), SnmpObjId.get(lastVarBindOid.getValue()), new Snmp4JValue(lastVarBindValue));
}

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

@Override
public SnmpVarBindDTO getSnmpVarBindDTO(int i) {
  SnmpObjId name = SnmpObjId.get(getVarBindAt(i).getOid().getValue());
  SnmpValue value = new Snmp4JValue(getVarBindAt(i).getVariable());
  return new SnmpVarBindDTO(name, value);
}

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

protected void processVarBindAt(int i) {
    SnmpObjId name = SnmpObjId.get(getVarBindAt(i).getOid().getValue());
    SnmpValue value = new Snmp4JValue(getVarBindAt(i).getVariable());
    processVarBind(name, value);
  }
}

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

protected void processVarBindAt(int i) {
    if (i == 0) {
      log().debug("Skipping processing of varbind " + i + ": it is sysuptime and the first varbind, and is not processed as a parm per RFC2089");
    } else if (i == 1) {
      log().debug("Skipping processing of varbind " + i + ": it is the trap OID and the second varbind, and is not processed as a parm per RFC2089");				
    } else {
      SnmpObjId name = SnmpObjId.get(getVarBindAt(i).getOid().getValue());
      SnmpValue value = new Snmp4JValue(getVarBindAt(i).getVariable());
      processVarBind(name, value);
    }
  }
}

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

public OID getProtocolForKeyChange(Request request, OID rowIndex, DHOperations.KeyType keyType) {
 ChangeSet changeSet = getUsmUserEntry().getRowPreview(request, rowIndex);
 OID cloneFrom = (OID) changeSet.getValue(colUsmUserCloneFrom);
 if ((cloneFrom != null) && (cloneFrom.size() > usmUserEntryOID.size())) {
  OID cloneRowIndex = new OID(cloneFrom.getValue(), usmUserEntryOID.size() + 1,
      cloneFrom.size() - (usmUserEntryOID.size() + 1));
  ChangeSet changeSetClone = getUsmUserEntry().getRowPreview(request, cloneRowIndex);
  return getProtocolForKeyChangeWithoutCloneFrom(changeSetClone, keyType);
 }
 return getProtocolForKeyChangeWithoutCloneFrom(changeSet, keyType);
}

相关文章