Package net.percederberg.mibble

Provides the SNMP MIB file loading and validation classes.

See: Description

Package net.percederberg.mibble Description

Provides the SNMP MIB file loading and validation classes. A MIB file is loaded with the MibLoader class. The contents of the MIB file are hereafter accessed with the Mib class. Below follows a simple example of loading a MIB file:

    MibLoader  loader = new MibLoader();
    Mib        mib;

    try {
        mib = loader.load(<inputfile>);
    } catch (FileNotFoundException e) {
        System.err.println(e.getMessage());
    } catch (MibLoaderException e) {
        e.getLog().printTo(System.err);
    }
    

A Mib consists of a set of MibSymbols. There are two types of symbols, one representing a MIB value assignment (MibValueSymbol) and one representing a MIB type assignment (MibTypeSymbol). In most normal usage (i.e. with SNMP), only the value symbols are of interest. Below follows a simple example printing all the value symbols in a loaded MIB file:

    Iterator   iter = mib.getAllSymbols().iterator();
    MibSymbol  symbol;

    while (iter.hasNext()) {
        symbol = (MibSymbol) iter.next();
        if (symbol instanceof MibValueSymbol) {
            System.out.println(symbol.toString());
        }
    }
    

A MIB value symbol contains a name, a MibType, and a MibValue. The type symbols only contain a name and a type. There are several different types and value implementations, present in the net.percederberg.mibble.snmp, net.percederberg.mibble.type, and net.percederberg.mibble.value packages.

Since:
2.0