Provides the SNMP MIB file loading and validation classes. A MIB file is loaded with the {@link net.percederberg.mibble.MibLoader MibLoader} class. The contents of the MIB file are hereafter accessed with the {@link net.percederberg.mibble.Mib 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 {@link net.percederberg.mibble.Mib Mib} consists of a set of {@link net.percederberg.mibble.MibSymbol MibSymbol}s. There are two types of symbols, one representing a MIB value assignment ({@link net.percederberg.mibble.MibValueSymbol MibValueSymbol}) and one representing a MIB type assignment ({@link net.percederberg.mibble.MibTypeSymbol 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 {@link net.percederberg.mibble.MibType MibType}, and a {@link net.percederberg.mibble.MibValue MibValue}. The type symbols only contain a name and a type. There are several different types and value implementations, present in the {@link net.percederberg.mibble.snmp}, {@link net.percederberg.mibble.type}, and {@link net.percederberg.mibble.value} packages.
@since 2.0