Main Content

reset

Reset position of PCAP file reader to first protocol packet of PCAP file

Since R2021b

    Description

    reset(pcap) resets the position of the specified PCAP file reader to the first protocol packet in the PCAP file.

    example

    Examples

    collapse all

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

    pcapReaderObj = pcapReader('ethernetSamplePackets.pcap');

    Create a filter for the eCPRI packets, specifying the message type as a bit sequence.

    filterString = 'ecpri.MessageType == BitSequence';

    Read the first eCPRI packet that matches the specified filter to the MATLAB® workspace.

    ecpriFilteredFirstPacket = read(pcapReaderObj,filterString)
    ecpriFilteredFirstPacket = struct with fields:
                 SNo: 22
           Timestamp: 1.6128e+15
            LinkType: 1
            Protocol: 'eth'
        PacketLength: 64
              Packet: [1x1 struct]
            RawBytes: [1x0 double]
    
    

    Reset the position of the PCAP file reader to the first packet of the PCAP file.

    reset(pcapReaderObj);

    Create a new filter for the eCPRI packets, specifying the message type as a bit sequence.

    filterString = 'ecpri.MessageType == IQData';

    Read the eCPRI packets that match the specified filter to the MATLAB workspace.

    ecpriFilteredPackets = readAll(pcapReaderObj,filterString)
    ecpriFilteredPackets = struct with fields:
                 SNo: 21
           Timestamp: 1.6128e+15
            LinkType: 1
            Protocol: 'eth'
        PacketLength: 64
              Packet: [1x1 struct]
            RawBytes: [1x0 double]
    
    

    Input Arguments

    collapse all

    PCAP file reader, specified as a pcapReader object.

    References

    [1] “Common Public Radio Interface: eCPRI Interface Specification V1.2 ” Accessed June 22, 2021.

    Version History

    Introduced in R2021b