I am hacking the code for the TCP. For the definition of the TCP header in the kernel,
I have following questions.
struct tcphdr {__u16 source; __u16 dest; __u32 seq; __u32 ack_seq;
#if defined(__LITTLE_ENDIAN_BITFIELD)__u16 res1:4,
what is meaning of 4 here, 4 bits?
};
Yes.
It's 4 bits.
It's a
standard (ANSI) C definition to allow easy access to variables that are
located
on
non-standard boundaries.
This
type of access is interpeted differently on big/little endian machines, hence
the "ifdef".
For
more details find a good C book (Kerningham & Ritchie) and some TCP header
documentation.