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 | <B08C0463E726B24EBED687F5FA6BD7CE01110424@USCHEXC006.nsn-intra.net> |
Thanks very much for the reply. In this case, can I get by without
setting up memory for the "next" pointer of the "<>head" provided by the
template ? What do I set my_data_context to ?
Does the following draft code look alright ?
netsnmp_variable_list *
retailerTable_get_first_data_point(void **my_loop_context,
void **my_data_context,
netsnmp_variable_list *put_index_data,
netsnmp_iterator_info *mydata)
{
netsnmp_variable_list *result;
netsnmp_variable_list *idx = put_index_data;
*my_loop_context = getRetailerDataEntry(0); // external interface
returns data, given an index
result = retailerTable_get_next_data_point(my_loop_context,
my_data_context,
put_index_data,
mydata);
if (result == NULL)
{
// what to do ?
}
return result;
}
netsnmp_variable_list *
retailerTable_get_next_data_point(void **my_loop_context,
void **my_data_context,
netsnmp_variable_list *put_index_data,
netsnmp_iterator_info *mydata)
{
struct retailerTable_entry *entry;
netsnmp_variable_list *idx = put_index_data;
entry = (retailerTable_entry*)(*my_loop_context);
if (entry)
{
snmp_set_var_typed_integer(idx, ASN_INTEGER,
entry->retailerIndex);
idx = idx->next_variable;
*my_data_context = //what should this be set to ?
*my_loop_context = (void *) getRetailerDataEntry(
entry->retailerIndex); // external interface returns data,
given an index
return put_index_data;
}
else
{
*my_loop_context = //what should this be set to ?
return NULL;
}
}
Thanks,
viji
-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of ext Dave Shield
Sent: Sunday, June 07, 2009 1:09 PM
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/5 Ranganathan, Viji (NSN - US/Boca Raton)
<[email protected]>:
> I am trying to implement a subagent that gets data from an external
data
> manager. This external data manager has it's own cache and it only
provides
> interfaces to get and set data.
Does it provide an interface for
"given one row (index) - here's the next row (index)" ?
If so, then you can use that instead of walking the links of a list.
The linked-list code is purely there as an example - the iterator
handler doesn't care how you determine the "next row" index
information.
Dave
------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises
looking to deploy the next generation of Solaris that includes the latest
innovations from Sun and the OpenSource community. Download a copy and
enjoy capabilities such as Networking, Storage and Virtualization.
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
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