On Tue, 2005-03-01 at 13:51, Robert Story wrote:

> KM> I have several counters that I need to register with the Master. Some of
> KM> these have type timeticks in the MIB file. I can't find the appropriate
> KM> function to register them. For integers I am using 
> KM> netsnmp_register_int_instance.
> 
> There isn't an existing function to do what you want,

Oh yes there is!
What about the 'scalar' or 'watched scalar' helpers?

Those take the type of the object being watched as a parameter, so
that the same interface can be used for any type of object. You
don't have to craft a new API call for each different syntax type.

Code such as

    netsnmp_register_watched_scalar(
        netsnmp_create_handler_registration(
            "my_counter", NULL,
             my_counter_oid, OID_LENGTH(OID_LENGTH),
             HANDLER_CAN_RONLY).
        netsnmp_create_watcher_info(
            &my_counter_var, sizeof(my_counter_var),
             ASN_TIMETICKS, WATCHER_FIXED_SIZE )
        );

should do the trick without needing to touch the APIs.

I know that nobody seems to want to use my scalar handlers (<sniff>)
but they *do* exist.   *AND* they handle invalid instances properly
which the instance helpers don't.

Dave



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to