Ethereal-dev: Re: [Ethereal-dev] tvb_get_ntohl and other

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

From: "Gilbert Ramirez" <gram@xxxxxxxxxxxxxxx>
Date: Tue, 21 Mar 2006 09:22:14 -0600
On 3/21/06, Sofia Altieri <sofiaaltieri@xxxxxxxxxxx> wrote:
> Hello List,
>
> I'm fetching all values defined in my proto with tvb_get_ntoh(l/s). This
> because this routine
> converts byte from *network* order to host order. Skimming through other
> dissectors I've noticed that tvb_get_letoh(l/s) routines are often used.
> Now:
>
> a) Why should I use tvb_get_letoh(l/s) routines if a more general
> tvb_get_ntoh(l/s) routine exists?
>

Neither is more general than the other. They are complementary. the
"letohl" routines convert little-endian numbers to proper integers on
the host. The "ntohl" routines convert network-order, or big-endian,
numbers to proper intergers on the host.

--gilbert