Hi Guys,
I'm trying to instrumenting dynamic tables(for example, the processes table...) for a project. Here is what I did: every time when a GET command for a table is issued, I'll clear the table and repupulate it with the CreateAndAddNew<TableName>TableEntry() method. I put the following code inside the Get<TableName><FirstColumnName>() method of <TableName>tableinstru.c:
if ((<TableName>TableEntryPtr->(<TableName>Index==1)
{
Free(<TableName>TableVector();
/* Free dpcHostInfoTable Memory. */
FreeTableMemory(&gv_(<TableName>TableVector, Free(<TableName>TableEntryMemory);
Init(<TableName>Table();
populatingTable();
}
populatingTable() will call CreateAndAddNew<TableName>TableEntry() method to add each rows. By putting the code inside the first column of the first row, I'm trying to avoid over do the re-populating.
Usually I can get the right data for the first time, but if I keep clicking the GET button from a mib browser, the agent will crash with heap corruption error.
Can anyonr help me with this? My questions are:
1. What is the correct way to instrument dynamic tables?
2. Where is the correct place to put the CreateAndAddNew<TableName>TableEntry() method ?
Thanks.
Peter