[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Mibble-users] newbie question about using mibble
From: |
Lloyd Parkes |
Subject: |
Re: [Mibble-users] newbie question about using mibble |
Date: |
Thu, 20 Sep 2012 08:56:54 +1200 |
On 19/09/2012, at 1:26 PM, diffuser78 <address@hidden> wrote:
> Quick question: Which class should I use if I want to get the OID by giving
> Symbol, i.e getOID(ifMIB) will return me "1.3.6.1.2.1.31" ?
I avoided talking about this in my earlier message because it's hard and the
reason it's hard is because ASN.1 is hard.
In ASN.1 symbols don't have to refer to OIDs. SNMP users (like me) live in a
world that only has SNMP variables, which alway do have an OID, but ASN.1
symbols and are not equivalent to SNMP variable names. When I had to work this
out, I spent some time in a Java debugger traversing the links between all the
objects and noting the useful information I found on a whiteboard.
I don't think I needed to do what you want to do, so I don't have any code on
hand for it, but what I think you need to do once get a MibValueSymbol is to
call its getValue() method and cast the result to an ObjectIdentifierValue. You
should use instanceof to verify that the object really is an
ObjectIdentifierValue before casting of course. The ObjectIdentifierValue class
as a method toAsn1String() that returns the string you are after.
Cheers,
Lloyd