Ethereal-dev: Re: [Ethereal-dev] Endianess question in packet-gryphon.c

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

From: "Ronnie Sahlberg" <ronnie_sahlberg@xxxxxxxxxxxxxx>
Date: Mon, 6 Oct 2003 12:49:01 +1000
The code is not endianess independent.
But a worse problem is that it uses guint64.
Ethereal is supported on platforms where there is no support for 64bit
integers.

Ethereal has some support for 64bit integers that are available on all
platforms
in the 64bit-int file down in epan.
Curently this support is limited to only handle conversation to/from a
string.

We would need new functions tvb_get_int64n() and tvb_get_int64le() that
stores the value in a char[8]
then we would need a few support routines to do simple arithmetics and
operations on such char[8]s like
   int64_div_by_guint32()
   int64_get_high()
   int64_get_low()



From: "Joerg Mayer"
Sent: Monday, October 06, 2003 11:48 AM
Subject: [Ethereal-dev] Endianess question in packet-gryphon.c


I'm wondering whether the following code in packet-gryphon.c is endianess
independent:

static int
resp_time(tvbuff_t *tvb, int offset, proto_tree *pt)
{
    int     hours, minutes, seconds, fraction;
    union {
        unsigned int            lng[2];
        guint64                 lnglng;
    } ts;
    unsigned int    timestamp;
    unsigned char   date[45];

    ts.lng[1] = tvb_get_ntohl(tvb, offset);
    ts.lng[0] = tvb_get_ntohl(tvb, offset + 4);
    timestamp = ts.lnglng / 100000L;
...

  Ciao
            Jörg
-- 
Joerg Mayer                                           <jmayer@xxxxxxxxx>
We are stuck with technology when what we really want is just stuff that
works. Some say that should read Microsoft instead of technology.

_______________________________________________
Ethereal-dev mailing list
Ethereal-dev@xxxxxxxxxxxx
http://www.ethereal.com/mailman/listinfo/ethereal-dev