Wireshark-dev: Re: [Wireshark-dev] usbmon: size of different fields?

From: "Maynard, Chris" <Christopher.Maynard@xxxxxxxxx>
Date: Tue, 9 Nov 2010 11:25:11 -0500
Not sure why I don't see this message posted on gmane?

Anyway, I see you received a few responses already elsewhere:
-> http://lkml.org/lkml/2010/11/9/243
-> http://www.spinics.net/lists/linux-usb/msg38480.html

But I don't think those responses are technically correct.  With the C standard, there are no guarantees except for relative sizes, ie., char <= short <= int <= long, although if the OS is POSIX-compliant, then you can sleep well at night knowing CHAR_BIT is defined as 8 in <limits.h>.  But there's no guarantee that every platform is POSIX-compliant or that the char size is guaranteed to be 8 bits on non-POSIX-conforming platforms, although I can't imagine that Wireshark runs today on any platform where that isn't the case.

As for int, I suspect that most platforms have 32-bit ints, but again, there are no guarantees.

- Chris
P.S. The endian-ness is not an issue because of the libpcap header's magic number.

-----Original Message-----
From: wireshark-dev-bounces@xxxxxxxxxxxxx [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of Németh Márton
Sent: Tuesday, November 09, 2010 1:41 AM
To: linux-usb@xxxxxxxxxxxxxxx
Cc: Developer support list for Wireshark; LKML
Subject: [Wireshark-dev] usbmon: size of different fields?

Hi,

I'm looking at the struct mon_bin_hdr and struct mon_bin_isodesc in file
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=drivers/usb/mon/mon_bin.c;h=44cb37b5a4dc1f9b27075e3db5346b9ebe307b22;hb=HEAD

As far as I understand u64, s64, u32 and s32 have always fixed bit lengths.

What about "unsigned char", "char", "unsigned int" and "int"? May their size in bits
differ in different architecture?

I'm asking this because I was dealing with the USB packet dissectors for Wireshark
and it is possible to capture the USB traffic on one computer and then transfer
the file to another computer.

	Márton Németh

CONFIDENTIALITY NOTICE: The contents of this email are confidential
and for the exclusive use of the intended recipient. If you receive this
email in error, please delete it from your system immediately and 
notify us either by email, telephone or fax. You should not copy,
forward, or otherwise disclose the content of the email.