add ipv4 frame tests; fix protocol setting

This commit is contained in:
soypat
2025-05-13 21:36:24 -03:00
parent 4b3db8fefd
commit 411d1b3c28
4 changed files with 125 additions and 7 deletions
+2 -2
View File
@@ -4,7 +4,7 @@ const (
sizeHeader = 20
)
// ToS represents the Traffic Class (a.k.a Type of Service).
// ToS represents the Traffic Class (a.k.a Type of Service). It is 8 bits long. 6 MSB are Differentiated Services; 2 LSB are Explicit Congenstion Notification.
type ToS uint8
// DS returns the top 6 bits of the IPv4 ToS holding the Differentiated Services field
@@ -14,7 +14,7 @@ func (tos ToS) DS() uint8 { return uint8(tos) >> 2 }
// ECN is the Explicit Congestion Notification which provides congestion control and non-congestion control traffic.
func (tos ToS) ECN() uint8 { return uint8(tos & 0b11) }
// Flags holds fragmentation field data of an IPv4 header.
// Flags holds fragmentation field data of an IPv4 header. It is 16 bits long.
type Flags uint16
// IsEvil returns true if evil bit set as per [RFC3514].