[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Mibble-users] Reverse usage of mibble
From: |
delphiVcl |
Subject: |
Re: [Mibble-users] Reverse usage of mibble |
Date: |
Fri, 2 Apr 2004 11:52:42 +0800 |
hiļ¼per
My email has been changed .
I have received no email since 2004/03/18.
on http://mail.gnu.org/archive/html/mibble-users/2004-03/msg00016.html I find
your answer to my email .
> Not sure I understand your modification. A leaf oid has no
> children, so to me it makes sense that findSymbolChild()
> returns null. Could you send a snipplet from the MIB file
> you're trying to parse? Just so that I can understand the
> issue here. If don't want to disclose it to the world,
> please use my private email address.
For example , I try to translate "1.3.6.1.2.1.1.1.0" to "sysDescr.0".
public MibValueSymbol findSymbolByOid(String oid) {
MibValueSymbol sym;
int pos;
int value;
sym = this.getSymbolByValue(oid);
if (sym == null) {
pos = oid.lastIndexOf(".");
if (pos > 0) {
sym = findSymbolByOid(oid.substring(0, pos));
}
//here we have get a Symbol sysDescr,
if (sym != null) {
value = Integer.parseInt(oid.substring(pos + 1));
sym = findSymbolChild(sym, value);
}
//here , if don't modify findSymbolChild , sym == null now .
}
return sym;
}
public MibValueSymbol findSymbolChild(MibValueSymbol sym, int value) {
ObjectIdentifierValue oid;
if (!(sym.getValue() instanceof ObjectIdentifierValue)) {
return null;
}
oid = (ObjectIdentifierValue) sym.getValue();
for (int i = 0; i < oid.getChildCount(); i++) {
if (oid.getChild(i).getValue() == value) {
return oid.getChild(i).getSymbol();
}
}
if (oid.getChildCount() == 1) {
return oid.getChild(0).getSymbol();
}
// return null; //here , if return null ,findSymbolByOid will return
null
else{
return sym;
}
- Re: [Mibble-users] Reverse usage of mibble,
delphiVcl <=