|
NAMESNMP::MIB::Compiler - a MIB Compiler supporting SMIv1 and SMIv2 SYNOPSIS use SNMP::MIB::Compiler;
my $mib = new SNMP::MIB::Compiler;
# search MIBs there...
$mib->add_path('./mibs', '/foo/bar/mibs');
# possibly using these extensions...
$mib->add_extension('', '.mib', '.my');
# store the compiled MIBs there..
$mib->repository('./out');
# only accept SMIv2 MIBs
$mib->{'accept_smiv1'} = 0;
$mib->{'accept_smiv2'} = 1;
# no debug
$mib->{'debug_lexer'} = 0;
$mib->{'debug_recursive'} = 0;
# store compiled MIBs into files
$mib->{'make_dump'} = 1;
# read compiled MIBs
$mib->{'use_dump'} = 1;
# follow IMPORTS clause while compiling
$mib->{'do_imports'} = 1;
# load a precompiled MIB
$mib->load('SNMPv2-MIB');
# compile a new MIB
$mib->compile('IF-MIB');
print $mib->resolve_oid('ifInOctets'), "\n";
print $mib->convert_oid('1.3.6.1.2.1.31.1.1.1.10'), "\n";
print $mib->tree('ifMIB');
DESCRIPTION SNMP::MIB::Compiler is a MIB compiler that fully supports
both SMI(v1) and SMIv2. This module can be use to compile
MIBs (recursively or not) or load already compiled MIBs for
later use.
Some tasks can be performed by the resulting object such as :
- resolution of object names into object identifiers (OIDs).
e.g. ifInOctets => 1.3.6.1.2.1.2.2.1.10
- convertion of OIDs.
e.g. 1.3.6.1.2.1.2.1 =>
iso.org.dod.internet.mgmt.mib-2.interfaces.ifNumber
- drawing MIB trees.
e.g. ifTestTable => ifTestTable
|
+-- --- ifTestEntry(1)
|
+-- -rw Integer ifTestId(1)
+-- -rw Integer ifTestStatus(2)
+-- -rw ObjectID ifTestType(3)
+-- -r- Integer ifTestResult(4)
+-- -r- ObjectID ifTestCode(5)
+-- -rw String ifTestOwner(6)
The MIB to be compiled requires no modification. Everything legal
according to SMIs is accepted, including MACRO definitions (which
are parsed but ignored).
This module is shipped with the basic MIBs usually needed by IMPORTS
clauses. A lot of IETF MIBs has been successfully tested as well as
some private ones.
Methods
Attributes
BUGSCurrently, it is more a TODO list than a bug list. - not enough documentation - not enough methods - not enough test scripts - find a better name for compiled MIBs than 'dump's.. even if they are no more than dumps. If your MIBs can't be compiled by this module, please, double check their syntax. If you really think that they are correct, send them to me including their "uncommon" dependencies. AUTHORFabien Tassin (fta@oleane.net) COPYRIGHTCopyright 1998, 1999, Fabien Tassin. All rights reserved. It may be used and modified freely, but I do request that this copyright notice remain attached to the file. You may modify this module as you wish, but if you redistribute a modified version, please attach a note listing the modifications you have made.
|