mibble-users
[Top][All Lists]
Advanced

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

[Mibble-users] RE : Problem when recognize OID Type


From: achraf mabrouk
Subject: [Mibble-users] RE : Problem when recognize OID Type
Date: Fri, 30 Nov 2007 17:12:00 +0100 (CET)

Hi;
 
 Can some one help on that problem?
 
-*- Kind regards
Achraf Mabrouk

achraf mabrouk <address@hidden> a écrit :
Hi;

 I'm using mibble Version 2.8 and I have a problem to resolve the type of a given OID. (eg 1.3.6.1.2.1.2.2.1.2 (ifDescr) ==> Octet String Size(255) ).

JAVA Code:
========
public void loadRFC1213Mib(){
         loader.addDir(new File("mibs"));
            try {
                mib = loader.load("RFC1213-MIB");
               
            } catch (FileNotFoundException e) {
                System.err.println(e.getMessage());
            } catch (MibLoaderException e) {
                e.getLog().printTo(System.err);
            }  catch(IOException exp){
                System.err.println(exp.getMessage());
            }
    }
public String getOidType(String oid){
        String retType="None";
       
        loadRFC1213Mib();
       
        MibValueSymbol mibValSymbl=null;
        mibValSymbl=mib.getSymbolByOid(oid);
        MibType type=mibValSymbl.getType();
        if (type.getTag()==null){
            System.out.println("The tag is null ");
            return "";
        }
        if (type.hasTag(MibTypeTag.UNIVERSAL_CATEGORY, 2)) {
            // INTEGER & Integer32
            retType="Integer";

        } else if (type.hasTag(MibTypeTag.UNIVERSAL_CATEGORY, 4)) {
            // OCTET STRING
            return "OCTET STRING";

        }
        return retType;
    }
Console Out
==============
The tag is null

NB: I have already the same with code given in :
http://www.mibble.org/doc/faq/api/index.html#Q9

-*- Best Regards
Achraf mabrouk

Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail


Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail
reply via email to

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