主要内容

writeGlobalHeader

Write global header to PCAP file

    Description

    writeGlobalHeader(pcapObj,linkType) writes a global header to the PCAP file specified in the PCAP file writer object, pcapObj. Input linkType specifies the unique identifier for a protocol.

    writeGlobalHeader(___, TimestampResoulution=timeResolution) additionally specifies the resolution of the timestamp.

    example

    Examples

    collapse all

    Create a default PCAP file writer object.

    pcapObj = pcapWriter;

    5G NR packets do not have a valid link type. As per Tcpdump, if a valid link type is not present, specify the link type of SLL packet.

    linkType = 113;

    Use the PCAP file writer object and the link type of the SLL packet to write a global header for the 5G NR packet to the PCAP file.

    writeGlobalHeader(pcapObj,linkType);

    Create a default PCAP file writer object. Specify the link type for WLAN packet.

    pcapObj = pcapWriter;
    wlanLinkType = 105;

    Using the PCAP file writer object and the WLAN link type, write a global header to the PCAP file.

    writeGlobalHeader(pcapObj,wlanLinkType);

    Create a PCAP file writer object, specifying the name of the PCAP file.

    pcapObj = pcapWriter('FileName','writeBluetoothLEheader');

    Specify the Bluetooth low energy (LE) link type.

    bleLinkType = 251;

    Write a global header to the PCAP file.

    writeGlobalHeader(pcapObj,bleLinkType);

    Input Arguments

    collapse all

    Note

    The pcapWriter object does not overwrite the existing PCAP file. Each time when you create this object, specify a unique PCAP file name.

    PCAP file writer object, specified as a pcapWriter object.

    Unique identifier for a protocol, specified as an integer in the range [0, 65535].

    Data Types: double

    Timestamp resolution, specified as "microseconds" or "nanoseconds".

    References

    [1] Group, The Tcpdump. “Tcpdump/Libpcap Public Repository.” Accessed May 20, 2020. https://www.tcpdump.org.

    [2] “Development/LibpcapFileFormat - The Wireshark Wiki.” Accessed May 20, 2020. https://www.wireshark.org.

    Extended Capabilities

    expand all

    C/C++ Code Generation
    Generate C and C++ code using MATLAB® Coder™.

    GPU Code Generation
    Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.

    Version History

    Introduced in R2020b

    expand all

    See Also

    Functions

    Objects