ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] how to retrieve a guint32

From: Teto <mattator@xxxxxxxxx>
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@xxxxxxxxxxxx> 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".
>