Struct block_storage_t

Struct Documentation

struct libnokogiri::pcapng::block_storage_t

Cached block information for pcapng sections.

This structure stores a small amount of information pertaining to a block in a section of a pcapng file.

It holds the block type, the block length, and the offset into the pcapng file the block is located at.

This class lets us know where every block is and it’s size without actually loading the blocks into memory. This makes reading a file and searching for blocks much faster and more memory efficient in exchange for a small time penalty when first reading the file.

Public Functions

constexpr block_storage_t() noexcept
constexpr block_storage_t(block_type_t type, std::uint32_t length, std::uintptr_t offset, std::optional<block_t> block = std::nullopt) noexcept
block_type_t type() const noexcept

Gets the type of the block stored

std::uint32_t length() const noexcept

Gets the length of the block stored

std::uintptr_t offset() const noexcept

Gets the offset of the block into the pcap file

std::optional<block_t> get_block() noexcept

Gets the block from the file