fact: Definition udp_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: bytes) => let bs' := AlignedByteBuffer.bytebuffer_of_bytebuffer_range offset tcpLen (projT2 bs) in WrapDecoder (@UDP_decoder_impl src dst (natToWord 16 tcpLen)) bs'.
imports: BinNat Coq.Lists.List Bedrock.Word Fiat.Common.EnumType Fiat.Narcissus.Formats.ByteBuffer Fiat.Narcissus.Examples.NetworkStack.IPv4Header Fiat.Narcissus.Examples.NetworkStack.UDP_Packet Fiat.Narcissus.Examples.NetworkStack.TCP_Packet