MCPcopy Index your code
hub / github.com/RizeCrime/linuxblaster_control / parse_file

Function parse_file

sniffer/src/main.rs:511–525  ·  view source on GitHub ↗
(path: &str)

Source from the content-addressed store, hash-verified

509// ---------------------------------------------------------------------------
510
511fn parse_file(path: &str) -> Vec<UrbHeader> {
512 let file = File::open(path)
513 .unwrap_or_else(|e| panic!("Cannot open {path}: {e}"));
514 let mut reader = PcapNgReader::new(file).unwrap();
515 let mut packets = Vec::new();
516 while let Some(block) = reader.next_block() {
517 let block = block.unwrap();
518 if let Block::EnhancedPacket(packet) = block {
519 if packet.data.get(64) == Some(&0x5a) {
520 packets.push(parse_packet_urb(&packet));
521 }
522 }
523 }
524 packets
525}
526
527fn write_parsed(path: &str) {
528 let input = std::path::Path::new(path);

Callers 1

write_parsedFunction · 0.85

Calls 1

parse_packet_urbFunction · 0.85

Tested by

no test coverage detected