On 4 January 2013 18:21, Reza Salehi <rezsal...@yahoo.com> wrote:
> I put a printf("test"); inside the former one (
> athStatusTable_get_first_data_point()  ).It gets called once if I run
> snmpget  but still it gets called multiple time ( up to number of column in
> the table) if I run snmpwalk   or snmptable.

Yes, that's correct.
This is the way that the iterator helper works.

You haven't shown how 'fill_table' works, but I suspect this
helper is probably not the best choice for your requirements.


> Maybe I need to run mib2c diffrently?  or I am missing something here.
>
> .... The only problem is I need to put  my function which fills the
> table somewhere to gets called once in response to snmptable or snmpwalk

What I would suggest is that you run

    mib2c -S cache=1 -c mib2c.table_data,conf  athStatusTable

This will include code to load the contents of the table into a local
cache, which will then be used to process requests.  That 'load_table'
routine is essentially the same as your curent 'fill_table', and will be
called whenever the cache is regarded as "too old" to be used.
If you tweak the cache timeout to a suitable value, this will typically
be re-loaded at the start of a walk, and remain valid for the duration.

You could use the same cache approach with the iterator helper
as well, but the table_data helper is probably more efficient.

Dave

------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to