It worked, thank you.

Sorry I've been a pain about this for the last few weeks, but this is so
different from the 4.x.x that I was unable to determine from the mib2c
generated code and what examples in the net-snmp package how to proceed.

-----Original Message-----
From: Dave Shield [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 05, 2005 1:25 AM
To: Toth, Gregory S
Cc: net-snmp-coders@lists.sourceforge.net
Subject: RE: How to implement tables in 5.0.6


On Thu, 2005-05-05 at 00:21, Toth, Gregory S wrote:
> Thanks, that worked (oops I missed the & on the &this_index.
> 
> The walk now returns the first row for each column in the table, but 
> not the other rows.

OK - so what does your getNextDataPoint routine look like?



> Should the flow look more like this (assuming multiple (2) rows for 
> each column)?
> 
> get_first_data_point
> get_next_data_point
> get_next_data_point
> ContentTable_handler
>   collects data for first column, first row
>   collects data for first column, second row

Not quite.  It would actually be:

> get_first_data_point
> get_next_data_point
> get_next_data_point
> ContentTable_handler
>   collects data for first column, first row

  get_first_data_point
  get_next_data_point
  get_next_data_point
  ContentTable_handler
>   collects data for first column, second row

> get_first_data_point
> get_next_data_point
> get_next_data_point
> ContentTable_handler
>   collects data for second column, first row

  get_first_data_point
  get_next_data_point
  get_next_data_point
  ContentTable_handler
>   collects data for second column, second row

        <etc, etc>

The full get_{first,next} loop is run for *each*
incoming GETNEXT request separately, to determine
the appropriate row needed for that request.
  The ContentTable_handler is then called to provide
the appropriate column value from that particular
row (singular).

(That's the basic idea, anyway - things are complicated
by multiple varbinds in a single request, GetBulk handling
and automatic caching - but that's the underlying model).



> If this is correct, than does this mean that the getNextDataPoint is 
> where the data structure is built up to allow the correct generation 
> of the requests structure for the ContentTable_handler?

No - the getNextDataPoint routine is where you step from one row of the
table to the next.  You use the incoming 'loop_context' parameter to
determine where you are currently - based on whatever you set for this
parameter in get_first_data_point.
  Then you update this parameter ready for the next iteration.

You also need to set the 'data_context' parameter so that the
ContentTable_handler knows which row it will finally be working with.


>From the description so far, I think you need to set both of these
to be 'this_index'.  So the get_first routine would include:

        snmp_set_var_value( vptr,  (u_char*)&this_index,
                                      sizeof(this_index));
        *loop_context = (void *)this_index;
        *data_context = (void *)this_index;

and the get_next routine would include:

        this_index = (int)*loop_context;
        this_index++;
        if ( this_index > LAST_INDEX )
            return NULL;
        snmp_set_var_value( vptr,  (u_char*)&this_index,
                                      sizeof(this_index));
        *loop_context = (void *)this_index;
        *data_context = (void *)this_index;



> If this is true, then I would expect the "netsnmp_variable_list * 
> put_index_data" structure that is passed to getNextDataPoint would 
> check the row data in the passed in put_index_data,

But 'put_index_data' does not pass anything *in* to this routine. It's
an empty framework, that getNextDataPoint is expected to populate. It's
used to pass information *out*, not in.

The only parameter used to pass information *in* is 'loop_context'.


> In this case, what methods are used to add the additional row data to 
> put_index_data?

put_index_data is only used to report the index value(s) for each row.
The data for that row is the responsibility of 'data_context'.


Dave



-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r 
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to