tcp 实现

include/uapi/linux/tcp.hstruct tcphdr { __be16 source; __be16 dest; __be32 seq; __be32 ack_seq;#if defined(__LITTLE_ENDIAN_BITFIELD) __u16 res1:4, doff:4, fin:1, syn:1, rst:1, psh:1,
摘要由CSDN通过智能技术生成

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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值