Wireshark mailing list archives
Re: how to retrieve a guint32
From: Guy Harris <guy () alum mit edu>
Date: Mon, 24 Oct 2011 10:27:53 -0700
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:
- how to retrieve a guint32 Teto (Oct 24)
- Re: how to retrieve a guint32 Graham Bloice (Oct 24)
- Re: how to retrieve a guint32 Guy Harris (Oct 24)
- Re: how to retrieve a guint32 Teto (Oct 25)