Hi Dave Thanks for your help, really appreciated.
We have concern to keep a cache of index, we might need audit to detect the mismatch between cache and external data. So we decided to not to keep data inside SNMP Agent, and read data directly from outside. I will study the code you referred to. Thanks, Barclay -----Original Message----- From: dave.shi...@gmail.com [mailto:dave.shi...@gmail.com] On Behalf Of Dave Shield Sent: 2012年12月17日 16:28 To: Zheng, Wenjie (Barclay) Cc: net-snmp-us...@lists.sourceforge.net; net-snmp-coders@lists.sourceforge.net Subject: Re: Index of table in SNMP Agent On 17 December 2012 01:18, Zheng, Wenjie (Barclay) <barclay.zh...@alcatel-lucent.com> wrote: > Thanks for your response, it's really helps. > Is there an example I can refer that SNNP can retrieve data from outside? Hmmm... there are probably not many examples of using the iterator to walk through external data. As I indicated last week, it's not exactly the most efficient of the table helpers, so a more common technique is to read in a snapshot of the external data, cache it, and use that cache to process incoming requests. The cache is only reloaded when it's deemed "too old". A quick look through the code shows about a dozen modules that use the iterator helper. Some of these (nsCache, nsDebug, etc) are reporting on internal data anyway, so aren't really relevant here. Probably the most promising for you to look at would be examples/netSnmpHostTable{,_access}.c which uses a variant of the iterator approach to read from /etc/hosts or mibII/icmp.c mibII/ipCidrRouteTable.c mibII/tcpTable.c mibII/udpTable.c which are probably the closest to what you're trying to do. 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