mibble-users
[Top][All Lists]
Advanced

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

Re: [Mibble-users] Identifying a type that is declared as an IPAddress


From: Per Cederberg
Subject: Re: [Mibble-users] Identifying a type that is declared as an IPAddress
Date: Fri, 04 Jun 2004 00:32:43 +0200

Hi!

On Thu, 2004-06-03 at 18:47, Luiz-Otavio Zorzella wrote:
> the javadocs for both MibType and MibTypeTag (links below) make
> reference to identifying a MIB nodes that was declared as an "IpAddress"
> by use of tags, but I can't figure out how exactly to do just that.
> 
> While debugging my application, if I inspect a node that is declared as
> IpAddress, I find that it has a single tag with category 1, value 0. How
> does that help me find out this is an IP Address?

Check out the SNMPv2-SMI MIB (available in the src/mibs/ietf
directory):

IpAddress ::=
    [APPLICATION 0]
        IMPLICIT OCTET STRING (SIZE (4))

The tag in this case is APPLICATION 0, and looking at the
constants defined in MibTypeTag.java it so happens that:

    public static final int APPLICATION_CATEGORY = 1;
 
So, the type tag reported for your value is indeed correctly
category 1 and value 0. Normally you should use the
MibTypeTag.APPLICATION_CATEGORY constant instead of the 
actual value though.

> Am I missing something?

Taking a look in one of the *SMI MIB files (either for SMIv1
or SMIv2) you'll find the type tags for all the commonly used
SNMP types. Also note that they should all be different,
thereby guaranteeing that a type tagged as [APPLICATION 0] 
was indeed once an IpAddress.

Now, if you don't like this method of checking the base type
you can also use MibType.hasReferenceTo("IpAddress") which 
checks the list of previous names for the type.

> Thanks a lot,

No problem, happy to help you out!

Cheers,

/Per
-- 
Per Cederberg, Software Consulting
http://www.percederberg.net/software/





reply via email to

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