Module pcap_parser::data

source ·
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§

Constants§

Functions§