> One more thing, is there a way to make net-snmp read my MIB module and 
> then use the library to find out what are de DEFAULT values and 
> allowable range of the INTEGER scalars defined in the MIB module

Not at run-time - no.
(Well, it's obviously possible, but I don't have the code to do it)


> (so I don't have to hardcode the allowable range of values and the
> DEFAULT value in my application)?

Given that the default value and range are fixed with the definition
of the MIB, hardcoding these values is the most obvious way to go.

I can't recall if the 'mib2c' template includes this or not - but it's
an obvious thing for it to handle.

> Also, what would you suggest to use for DisplayString variables

        netsnmp_register_watched_scalar()

:-)

That's the other main difference betweeen this helper, and the
integer_interface family.  They just implement integer-syntax objects,
while the watched scalar helper covers *any* scalar object.
Just define the watcher structure using the appropriate ASN_xxx
value for the object you're implementing.

The one potential stumbling block is with variable-length writable
objects.  The 'netsnmp_create_watcher_info' call includes a single
size parameter, which is used for both current and maximum size.

If that's not correct, you'd have to fix it before actually registering
the watcher:

    netsnmp_handler_registration *reg =
        netsnmp_create_handler_registration( ..., handle_myObject, ... );
    netsnmp_watcher_info *watch =
        netsnmp_create_watcher_info( buf, sizeof( buf ),
                                     ASN_OCTET_STRING,
                                     WATCHER_MAX_SIZE);
+   watch->data_size = strlen( buf );
    netsnmp_register_watched_scalar( reg, watch );


Or else initialise using 'strlen' and fix with:
    watch->max_size = sizeof( buf );
The effect is the same.



Dave



-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Net-snmp-coders mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to