Re: Table GetNext for next column

"Dave Shield" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
On 10/07/07, Madan Mohan Goud <[email protected]> wrote:
> 1. I am following iterator approach

OK.

So you indicate the end of the column by returning NULL from the
'Get_next_data_point' routine.


> My handler function will take the indexes from the request and retrieve
> the value corresponding to this instance from application.

The expectation is that your 'get_{first,next}_data_point' routines will
save a reference to the per-row data structure in the 'data_context'
parameter.  The handler function can then retrieve this via the API
call 'netsnmp_extract_iterator_context()'.
   It shouldn't be necessary to interpret the index values again.



> 2. What is the simplest way of sending back the agent that no more
> instances of this object exists?

Return NULL from the 'get_next_data_point' routine.
The handler will only be called if there is another row to report.
Moving on to the next column will be handled internally by the
iterator helper.

>                           I am doing it by setting the type of
> varbind in request to (request->requestvb->type) SNMP_NOSUCHOBJECT.

No - that's wrong.
(And will probably confuse the iterator helper).

It's not even the right exception - the agent would return 'noSuchInstance'
for a GET request of a non-existent row.  'noSuchObject' implies the column
does not exist at all.

But this is not the way to handle things using the iterator helper.
The handler will be called with things already set up for the appropriate
row.  Just return the relevant column value, and leave the helper to
handle everything else.

Dave

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.