Re: how to Initialise the contents of the table?
"蔷<Qiang Hu>" <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
thank you very much,it did help me a lot by the example nsCache.c. thank you. i saw the agent/nsCache.c ,but i can't see how it initials the contents of the table,it seems that it didn't do anything to initial the contents of the table and all depent on setting request to initial contents of table?is it right or i'm wrong? and maybe because not initial,there is no information about how to create an entry by that routine called ***_CreateEntry, i still felt it difficult to know how to initial by that routine.:< On 8/11/06, Dave Shield <[email protected]> wrote: > > On 11/08/06, qiang<Qiang Hu> <[email protected]> wrote: > > i saw this routine and i'm pulzzled about "table_entry = (struct > > tbModuleTable_entry > > *)netsnmp_extract_iterator_context(request);" it seems that > > table_entry get relevant datas from this > > netsnmp_extract_iterator_context;and how can i initial > > contents of table in iterator. > > OK - take a step back. > There are three main areas involved in handling a table (regardless of > which helper you might use to do this): > > a) Building a internal representation of the table > b) Choosing the appropriate row for a given request > c) Returning or updating the relevant columns from that row. > > With most of the helpers, these three tasks tend to be handled separately. > > In the case of the iterator helper: > a) is done via tbModuleTable_createEntry() > (typically invoked from the init routine) > b) is handled by tbModuleTable_get_{first,next}_data_point > (plus the main iterator helper) > c) is the responsibility of tbModuleTable_handler() > > > >i can't understand the iterator operation mechanism. > > The get_{first,next} routines cycle through the rows of the table, in > whatever order is most natural, setting the index value(s) for each > row. The main iterator handler keeps track of which row(s) are > relevant for this particular PDU. > > Once this has been done, the iterator handler calls the > tbModuleTable_handler() routine, which extracts the relevant row for > each varbind ("request"), and works with the appropriate column from > it. > > > i saw an exitent mib handler code of net-snmp which initials in > > this way as following: > > > > iinfo->make_data_context = > netSnmpHostsTable_context_convert_function; > > iinfo->free_data_context = netSnmpHostsTable_data_free; > > iinfo->free_loop_context_at_end = netSnmpHostsTable_loop_free; > > No - I wouldn't use that particular example as a template. It uses > the "iterator_access" framework, which is built upon the basic > iterator helper, but has a very different model. > > > is there any examples mibs for how to modify the generater code by > > mib2c.iterate.conf ? > > Try looking at agent/nsCache.c > That uses the iterator helper, in a very similar way to your code. > > Dave > thanks -- qiang ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ 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