Thanks again for the response Niels. I hope you don't mind me throwing one more 
at you. Is there a good way to take the value/values that are returned and 
convert them into strings (if they are of different snmp types)? Given the 
example below it seems like I'd have to have a case statement, but is there an 
easier way?

-----Original Message-----
From: Niels Baggesen [mailto:n...@users.sourceforge.net]
Sent: Wednesday, March 19, 2014 4:18 PM
To: Pentasuglia, Corey
Cc: net-snmp-coders
Subject: Re: Problems with async

Den 19-03-2014 20:27, Pentasuglia, Corey skrev:
> Say I get the system description:
> SNMPv2-MIB::sysDescr.0 = STRING: Linux system.name kernel#...so on How
> can I just retrieve what comes have STRING: and store it off in I a string?

if (vars->type == ASN_OCTET_STR) {
    char *str = malloc(vars->val_len+1);
    memcpy(str, vars->val.string, vars->val_len);
    str[vars->val_len] = '\0';
    ...

/Niels

--
Niels Baggesen - @home - Ã…rhus - Denmark - n...@users.sourceforge.net
The purpose of computing is insight, not numbers   ---   R W Hamming
This message is intended only for the addressee and may contain information 
that is company confidential or privileged. Any technical data in this message 
may be exported only in accordance with the U.S. International Traffic in Arms 
Regulations (22 CFR Parts 120-130) or the Export Administration Regulations (15 
CFR Parts 730-774). Unauthorized use is strictly prohibited and may be 
unlawful. If you are not the intended recipient, or the person responsible for 
delivering to the intended recipient, you should not read, copy, disclose or 
otherwise use this message. If you have received this email in error, please 
delete it, and advise the sender immediately.

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to