mirror of
https://github.com/impact-eintr/netstack.git
synced 2025-10-28 06:51:27 +08:00
tcp可靠性实现 抄了一堆东西 信息量太大了 看不过来
This commit is contained in:
@@ -33,6 +33,7 @@ func ChecksumCombine(a, b uint16) uint16 {
|
||||
// given destination protocol and network address, ignoring the length
|
||||
// field. Pseudo-headers are needed by transport layers when calculating
|
||||
// their own checksum.
|
||||
// hash(protocol, hash(dst, hash(src, 0)))
|
||||
func PseudoHeaderChecksum(protocol tcpip.TransportProtocolNumber, srcAddr tcpip.Address, dstAddr tcpip.Address) uint16 {
|
||||
xsum := Checksum([]byte(srcAddr), 0)
|
||||
xsum = Checksum([]byte(dstAddr), xsum)
|
||||
|
||||
@@ -131,6 +131,23 @@ const (
|
||||
)
|
||||
|
||||
// SACKBlock 表示 sack 块的结构体
|
||||
/*
|
||||
+--------+--------+
|
||||
| Kind=5 | Length |
|
||||
+--------+--------+--------+---------+
|
||||
| Start of 1st Block |
|
||||
+--------+--------+--------+---------+
|
||||
| End of 1st Block |
|
||||
+--------+--------+--------+---------+
|
||||
| |
|
||||
/ . . . . . . /
|
||||
| |
|
||||
+--------+--------+--------+---------+
|
||||
| Start of nth Block |
|
||||
+--------+--------+--------+---------+
|
||||
| End of nth Block |
|
||||
+--------+--------+--------+---------+
|
||||
*/
|
||||
type SACKBlock struct {
|
||||
// Start indicates the lowest sequence number in the block.
|
||||
Start seqnum.Value
|
||||
|
||||
Reference in New Issue
Block a user