On Sat, 2005-09-24 at 17:25 +0530, Kandasamy wrote:
> if snmpget/set request contains multiple oids, I have to send oid
> wise error response to denote in that request which oid went wrong
The agent does, yes. (Using the 'errIndex' field).
> In mib2c code generated by mib2c.scalar.conf, i am calling one method
> callServer(requests).
Note that the scalar helpers process varbinds one at a time.
It's up to the main agent driving code to detect when a varbind
throws an error, and set 'errIndex' accordingly.
The user-level handler code does not need to be concerned
with this.
> In callServer(request), if the requested oid is not the last oid in the
> varbind i am storing request informations and simply returning from the
> callServer to handler_XXX. if the requested oid is last in the varbind i
> am calling one server to get/set the values for all the requested oid as
> a single request to that server and getting the response.
The Net-SNMP agent does not work that way.
Your handler should process the varbinds it is passed via the 'requests'
parameter, and should *NOT* attempt to work with the raw PDU varbind
list.
[snip]
> In this case it always says last oid as the error even middle one had
> error value for set/get
Because the agent knows which varbind(s) it is asking your module to
process. When you call netsnmp_request_set_error(), you specify
the varbind concerned ('requests'), and the agent sets errIndex
accordingly.
> Can i send error message by using snmp_set_var_typed_value()
No.
> or is there any API so that i can send the var pointer
> (requests->agent_req_info->asp->pdu->variables)
No. You should not be using this list.
> to set the error for particular oid in the request.
The way to set the error for a particular OID, is to
use netsnmp_request_set_error() with the relevant
netsnmp_request_info varbind.
Dave
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders