pub struct CapHeader {
pub version_major: u32,
pub version_minor: u32,
pub start_time: u32,
pub nframes: u32,
pub start_offset: u32,
pub end_offset: u32,
pub datalink: DataLink,
pub network_plus: u8,
pub captype: u8,
pub endianness: Endianness,
}Expand description
NetXRay file header (minus magic number).
As field usages are identified, please revise as needed Please do not use netxray_hdr xxx… names in the code (Placeholder names for all ‘unknown’ fields are of form xxx_x<hex_hdr_offset> where <hex_hdr_offset> includes the magic number)
Fields§
§version_major: u32Major version number
version_minor: u32Minor version number
start_time: u32UNIX [UTC] time when capture started
nframes: u32number of packets
start_offset: u32start offset
end_offset: u32end offset
datalink: DataLinkdatalink type u8
network_plus: u8[See code]
captype: u8capture type
endianness: EndiannessEndianness of the cap (excluding the packet data)
Implementations§
Source§impl CapHeader
impl CapHeader
Sourcepub fn from_slice(slice: &[u8]) -> PcapResult<(&[u8], CapHeader)>
pub fn from_slice(slice: &[u8]) -> PcapResult<(&[u8], CapHeader)>
Creates a new CapHeader 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.
Sourcepub async fn async_from_slice(slice: &[u8]) -> PcapResult<(&[u8], CapHeader)>
pub async fn async_from_slice(slice: &[u8]) -> PcapResult<(&[u8], CapHeader)>
Asynchronously creates a new CapHeader 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.