I'm learning to use raw sockets, and im trying to prase out the tcp header data, but i can't seem to figure out what res1, ece, and cwr are. Through my networking book and google i know what the rest stand for, but can't seem to find anything on those three. Below is the tcphdr struct in my includes area. Ive commented the parts a bit as i was figureing out what they stood for.
struct tcphdr {
__be16 source;
__be16 dest;
__be32 seq;
__be32 ack_seq;
\#if defined(__LITTLE_ENDIAN_BITFIELD)
__u16 res1:4,
doff:4,//tcp header length
fin:1,/开发者_运维百科/final
syn:1,//synchronization
rst:1,//reset
psh:1,//push
ack:1,//ack
urg:1,// urge
ece:1,
cwr:1;
\#elif defined(__BIG_ENDIAN_BITFIELD)
__u16 doff:4,//tcp header length
res1:4,
cwr:1,
ece:1,
urg:1,//urge
ack:1,//ack
psh:1,//push
rst:1,//reset
syn:1,//synchronization
fin:1;//final
\#else
\#error "Adjust your <asm/byteorder.h> defines"
\#endif
__be16 window;
__sum16 check;
__be16 urg_ptr;
};
See http://en.wikipedia.org/wiki/Transmission_Control_Protocol#TCP_segment_structure
res1 is called reserved there. The others have the same name.
CWR (1 bit) – Congestion Window Reduced (CWR)
ECE (1 bit) – ECN-Echo indicates
精彩评论