Returning SNMP float values?
Joshua Tolley <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <20090612180431.GK12253@eddie> |
I've managed to return string values, integer values, and boolean values (as integers). I'm trying to return float values. The nearest thing I see is a Float type defined in UCD-SNMP-MIB, defined in terms of an Opaque type, in SNMPv2-SMI. Opaque is defined as "IMPLICIT OCTET STRING". I guess that means if I want to return a floating type, I return it as a string, with something like this: /* mystr is an allocated string buffer * myfloat is the float I want to return */ sprintf(mystr, "%f", myfloat); snmp_set_var_typed_value(var, ASN_OCTET_STR, (u_char *) mystr, strlen(mystr)); Is that right? Thanks. - Josh / eggyknap ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ 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
signature.asc
(application/pgp-signature, 197 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkoymK8ACgkQRiRfCGf1UMMndgCgpy8Za1lGVOeXqCfbKIGgAdTf HYwAn0ybeucsAXwH8k+05UF8hXnIQUSR =MUFW -----END PGP SIGNATURE-----