handler problem (where to get table index)

Mark Gardinier <[email protected]>
Newsgroups gmane.network.net-snmp.user
Organization Advanced Technologies, Incorporated
Message-ID <[email protected]>
Hi:

I'm brand new to SNMP (thought I'd start with that).

I'm trying to write a table handler. I used mib2c to generate the
source code. Everything is going well...except in the handler I cannot
find the value of the table index during a set operation. I can find
the type of the data using requests->requestvb->type.
Based on the type, then I can find the value of the data using requests->requestvb->val.integer
(if it was integer data). However, I can't find the index,
element, or whatever its called. I tried using both requests->index
and requests->requestvb->index
but both are are set to 1. The
handler must be automatically called from the master agent.

I check if reqinfo->mode == COMMIT. When this is true, I need to
pass the type, value, and index to my own routine. The handler's
definition (generated by mib2c is:

/** handles requests for the
phaseTable table, if anything else needs to be done */

int

phaseTable_handler(netsnmp_mib_handler
*handler,

netsnmp_handler_registration *reginfo,

netsnmp_agent_request_info *reqinfo,

netsnmp_request_info *requests)

As an example, if I type the following:

snmpset -v 2c -c private localhost NTCIP1202-2004::phaseWalk.4 i 20

NTCIP1202-2004::phaseWalk.4 = INTEGER: 20

My agent handler (PhaseTable_handler) debug will dump out:

type 2 -- Object
type is integer from requests->requestvb->type

value
length 4 -- length is 4 bytes from requests->requestvb->val_length

name
44137224 -- OID is some large number requests->requestvb->name

data
20 -- data is 20 requests->requestvb->val.integer

index
1 -- index is wrong. requests->index or
request->requestvb->index

The index should be 4. But, it never is. My question is how do I get
the index from the reqinfo or requests handler data?

Thanks for any replies.

Mark

------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev

_______________________________________________
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.