On Tue, 2006-02-14 at 16:12 +0000, Raffles wrote:
> In a similar vein, is "netsnmp_register_watched_scalar" still the right
> call to make to register my watched integers, or to put it another way,
> is there any reason not to use "netsnmp_register_watched_instance" for
> them too (it would be nice my OIDs either all had zeros or not, rather
> than being mixed).

If you are implementing scalar objects, then you should use
"netsnmp_register_scalar" or "netsnmp_register_watched_scalar"
in preference to "netsnmp_register_instance" or
"netsnmp_register_watched_instance".

The ns_*_instance approach will return incorrect results in certain
circumstances, while the ns_*_scalar alternatives handle the same
situations properly.




> For reference I've pasted below the code for the plain "register" functions,
> which the "register_watched" functions call. If I've understood correctly, the
> only difference apart from the ".0" is the registration of a scalar handler?

Correct.   The scalar helper actually uses the instance handler to do
most of the work anyway.  But the additional scalar handler will cope
with the extra stuff that the instance helper ignores.


> 1. Does that assume a fixed size (the strings are not fixed size)

No.

>  2. Is it required for integers to be handled correctly?

The problem is nothing to do with the actual value reported.
The instance helper is used for this in either case.

Where the instance helper falls down is in the handling
of *invalid* SNMPv2 requests.

Try comparing the results of running

        snmpget -v 2 localhost  ifNumber.1

against the main CVS code from yesterday (with code that
used netsnmp_register_instance) and today (fixed to use
netsnmp_register_scalar).

Dave


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
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

Reply via email to