A MIB Compiler is an application that performs some degree of validation of a specified MIB Module (checking such things as type usage, consistent size/range refinements and undefined symbols), and translates the MIB from its normal ASN.1 format to a format that is easier for other applications to interpret.
Some compilers (typically those that accompany SNMP Agent Development Libraries), rather than simply reformatting the MIB Modules into an easier parse format, output source code templates to be edited, compiled, and linked to the development libraries. Such "source code generators" accelerate development time by automating those parts of a project necessary to make the agent aware of the objects in a MIB and handle SNMP requests on those objects, leaving to the developer the task of implementing the object-specific semantics detailed in the MIB specification.
The extent to which a MIB is validated in this process varies between implementations, as does the output format. MIB Smithy, for example, performs over 560 individual checks for nearly every aspect of a MIB design, including cross-checking types and usage between multiple modules that reference one another, as well as use of technically valid features of ASN.1 or the SMI that are known to be unsupported or problematic for other MIB compilers or tools.
MIB Smithy's compiler has built-in support for compiling to an extended version of the MOSY (.defs file) format . MOSY started as freely available MIB compiler that is in used and supported by a variety of applications and compilers; however, the common implementation's validation of MIB modules is fairly limited, and it does not do any cross-checking between MIB modules. Using MIB Smithy in place of MOSY allows you to perform much more extensive checks on your MIB modules while still being compatible with applications that use the MOSY format .
MIB Smithy provides interfaces for validating MIB modules on a per-file or per-project bases, where each file may contain one or more MIB modules and each project typically contains all MIB modules supported by a particular device, and any dependencies (IMPORTS) they may have. MIB Smithy is capable of compiling and validating modules with or without all dependencies present. If dependencies are present, they are fully validated and cross-checked; however, warnings will be issued for any dependencies that are not present. To be completely sure your MIB modules are valid, you should be sure to have all dependencies loaded into the project at validation time.
The Build Settings dialog can also be used to configure which files are only dependencies, which are present in the project only for the purpose of fully validating your main MIB module(s), but for which no compiler output (other than any error and warning messages) is desired.
Select the file or module using the Project Tree. Then, either use the Validate item in the Build Menu or click on the Validate button in the Toolbar.
Either use the Validate All item in the Build Menu or click on the Validate All button in the Toolbar. Each file will be validated in the order it appears in the Project Tree.
Compiling MIB Files and Modules is very similar to validating MIB Files and Modules. When you compile a file or module with MIB Smithy, it will first automatically validate the file using the same methods and features as validating only. If validation for a particular file fails due to one or more errors, then compiling also fails and no output file is generated.
If any one of several modules in an individual file fail the validation phase, no output will be generated for any module in that file. It will not, however, prevent the output of other modules in other files that are validated successfully. If validation is successful, then MIB Smithy will generate output according to the output format and directories configured in the Build Settings dialog.
The default build settings create one or more MOSY format .defs files containing "condensed" versions of the MIB modules that are easier for programmers to write parsers for. The output file name is is the same as the name of the module compiled, with a '.defs' extension added. Thus, for example, compiling rfc2579.mib containing module SNMPv2-TC results in a file named 'SNMPv2-TC.defs'.
Select the file or module using the Project Tree. Then, either use the Compile item in the Build Menu, click on the Compile button in the Toolbar, or right-click on the file in the Project Tree and select 'Compile'.
Either use the Build or Rebuild All items in the Build Menu or click on the Build button in the Toolbar. Each file will be validated and compiled in the order it appears in the Project Tree.