Ethereal-dev: Re: [Ethereal-dev] Handling DOUBLES

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

From: Gilbert Ramirez <gilramir@xxxxxxxxx>
Date: Thu, 05 Apr 2001 15:11:41 -0500
"Nicholas, John S" wrote:
> 
> Hi,
> 
> I was wondering why the "proto_tree_add_item" function does not handle
> FT_DOUBLE fields.  It looks like I can use proto_tree_add_double(),
> but it would be nice if the generic function could decode the type field
> so I would not have to check what the type is before adding to the
> proto_tree.
> 
> There is probably something I am missing here.

The proto_tree_add_item() function pulls the data from the tvbuff
directly. That means that there has to be some universal
double-precision floating point format that is used in protocols.

There is for integers, but we have to specify big-endian or
little-endian
(that's the reason for the "little_endian" argument to
proto_tree_add_item()).

I'm not an expert in floating-point representations and how they're
used on the wire for various protocols.

> Also, I was wondering how I distinguish between 32bit floats and 64bit floats.
> There is no FT_FLOAT type to use, only FT_DOUBLE.

Necessity -- we haven't had to yet.

--gilbert