Choosing the right ASN type

Sverre Moe <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
There seems to be a difference between some ASN types in both asn1.h and snmp_impl.h. 

asn1.h 
/* 
* value for Float 
*/ 
#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT) 
/* 
* value for Double 
*/ 
#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE) 
/* 
* value for Integer64 
*/ 
#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64) 
/* 
* value for Unsigned64 
*/ 
#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64) 

snmp_impl.h 
#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES 
/* 
* defined types from draft-perkins-opaque-01.txt 
*/ 
#define ASN_FLOAT (ASN_APPLICATION | 8) 
#define ASN_DOUBLE (ASN_APPLICATION | 9) 
#define ASN_INTEGER64 (ASN_APPLICATION | 10) 
#define ASN_UNSIGNED64 (ASN_APPLICATION | 11) 
#endif /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */ 

I'm also unsure what to use for unsigned integer32: 
#define ASN_UNSIGNED (ASN_APPLICATION | 2) /* RFC 1902 - same as GAUGE */ 
#define ASN_UINTEGER (ASN_APPLICATION | 7) /* historic - don't use */ 


Wes Hardaker: 
"Generally, you should never use OPAQUEs." 
http://www.mail-archive.com/[email protected]/msg16519.html 

Dave Shield: 
"If you want it to work, use ASN_OPAQUE_FLOAT. 
If you're not bothered, use ASN_FLOAT" 
http://www.mail-archive.com/[email protected]/msg17253.html 

Wes Hardaker: 
"ASN_FLOAT is not a legal SNMP data type. ASN_OPAQUE_FLOAT encodes a 
float in a way that is legal for encoding in SNMP packets. Note, 
however, that Net-SNMP is likely the only package that supports them." 
http://www.mail-archive.com/[email protected]/msg17266.html 


Using ASN_OPAQUE_DOUBLE always outputs the value as "Opaque: Float: ". Because of this, my values of type double are shortened. A longitude value of 69.2457534806943 gets shorten down to 69.245753. How can I avoid this? 

I tried using the ASN types ASN_INTEGER64, ASN_FLOAT and ASN_DOUBLE, but got SNMP error "Internal error in type switching". 
 


CONFIDENTIALITY
This e-mail and any attachment contain KONGSBERG information which may be 
proprietary, confidential or subject to export regulations, and is only meant 
for the intended recipient(s). Any disclosure, copying, distribution or use is 
prohibited, if not otherwise explicitly agreed with KONGSBERG. If received in 
error, please delete it immediately from your system and notify the sender 
properly.

------------------------------------------------------------------------------
Keep yourself connected to Go Parallel: 
INSIGHTS What's next for parallel hardware, programming and related areas?
Interviews and blogs by thought leaders keep you ahead of the curve.
http://goparallel.sourceforge.net

_______________________________________________
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.