Re: non contiguous column index
Renaud Barbier <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
Here is the initialization code from one of the table in XXX_tables.c
as generated by mib2c.
If that does not anwser all three parts of your question, let me know.
/** Initialize the ThisTable table by defining its contents and how
it'sctured */
void
initialize_table_ThisTable(void)
{
static oid ThisTable_oid[] = { 1, 3, 6, 1, 2, 1, 17, 999, 14 };
netsnmp_table_registration_info *table_info;
netsnmp_handler_registration *my_handler;
netsnmp_iterator_info *iinfo;
/** create the table registration information structures */
table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
my_handler = netsnmp_create_handler_registration("ThisTable",
ThisTable_handler,
ThisTable_oid,
OID_LENGTH
(ThisTable_oid),
HANDLER_CAN_RWRITE);
if (!my_handler || !table_info || !iinfo) {
snmp_log(LOG_ERR,
"malloc failed in initialize_table_ThisTable");
return; /** Serious error. */
}
/***************************************************
* Setting up the table's definition
*/
netsnmp_table_helper_add_indexes(table_info, ASN_INTEGER,
/** index: ThisId */
0);
/** Define the minimum and maximum accessible columns. This
optimizes retrival. */
table_info->min_column = 1;
table_info->max_column = 13;
/** iterator access routines */
iinfo->get_first_data_point = ThisTable_get_first_data_point;
iinfo->get_next_data_point = ThisTable_get_next_data_point;
/** you may wish to set these as well */
#ifdef MAYBE_USE_THESE
iinfo->make_data_context = ThisTable_context_convert_function;
iinfo->free_data_context = ThisTable_data_free;
/** pick *only* one of these if you use them */
iinfo->free_loop_context = ThisTable_loop_free;
iinfo->free_loop_context_at_end = ThisTable_loop_free;
#endif
/** tie the two structures together */
iinfo->table_reginfo = table_info;
/***************************************************
* registering the table with the master agent
*/
DEBUGMSGTL(("initialize_table_ThisTable",
"Registering table ThisTable as a table iterator\n"));
netsnmp_register_table_iterator(my_handler, iinfo);
}
Dave Shield wrote:
> On 30/01/07, Renaud Barbier <[email protected]> wrote:
>> I have a MIB where the column index are not contiguous (i.e
>> 1,2,3,4,., 6)
>
> How are you registering the table?
> What helper are you using, and what does your initialisation code look
> like?
>
> Dave
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users