From: "Guy Harris" <gharris@xxxxxxxxx>
Reply-To: Ethereal development <ethereal-dev@xxxxxxxxxxxx>
To: "Ethereal development" <ethereal-dev@xxxxxxxxxxxx>
Subject: Re: [Ethereal-dev] tvb_get_ntohl and other
Date: Tue, 21 Mar 2006 10:15:21 -0800 (PST)
Sofia Altieri wrote:
> 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?
As Gilbert noted, network byte order is big-endian, so the ntoh* routines
aren't more general than the letoh* routines, they're complementary -
ntoh* for big-endian, letoh* for little-endian.
Ok, then the fact that tvb_get_ntoh* functions work when sniffing data
between my two PCs isn't enough, is it? Should I check every time if data in
tvbuff are stored in LE order or not, and depending of the result, change
routine?
Thanx
_________________________________________________________________
Scarica gratuitamente MSN Toolbar! http://toolbar.msn.it/