Struct packet_header_modified_t

Struct Documentation

struct libnokogiri::pcap::packet_header_modified_t

The packet header for the patched version of libpcap.

This header is an extension of the normal packet header, it adds four fields to the end of the traditional header.

The packet headers have the following 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
+                                                               +
|                                                               |
+                         Packet Header                         +
|                                                               |
+                                                               +
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                        Interface Index                        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           Protocol            |      Type     |    Padding    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  • Packet Header - The standard pcap packet header represented by the libnokogiri::pcap::packet_header_t structure.

  • Interface Index - An unsigned 32-bit integer representing the index of the interface on which the capturing machine this packet came from.

  • Protocol - An unsigned 16-bit value representing the Ethernet packet type. Not to be confused with Type.

  • Type - An unsigned 8-bit value representing if the packet was broadcast/multicast/etc.

  • Padding - 8-bits of padding to pad the structure to a 32-bit boundary.

Public Functions

constexpr packet_header_modified_t() noexcept
constexpr packet_header_modified_t(packet_header_t &&base_header, std::uint32_t if_index, std::uint16_t protocol, std::uint8_t type) noexcept
packet_header_modified_t(std::nullptr_t) noexcept
packet_header_modified_t(const packet_header_modified_t&) = delete
packet_header_modified_t &operator=(const packet_header_modified_t&) = delete
packet_header_modified_t(packet_header_modified_t&&) = default
packet_header_modified_t &operator=(packet_header_modified_t&&) = default
const packet_header_t &base_header() const noexcept

Retrieve the base packet header

void base_header(packet_header_t &&base_header) noexcept

Set the base packet header

std::uint32_t interface_index() const noexcept

Retrieve the interface index for this packet

void interface_index(std::uint32_t interface_index) noexcept

Set the interface index for this packet

std::uint16_t protocol() const noexcept

Retrieve protocol type for this packet

void protocol(std::uint16_t protocol) noexcept

Set protocol type for this packet

std::uint8_t type() const noexcept

Retrieve the type of this packet

void type(std::uint8_t type) noexcept

Set the type of this packet