ark::pcap::PacketBuffer

Defined in header “ark/pcap/packet_buffer.hh”.


This class will take raw PCAP packets and sort them in time order. Useful to return packets in a PCAP file in time order without loading the entire file.

Methods

  • PacketBuffer(PcapParser & parser, size_t lookahead_count)
    Constructor. Initializes a new packet buffer for the given parser. The lookahead count is the number of messages we read ahead.

  • std::optional< ParsedPcapPacket > step()
    Steps through the file, returning a byte buffer containing the next block. Note that unlike the pcap parser, it is safe to hold onto this data between API calls.

  • bool peek(std::chrono::steady_clock::time_point & next_time)
    Peeks, returning the next timestamp that will be processed. Returns false if no more packets exist.