Struct PacketInfo

Struct Documentation

struct PacketInfo

Metadata describing a packet read from or written to a PCAP file.

This structure contains information about a single UDP packet, including source and destination addresses, ports, payload and packet sizes, timestamps, encapsulation, and positioning within a PCAP file.

It is used both by PcapReader when extracting packet metadata and by PcapWriter when writing packets to disk.

Public Types

using ts = std::chrono::microseconds

Type alias for timestamp, in microseconds.

Public Members

std::string dst_ip

The destination IP.

std::string src_ip

The source IP.

int dst_port

The destination port.

int src_port

The source port.

size_t payload_size

The size of the packet payload.

size_t packet_size

The size of the full packet.

ts timestamp

The packet capture timestamp.

int fragments_in_packet

Number of fragments in the packet.

int ip_version

The ip version, 4 or 6.

int encapsulation_protocol

PCAP encapsulation type.

uint64_t file_offset

Where the packet is in the pcap.

int network_protocol

IANA protocol number. Always 17 (UDP)