Struct packet_t

Struct Documentation

struct libnokogiri::pcap::packet_t

pcap packet template

Retrieve the packet header

Set the packet header

Retrieve the offset in the file the packet is located at

Set the offset in the file the packet is located at

Retrieve the packet data

Set the packet data

Type alias for generic conforming pcap packets with the standard header

Type alias for packets from the modified pcap files

This template provides the framework for reading and writing packets.

They can have custom headers, but the two standardized packets are already specified as libnokogiri::pcap::generic_packet_t and libnokogiri::pcap::modified_packet_t .

All this template does is change out the packet header type, the rest of the logic is identical.

Public Types

using pkt_header_t = std::variant<std::monostate, packet_header_t, packet_header_modified_t>

Public Functions

packet_t(std::size_t length, pkt_header_t header = {}) noexcept
packet_t(const packet_t&) = delete
packet_t &operator=(const packet_t&) = delete
packet_t(packet_t&&) = default
packet_t &operator=(packet_t&&) = default
std::size_t length() const noexcept
pkt_header_t &header() noexcept
bool is_complete() const noexcept
template<typename T>
T &as()
template<typename T>
T *operator[](const off_t idx)
auto begin() noexcept
auto end() noexcept
template<typename T>
const T *operator[](const off_t idx) const
template<typename T>
T *at(const off_t idx)
template<typename T>
const T *at(const off_t idx) const
void *address(const off_t offset) noexcept