On Thu, 2005-04-28 at 10:39, ericyosho wrote:
> I just wonder why you've got the idea to drop the
> instance helper.

I haven't - that was Robert's idea.  I'm not
particularly bothered either way.

> i think it is a fine way to work with a instance
> especially within a paticular table.
> right?

It's a reasonable thing to use within a table in theory, yes.
Though in practise, it would be somewhat cumbersome to implement
a whole table that way, and I'd prefer to use one of the specific
table-related handlers.  I can't immediately envisage any situation
where the instance helper would actually be of much use!


> and we can just do the following with a scalar:
> in our code, register the scalar as an instance,but
> give the exact oid without the subid .0
> 
> then we can GET
> snmpget -v2c -c public localhost sysUpTime
> to a normal use instead of having to add .0 in the
> command line
> it seems better,at least for me :-) 

Apart from the minor matter that you've just broken every
single bit of SNMP management software on the market.

Scalar SNMP object values *MUST* include the final .0
subidentifier.  That's how SNMP is defined as working.
You can't simply throw away international standards, and
do your own thing.  Well, I suppose you can  - but don't be
surprised if you encounter an avalanche of opposition! :-)

The scalar helper is specifically designed to match the
behaviour of SNMP scalar object.  Why would you prefer
not to use it?


> and i think the most appealing thing is that we could
> throw the SET steps out of our consideration, as it is
> automatically done by the instance helper.

That doesn't make sense.  The scalar helper is built on
top of the instance helper.  *Everything* that the instance
helper provides for you, is available with the scalar helper
as well.  Plus it handles requests for invalid instances as
well (which the instance helper doesn't).
  The handling of SET requests is exactly the same for the
two helpers.


> just one question:
> when i use netsnmp_register_int_instance(),no
> warnings;
> but when using netsnmp_register_ulong_instance(),i get

Ah - now if you're talking about using the type-specific
APIs, then that's a slightly different matter.  The scalar
helper doesn't include the same set of individual registration
calls.
  Instead, there's a (consolidated) "watcher" helper, to handle
*all* forms of watched scalar objects.  The idea is much the
same as the 'netsnmp_register_*_instance' calls, but the API
is rather different.

The two calls above would be handled by

    long myIntVariable;
    netsnmp_register_watched_scalar(
        netsnmp_create_handler_registration(
             "myIntExample", NULL,
             myIntOID, OID_LENGTH( myIntOID ), HANDLER_CAN_RONLT),
        netsnmp_create_watcher_info(
             (void*)&myIntVariable, sizeof(myIntVariable),
             ASN_INTEGER, WATCHER_FIXED_SIZE ));

and

    unsigned long myUIntVariable;
    netsnmp_register_watched_scalar(
        netsnmp_create_handler_registration(....),
        netsnmp_create_watcher_info(...., ASN_UNSIGNED32, ....));

So rather than have separate API calls for each type,
one of the netsnmp_create_watcher_info parameters specifies
the type of the MIB object being monitored.

Wes' instance approach is probably more immediately accessible,
but the watched_scalar can also handle *any* SNMP syntax,
including TimeTicks, strings, and OID values - none of which
the instance helper supports.


> passing arg 4 of `netsnmp_register_ulong_instance'
> from incompatible pointer type
> 
> what's the matter?

What's the matter?  The fact that you haven't given us
enough information to work with!  :-)

So what *is* the fourth parameter to the
`netsnmp_register_ulong_instance' call?
What are you passing to this routine, and how have you
declared the relevant variable?

Dave



-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to