pub struct PcapPacket {
pub ts_sec: u32,
pub ts_frac: u32,
pub incl_len: u32,
pub orig_len: u32,
pub data: Vec<u8>,
}
Expand description
Pcap packet with its header and data.
Fields§
§ts_sec: u32
Timestamp in seconds.
ts_frac: u32
Nanosecond or microsecond part of the timestamp.
incl_len: u32
Length of the packet saved that is saved in the file (Length of the data field).
orig_len: u32
Original length of the packet on the wire.
data: Vec<u8>
Payload.
Implementations§
Source§impl PcapPacket
impl PcapPacket
Sourcepub fn read<R>(reader: R) -> Result<Self, PcapError>where
R: ReadEndian,
pub fn read<R>(reader: R) -> Result<Self, PcapError>where
R: ReadEndian,
Parse a new PcapPacket
from a reader.
Sourcepub fn read_with<R>(reader: R, data: Vec<u8>) -> Result<Self, PcapError>where
R: ReadEndian,
pub fn read_with<R>(reader: R, data: Vec<u8>) -> Result<Self, PcapError>where
R: ReadEndian,
Parse a new PcapPacket
from a reader. Use the supplied Vec as a backing storage
for the payload data.
Sourcepub fn write<W>(&self, writer: W) -> Result<u32, PcapError>where
W: WriteEndian,
pub fn write<W>(&self, writer: W) -> Result<u32, PcapError>where
W: WriteEndian,
Write a PcapPacket
to a WriteEndian writer.
The fields of the packet are not validated.
pub fn len(&self) -> u32
Trait Implementations§
Source§impl Clone for PcapPacket
impl Clone for PcapPacket
Source§fn clone(&self) -> PcapPacket
fn clone(&self) -> PcapPacket
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for PcapPacket
impl Debug for PcapPacket
Source§impl PartialEq for PcapPacket
impl PartialEq for PcapPacket
impl Eq for PcapPacket
impl StructuralPartialEq for PcapPacket
Auto Trait Implementations§
impl Freeze for PcapPacket
impl RefUnwindSafe for PcapPacket
impl Send for PcapPacket
impl Sync for PcapPacket
impl Unpin for PcapPacket
impl UnwindSafe for PcapPacket
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more