On Jun 1, 2006, at 12:57 AM, Emil Kondayan wrote:
Can someone tell me why "ip_hl" and "ip_v" are of type "u_int" when
the
structure is packed and they only fill a byte?
Well, that struct definition is relying on the compiler to squeeze
the bitfields into the smallest space required. Some platforms
define ip_hl and ip_v as a char called ip_vhl instead:
/*
* Structure of an internet header, naked of options.
*/
struct ip {
#ifdef _IP_VHL
u_char ip_vhl; /* version << 4 | header
length >> 2 */
#else
[ ...bitfields vary based on BYTE_ORDER... ]
And my second question:do these "#define ..." directives allocate
space in the
structure?
No. They define bitmasks to access each flag bit.
--
-Chuck
_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "[EMAIL PROTECTED]"