2011/3/2 yongzhi wang <[email protected]>: > Refer to the mib “nsModuleTable”, I initialized the table module, > registered the handler , defined the iterator access routines such as > “iifo->get_first_data_point”, “iifo->get_first_next_point” and > “iifo->free_loop_context_at_end”. But the value get by tool is wrong. So I > added debug message and found that, the memory, allocated in the routine > “iifo->get_first_data_point”, pointed by the pointer “my_loop_context”, was > freed prematurely by the routine “netsnmp_table_iterator_helper_handler( )”. > So when the routine ” netsnmp_call_next_handler( )” was called, the values > pointed by “my_loop_context” are wrong.
The values pointed to by 'my_loop_context' are *only* relevant to the get_first/get_next hook routines. Once the iterator helper has detected to appropriate row(s) for this request, this context has served its purpose, and is no longer required. Since you have defined the (optional) free_loop_context_at_end() hook routine, this will be called to free the loop context information - exactly as you have requested. The value used by the handler routine to retrieve the data for this row is the value saved in 'my_data_context'. This should still be valid. Dave ------------------------------------------------------------------------------ Free Software Download: Index, Search & Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-dev2dev _______________________________________________ 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
