mirror of
https://github.com/impact-eintr/netstack.git
synced 2025-10-12 16:20:03 +08:00
网卡对象 绑定IP地址 然后向网卡对象写入数据 数据中将包含dst和src
This commit is contained in:
30
tcpip/header/ipv4.go
Normal file
30
tcpip/header/ipv4.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package header
|
||||
|
||||
import "netstack/tcpip"
|
||||
|
||||
type IPv4 []byte
|
||||
|
||||
const (
|
||||
// IPv4MinimumSize is the minimum size of a valid IPv4 packet.
|
||||
IPv4MinimumSize = 20
|
||||
|
||||
// IPv4MaximumHeaderSize is the maximum size of an IPv4 header. Given
|
||||
// that there are only 4 bits to represents the header length in 32-bit
|
||||
// units, the header cannot exceed 15*4 = 60 bytes.
|
||||
IPv4MaximumHeaderSize = 60
|
||||
|
||||
// IPv4AddressSize is the size, in bytes, of an IPv4 address.
|
||||
IPv4AddressSize = 4
|
||||
|
||||
// IPv4ProtocolNumber is IPv4's network protocol number.
|
||||
IPv4ProtocolNumber tcpip.NetworkProtocolNumber = 0x0800
|
||||
|
||||
// IPv4Version is the version of the ipv4 protocol.
|
||||
IPv4Version = 4
|
||||
|
||||
// IPv4Broadcast is the broadcast address of the IPv4 procotol.
|
||||
IPv4Broadcast tcpip.Address = "\xff\xff\xff\xff"
|
||||
|
||||
// IPv4Any is the non-routable IPv4 "any" meta address.
|
||||
IPv4Any tcpip.Address = "\x00\x00\x00\x00"
|
||||
)
|
Reference in New Issue
Block a user