| @open -@ |
| mib2c has multiple configuration files depending on the type of |
| code you need to write. You must pick one depending on your need. |
| |
| You requested mib2c to be run on the following part of the MIB tree: |
| OID: $name |
| numeric translation: $name.objectID |
| @eval $num = count_scalars@ |
| number of scalars within: $num |
| @eval $num = count_tables@ |
| number of tables within: $num |
| @eval $num = count_notifications@ |
| number of notifications within: $num |
| |
| First, do you want to generate code that is compatible with the |
| ucd-snmp 4.X line of code, or code for the newer Net-SNMP 5.X code |
| base (which provides a much greater choice of APIs to pick from): |
| |
| 1) ucd-snmp style code |
| 2) Net-SNMP style code |
| |
| @prompt $ans Select your choice : @ |
| @if $ans == 1@ |
| ********************************************************************** |
| GENERATING CODE FOR THE 4.X LINE OF CODE (THE OLDER API) |
| ********************************************************************** |
| |
| using the mib2c.old-api.conf configuration file to generate your code. |
| @run mib2c.old-api.conf@ |
| |
| @elsif $ans != 2@ |
| Invalid answer. |
| @else@ |
| @if count_scalars() > 0@ |
| |
| ********************************************************************** |
| GENERATING CODE FOR SCALAR OBJECTS: |
| ********************************************************************** |
| |
| It looks like you have some scalars in the mib you requested, so I |
| will now generate code for them if you wish. You have two choices |
| for scalar API styles currently. Pick between them, or choose not |
| to generate any code for the scalars: |
| |
| 1) If you're writing code for some generic scalars |
| (by hand use: "mib2c -c mib2c.scalar.conf $name") |
| |
| 2) If you want to magically "tie" integer variables to integer |
| scalars |
| (by hand use: "mib2c -c mib2c.int_watch.conf $name") |
| |
| 3) Don't generate any code for the scalars |
| |
| @prompt $ans Select your choice: @ |
| @if $ans == 1@ |
| using the mib2c.scalar.conf configuration file to generate your code. |
| @run mib2c.scalar.conf@ |
| @else@ |
| @if $ans == 2@ |
| using the mib2c.int_watch.conf configuration file to generate your code. |
| @run mib2c.int_watch.conf@ |
| @else@ |
| @if $ans != 3@ |
| WARNING: Unknown response. Skipping code generation for scalars. |
| @end@ |
| @end@ |
| @end@ |
| @end@ # scalars |
| |
| @if count_tables() > 0@ |
| ********************************************************************** |
| GENERATING CODE FOR TABLES: |
| ********************************************************************** |
| |
| Your tables will likely either fall into one of two categories: |
| |
| 1) tables which monitor or manipulate external data, like data |
| extracted from the operating system kernel (eg, interface |
| information, etc), devices (eg, hard disks, etc) , or other |
| resources within the system. |
| |
| 2) tables which are entirely contained within the memory of the |
| agent itself and are functionally data repositories. The agent |
| will likely contain additional code (that you must write) that |
| will operate on the data within these tables in some fashion. |
| |
| 3) Do not generate code for the tables. |
| |
| @prompt $ans Select the option that best fits you: @ |
| @if $ans != 3@ |
| @if $ans == 1@ |
| |
| In this case you will want to use the iterator APIs to |
| instrument your external data so it can be represented by your |
| SNMP tables. There are two different mechanisms by which you |
| can do this: |
| |
| 1) A more raw interface where you manipulate most of the data |
| yourself and have complete control over how the data is |
| processed (on the flip side, less is taken care of for you). |
| (by hand use: "mib2c -c mib2c.iterate.conf $name") |
| (See the agent/mibgroup/mibII/vacm_context.c file for an example) |
| |
| 2) A API layer wrapped on top of number 1) above that provides |
| more APIs to fill out, but are much more refined. |
| Specifically, it provides a set of template functions (a |
| get_column() and a set_column() function) for each column in the |
| table plus some other routines for manipulating rows. |
| (by hand use: "mib2c -c mib2c.iterate_access.conf $name") |
| (See the agent/mibgroup/example/netSnmpHostsTable.c file for example) |
| |
| 3) Do not generate code for the tables. |
| |
| If you are unsure which option to pick, choice 2) should be |
| easier for most people and especially for those less familiar |
| with the concepts behind the SNMP protocol. |
| |
| @prompt $ans Select the API style you wish to use: @ |
| @if $ans != 3@ |
| @if $ans == 1@ |
| using the mib2c.iterate.conf configuration file to generate your code. |
| @run mib2c.iterate.conf@ |
| @else@ |
| @if $ans == 2@ |
| using the mib2c.iterate_access.conf configuration file to |
| generate your code. |
| @run mib2c.iterate_access.conf@ |
| @else@ |
| WARNING: Unknown response. Skipping code generation for tables. |
| @end@ |
| @end@ |
| @end@ |
| @else@ |
| @if $ans == 2@ |
| There are two generic storage types available: |
| |
| 1) dataset storage: The data for the table is stored in a |
| large sorted linked list. |
| (manually mib2c -c mib2c.create-dataset.conf ${name}) |
| |
| 2) sorted array: The data for the table is stored in a sorted |
| array. |
| (manually mib2c -c mib2c.array-user.conf ${name}) |
| |
| 3) Do not generate code for the tables. |
| |
| Both APIs are fully functional with little-to-no required code |
| to make the table operational on your end once the template |
| code is produced. The dataset API is a bit better documented |
| at the moment, but the sorted array is probably better tested |
| as it was used heavily in the net-policy sourceforge project. |
| The dataset API is used inside the snmptrapd application for |
| logging incoming traps. |
| |
| @prompt $ans Select the API style you wish to use: @ |
| @if $ans != 3@ |
| @if $ans == 1@ |
| using the mib2c.create-dataset.conf configuration file |
| to generate your code. |
| @run mib2c.create-dataset.conf@ |
| @else@ |
| @if $ans == 2@ |
| using the mib2c.array-user.conf configuration file to |
| generate your code. |
| @run mib2c.array-user.conf@ |
| @else@ |
| WARNING: Unknown response. Skipping code generation for tables. |
| @end@ |
| @end@ |
| @else@ |
| WARNING: Unknown response. Skipping code generation for tables. |
| @end@ |
| @end@ |
| @end@ |
| @end@ # != 3 |
| @end@ # tables |
| |
| @if count_notifications() > 0@ |
| ********************************************************************** |
| GENERATING CODE FOR TABLES: |
| ********************************************************************** |
| |
| Would you like to generate code for sending notifications from within |
| the agent? |
| |
| @prompt $ans "y" or "n": @ |
| @if ("$ans" eq "y") or ("$ans" eq "yes")@ |
| using mib2c.notify.conf to generate code for sending notifications |
| @run mib2c.notify.conf@ |
| @end@ |
| |
| # GENERATING HEADER FILE DEFINITIONS |
| # |
| # To generate just a header with a define for each column number in |
| # your table: |
| # |
| # mib2c -c mib2c.column_defines.conf ${name} |
| # |
| # To generate just a header with a define for each enum for any |
| # column containing enums: |
| # |
| # mib2c -c mib2c.column_enums.conf ${name} |
| |
| @end@ # notifications |
| @end@ # new style code |
| |
| ********************************************************************** |
| * NOTE WELL: The code generated by mib2c is only a template. *YOU* * |
| * must fill in the code before it'll work most of the time. In many * |
| * cases, spots that MUST be edited within the files are marked with * |
| * /* XXX */ or /* TODO */ comments. * |
| ********************************************************************** |