************************************************************************ ifTable README ------------------------------------------------------------------------ This document describes the results of the mib2c code generation system using the mfd code generation template. The resulting files are documented both in this README file as well as per-table specific README files. All of the files generated by this run of mib2c will begin with the ifTable prefix. MIBs For Dummies Overview ------------------------- The MIBs For Dummies (MFD) configuration files have been written to help SNMP novices implement SNMP MIBs. This section will be a brief introduction to some of the general concepts you should be familar with. Managed Information Base (MIB) ------------------------------ A SNMP MIB (Managed information base) is a text file that describes the syntax for some set of data objects. The MIB creates a correlation between an ASCII name for an object and a number OID (Object Identifier). The SNMP protocol communicates information using the OIDs, and the MIB allows tools to display a name, which we humans find easier to deal with. To use an analogy, a MIB is much like a menu at a restaurant. If you've ever been to a reataurant and ordered a meal, and later received a bill that simply had '#6' on it, you get the idea. The name is easier for the customers to remember, and the waiters and chefs use the number for efficency. Scalars ------- A scalar variable is a unique object in a MIB which can represent a single value. For example, the SNMP standard MIB-II defines a variable, sysContact.0, which is a string containing the contact information for the person in charge of a particular agent. Note that scalar variable always end with '.0'. Rows and Tables --------------- When a group of related attributes occur more than once, they can be grouped together in a table. A table has an index, which uniquely identifies a particular row, and data columns, which contain the attributes for that row. For example, the SNMP standard MIB-II defines a table, ifTable, which contains information on the ethernet interfaces on a system. Data Structures --------------- The code generated by the MFD configuration files has a few important structures. The Data Context ---------------- The data context structure should contain the necessary information to provide the data for the columns in a given row. As long as you can extract the data for a column for the data context, the data context can be anything you want: a pointer to an existing structure, the parameters needed for a function call or an actual copy of the data. By default, a data context structure is generated with storage for all the data in a row. Information on changing the default is presented later on in this help. The Index Context ----------------- The index context structure is generated with storage for all the indexes of a table. This data will be used when searching for the correct row to process for a request. The Table Context ----------------- Each table will have a unique data structure for holding data during the processing of a particular row. The table context contains the data context, the index context, then undo context (for settable tables) andother data. There is also a netsnmp_data_list, which can be used to temporary storage during processing. The Table Registration Pointer ------------------------------ During initilization, you may provide a pointer to arbitrary data for you own use. This pointer will be set in the data context, and is passed as a parameter to several functions. It is not required, and is provided as a way for you to access table specific data in the generated code. These files are top-level files potentially useful for all the tables: ------------------------------------------------------------------------ File : ifTable_Makefile ---------------------------------------------------------------------- Purpose : Make file for compiling a (sub)agent. This file is only useful if you don't want to compile your code directly into the Net-SNMP master agent. Editable: Optional Usage : make -f ifTable_Makefile File : ifTable_subagent.c ---------------------------------------------------------------------- Purpose : This file contains a main() function for an agent or sub-agent and is compiled using the Makefile above. Table specific README files ------------------------------------------------------------------------ Each table for which code was generated has its own README file describing the files specifically associated with each table. You should probably read these next: ifTable-README-ifTable.txt These are miscellaneous auto-generated code files you generally shouldn't edit. They contain code that ties your code together with the Net-SNMP agent. ------------------------------------------------------------------------ File : ifTable.c Purpose : Initilization for the entire module set, including the SNMP tables. File : ifTable.h Purpose : Header file for the module set. Includes config_require macros to auto-load the other code pieces when compiled into the agent. File : ifTable_oids.h Purpose : C #define definitions of the tables, columns, and OIDs File : ifTable_enums.h Purpose : C #define definitions of the enumerated type values for each column of each table that requires them. File : ifTable_interface.c Purpose : MFD interface to Net-SNMP. This auto-generated code ties the functions you will fill out and edit to the code that the agent needs.