(path: &str)
| 509 | // --------------------------------------------------------------------------- |
| 510 | |
| 511 | fn 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 | |
| 527 | fn write_parsed(path: &str) { |
| 528 | let input = std::path::Path::new(path); |
no test coverage detected