I have some questions with appending a table to the snmpd. --------------- /* from the comment in the source code */
/*quote one*/ get_first_data_point return the first set of "index" data. get_next_data_point return the next loop context /* from http://www.net-snmp.org/dev/agent/group__table__iterator.html */ /*quote two*/ the get_next_data_point hook is then called repeatedly ---------------- >From the quote one, I don't know what "the first set of 'index' data" mean? The first set of "index" data point to the index colomn data in table ,isn't it? >From the quote two, I know get_next_data_point is called repeatedly. When will it stop? Is there some offical document for describeing the architecture of snmpd? /*mib definition*/ SeqEntry ::= SEQUENCE { testOne DisplayString, testTwo INTEGER } /*my added code*/ /*table structure*/ struct node { char *string; long num; struct node * next; }; -------get_first_data--------- struct node *head = producedata(); netsnmp_variable_list *vptr; *my_loop_context =head /** XXX */; *my_data_context =head/** XXX */; vptr = put_index_data; snmp_set_var_value(vptr, (u_char *)head->string/** XXX: testOne data */,strlen(head->string) /** XXX: length of testOne data */); vptr = vptr->next_variable; return put_index_data; -------get_next_data--------- struct node *tmp = my_loop_context; tmp = tmp->next; if(!tmp) return NULL; netsnmp_variable_list *vptr; *my_loop_context = tmp/** XXX */; *my_data_context = tmp/** XXX */; vptr = put_index_data; snmp_set_var_value(vptr, (u_char *)tmp->string /** XXX: testOne data */, strlen(tmp->string) /** XXX: length of testOne data */); vptr = vptr->next_variable; return put_index_data; ------------------------------------------------------- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php _______________________________________________ Net-snmp-coders mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
