Table

From Net-SNMP Wiki
Revision as of 14:58, 17 July 2011 by Wes (Talk | contribs)

Jump to: navigation, search
Net-SNMP MIB Helper
Table
Documentation: doxygen API
Code: agent/helpers/table.c
Example: agent/helper/testhandler.c
Other Helpers: Agent Helpers

The table helper is designed to take care of common tasks associated with storing date in a row/column fashion. In particular, it parses incoming request indexes into associated column numbers and row-indexes. Many of the other more specific table helpers inject this helper themselves, so typically you only want to inject this handler yourself if you're not using any of the other table helpers and are doing all the processing yourself. For an example, see the my_test_table_handler() function in the agent/mibgroup/testhandler.c file which implements a multiplication table using this table helper.

By creating a table handler and injecting it into your calling chain, or by using the netsnmp_register_table() function to register your table, you get access to some pre-parsed information. Specifically, the table handler pulls out the column number and indexes from the request oid so that you don't have to do the complex work to do that parsing within your own code.

To do this, the table handler needs to know up front how your table is structured. To inform it about this, you fill in a table_registeration_info structure that is passed to the table handler. It contains the asn index types for the table as well as the minimum and maximum column that should be used.