我自己整理出来的汇编版本
;;IP数据包头部结构定义
ip_head struct
h_lenver db ? ;4位IP版本号+4位首部长度
TOS db ? ;8位服务类型
tcp_len dw ? ;16位TCP数据包总长度
ident dw ? ;16位标识
frag_and_flags dw ? ;3位分片标志+13位分片偏移
ttl db ? ;8位生存时间
proto db ? ;8位协议类型
checksum dw ? ;16位校验和
sourceIP dd ? ;32位源IP
destIP dd ? ;32位目的IP
ip_head ends
;;TCP头部结构定义
tcp_head struct
th_sport dw ? ;16位源端口
th_dport dw ? ;16位目的端口
th_seq dd ? ;32位序列号
th_ack dd ? ;32位确认号
th_lenres db ? ;4位首部长度+6位保留字,注意这个字段和下面的标志共16位,因6位保留为0,为了定义方便所以填充时可按8位填充两个字段
th_flag db ? ;6位标志位
th_win dw ? ;16位窗口大