________________________________
From: Dave Shield <[email protected]>
To: sujata patra <[email protected]>
Cc: net-snmp-coders <[email protected]>
Sent: Wednesday, August 24, 2011 1:18 PM
Subject: Re: is there any way I can avoid global variable?
On 23 August 2011 08:27, sujata patra <[email protected]> wrote:
> I have one more doubt. Let's say there is two table tcpTable and udpTable.
> And both has been loaded by same _load() function and _free function.
> So I do not want to create seperate cache for udp table.
> Like to keep the same cache for both the table oids.
> is it possible to do so ?
Yes.
> How can I do so ?
Have a look at the code for the ifXTable (if-mib/ifXTable/*)
This shares the same cache as the main ifTable.
In particular, the routine _ifXTable_container_init()
makes use of netsnmp_cache_find_by_oid() to retrieve
the shared cache structure.
Dave
Thanks , I am using that api frequently to change the cache pareameters. I am
confused looking at the structure definition of struct netsnmp_cache_s. It
hooks the _load() and _free() with the root oid. But when I have two root oid(
two table but one _load() ) , how will it work ?
If the snmpcmd request is there only for the second table , it will not find
any load function as there is no registration of _load() function for the
second table.
I am thinking to get the cache by calling netsnmp_cache_find_by_oid() and check
the cache->expired
from get_first_data_point(). If the cache expired, call the common _load()
function of the two table.
I hope that is okay to do .
------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management
Up to 160% more powerful than alternatives and 25% more efficient.
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders