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] Merging wiretap pint macro to wsutil/pint.h

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Thu, 28 Nov 2013 13:40:31 -0800
On Nov 28, 2013, at 1:39 PM, Jakub Zawadzki <darkjames-ws@xxxxxxxxxxxx> wrote:

> On Tue, Nov 19, 2013 at 07:15:54PM +0100, Jakub Zawadzki wrote:
>> htons(), htonl(), htonll() is kinda easier to write and looks prettier for me than hton16, hton32, hton64().
> 
> It seems that such change would get us to have name conflict with <endian.h> (at least on Linux),

phtoXX() take a pointer and handles unaligned data; renaming them won't cause a conflict with the Linux #defines.

htoXX() take an argument and just byte-swaps as necessary; they're currently just wrappers for GLib macros:

	/* Turn host-byte-order values into little-endian values. */  
	#define htoles(s) GUINT16_TO_LE(s)
	#define htolel(l) GUINT32_TO_LE(l)

so one option would simply be to get rid of htoles() and htolel() and just use the GLib macros directly.