While creating a c file using the mib2c , using the dataset option, 

It creates all the indexes in the table as well, 

Instead of creating the indexes in the "netsnmp_table_set_add_indexes"
alone.

It creates it over there , and in the
netsnmp_table_set_multi_add_default_row.

This prevents from doing a correct walk over the table.

 

 

Example:

 

initialize_table_ipAddrTable(void)

{

    static oid      ipAddrTable_oid[] = { 1, 3, 6, 1, 2, 1, 4, 20 };

    size_t          ipAddrTable_oid_len = OID_LENGTH(ipAddrTable_oid);

    netsnmp_table_data_set *table_set;

 

    /*

     * create the table structure itself

     */

    table_set = netsnmp_create_table_data_set("ipAddrTable");

 

    /*

     * comment this out or delete if you don't support creation of new
rows

     */

    table_set->allow_creation = 1;

 

    /***************************************************

     * Adding indexes

     */

    DEBUGMSGTL(("initialize_table_ipAddrTable",

                "adding indexes to table ipAddrTable\n"));

    netsnmp_table_set_add_indexes(table_set, ASN_IPADDRESS,     /*
index: ipAdEntAddr */

                                  0);

 

    DEBUGMSGTL(("initialize_table_ipAddrTable",

                "adding column types to table ipAddrTable\n"));

    netsnmp_table_set_multi_add_default_row(table_set,

                                            COLUMN_IPADENTADDR,

                                            ASN_IPADDRESS, 0, NULL, 0,

                                            COLUMN_IPADENTIFINDEX,

                                            ASN_INTEGER, 0, NULL, 0,

                                            COLUMN_IPADENTNETMASK,

                                            ASN_IPADDRESS, 0, NULL, 0,

                                            COLUMN_IPADENTBCASTADDR,

                                            ASN_INTEGER, 0, NULL, 0,

                                            COLUMN_IPADENTREASMMAXSIZE,

                                            ASN_INTEGER, 0, NULL, 0, 0);

 

 

Dan Porat

 

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to