Module 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§

ExportedTlv
NflogHdr
NflogPacket
NflogTlv

Enums§

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

Constants§

ETHERTYPE_IPV4
ETHERTYPE_IPV6
EXP_PDU_TAG_DISSECTOR_TABLE_NAME
EXP_PDU_TAG_DISSECTOR_TABLE_NAME_NUM_VAL
EXP_PDU_TAG_PROTO_NAME

Functions§

get_packetdata
Get packet data, depending on linktype.
get_packetdata_ethernet
Get packet data for LINKTYPE_ETHERNET (1)
get_packetdata_ipv4
Get packet data for LINKTYPE_IPV4 (228)
get_packetdata_ipv6
Get packet data for LINKTYPE_IPV6 (229)
get_packetdata_linux_sll
Get packet data for LINKTYPE_LINUX_SLL (113)
get_packetdata_linux_sll2
Get packet data for LINKTYPE_LINUX_SLL2 (276)
get_packetdata_nflog
Get packet data for LINKTYPE_NFLOG (239)
get_packetdata_null
Get packet data for LINKTYPE_NULL (0)
get_packetdata_raw
Get packet data for LINKTYPE_RAW (101)
get_packetdata_wireshark_upper_pdu
Get packet data for WIRESHARK_UPPER_PDU (252)
parse_exported_tlv
parse_many_exported_tlv
parse_nflog
parse_nflog_header
parse_nflog_tlv