Function calculate_checksum

Source
pub fn calculate_checksum(buffer: &[u8], pseudo_header: &PseudoHeader) -> u16
Expand description

Calculate the checksum for a UDP/TCP packet.

§Arguments

  • ‘buffer’ - the UDP/TCP packet as bytes (without the IP header)

  • ‘pseudo_header’ - the pseudo header for this packet (IPv4 or IPv6)