Re: I've met some troubles really headachy,pls help me!
jin zhou <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
Dear Dave,
Thank you very much for your reply.It is very professional,exhaustive,and really helpful to me.According to your suggestions,I've cleared the first 3 troubles successfully so far.There is the last one left:
>> 4.About table variable's implement
>> I use the module mib2c.iterate.conf to build C files for the table...
>> But when using a array to store these
>> datas,it will automatically add an empty row to the beginning when
>> requested.
>You should look carefully at how you are initialising the index and
>context variables in the 'get_first' hook routine. Make sure that
>these refer to the first (valid) entry in your array.
Actually,I did that like you said.I paid extra attention to the "get_first" and "get_next" hook routines,compared my codes with /mibII/udptable.c carefully,but didnt find any mistakes.My routines are as below:
netsnmp_variable_list *
exampleTable_get_first_data_point(void **my_loop_context,
void **my_data_context,
netsnmp_variable_list * put_index_data,
netsnmp_iterator_info *mydata)
{
if(TABLESIZE == 0)
return NULL;
*my_loop_context = 0;
return exampleTable_get_next_data_point(my_loop_context,
my_data_context,
put_index_data, mydata);
}
netsnmp_variable_list *
exampleTable_get_next_data_point(void **my_loop_context,
void **my_data_context,
netsnmp_variable_list * put_index_data,
netsnmp_iterator_info *mydata)
{
int i = (int) *my_loop_context;
if (TABLESIZE >= i) {
snmp_set_var_value(put_index_data, (u_char *)&exampleTable_head[i].userIndex,
sizeof(exampleTable_head[i].userIndex));
*my_data_context = (void *) &exampleTable_head[i];
*my_loop_context = (void *) ++i;
return put_index_data;
} else {
return NULL;
}
I tried to modify *my_loop_context to 1,then snmptalbe shows:An empty row (as my description before),then exampleTable_head[1] datas.So I thought if this is the internal mechanism of net-snmp?If not, how can I fix it?
I am really sorry for wasting your time to help me,and appreciate your help again.
---------------------------------
抢注雅虎免费邮箱-3.5G容量,20M附件!
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
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