On 14 December 2012 06:45, Zheng, Wenjie (Barclay) <barclay.zh...@alcatel-lucent.com> wrote: > I am trying to setup a SNMP Agent to manage data from outside of SNMP Agent. > I try to use mib2c.iterate.conf to generate code, I found that the table > handler need > to keep a index list of the table data, but as my data is from out side of > SNMP Agent, > I am confused why SNMP need to keep a copy of the index list
It doesn't. The table handler needs to know the *structure* of the indexing of the table (whether it's a single integer, three octet strings and a dog, or whatever), but it doesn't necessarily need to know the actual index list, or keep a copy of this. The iterator helper has a pair of hook routines - "get_first" and "get_next" which can be used to query the external data source to determine the current list of valid row indexes. But these will be invoked afresh for each individual request, so would pick up any changes in the meantime. (Please don't be mislead by the fact that the default template code generated by mib2c.iterate.conf uses a linked list of data structures, and hence does hold the list of valid indexes internally. This is purely to provide a starting framework for the MIB code. You can replace the traversal of this list with calls to the external source). > Is this a must that SNMP Agent need to keep a index list for table handler? No. There may well be a performance hit when using an external data source (particularly with the iterator helper, which isn't particularly efficient anyway). But the agent can work quite happily by retrieving the list of valid rows from outside. Dave ------------------------------------------------------------------------------ LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d _______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders