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: Tue, 16 Mar 2004 09:46:17 +0100

On Tue, 2004-03-16 at 07:40, wshang wrote:
> hi,Per,
> Thanks a lot.
> 
> I have add findSymbolByOid function to Mib.java,and modified a little.
> 
> But I don't know why you use findSymbolChild. I comment four lines in
> your code and it works good.
> I think it is no need to findSymbolChild . In your findSymbolChild,
> oid.getChildCount() always = 0 , so it always return null.

Hmm... Is there some case I have overlooked?

It was supposed to support returning the individual column 
symbols. After commenting those lines out, you'll always get 
the table symbol back. As I mentioned in a previous mail,
things may look like this in the MIB (a bit simplified):

helloTable   ... ::= { 1 2 }
helloEntry   ... ::= { helloTable 1 }
helloColumn1 ... ::= { helloEntry 1 }
helloColumn2 ... ::= { helloEntry 2 }
helloColumn3 ... ::= { helloEntry 3 }

And I wished to accomplish the following:

1.2       --> helloTable
1.2.0     --> helloEntry
1.2.9.1   --> helloColumn1
1.2.3.2   --> helloColumn2
1.2.42.3  --> helloColumn3

So in the last case I first try to retrieve 1.2.42.3 oid from
the MIB, but that will fail. Then I try with 1.2.42 which will
also fail. Finally I try 1.2 which will give me the helloTable
symbol. Going up through the recursion I'll call the 
findSymbolChild() method to try to find the right child. For
helloTable there will be only one, so it should be returned. 
For helloEntry there will be three different, so it should use
the ".3" part of the OID and return the helloColumn3 symbol.

But maybe there is some bug in this reasoning (or the code)?

> Perhaps I haven't understand your words : 
> > Rather it checks
> > if there is only one child to an OID and returns that. It
> > just ocurred to me that this may also happen in some other
> > cases (rarely though), so one might add some check to see
> > if the symbol really is a table symbol (type is SEQUENCE OF)
> > also

Yes, this was cryptical. Basically the findSymbolChild() method
assumes that if an OID has only a single child it represents a
table. In the example above, although the requested value is 42
the child returned (helloEntry) actually has value 1. What I'm
trying to say is that there may be cases where an OID doesn't
exist in the MIB, but the code still returns something.

Thanks for testing the code!

Cheers,

/Per






reply via email to

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