[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: |
Thu, 18 Mar 2004 17:42:55 +0800 |
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 .
And these oids are "wrong" oids.
Am I right ?
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 .
----- Original Message -----
From: "Per Cederberg" <address@hidden>
To: "Announcements, support, and forum for Mibble users" <address@hidden>
Sent: Tuesday, March 16, 2004 4:46 PM
Subject: Re: [Mibble-users] Reverse usage of mibble
> 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
>
>
>
>
> _______________________________________________
> Mibble-users mailing list
> address@hidden
> http://mail.nongnu.org/mailman/listinfo/mibble-users
- [Mibble-users] Reverse usage of mibble, Louis GOUNOT, 2004/03/13
- Re: [Mibble-users] Reverse usage of mibble, Per Cederberg, 2004/03/13
- Re: [Mibble-users] Reverse usage of mibble, wshang, 2004/03/14
- Re: [Mibble-users] Reverse usage of mibble, Per Cederberg, 2004/03/15
- Re: [Mibble-users] Reverse usage of mibble, Louis GOUNOT, 2004/03/15
- Re: [Mibble-users] Reverse usage of mibble, Per Cederberg, 2004/03/15
- Re: [Mibble-users] Reverse usage of mibble, wshang, 2004/03/16
- Re: [Mibble-users] Reverse usage of mibble, Per Cederberg, 2004/03/16
- Re: [Mibble-users] Reverse usage of mibble,
delphiVcl <=
- Re: [Mibble-users] Reverse usage of mibble, Per Cederberg, 2004/03/18