ark::pcap::PcapParser

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


This is capable of loading a pcap file and then stepping through it, returning the network packets that were read.

Methods

  • PcapParser(const std::filesystem::path & path)
    Constructor. Opens the PCAP file and prepares it for reading.

  • ~PcapParser()
    Destructor. Cleans up open handles.

  • void close()
    Closes the file, cleaning up open handles and mappings. You can no longer read from the file.

  • std::optional< ParsedPcapPacket > step()
    Steps through the file, returning a byte buffer containing the next block. Note that the buffer inside this packet will fall out of scope if you call any other PcapParser APIs.

  • 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.

  • const PcapParserStatistics & statistics()
    Returns active statistics for this parser.