Struct pnet_packet::arp::MutableArpPacket
source · [−]pub struct MutableArpPacket<'p> { /* private fields */ }
Expand description
A structure enabling manipulation of on the wire packets
Implementations
sourceimpl<'a> MutableArpPacket<'a>
impl<'a> MutableArpPacket<'a>
sourcepub fn new<'p>(packet: &'p mut [u8]) -> Option<MutableArpPacket<'p>>
pub fn new<'p>(packet: &'p mut [u8]) -> Option<MutableArpPacket<'p>>
Constructs a new MutableArpPacket. If the provided buffer is less than the minimum required packet size, this will return None.
sourcepub fn owned(packet: Vec<u8>) -> Option<MutableArpPacket<'static>>
pub fn owned(packet: Vec<u8>) -> Option<MutableArpPacket<'static>>
Constructs a new MutableArpPacket. If the provided buffer is less than the minimum required packet size, this will return None. With this constructor the MutableArpPacket will own its own data and the underlying buffer will be dropped when the MutableArpPacket is.
sourcepub fn to_immutable<'p>(&'p self) -> ArpPacket<'p>
pub fn to_immutable<'p>(&'p self) -> ArpPacket<'p>
Maps from a MutableArpPacket to a ArpPacket
sourcepub fn consume_to_immutable(self) -> ArpPacket<'a>
pub fn consume_to_immutable(self) -> ArpPacket<'a>
Maps from a MutableArpPacket to a ArpPacket 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: &Arp) -> usize
pub fn packet_size(_packet: &Arp) -> usize
The size (in bytes) of a Arp instance when converted into a byte-array
sourcepub fn get_hardware_type(&self) -> ArpHardwareType
pub fn get_hardware_type(&self) -> ArpHardwareType
Get the value of the hardware_type field
sourcepub fn get_protocol_type(&self) -> EtherType
pub fn get_protocol_type(&self) -> EtherType
Get the value of the protocol_type field
sourcepub fn get_hw_addr_len(&self) -> u8
pub fn get_hw_addr_len(&self) -> u8
Get the hw_addr_len field.
sourcepub fn get_proto_addr_len(&self) -> u8
pub fn get_proto_addr_len(&self) -> u8
Get the proto_addr_len field.
sourcepub fn get_operation(&self) -> ArpOperation
pub fn get_operation(&self) -> ArpOperation
Get the value of the operation field
sourcepub fn get_sender_hw_addr(&self) -> MacAddr
pub fn get_sender_hw_addr(&self) -> MacAddr
Get the value of the sender_hw_addr field
sourcepub fn get_sender_proto_addr(&self) -> Ipv4Addr
pub fn get_sender_proto_addr(&self) -> Ipv4Addr
Get the value of the sender_proto_addr field
sourcepub fn get_target_hw_addr(&self) -> MacAddr
pub fn get_target_hw_addr(&self) -> MacAddr
Get the value of the target_hw_addr field
sourcepub fn get_target_proto_addr(&self) -> Ipv4Addr
pub fn get_target_proto_addr(&self) -> Ipv4Addr
Get the value of the target_proto_addr field
sourcepub fn set_hardware_type(&mut self, val: ArpHardwareType)
pub fn set_hardware_type(&mut self, val: ArpHardwareType)
Set the value of the hardware_type field.
sourcepub fn set_protocol_type(&mut self, val: EtherType)
pub fn set_protocol_type(&mut self, val: EtherType)
Set the value of the protocol_type field.
sourcepub fn set_hw_addr_len(&mut self, val: u8)
pub fn set_hw_addr_len(&mut self, val: u8)
Set the hw_addr_len field.
sourcepub fn set_proto_addr_len(&mut self, val: u8)
pub fn set_proto_addr_len(&mut self, val: u8)
Set the proto_addr_len field.
sourcepub fn set_operation(&mut self, val: ArpOperation)
pub fn set_operation(&mut self, val: ArpOperation)
Set the value of the operation field.
sourcepub fn set_sender_hw_addr(&mut self, val: MacAddr)
pub fn set_sender_hw_addr(&mut self, val: MacAddr)
Set the value of the sender_hw_addr field.
sourcepub fn set_sender_proto_addr(&mut self, val: Ipv4Addr)
pub fn set_sender_proto_addr(&mut self, val: Ipv4Addr)
Set the value of the sender_proto_addr field.
sourcepub fn set_target_hw_addr(&mut self, val: MacAddr)
pub fn set_target_hw_addr(&mut self, val: MacAddr)
Set the value of the target_hw_addr field.
sourcepub fn set_target_proto_addr(&mut self, val: Ipv4Addr)
pub fn set_target_proto_addr(&mut self, val: Ipv4Addr)
Set the value of the target_proto_addr field.
sourcepub fn set_payload(&mut self, vals: &[u8])
pub fn set_payload(&mut self, vals: &[u8])
Set the value of the payload field (copies contents)
Trait Implementations
sourceimpl<'p> Debug for MutableArpPacket<'p>
impl<'p> Debug for MutableArpPacket<'p>
sourceimpl<'p> FromPacket for MutableArpPacket<'p>
impl<'p> FromPacket for MutableArpPacket<'p>
sourcefn from_packet(&self) -> Arp
fn from_packet(&self) -> Arp
Converts a wire-format packet to #[packet] struct format.
sourceimpl<'a> MutablePacket for MutableArpPacket<'a>
impl<'a> MutablePacket for MutableArpPacket<'a>
sourcefn packet_mut<'p>(&'p mut self) -> &'p mut [u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
fn packet_mut<'p>(&'p mut self) -> &'p mut [u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
Retreive the underlying, mutable, buffer for the packet.
sourcefn payload_mut<'p>(&'p mut self) -> &'p mut [u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
fn payload_mut<'p>(&'p mut self) -> &'p mut [u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
Retreive the mutable payload for the packet.
sourcefn clone_from<T>(&mut self, other: &T) where
T: Packet,
fn clone_from<T>(&mut self, other: &T) where
T: Packet,
Initialize this packet by cloning another.
sourceimpl<'a> Packet for MutableArpPacket<'a>
impl<'a> Packet for MutableArpPacket<'a>
sourceimpl<'a> PacketSize for MutableArpPacket<'a>
impl<'a> PacketSize for MutableArpPacket<'a>
sourcefn packet_size(&self) -> usize
fn packet_size(&self) -> usize
Get the calculated size of the packet.
sourceimpl<'p> PartialEq<MutableArpPacket<'p>> for MutableArpPacket<'p>
impl<'p> PartialEq<MutableArpPacket<'p>> for MutableArpPacket<'p>
sourcefn eq(&self, other: &MutableArpPacket<'p>) -> bool
fn eq(&self, other: &MutableArpPacket<'p>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &MutableArpPacket<'p>) -> bool
fn ne(&self, other: &MutableArpPacket<'p>) -> bool
This method tests for !=
.
impl<'p> StructuralPartialEq for MutableArpPacket<'p>
Auto Trait Implementations
impl<'p> RefUnwindSafe for MutableArpPacket<'p>
impl<'p> Send for MutableArpPacket<'p>
impl<'p> Sync for MutableArpPacket<'p>
impl<'p> Unpin for MutableArpPacket<'p>
impl<'p> !UnwindSafe for MutableArpPacket<'p>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more