pub struct ArpPacket<'a> { /* private fields */ }Expand description
A structurally validated immutable ARP packet view.
RFC 826 uses independent one-octet hardware and protocol address lengths. Parsing validates that layout and restricts the view to it, excluding supplied trailing bytes.
Implementations§
Source§impl<'a> ArpPacket<'a>
impl<'a> ArpPacket<'a>
Sourcepub fn sender_mac_address(&self) -> Option<MacAddress>
pub fn sender_mac_address(&self) -> Option<MacAddress>
Returns the sender MAC address only for Ethernet hardware with a six-octet address.
Sourcepub fn target_mac_address(&self) -> Option<MacAddress>
pub fn target_mac_address(&self) -> Option<MacAddress>
Returns the target MAC address only for Ethernet hardware with a six-octet address.
Source§impl<'a> ArpPacket<'a>
impl<'a> ArpPacket<'a>
Sourcepub fn parse(bytes: &'a [u8]) -> Result<Self, ParseError>
pub fn parse(bytes: &'a [u8]) -> Result<Self, ParseError>
Validates the generic RFC 826 layout without interpreting address semantics.
Sourcepub fn hardware_type(&self) -> ArpHardwareType
pub fn hardware_type(&self) -> ArpHardwareType
Returns the RFC 826 hardware type, preserving unknown values.
Sourcepub fn protocol_type(&self) -> ArpProtocolType
pub fn protocol_type(&self) -> ArpProtocolType
Returns the RFC 826 protocol type, preserving unknown values.
Sourcepub fn hardware_address_length(&self) -> u8
pub fn hardware_address_length(&self) -> u8
Returns the encoded hardware address length.
Sourcepub fn protocol_address_length(&self) -> u8
pub fn protocol_address_length(&self) -> u8
Returns the encoded protocol address length.
Sourcepub fn operation(&self) -> ArpOperation
pub fn operation(&self) -> ArpOperation
Returns the RFC 826 operation, preserving unknown values.
Sourcepub fn sender_hardware_address(&self) -> &'a [u8]
pub fn sender_hardware_address(&self) -> &'a [u8]
Returns the sender hardware address bytes.
Sourcepub fn sender_protocol_address(&self) -> &'a [u8]
pub fn sender_protocol_address(&self) -> &'a [u8]
Returns the sender protocol address bytes.
Sourcepub fn target_hardware_address(&self) -> &'a [u8]
pub fn target_hardware_address(&self) -> &'a [u8]
Returns the target hardware address bytes.
Sourcepub fn target_protocol_address(&self) -> &'a [u8]
pub fn target_protocol_address(&self) -> &'a [u8]
Returns the target protocol address bytes.
Source§impl ArpPacket<'_>
impl ArpPacket<'_>
Sourcepub fn sender_ipv4_address(&self) -> Option<Ipv4Address>
pub fn sender_ipv4_address(&self) -> Option<Ipv4Address>
Returns the sender IPv4 address when the protocol type is IPv4 and its size is four.
Sourcepub fn target_ipv4_address(&self) -> Option<Ipv4Address>
pub fn target_ipv4_address(&self) -> Option<Ipv4Address>
Returns the target IPv4 address when the protocol type is IPv4 and its size is four.