Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
Other versions of this page are also available for the following:
Windows Mobile Not Supported Windows Embedded CE Supported
8/28/2008

The MIB_TABLEmacro generates information about the number of entries in a MIB table, as well as the offset of the table within the SnmpMibEntryarray. It does this by generating references to additional variables that must have been defined earlier in the source file or in a header file. The following list describes the SnmpMibTable array variables that need to be defined:

mib_base name1

A table of type SnmpEntrythat must be defined in the source file as the name of an array of SnmpMibEntryobjects.

mi_base name2

MIB index of the entry (usually defined as mi_of the table plus 1), which must be defined in a #definestatement prior to the MIB_TABLEmacro.

ne_base name3

Number of elements in one entry of the table, which must be defined with a #definestatement prior to the MIB_TABLEmacro.

ni_base name3

Number of table indexes that are defined for this table.

Each table in a MIB group must have one entry in the SnmpMibTable[]array. The MIB table name must follow the SnmpTfx Macro Name Conventionsthat are used with the framework macros. The following code example is from the sample MIB.

Copy Code
SnmpMibTable tbl_snmpTest[] = 
{
  MIB_TABLE (snmpTest, snmpErrEntry, NULL)
};

The following code example shows the definitions that were made prior to this macro.

Copy Code
#define mi_snmpErrTable			1
#define mi_snmpErrEntry			mi_snmpErrTable+1
#define ne_snmpErrEntry			1
#define ni_snmpErrEntry			1

The mi_snmpErrTableentry defines the offset from the start of the SnmpMibEntryarray for the table definition. The mi_snmpErrEntryentry defines the offset from the start of the SnmpMibEntryarray for the entry definition. The ne_snmpErrEntryentry defines the number of variables that are defined for snmpErrEntry. The ni_snmpErrEntryentry defines the number of indexes that are in the table.

If ni_snmpErrEntrywere 2, the final parameter in the MIB_TABLEmacro would not be NULL, but rather a pointer to an array of SnmpMibTablepointers pointing to an entry for a new SnmpMibEntryelement.

Table-definition Macro

Each entry in the SnmpMibTablearray is declared as an instance of the MIB_TABLEmacro. The table-definition macro form is as follows.

Copy Code
MIB_TABLE(X, Y, Z)

The parameters to this macro are:

X

The base name of the MIB, as defined in the MIB_VIEWmacro. This name generates a reference to the base OID for the MIB.

Y

The base name of the Entryobject for this table. This name generates references to the mi_Y, ne_Y, and ni_Yconstants, which must have been defined previously.

Z

For one-dimensional tables, this parameter is set to NULL. For all of the other tables, this parameter is the name of an array of SnmpMibEntry pointers defining the locations of the second dimension of the table.

See Also