From b0163415a511cc014a71a21d0347dd2495082852 Mon Sep 17 00:00:00 2001 From: Rui Paulo Date: Wed, 16 Sep 2026 11:10:13 -0700 Subject: [PATCH] Checksum: add hardware assist capability flags - Introduce `IfnetHardwareAssistFlags` enum mapping xnu ifnet hwassist capability bits --- Sources/SwiftNetwork/Protocols/Checksum.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Sources/SwiftNetwork/Protocols/Checksum.swift b/Sources/SwiftNetwork/Protocols/Checksum.swift index cae0d381..6ff69db6 100644 --- a/Sources/SwiftNetwork/Protocols/Checksum.swift +++ b/Sources/SwiftNetwork/Protocols/Checksum.swift @@ -207,3 +207,11 @@ extension UnsafeRawBufferPointer { return UInt16(sum) } } + +// Hardware assist flags from xnu. +enum IfnetHardwareAssistFlags { + static let ifnetIPHeader: UInt32 = 0x0001 // IFNET_CSUM_IP + static let ifnetTCP: UInt32 = 0x0002 // IFNET_CSUM_TCP + static let ifnetTCPIPv6: UInt32 = 0x0020 // IFNET_CSUM_TCPIPV6 + static let ifnetPartial: UInt32 = 0x1000 // IFNET_CSUM_PARTIAL +}