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: wshang
Subject: Re: [Mibble-users] Reverse usage of mibble
Date: Tue, 16 Mar 2004 14:40:52 +0800

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.

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


    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));
             }
/*             
             if (sym != null) {
                 value = Integer.parseInt(oid.substring(pos + 1));
                 sym = findSymbolChild(sym, value);
             }
*/
         }
         return sym;
    }
----- Original Message ----- 
From: "Per Cederberg" <address@hidden>
To: "Announcements, support, and forum for Mibble users" <address@hidden>
Sent: Monday, March 15, 2004 6:12 PM
Subject: Re: [Mibble-users] Reverse usage of mibble


> On Mon, 2004-03-15 at 10:44, Louis GOUNOT wrote:
> > Hi,
> > 
> > > Yes, tables are problematic. As far as I have seen, most of the
> > > tableEntry symbols in the MIBs are declared to have an oid ending
> > > with .1 (not .0) so that might help in some cases.
> > In my point of view, as I've read about in different RFCs, tableEntry
> > symbols are compound of :
> >           the tableEntry OID,
> >           a dot character,
> >           the row index in the table.
> > But it seems to be different in some other cases (I don't remember them, but
> > somteimes you have a concatenation of an OID and of an IP address)
> 
> Yes, maybe I should've expressed myself a bit clearer. When
> you retrieve something from a table with SNMP you use an OID
> like "1.2.3.<rowFromZero>.13" where 13 in this case is the
> particular field (or column if you like).
> 
> In the MIB file, however, things usually look like this:
> 
> helloTable  ... ::= { symbol 3 }
> 
> helloEntry  ... ::= { helloTable 1 }     <-- Using 1 not 0
> 
> helloColumn ... ::= { helloEntry 13 }
> 
> So this is what I mean by the row index being 1 in the MIB
> file. Basically that most people seem to use the magical
> number 1 for declaring the row value symbol. I don't know
> if this is defined somewhere or if it is just tradition,
> but it does make sense as you won't find any other OID:s
> with a 0 in them.
> 
> BTW, my code doesn't use this assumption. 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.
> 
> But as long as you're not using tables, the method
> Mib.getSymbolByValue() is just fine.
> 
> Cheers,
> 
> /Per
> 
> 
> 
> 
> _______________________________________________
> Mibble-users mailing list
> address@hidden
> http://mail.nongnu.org/mailman/listinfo/mibble-users

reply via email to

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