Difference between revisions of "Mib2c"
From Net-SNMP Wiki
(→Regeneratable Code) |
|||
Line 21: | Line 21: | ||
Some of the mib2c output will contain both of these types of code, and code that can be regenerated/updated in the future is marked as such. | Some of the mib2c output will contain both of these types of code, and code that can be regenerated/updated in the future is marked as such. | ||
+ | |||
+ | == Development Process Using mib2c == | ||
+ | |||
+ | The typical process for using mib2c follows this pattern: | ||
+ | |||
+ | # Write a MIB and objects for it (eg, tables and scalars) | ||
+ | # run mib2c on the MIB objects to generate code, producing: | ||
+ | #* code that should be edited to complete the implementation | ||
+ | #* code that should not be edited ("regeneratable"). | ||
+ | # Edit the code to return value MIB data (or accept it when processing SETs) |
Revision as of 21:35, 30 June 2011
The mib2c script is badly named. It really should have been named mib2anything, as it's actually can provide output tailored to anything you might want to change MIB data into.
(Full Manual Page: mib2c)
mib2c Goals
mib2c was designed to:
- Alleviate the task of producing identically similar code for each mib object
- Be a generic MIB processing engine, capable of converting MIBs and MIB structures to any other format.
- Provide an easy-as-possible getting started interface for new coders trying to write new code to support MIBs
Error creating thumbnail: Unable to save thumbnail to destination
Regeneratable Code
One second goal besides just generating code once and leaving it to the programmer to fill in the blanks, is to provide a framework for splitting code into two pieces:
- code that needs to be maintained by a human implementing the MIB objects
- code that needs only to be written by mib2c itself, and can be regenerated in the future to take advantage of new features produced by mib2c
Some of the mib2c output will contain both of these types of code, and code that can be regenerated/updated in the future is marked as such.
Development Process Using mib2c
The typical process for using mib2c follows this pattern:
- Write a MIB and objects for it (eg, tables and scalars)
- run mib2c on the MIB objects to generate code, producing:
- code that should be edited to complete the implementation
- code that should not be edited ("regeneratable").
- Edit the code to return value MIB data (or accept it when processing SETs)