Crate pcap_file [−] [src]
Contains all the materials needed to read and write a pcap file format.
Provides two structs, PcapReader
and PcapWriter
, to read and write Pcap.
Provides a Packet
which contains all the data relative to one packet
Examples
use std::fs::File; use pcap_file::{PcapReader, PcapWriter}; let file_in = File::open("test.pcap").expect("Error opening file"); let pcap_reader = PcapReader::new(file_in).unwrap(); let file_out = File::create("out.pcap").expect("Error creating file"); let mut pcap_writer = PcapWriter::new(file_out).unwrap(); // Read test.pcap for pcap in pcap_reader { //Write each packet of test.pcap in out.pcap pcap_writer.write_packet(&pcap).unwrap(); }
Reexports
pub use packet::Packet; |
pub use reader::PcapReader; |
pub use writer::PcapWriter; |
Modules
errors |
Contains |
packet |
This module contains the |
pcap_header |
This module contains informations relative to the global Pcap header. |
reader |
This module contains the |
writer |
This module contains the |