[−][src]Struct pcap_file::pcap::PcapHeader
Pcap Global Header
Fields
magic_number: u32
Magic number
version_major: u16
Major version number
version_minor: u16
Minor version number
ts_correction: i32
GMT to local timezone correction, should always be 0
ts_accuracy: u32
Timestamp accuracy, should always be 0
snaplen: u32
Max length of captured packet, typically 65535
datalink: DataLink
DataLink type (first layer in the packet)
Methods
impl PcapHeader
[src]
pub fn from_reader<R: Read>(reader: &mut R) -> Result<PcapHeader, PcapError>
[src]
Creates a new PcapHeader
from a reader
Returns an error if the reader doesn't contain a valid pcap or if there is a reading error.
pub fn from_slice(slice: &[u8]) -> Result<(&[u8], PcapHeader), PcapError>
[src]
Creates a new PcapHeader
from a slice of bytes
Returns an error if the reader doesn't contain a valid pcap or if there is a reading error.
PcapError::IncompleteBuffer
indicates that there is not enough data in the buffer
pub fn set_ts_resolution(&mut self, ts_resolution: TsResolution)
[src]
Set the timestamp resolution to ts_resolution by modifying the magic_number Preserve its endianness
pub fn set_endianness(&mut self, endianness: Endianness)
[src]
Change the endianness of the magic_number
pub fn write_to<W: Write, B: ByteOrder>(
&self,
writer: &mut W
) -> Result<(), PcapError>
[src]
&self,
writer: &mut W
) -> Result<(), PcapError>
Write a PcapHeader
to a writer.
Writes 24o in the writer on success.
pub fn endianness(&self) -> Endianness
[src]
pub fn ts_resolution(&self) -> TsResolution
[src]
pub fn to_array<B: ByteOrder>(&self) -> Result<Vec<u8>, PcapError>
[src]
Please use write_to
instead
Convert a PcapHeader
to a Vec<u8>
.
pub fn with_datalink(datalink: DataLink) -> PcapHeader
[src]
Please use the Default struct constructor instead, will be removed in 1.0
Creates a new PcapHeader
with the following parameters:
PcapHeader { magic_number : 0xa1b2c3d4, version_major : 2, version_minor : 4, ts_correction : 0, ts_accuracy : 0, snaplen : 65535, datalink : #datalink };
Trait Implementations
impl Clone for PcapHeader
[src]
fn clone(&self) -> PcapHeader
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for PcapHeader
[src]
impl Default for PcapHeader
[src]
Creates a new PcapHeader
with the default parameters:
PcapHeader { magic_number : 0xa1b2c3d4, version_major : 2, version_minor : 4, ts_correction : 0, ts_accuracy : 0, snaplen : 65535, datalink : DataLink::ETHERNET };
impl Eq for PcapHeader
[src]
impl PartialEq<PcapHeader> for PcapHeader
[src]
fn eq(&self, other: &PcapHeader) -> bool
[src]
fn ne(&self, other: &PcapHeader) -> bool
[src]
impl Debug for PcapHeader
[src]
impl StructuralPartialEq for PcapHeader
[src]
impl StructuralEq for PcapHeader
[src]
Auto Trait Implementations
impl Send for PcapHeader
impl Sync for PcapHeader
impl Unpin for PcapHeader
impl UnwindSafe for PcapHeader
impl RefUnwindSafe for PcapHeader
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,