Hi,

I have a custom-MIB's table implementation using net-snmp [generated code
using mib2c].
I am using the master-agent sub-agent approach.
The init_xxx() creates a table, registers it and populates the data
required.
I have registered a table iterator as a helper for iterating the registred
table.
SNMP GETs are also successfully fetched using the _handler callbacks.

*My requirement:*
My data is dynamic. In the sense, the columns are fixed, but the number of
rows are dynamic based on the number of events occured in the business
logic.
Hence, I need to clear the table everytime a handler is hit so I can clear
the table and re-polulate it to fetch the latest data.

*Now coming to the problem:*
I see that there is no ready-made API to clear the table. I wrote my own
implementation to clear the table data as shown:

rowCount = netsnmp_iterator_row_count(iterator_info);
while(rowCount) {
    entry = xxx_findEntry(int);
// clear the entry details here.
entry.x = 0;
entry.y = false;
entry.z = "default";
entry.valid = 0;
...
}

After clearing the table entries, I re-populate the data similar to how I
populated during the init() call.

*Crux of the issue:*
When I follow the above method, the indexes of the row entries sometimes
gets messed up.
I am not clear of the usage of valid = 0.

*Question:*
Why does net-snmp not provide an API to clear the table ?
How does net-snmp suggest me to clear a table and re-populate it with
latest values in the table ?
Any other suggestions on how to implement a table which has dynamic rows ?

Thanks,
V
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to