[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Mibble-users] mibble question
From: |
Per Cederberg |
Subject: |
Re: [Mibble-users] mibble question |
Date: |
Wed, 11 Feb 2004 16:07:45 +0100 |
On Tue, 2004-02-10 at 22:42, Brian Keller wrote:
> To preface, I am new to MIBBLE and MIBs in general.
No problem, this list is for answering any kinds of problems or
questions! I'm not around so often right now (due to absent
Internet connection at home), so please don't count on my
responses being quick or anything... :-(
I hope, however, that everyone on the list feels free to help
out from time to time if you have some time to spare. Thanks in
advance for any help answering questions, etc!
Now, over to the issue at hand:
> I've installed and run the MibPrinter on our MIB files with no
> problem.
> I was wondering if there is any method to walk back up the "tree" to
> see the names of the elements higher up in the dotted number path.
>
> For instance...
> 1.2.3.4.5.6 gives XYZ as its name
> How can I see what 1.2.3 's name is?
Ok, this is untested code, so please don't be too frustrated
if it doesn't compile... ;-)
// get "XYZ" symbol
startSymbol = (MibValueSymbol) mib.getSymbol("XYZ");
// get "XYZ" object identifier value, i.e. 1.2.3.4.5
startOid = (ObjectIdentifierValue) startSymbol.getValue();
// get 1.2.3 object identifier value
endOid = startOid.getParent().getParent();
// get 1.2.3 symbol
endSymbol = endOid.getSymbol();
// print 1.2.3 symbol
System.out.println(endSymbol);
Basically, what you do is to traverse the tree of OIDs that
are linked across MIBs. Note, however, that the OIDs are only
linked if the MIBs have been loaded with the same MibLoader
instance (which is usually the case, but anyway good to know).
Hope this helps!
Cheers,
/Per
--
Per Cederberg, Software Consultant
http://www.percederberg.net/software