[AGENT++] [SNMP++] Longer than expected response with unprintable (Chaim Turkel)

Chaim Turkel - Israel ChaimT at gilat.com
Wed Jul 4 08:18:37 CEST 2007


I found that to get a mac address back and formatted like
AC:03:EF:00:00:00 I had to write my own get_printable_hex().

Chaim


Using the SNMP++ library, I am observing that I am getting longer
responses
than expected which contain unprintable characters and spaces beyond the
valid characters. This always happens for the hex octet strings. So if a
MAC
address is to be returned as follows:

AC 03 EF 00 00 00

I get ........  AC 03 EF 00 00 00 .........................
............

The same applies to IP address values etc. I have worked around this in
my
application by checking the size of the printable_value and that of the
octetstr which differ in this case and if they are different, I strip
off
characters myself.

A bigger problem occurs when the type is a composite string in which
case I
get more garbage.

Is this a known problem and is there a fix for this?

thanks
Altaf


------------------------------

Message: 2
Date: Mon, 02 Jul 2007 11:22:53 +0200
From: Jochen Katz <katz at agentpp.com>
Subject: Re: [AGENT++] [SNMP++] Longer than expected response with
	unprintable	characters
To: agentpp at agentpp.org
Message-ID: <4688C3ED.4020206 at agentpp.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi,

you obviously use the get_printable() function, that behaves as desired.

If the string contains nonprintable characters, the output of 
get_printable_hex() is returned.
See http://sa-ha.de/tmp_doc/classOctetStr.html#a17

If you want the raw value, you have to use data() and len() functions.

Regards,
   Jochen

Altaf Aali schrieb:
> Using the SNMP++ library, I am observing that I am getting longer
responses
> than expected which contain unprintable characters and spaces beyond
the
> valid characters. This always happens for the hex octet strings. So if
a 
> MAC
> address is to be returned as follows:
> 
> AC 03 EF 00 00 00
> 
> I get ........  AC 03 EF 00 00 00 .........................
............
> 
> The same applies to IP address values etc. I have worked around this
in my
> application by checking the size of the printable_value and that of
the
> octetstr which differ in this case and if they are different, I strip
off
> characters myself.
> 
> A bigger problem occurs when the type is a composite string in which
case I
> get more garbage.
> 
> Is this a known problem and is there a fix for this?
> 
> thanks
> Altaf
> _______________________________________________
> AGENTPP mailing list
> AGENTPP at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/agentpp



------------------------------

_______________________________________________
AGENTPP mailing list
AGENTPP at agentpp.org
http://lists.agentpp.org/mailman/listinfo/agentpp


End of AGENTPP Digest, Vol 42, Issue 1
**************************************

IMPORTANT - This email and any attachments is intended for the above named addressee(s), and may contain information which is confidential or privileged. If you are not the intended recipient, please inform the sender immediately and delete this email: you should not copy or use this e-mail for any purpose nor disclose its contents to any person. 




More information about the AGENTPP mailing list