Struct option_t

Inheritance Relationships

Derived Type

Struct Documentation

struct libnokogiri::pcapng::option_t

Base for all pcapng options.

This structure represents the atomic base for all options defined by libnokogiri as well as by the developer if the add custom options.

For documentation on how to add new options to libnokogiri see the Adding Options section in Extending libnokogiri

Options have the following overarching structure:

 0               1               2               3
 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           Option Type         |          Option Length        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/                          Option Data                          /
/                Variable Length padded to 32 bits              /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

  • Option Type is a 16-bit unsigned value describing how to interpret the data

  • Option Length is a 16-bit unsigned value describing how long the option data is without padding

  • Option Data is optional, and depends on Option Type

Options are collected into a contiguous block which is then suffixed with a special option value to indicate the end of an option block.

The termination option is a single option with the type of 0x0000 and the length of 0x0000. However, the assumption that this termination option is present can not be made (for some reason, ask the RFC committee, I don’t fucking know).

For safety, when you construct a default empty base option_t, it will act the same as an options::end_of_options_t .

Subclassed by libnokogiri::pcapng::options::end_of_options_t

Public Functions

constexpr option_t() noexcept
option_type_t type() const noexcept

Gets the type of the option

std::uint16_t length() const noexcept

Gets the length of the option

std::size_t size() const noexcept

Gets the total size of this structure as it would be in the pcap file

bool multiple_allowed() const noexcept

Gets if there can be more than one of this type of option per block

Protected Functions

constexpr option_t(option_type_t type, std::uint16_t length, bool multiple) noexcept