mibble-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Mibble-users] Reverse usage of mibble


From: Per Cederberg
Subject: Re: [Mibble-users] Reverse usage of mibble
Date: Thu, 18 Mar 2004 11:29:49 +0100

On Thu, 2004-03-18 at 10:42, delphiVcl wrote:
> Hi,Per
> I understand it now .
> In the example you provide,
> > 1.2       --> helloTable
> > 1.2.0     --> helloEntry
> > 1.2.9.1   --> helloColumn1
> > 1.2.3.2   --> helloColumn2
> > 1.2.42.3  --> helloColumn3
> Whatever x is ,1.2.x.1 will always return the helloColumn1 symbol.
> 1.2.x.3 will always return the helloColumn3 symbol.
> Because helloTable has only one child (helloEntry), so x is not important .

Exactly.

> And these oids are "wrong" oids.

You mean that they do not start with the long "correct" prefix?
Or do you mean something else? (I thought a small example would
more readable, so that's why I'm using these fake OIDs.)

> Am I right ?

Yup.

>     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        just modified here . the leaf oid getChildCount 
> ==== 0
>         else{                           
>             return sym;
>         }
>     }
> I modefied the findSymbolChild, and it worked fine in my project.
> But I was not sure about it because I have not test it with "wrong"
> oids. 

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.

Cheers,

/Per






reply via email to

[Prev in Thread] Current Thread [Next in Thread]