[][src]Struct ethox::wire::ArpPacket

pub struct ArpPacket<T: AsRef<[u8]>> { /* fields omitted */ }

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]

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_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

impl<T> Send for ArpPacket<T> where
    T: Send

impl<T> Sync for ArpPacket<T> where
    T: Sync

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]