Packet and Header Access

Zero-allocation pattern:

Ip4 ip = new Ip4(); // allocate once
Tcp tcp = new Tcp();

pcap.loop(-1, packet -> {
    if (packet.hasHeader(ip) && packet.hasHeader(tcp)) {
        // bound to current packet
    }
});

Last updated