Struct pnet_packet::usbpcap::UsbPcapPacket
source · pub struct UsbPcapPacket<'p> { /* private fields */ }
Expand description
A structure enabling manipulation of on the wire packets
Implementations§
source§impl<'a> UsbPcapPacket<'a>
impl<'a> UsbPcapPacket<'a>
sourcepub fn new<'p>(packet: &'p [u8]) -> Option<UsbPcapPacket<'p>>
pub fn new<'p>(packet: &'p [u8]) -> Option<UsbPcapPacket<'p>>
Constructs a new UsbPcapPacket. If the provided buffer is less than the minimum required packet size, this will return None.
sourcepub fn owned(packet: Vec<u8>) -> Option<UsbPcapPacket<'static>>
pub fn owned(packet: Vec<u8>) -> Option<UsbPcapPacket<'static>>
Constructs a new UsbPcapPacket. If the provided buffer is less than the minimum required packet size, this will return None. With this constructor the UsbPcapPacket will own its own data and the underlying buffer will be dropped when the UsbPcapPacket is.
sourcepub fn to_immutable<'p>(&'p self) -> UsbPcapPacket<'p>
pub fn to_immutable<'p>(&'p self) -> UsbPcapPacket<'p>
Maps from a UsbPcapPacket to a UsbPcapPacket
sourcepub fn consume_to_immutable(self) -> UsbPcapPacket<'a>
pub fn consume_to_immutable(self) -> UsbPcapPacket<'a>
Maps from a UsbPcapPacket to a UsbPcapPacket while consuming the source
sourcepub const fn minimum_packet_size() -> usize
pub const fn minimum_packet_size() -> usize
The minimum size (in bytes) a packet of this type can be. It’s based on the total size of the fixed-size fields.
sourcepub fn packet_size(_packet: &UsbPcap) -> usize
pub fn packet_size(_packet: &UsbPcap) -> usize
The size (in bytes) of a UsbPcap instance when converted into a byte-array
sourcepub fn get_header_length(&self) -> u16le
pub fn get_header_length(&self) -> u16le
Get the header_length field. This field is always stored little-endian within the struct, but this accessor returns host order.
sourcepub fn get_irp_id(&self) -> u64le
pub fn get_irp_id(&self) -> u64le
Get the irp_id field. This field is always stored little-endian within the struct, but this accessor returns host order.
sourcepub fn get_status(&self) -> UsbPcapStatus
pub fn get_status(&self) -> UsbPcapStatus
Get the value of the status field
sourcepub fn get_function(&self) -> UsbPcapFunction
pub fn get_function(&self) -> UsbPcapFunction
Get the value of the function field
sourcepub fn get_reserved_info(&self) -> u7
pub fn get_reserved_info(&self) -> u7
Get the reserved_info field.
sourcepub fn get_pdo_to_fdo(&self) -> u1
pub fn get_pdo_to_fdo(&self) -> u1
Get the pdo_to_fdo field.
sourcepub fn get_bus(&self) -> u16le
pub fn get_bus(&self) -> u16le
Get the bus field. This field is always stored little-endian within the struct, but this accessor returns host order.
sourcepub fn get_device(&self) -> u16le
pub fn get_device(&self) -> u16le
Get the device field. This field is always stored little-endian within the struct, but this accessor returns host order.
sourcepub fn get_direction(&self) -> u1
pub fn get_direction(&self) -> u1
Get the direction field.
sourcepub fn get_reserved_endpoint(&self) -> u3
pub fn get_reserved_endpoint(&self) -> u3
Get the reserved_endpoint field.
sourcepub fn get_endpoint(&self) -> u4
pub fn get_endpoint(&self) -> u4
Get the endpoint field.
sourcepub fn get_transfer(&self) -> u8
pub fn get_transfer(&self) -> u8
Get the transfer field.
sourcepub fn get_data_length(&self) -> u32le
pub fn get_data_length(&self) -> u32le
Get the data_length field. This field is always stored little-endian within the struct, but this accessor returns host order.
sourcepub fn get_header_payload_raw(&self) -> &[u8] ⓘ
pub fn get_header_payload_raw(&self) -> &[u8] ⓘ
Get the raw &u8 value of the header_payload field, without copying
sourcepub fn get_header_payload(&self) -> Vec<u8>
pub fn get_header_payload(&self) -> Vec<u8>
Get the value of the header_payload field (copies contents)
Trait Implementations§
source§impl<'p> Debug for UsbPcapPacket<'p>
impl<'p> Debug for UsbPcapPacket<'p>
source§impl<'p> FromPacket for UsbPcapPacket<'p>
impl<'p> FromPacket for UsbPcapPacket<'p>
source§impl<'a> Packet for UsbPcapPacket<'a>
impl<'a> Packet for UsbPcapPacket<'a>
source§impl<'a> PacketSize for UsbPcapPacket<'a>
impl<'a> PacketSize for UsbPcapPacket<'a>
source§fn packet_size(&self) -> usize
fn packet_size(&self) -> usize
source§impl<'p> PartialEq for UsbPcapPacket<'p>
impl<'p> PartialEq for UsbPcapPacket<'p>
source§fn eq(&self, other: &UsbPcapPacket<'p>) -> bool
fn eq(&self, other: &UsbPcapPacket<'p>) -> bool
self
and other
values to be equal, and is used
by ==
.