Struct pcap_t

Struct Documentation

struct libnokogiri::pcap::pcap_t

pcap file container

This structure contains the machinery to read, write, and edit pcap files.

The structure of a pcap file is a file header (pcap_header_t) followed by a collection of packet header and packet data pairs. This is all optionally gz compressed.

Public Types

using iterator_t = libnokogiri::internal::bi_iterator<std::optional<std::reference_wrapper<packet_t>>, packet_storage_t, std::vector<packet_storage_t>::iterator>

Public Functions

constexpr pcap_t() = delete
pcap_t(libnokogiri::internal::fs::path &file, capture_compression_t compression, bool read_only, bool prefetch = false) noexcept

Construct a new pcap file container.

Parameters
  • file: The path to the pcap file

  • compression: The compression mode for the pcap file

  • read_only: Open the pcap file in read only

  • prefetch: Rather than initially building a packet index and then doing I/O to get each packet, ingest all packets at once, this trades memory usage for speed

pcap_t(const pcap_t&) = delete
pcap_t &operator=(const pcap_t&) = delete
pcap_t(pcap_t &&capture) noexcept
void operator=(pcap_t &&capture) noexcept
bool needs_swapping() const noexcept
file_header_t &header() noexcept
void header(file_header_t &&header) noexcept
capture_compression_t compression_type() const noexcept
bool valid() const noexcept
std::size_t packet_count() const noexcept
bool save() const noexcept
void swap(pcap_t &desc) noexcept
void remove_packet(std::size_t index) noexcept
std::optional<std::reference_wrapper<packet_t>> get_packet(std::size_t idx) noexcept
std::optional<std::reference_wrapper<packet_t>> get_packet(packet_storage_t &pkt_storage) noexcept
iterator_t begin() noexcept
iterator_t end() noexcept