Function caracat::builder::build_ipv4

source ·
pub fn build_ipv4(
    packet: &mut Packet<'_>,
    src_addr: Ipv4Addr,
    dst_addr: Ipv4Addr,
    ttl: u8,
    id: u16
)
Expand description

Build the IPv4 header.

In the IP header, the type of service, protocol, source and destination address fields are used for per-flow load-balancing. We also encode the TTL in the ID field in order to retrieve it in the ICMP destination unreachable/TTL exceeded messages since the TTL field is decreased/modified at each hop.