Ethereal-dev: Re: [Ethereal-dev] snmp asn1 counter64

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <gharris@xxxxxxxxx>
Date: Mon, 14 Apr 2003 22:37:26 -0700
On Mon, Apr 14, 2003 at 09:33:06AM +0200, markus.carlstedt@xxxxxxxxx wrote:
> Does anyone know why the SNMP_COUNTER64 type
> has to be 8 bytes in length? See code below
> taken from "packet-snmp.c"
> 
> I cannot find this requirement in the SNMP RFCs.
> I thought the ASN1 code only took up the space
> it needed.

The code could probably be made to handle non-8-byte COUNTER64 values.

I'm not certain it even handles 8-byte COUNTER64 values correctly; I
don't remember whether, or how, the older versions of UCD SNMP handled
COUNTER64, so maybe the older versions were treated as, in effect, OCTET
STRING values, but 4.2.4pre2, and probably later versions, handle them
as 64-bit integers in the form of a "counter64" structure, with u_long
"high" and "low" members.

We'd want to have an "asn1_uint64_value_decode()" routine in asn1.c,
that extracts the value into an array of 8 bytes (so that the
"epen/int-64bit.c" routines can handle them) and, if we have UCD SNMP,
convert that array into a "counter64" value, otherwise just print it
using the "epan/int-64bit.c" routines.