Wireshark-dev: [Wireshark-dev] Endianess

From: Gerhard Gappmeier <gerhard.gappmeier@xxxxxxxxxxx>
Date: Tue, 11 Jul 2006 17:04:08 +0200
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