@Override
    public PacketHandler getPcapPacketHandler() {
        return packet -> {
            // If it's a VLan packet, we need to go one level deeper.
            if (packet.getPayload() instanceof Dot1qVlanTagPacket) {
                return packet.getPayload().getPayload().getPayload().getPayload().getRawData();
            }
            // This is a normal udp packet.
            else {
                if ((packet.getPayload() != null) && (packet.getPayload().getPayload() != null) && (packet.getPayload().getPayload().getPayload() != null)) {
                    return packet.getPayload().getPayload().getPayload().getRawData();
                }
            }
            return null;
        };
    }
Packet handler to use when running in PCAP mode.
In this case all packets are Ethernet frames and we need to first get the
IP packet and then the UDP packet and then the raw data from that.

@return payload of the packet.
plc4j/drivers/bacnet/src/main/java/org/apache/plc4x/java/bacnetip/configuration/BacNetRawSocketTransportConfiguration.java