mibble-users
[Top][All Lists]
Advanced

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

RE: [Mibble-users] Need to extract value of Object-Type, syntax


From: Per Cederberg
Subject: RE: [Mibble-users] Need to extract value of Object-Type, syntax
Date: Tue, 11 Oct 2005 09:27:38 +0200

Hi,

The MibbleBrowser currently doesn't print the symbol names in
an enumeration, but only the constrained values. I agree this
is a bit stupid, so I'll see if I can get in a quick fix for
that by Mibble 2.6.

The way to retrieve the enumeration names is to first get the
IntegerType, then calling the getAllSymbols(). The list
returned contains MibValueSymbols with the name and value of
a single enumeration constant. Here is a code snipplet from
the new MibWriter to explain the concept:

    /**
     * Returns all enumeration values for a MIB type. If the type
     * didn't have any enumerated values, null will be returned.
     *
     * @param type           the MIB type
     *
     * @return the MIB enumeration value symbols, or
     *         null if no symbols were set
     */
    private MibValueSymbol[] getSymbols(MibType type) {
        if (type instanceof IntegerType) {
            return ((IntegerType) type).getAllSymbols();
        } else if (type instanceof BitSetType) {
            return ((BitSetType) type).getAllSymbols();
        } else if (type instanceof SnmpTextualConvention) {
            return getSymbols(((SnmpTextualConvention)
type).getSyntax());
        } else {
            return null;
        }
    }

Please check the new MibblePrinter application in 2.6.alpha5
to see if Mibble really misses something during parsing. You
can find the download here:

http://www.mibble.org/download/development/index.html

Cheers,

/Per

On tue, 2005-10-11 at 10:42 +0530, Saiprasad G V (sagv) wrote:
> Hi,
> 
> We are unable to extract the enumerated names. In the Object definition
> below the enumerated names b600,b1200..b38400 etc are not getting retrieved.
> Even in the Mibble provided mib-browser we do not see the enumerated names. 
> 
> One more interesting thing that we have noticed is when we parse the whole
> mib and do a getChildren we do not see any objects which are of type
> 'IntegerType' but there are lots of objects which are INTEGER enumeration.
> So are we missing something?
> 
> Any help would be greatly appreciated.
> 
> Thanks in advance,
> Sai
> 
> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden On Behalf Of Per
> Cederberg
> Sent: Monday, October 10, 2005 8:44 PM
> To: Indrasish Ghosh; Announcements, support,and forum for Mibble users
> Subject: Re: [Mibble-users] Need to extract value of Object-Type, syntax
> 
> Hi,
> 
> Have a look at the FAQ. I think Java API question 10 is about the very same
> thing:
> 
> http://www.mibble.org/doc/faq/api/index.html#Q10
> 
> If you are using Mibble 2.6.alpha1 or later I think the enumeration symbols
> are returned in order, so that might be interesting to check out too.
> Anyway, Mibble 2.6 will be out any week now. Just doing the last
> refinements...
> 
> Cheers,
> 
> /Per
> 
> On mon, 2005-10-10 at 04:32 -0700, Indrasish Ghosh wrote:
> > Hi All,
> > I want a help from you guys. I am trying to get the value of syntax 
> > from a OBJECT-TYPE
> >  
> > For example:-
> >  
> > mahesh OBJECT-TYPE
> > 
> > SYNTAX INTEGER {
> > 
> > b600(600),
> > 
> > b1200(1200),
> > 
> > b2400(2400),
> > 
> > b4800(4800),
> > 
> > b9600(9600),
> > 
> > b19200(19200),
> > 
> > b38400(38400)
> > 
> > }
> > 
> > MAX-ACCESS not-accessible
> > 
> > STATUS current
> > 
> > DESCRIPTION "The baud rate in bits per second of the RS-232 port."
> > 
> > DEFVAL { b9600 }
> > 
> > ::= { Jai 10 }
> > 
> >  
> > 
> > I need "b600","b1200","b2400" etc from the syntax.
> > 
> >  
> > 
> > Need ASAP.
> > 
> > Thanks in Advance
> > 
> > 
> > 
> > ______________________________________________________________________
> > Yahoo! Music Unlimited - Access over 1 million songs. Try it free.
> > _______________________________________________
> > Mibble-users mailing list
> > address@hidden
> > http://lists.nongnu.org/mailman/listinfo/mibble-users
> 
> 
> 
> _______________________________________________
> Mibble-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/mibble-users
> 
> 
> _______________________________________________
> Mibble-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/mibble-users
> 





reply via email to

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