/** * Copy constructor. * @param other OID */ public OID(OID other) { this(other.getValue()); }
/** * Copy constructor. * @param other OID */ public OID(OID other) { this(other.getValue()); }
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"); } }
@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"); } }
public final void fromSubIndex(OID subIndex, boolean impliedLength) { int offset = 1; if (impliedLength) { offset = 0; } setValue(subIndex.getValue(), offset, subIndex.size() - offset); }
public final void fromSubIndex(OID subIndex, boolean impliedLength) { int offset = 1; if (impliedLength) { offset = 0; } setValue(subIndex.getValue(), offset, subIndex.size()-offset); }
public OID getLowerBound() { if (lowerBound == null) { lowerBound = new OID(oid.getValue(), 0, oid.size()-1); } return lowerBound; }
@Override public OID getLowerBound() { if (lowerBound == null) { lowerBound = new OID(oid.getValue(), 0, oid.size() - 1); } return lowerBound; }
public final void fromSubIndex(OID subIndex, boolean impliedLength) { int offset = 1; if (impliedLength) { offset = 0; } setValue(subIndex.getValue(), offset, subIndex.size()-offset); }
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(); } }
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); }
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()); } }
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()); } }
@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)); }
@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); }
protected void processVarBindAt(int i) { SnmpObjId name = SnmpObjId.get(getVarBindAt(i).getOid().getValue()); SnmpValue value = new Snmp4JValue(getVarBindAt(i).getVariable()); processVarBind(name, value); } }
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)); }
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)); }
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); } } }
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); }