pub fn parse_records<'a>(
        input: &'a [u8],
        endianness: Endianness,
    ) -> IResult<&'a [u8], std::vec::Vec<record::PcapRecord<'a>>> {
        let mut records: std::vec::Vec<record::PcapRecord> = vec![];
        let mut current = input;

        trace!("{} bytes left for record parsing", current.len());

        loop {
            match record::PcapRecord::parse(current, endianness) {
                Ok((rem, r)) => {
                    current = rem;
                    trace!("{} bytes left for record parsing", current.len());
                    records.push(r);
                }
                Err(nom::Err::Incomplete(nom::Needed::Size(s))) => {
                    debug!("Needed {} bytes for parsing, only had {}", s, current.len());
                    break;
                }
                Err(nom::Err::Incomplete(nom::Needed::Unknown)) => {
                    debug!(
                        "Needed unknown number of bytes for parsing, only had {}",
                        current.len()
                    );
                    break;
                }
                Err(e) => return Err(e),
            }
        }

        Ok((current, records))
    }
///
/// Parse a slice of bytes that correspond to a set of records, without libcap file format
/// header (https://wiki.wireshark.org/Development/LibpcapFileFormat). Endianness of the byte
/// slice must be known.
///
Parse a slice of bytes that correspond to a set of records, without libcap file format
header . Endianness of the byte
slice must be known.
Parse a slice of bytes that correspond to a set of records without libcap file format header . Endianness of the byte slice must be known .
pub fn parse_records<'a>(
        input: &'a [u8],
        endianness: Endianness,
    ) -> IResult<&'a [u8], std::vec::Vec<record::PcapRecord<'a>>> {
        let mut records: std::vec::Vec<record::PcapRecord> = vec![];
        let mut current = input;
        trace!("{} bytes left for record parsing", current.len());
        loop {
            match record::PcapRecord::parse(current, endianness) {
                Ok((rem, r)) => {
                    current = rem;
                    trace!("{} bytes left for record parsing", current.len());
                    records.push(r);
                }
                Err(nom::Err::Incomplete(nom::Needed::Size(s))) => {
                    debug!("Needed {} bytes for parsing, only had {}", s, current.len());
                    break;
                }
                Err(nom::Err::Incomplete(nom::Needed::Unknown)) => {
                    debug!(
                        "Needed unknown number of bytes for parsing, only had {}",
                        current.len()
                    );
                    break;
                }
                Err(e) => return Err(e),
            }
        }
        Ok((current, records))
    }
pub fn parse_records < ' a > ( input : & ' a [ u8 ] , endianness : Endianness , ) -> IResult < & ' a [ u8 ] , std :: vec :: Vec < record :: PcapRecord < ' a > > > { let mut records : std :: vec :: Vec < record :: PcapRecord > = vec ! [ ] ; let mut current = input ; trace ! ( " " current len ( ) ) ; loop { match record :: PcapRecord :: parse ( current , endianness ) { Ok ( ( rem , r ) ) => { current = rem ; trace ! ( " " current len ( ) ) ; records . push ( r ) ; } Err ( nom :: Err :: Incomplete ( nom :: Needed :: Size ( s ) ) ) => { debug ! ( " " s current len ( ) ) ; break ; } Err ( nom :: Err :: Incomplete ( nom :: Needed :: Unknown ) ) => { debug ! ( " " current len ( ) ) ; break ; } Err ( e ) => return Err ( e ) , } } Ok ( ( current , records ) ) }
Parse a slice of bytes that correspond to a set of records, without libcap file format
header (https://wiki.wireshark.org/Development/LibpcapFileFormat).
Parse a slice of bytes that correspond to a set of records without libcap file format header ( https : // wiki . wireshark . org / Development / LibpcapFileFormat ) .
input
&'a [u8]
endianness
Endianness