Wireshark mailing list archives

Re: how to retrieve a guint32


From: Teto <mattator () gmail com>
Date: Tue, 25 Oct 2011 10:17:45 +0200

Thank you both for these comprehensive answers :)

On Mon, Oct 24, 2011 at 7:27 PM, Guy Harris <guy () alum mit edu> wrote:

On Oct 24, 2011, at 8:49 AM, Teto wrote:

tvb_get_letoh24 / tvb_get_letohl look more straightforward but I don't
understand how they transform the number.
letoh stands for "local to host" ?

"Little-endian to host", and the "l" stands for "long".

The "'l' stands for 'long'" is a historical artifact; in 4.2BSD (and probably earlier), there were "ntohl()" and 
"htonl()" routines to convert a C "long", which, at the time, was 32 bits long on 16-bit and 32-bit platforms, 
between "network byte order" (big-endian) and "host byte order".  There were also "ntohs()" and "htons()" to convert 
a C "short", which was 16 bits on those platforms.

why the "24" ?

24 bits.

I guess the last "l"
in  tvb_get_letohl is for little endian ?

Nope, "long".

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

Current thread: