[−][src]Struct ethox::wire::ArpPacket
A read/write wrapper around an Address Resolution Protocol packet buffer.
Methods
impl<T: AsRef<[u8]>> Packet<T>
[src]
pub fn new_unchecked(buffer: T) -> Packet<T>
[src]
Imbue a raw octet buffer with ARP packet structure.
pub fn new_checked(buffer: T) -> Result<Packet<T>>
[src]
Shorthand for a combination of new_unchecked and check_len.
pub fn check_len(&self) -> Result<()>
[src]
Ensure that no accessor method will panic if called.
Returns Err(Error::Truncated)
if the buffer is too short.
The result of this check is invalidated by calling set_hardware_len or set_protocol_len.
pub fn into_inner(self) -> T
[src]
Consume the packet, returning the underlying buffer.
pub fn hardware_type(&self) -> Hardware
[src]
Return the hardware type field.
pub fn protocol_type(&self) -> Protocol
[src]
Return the protocol type field.
pub fn hardware_len(&self) -> u8
[src]
Return the hardware length field.
pub fn protocol_len(&self) -> u8
[src]
Return the protocol length field.
pub fn operation(&self) -> Operation
[src]
Return the operation field.
pub fn source_hardware_addr(&self) -> &[u8]
[src]
Return the source hardware address field.
pub fn source_protocol_addr(&self) -> &[u8]
[src]
Return the source protocol address field.
pub fn target_hardware_addr(&self) -> &[u8]
[src]
Return the target hardware address field.
pub fn target_protocol_addr(&self) -> &[u8]
[src]
Return the target protocol address field.
impl<T: AsRef<[u8]> + AsMut<[u8]>> Packet<T>
[src]
pub fn set_hardware_type(&mut self, value: Hardware)
[src]
Set the hardware type field.
pub fn set_protocol_type(&mut self, value: Protocol)
[src]
Set the protocol type field.
pub fn set_hardware_len(&mut self, value: u8)
[src]
Set the hardware length field.
pub fn set_protocol_len(&mut self, value: u8)
[src]
Set the protocol length field.
pub fn set_operation(&mut self, value: Operation)
[src]
Set the operation field.
pub fn set_source_hardware_addr(&mut self, value: &[u8])
[src]
Set the source hardware address field.
Panics
The function panics if value
is not self.hardware_len()
long.
pub fn set_source_protocol_addr(&mut self, value: &[u8])
[src]
Set the source protocol address field.
Panics
The function panics if value
is not self.protocol_len()
long.
pub fn set_target_hardware_addr(&mut self, value: &[u8])
[src]
Set the target hardware address field.
Panics
The function panics if value
is not self.hardware_len()
long.
pub fn set_target_protocol_addr(&mut self, value: &[u8])
[src]
Set the target protocol address field.
Panics
The function panics if value
is not self.protocol_len()
long.
Trait Implementations
impl<T: AsRef<[u8]>> PrettyPrint for Packet<T>
[src]
fn pretty_print(
buffer: &dyn AsRef<[u8]>,
f: &mut Formatter,
indent: &mut PrettyIndent
) -> Result
[src]
buffer: &dyn AsRef<[u8]>,
f: &mut Formatter,
indent: &mut PrettyIndent
) -> Result
impl<T: PartialEq + AsRef<[u8]>> PartialEq<Packet<T>> for Packet<T>
[src]
impl<T: AsRef<[u8]>> AsRef<[u8]> for Packet<T>
[src]
impl<T: Clone + AsRef<[u8]>> Clone for Packet<T>
[src]
fn clone(&self) -> Packet<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: AsRef<[u8]>> Display for Packet<T>
[src]
impl<T: Debug + AsRef<[u8]>> Debug for Packet<T>
[src]
Auto Trait Implementations
Blanket Implementations
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> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom 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 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 for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut 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,