Available on crate feature data only.
Expand description

Helper functions to access block contents (depending in linktype)

Example

use pcap_parser::data::{get_packetdata, PacketData};
use pcap_parser::pcapng::EnhancedPacketBlock;
use pcap_parser::Linktype;

fn parse_block_content<'a>(
    epb: &'a EnhancedPacketBlock<'_>,
    linktype: Linktype
) -> Option<()> {
    let packet_data =  get_packetdata(epb.data, linktype, epb.caplen as usize)?;
    match packet_data {
        PacketData::L3(_, _data) => {
            // ...
        },
        _ => println!("Unsupported link type"),
    }
    Some(())
}

Structs

Enums

Contents of a pcap/pcap-ng block. This can be network data, USB, etc.

Constants

Functions

Get packet data, depending on linktype.

Get packet data for LINKTYPE_ETHERNET (1)

Get packet data for LINKTYPE_IPV4 (228)

Get packet data for LINKTYPE_IPV6 (229)

Get packet data for LINKTYPE_LINUX_SLL (113)

Get packet data for LINKTYPE_NFLOG (239)

Get packet data for LINKTYPE_NULL (0)

Get packet data for LINKTYPE_RAW (101)

Get packet data for WIRESHARK_UPPER_PDU (252)