Re: How to get instance from a Request in Table_handler()

Dave Shield <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <CAKoMtGaG+8a=WHrdJa2zLaAEb+F3pHjxw0y6yLnJ3yfJjKvq6A@mail.gmail.com>
On 16 March 2012 19:39, Simon Chamlian <[email protected]> wrote:
> In the request handler function:

> How can we get the instance of the request
> (i.e., the row number of the table) ?

The clean way:

    for (request=requests; request; request=request->next) {
        table_info = netsnmp_extract_table_info(request);
        /** table_info->colnum contains the column number requested */
        /** table_info->indexes contains a linked list of snmp variable
           bindings for the indexes of the table.  Values in the list
           have been set corresponding to the indexes of the request */
        :
    }


The dirty way (relies on the OID being valid and complete,
and the table being indexed by a single integer)

    for (request=requests; request; request=request->next) {
        vb = request->requestvb;
        idx = vb->name[ vb->name_length -1 ];
        :
    }


Dave

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
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.