Check the bundled source code for the MibbleBrowser app. It performs
reverse lookups on the OIDs returned in GetNext SNMP responses.
Cheers,
/Per
On Wednesday, September 19, 2012, Lloyd Parkes wrote:
On 19/09/2012, at 1:26 PM, diffuser78 diffuse...@gmail.com javascript:;
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
___
Mibble-users mailing list
Mibble-users@nongnu.org javascript:;
https://lists.nongnu.org/mailman/listinfo/mibble-users
___
Mibble-users mailing list
Mibble-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/mibble-users