Re: how to determine table query index in snmp subagent table handler?
Dave Shield <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <CAKoMtGY+SWeYjs8LFxjKyXA4vx2-gOm3=yE-wuJoSAAZNeOihg@mail.gmail.com> |
On 10 November 2011 23:03, Dave Shield <[email protected]> wrote: >> Example handler code: > >> int index; > >> for (request=requests; request; request=request->next) { >> index = request->index; > > Isn't this what you are looking for? Sorry - you're right of course. This is the index of the varbind within the incoming request (1 for the first or only varbind, 2 for the second, etc). [ I really shouldn't try to respond to queries on the list, just before going to bed!] The list of index value(s) as parsed from the incoming OID can be retrieved using: for (request=requests; request; request=request->next) { netsnmp_table_request_info *table_info = netsnmp_extract_table_info(request); and the individual index values are accessible from table_info->indexes, table_info->indexes->next_variable, etc These are normal VarBind structures, so ignore the OID fields, and just look at the value field. For a simple table (with a single integer index), it's probably easier to extract thie index directly from the OID itself, but for more complex tables (strings, OIDs or multiple indexes), it makes sense to use this varbind list. Dave ------------------------------------------------------------------------------ RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 _______________________________________________ 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