On 22/01/2008, Giuseppe Modugno wrote:
> What should I do if the sub-agent doesn't receive any answer from the
> equipment after the timeout, or it receives a corrupted answer?
> Could SNMP_ERR_NOACCESS be the right choice,
> or SNMP_ERR_RESOURCEUNAVAILABLE,


No.
Most of the SNMP error codes have very specific meanings,
and the protocol specs are very definite about exactly when
they should be used.

Both noAccess and resourceUnavailable are only used with
SET requests (RFC 1905, section 4.2.5, steps (1) & (11))

> or a more general error like SNMP_ERR_GENERR?


Correct.
This is covered explicitly in the same RFC (section 4.2.1)


> Are there any differences between exceptions
> (noSuchObject, noSuchInstance and endOfMib) and error codes?


Yes.
If you have two varbinds in the request, and one fails with an
exception, then the agent will return the value for the other
varbind as part of the same response.
If one fails with an error, then the response reports that error,
and nothing else.


This can be seen by comparing the following two commands:

snmpget -Cf -v 1 -c public localhost sysName sysName.0
snmpget -Cf -v 2c -c public localhost sysName sysName.0

The first returns an error (since SNMPv1 didn't include the
idea of exceptions), and doesn't process the valid varbind.
The second returns the exception, and the requested value.

Dave

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/...et-snmp-coders