fact: Definition tcp_decode (hdr: IPv4_Packet) := let src := ipv4ToByteBuffer hdr.(SourceAddress) in let dst := ipv4ToByteBuffer hdr.(DestAddress) in let offset := 20 + 4 * List.length hdr.(IPv4Header.Options) in let tcpLen := wordToNat hdr.(TotalLength) - offset in fun bs => let bs' := AlignedByteBuffer.bytebuffer_of_bytebuffer_range offset tcpLen (projT2 bs) in WrapDecoder (@TCP_decoder_impl src dst (natToWord 16 tcpLen)) bs'.
imports: Fiat.QueryStructure.Automation.MasterPlan Fiat.Narcissus.Examples.NetworkStack.IPv4Header Fiat.Narcissus.Examples.NetworkStack.TCP_Packet Fiat.Narcissus.Formats.ByteBuffer Bedrock.Word Fiat.Narcissus.BinLib.Core