--===============0880907627==
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit







Hi,



As Dave says, you have to use the cache helper :

mib2c -c mib2c.table_data.conf  -S cache=1   myDataTable

The code produced don't compile, it's a little buggy. See my code below.

the cache->flags is set to call each time the load function.

http://www.net-snmp.org/dev/agent/group__cache__handler.html

The last problem is if the table is empty the load function is never
call !



----------

in .h:

NetsnmpCacheLoad myDataTable_load;

//NetsnmpCacheFree myDataTable_free;



in.c :

initialize_table_mydataTable(void) {

.....

    netsnmp_tdata_register(reg, table_data, table_info);



    cache = netsnmp_cache_create(-1, myDataTable_load,
(NetsnmpCacheFree *)myDataTable_free,

        myDataTable_oid, myDataTable_oid_len);

  cache->magic =  (void *) table_data;

  cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET |
NETSNMP_CACHE_DONT_FREE_BEFORE_LOAD | NETSNMP_CACHE_DONT_FREE_EXPIRED |
NETSNMP_CACHE_DONT_AUTO_RELEASE;



  netsnmp_inject_handler_before(reg,
netsnmp_cache_handler_get(cache),"mydataTable");

    // Init table

    mydataTable_load(cache, table_data);



}





int myDataTable_load(netsnmp_cache * cache, void *vmagic)

{

  netsnmp_tdata * table_data = (netsnmp_tdata *) vmagic;

  netsnmp_tdata_row *row;

  struct myDataTable_entry *row_entry; 

 

    row = NULL;

  row = netsnmp_tdata_row_next(table_data, row);

  row_entry = (struct myDataTable_entry *)row->data;

  row_entry->myDataVal1++;

    ....

}

-------



Stephane.



kumar undurthi a écrit :
cite="mid:ae35fd890803141232r2bee2f8bi9254f90f25278e92@m ail.gmail.com"
type="cite">Hi All,



      I have requirement in which i have to fill the table data when
ever a request will come, For example check the below  example.... it
was generated by using mib2c.table_data.conf.

          : in which "ocStbHostAVInterfaceTable_handler"  is taking
care of the requests, So my requirement is

when the a request come  at " i.e   "(check in code )  case MODE_GET:" 
then i want to update the table instated of initialize the  table first
(filling the table)  at (check in code "
initialize_table_ocStbHostAVInterfaceTable(void) " )



Please give the Solution as early as possible..... (adv Thank's)