include/uapi/linux/tcp.h
struct tcphdr {
__be16 source; // source port
__be16 dest; // destination port
__be32 seq; // sequence number
__be32 ack_seq; // acknowledgement number
#if defined(__LITTLE_ENDIAN_BITFIELD) // little-endian byte order
__u16 res1:4, // unused
doff:4, // dat offset, the header length. it is the length of the TCP header, including
// options, in 32-bit words, which is the offset of the first byte of data.
fin:1, // flag FIN. the sender is finished sending data
syn:1, // flag SYN. synchronize sequence numbers( establish connection )
rst:1, // flag RST. reset the connection
psh:1, // flag PUSH. receiver should pass the data to application without delay
ack:1, // flag ACK. the acknowledgement number( ack_seq ) is valid
urg:1, // flag URG. the urgent offset( urg_ptr ) is valid
ece:1, //
cwr:1; //
#elif defined(__BIG_ENDIAN_BITFIELD) // big-endian byte order
__u16 doff:4,
res1:4,
cwr:1,
ece:1,
urg:1,
ack:1,
psh:1,
rst:1,
syn:1,
fin:1;
#else
#error "Adjust your <asm/byteorder.h> defines"
#endif
__be16 window; // advertised window
__sum16 check; // checksum
__be16 urg_ptr; // urgent offset
};
Every byte of data exchanged across a TCP connection, along with the SYN and FIN flags, is assigned a 32-bit sequence number. The sequence number field in the TCP header contains the sequence number of the first byte of data in the segment. The acknowledgment number field in the TCP header contains the next sequence number that the s