RE: Question on Iterator model without having to setup a linked list

"Ranganathan, Viji (NSN - US/Boca Raton)" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <B08C0463E726B24EBED687F5FA6BD7CE01110A30@USCHEXC006.nsn-intra.net>
Thank you. I got this working.
Last question ( I hope ) . I observe that during snmpwalk, after the
handler routine with MODE_GET fetches the correct data, the logic goes
back again to get_first_data_point. 
There are two rows and 24 columns.

Getnextdatapoint : called 169 times
getfirstdatapoint : called 49 times

I just want to verify if this many number of calls to the first/next
routines is normal.

I have set NETSNMP_ITERATOR_FLAG_SORTED.

Thanks,
viji

-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of ext Dave Shield
Sent: Monday, June 08, 2009 8:43 AM
To: Ranganathan, Viji (NSN - US/Boca Raton)
Cc: [email protected]
Subject: Re: Question on Iterator model without having to setup a linked
list

2009/6/8 Ranganathan, Viji (NSN - US/Boca Raton)
<[email protected]>:
>                               In this case, can I get by without
> setting up memory for the "next" pointer of the "<>head" provided by
the
> template ?

The 'loop_context' field is simply some value, that can be passed
from one invocation of the 'get_next' hook routine to the next,
so that it knows how far through the list it's got.
This value is *only* every interpreted by the get_{first,next} routines,
so you can set it to whatever you like.   It doesn't have to be a memory
pointer.

With a linked-list, the obvious choice is a pointer to the data
structure
itself - either the current one or (more commonly) the "next" one.
With a direct access interface, you might want to set this value to be
the actual index.
   Basically - if your 'get_next' routine is called with this value, it
needs to
be able to determine the appropriate next row of the table.


>     What do I set my_data_context to ?

That's essentially similar.   It's a value that will be passed from the
get_first,next hook routines to the main MIB handler, that can then
be used to retrieve the data relating to that particular row.

Again, it's only ever interpreted by the code you provide, so you
can use whatever seems sensible.   For a linked-list implementation,
the obvious choice is the data structure itself    With a direct-access
interface, this might be the index value.  Or some hash value.  Or
anything else that seems sensible.

It doesn't have to be the same as the loop_context (though it often is).
Just some way for the main handler to get the appropriate data.

Dave

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.