> I am trying to implement a table using net-snmp5.1. I
> have a  simple array that I want to rertieve from this
> table. When I do a walk on this table it loops forever
> in my get_next entry function.

The 'lnbCustom2Table_get_next_data_point' routine needs to return NULL
when it gets to the end of your table:

> netsnmp_variable_list *
> lnbCustom2Table_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;
>     DEBUGMSGTL(("lnbCustom2Table",
>      "lnbCustom2Table_get_next_data_point \n"));

I'd be tempted for this debug statement to include the current index
value.  I.e.

   DEBUGMSGTL(("lnbCustom2Table",
               "lnbCustom2Table_get_next_data_point %d\n", i ));

>     netsnmp_variable_list *vptr;
>     vptr = put_index_data;
> 
>     snmp_set_var_value(vptr, 
>      (u_char *)&custom2table[i].loBand,
>          sizeof(custom2table[i].loBand) );

How big is "custom2table" ?
What happens when you run off the end of it?

You probably need something like:

      if ( i > MAX_custom2table_INDEX )
          return NULL;


(coming *before* the snmp_set_var_value statement above)


>     DEBUGMSGTL(("lnbCustom2Table",
>      "lnbCustom2Table_get_next_data_point loBand\n"));
> 
>     *my_data_context = (void*)&custom2table[i];
>     *my_loop_context =  (void*)++i;
> 
>     DEBUGMSGTL(("lnbCustom2Table",
>      "lnbCustom2Table_get_next_data_point end\n"));

I probably wouldn't bother with those two debug statements either.
A single debug output, containing all of the useful information about
this particular run is likely to prove clearer.

>     return put_index_data;
> }




Dave



-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
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

Reply via email to