Wireshark-dev: Re: [Wireshark-dev] Endianess
From: Gerhard Gappmeier <[email protected]>
Date: Tue, 11 Jul 2006 17:22:58 +0200
Hi,

I was searching the hole day, but found the answer myself 5 minutes after sending the mail ;-)

For all others that have the same question:
tvb_get_letohl() can be used instead of an own function to convert
little endian byte order to host byte order.

mit freundlichen Grüßen / best regards

Gerhard Gappmeier
ascolab GmbH - automation system communication laboratory
Tel.: +49 9131 691 123
Fax: +49 9131 691 128
Web: http://www.ascolab.com
GPG-Key: http://www.ascolab.com/gpg/gg.asc


Gerhard Gappmeier schrieb:
Hello,

I'm currently developing a new dissector plugin.
Because the protocol is LittleEndian and not BigEndian I cannot use ntohX().
I need to convert when ntoh does nothing and vice versa.

To be portable I'm using such a code fragment:
#ifdef BigEndian
# define ua_ntohs(x) (((x & 0xff) << 8) || ((x & 0xff00) >> 8))
# define ua_ntohl(x) (((x & 0xff) << 24) || ((x & 0xff00) << 8) || ((x & 0xff0000) >> 8) || ((x & 0xff000000) >> 24))
#else
# define ua_ntohs(x) x
# define ua_ntohl(x) x
#endif

Is there any Little/Big-Endian define in wireshark that I can use for that?

--
mit freundlichen Grüßen / best regards

Gerhard Gappmeier
ascolab GmbH - automation system communication laboratory
Tel.: +49 9131 691 123
Fax: +49 9131 691 128
Web: http://www.ascolab.com
GPG-Key: http://www.ascolab.com/gpg/gg.asc

_______________________________________________ Wireshark-dev mailing list [email protected] http://www.wireshark.org/mailman/listinfo/wireshark-dev