[][src]Struct jnet::icmpv6::Message

pub struct Message<BUFFER, TYPE> where
    BUFFER: AsSlice<Element = u8>, 
{ /* fields omitted */ }

ICMPv6 Message

Methods

impl<B, T> Message<B, T> where
    B: AsSlice<Element = u8>, 
[src]

pub fn get_type(&self) -> Type[src]

Reads the 'Type' field

pub fn get_code(&self) -> u8[src]

Reads the 'Code' field

pub fn get_checksum(&self) -> u16[src]

Reads the 'Checksum' field

pub fn as_bytes(&self) -> &[u8][src]

Returns the byte representation of this frame

pub fn verify_checksum(&self, src: Addr, dest: Addr) -> bool[src]

Verifies the 'Checksum' field

pub fn free(self) -> B[src]

Returns the underlying buffer

impl<B, T> Message<B, T> where
    B: AsMutSlice<Element = u8>, 
[src]

pub fn update_checksum(&mut self, src: Addr, dest: Addr)[src]

Recomputes and updates the 'Checksum' field

impl<B> Message<B, Unknown> where
    B: AsSlice<Element = u8>, 
[src]

pub fn parse(bytes: B) -> Result<Self, B>[src]

Parses the bytes as an ICMPv6 message NOTE this function does not validate the message checksum

impl<B> Message<B, Unknown> where
    B: AsSlice<Element = u8>, 
[src]

pub fn downcast<TYPE>(self) -> Result<Message<B, TYPE>, Message<B, Unknown>> where
    Self: TryInto<Message<B, TYPE>, Error = Self>, 
[src]

Downcasts this packet with unknown type into a specific type

impl<B> Message<B, NeighborSolicitation> where
    B: AsSlice<Element = u8>, 
[src]

pub fn get_target(&self) -> Addr[src]

Reads the 'Target Address' field

pub fn get_source_ll(&self) -> Option<&[u8]>[src]

Reads the 'Source Link-layer address' option

impl<B> Message<B, NeighborAdvertisement> where
    B: AsMutSlice<Element = u8> + Truncate<u8>, 
[src]

pub fn neighbor_advertisement(buffer: B, target_ll_opt_size: u8) -> Self[src]

Transforms the input buffer into a Neighbor Advertisement ICMPv6 message

target_ll_opt_size is the size of the 'Target Link-layer Address' option in units of 8 octets. A value of 0 means that the option will be omitted.

All these fields need to be filled by the caller

  • Override bit
  • Solicited bit
  • Router bit
  • Target Address field
  • Target Link-layer Address option

impl<B> Message<B, NeighborAdvertisement> where
    B: AsSlice<Element = u8>, 
[src]

pub fn get_router(&self) -> bool[src]

Reads the 'Router' flag

pub fn get_solicited(&self) -> bool[src]

Reads the 'Solicited' flag

pub fn get_override(&self) -> bool[src]

Reads the 'Override' flag

pub fn get_target(&self) -> Addr[src]

Reads the 'Target Address' field

pub fn get_target_ll(&self) -> Option<&[u8]>[src]

Reads the 'Target Link-layer Address' option

impl<B> Message<B, NeighborAdvertisement> where
    B: AsMutSlice<Element = u8>, 
[src]

pub fn set_router(&mut self, router: bool)[src]

Sets the 'Router' flag

pub fn set_solicited(&mut self, solicited: bool)[src]

Sets the 'Solicited' flag

pub fn set_override(&mut self, override_: bool)[src]

Sets the 'Override' flag

pub fn set_target(&mut self, addr: Addr)[src]

Sets the 'Target Address' field

pub fn target_ll_mut(&mut self) -> Option<&mut [u8]>[src]

Mutable view into the 'Target Link-layer address' option

impl<B, E> Message<B, E> where
    B: AsSlice<Element = u8>,
    E: Echo, 
[src]

pub fn get_identifier(&self) -> u16[src]

Reads the 'Identifier' field

pub fn get_sequence_number(&self) -> u16[src]

Reads the 'Sequence number' field

pub fn payload(&self) -> &[u8][src]

Immutable view into the payload of this message

impl<B> Message<B, EchoReply> where
    B: AsMutSlice<Element = u8>, 
[src]

pub fn echo_reply(buffer: B) -> Self[src]

Transforms the input buffer into a Echo Reply ICMPv6 message

pub fn set_identifier(&mut self, id: u16)[src]

Sets the 'Identifier' field

pub fn set_sequence_number(&mut self, seq: u16)[src]

Sets the 'Sequence number' field

impl<B> Message<B, EchoReply> where
    B: AsMutSlice<Element = u8> + Truncate<u8>, 
[src]

pub fn set_payload(&mut self, data: &[u8])[src]

Fills the payload with the given data and adjusts the length of the UDP packet

Trait Implementations

impl<B> From<Message<B, EchoRequest>> for Message<B, EchoReply> where
    B: AsSlice<Element = u8> + AsMutSlice<Element = u8>, 
[src]

impl<B> Debug for Message<B, Unknown> where
    B: AsSlice<Element = u8>, 
[src]

impl<B> Debug for Message<B, NeighborSolicitation> where
    B: AsSlice<Element = u8>, 
[src]

impl<B> Debug for Message<B, NeighborAdvertisement> where
    B: AsSlice<Element = u8>, 
[src]

impl<B, E> Debug for Message<B, E> where
    B: AsSlice<Element = u8>,
    E: Echo, 
[src]

impl<B, T> Copy for Message<B, T> where
    B: AsSlice<Element = u8> + Copy
[src]

impl<B, T> Clone for Message<B, T> where
    B: AsSlice<Element = u8> + Clone
[src]

Auto Trait Implementations

impl<BUFFER, TYPE> Unpin for Message<BUFFER, TYPE> where
    BUFFER: Unpin,
    TYPE: Unpin

impl<BUFFER, TYPE> Send for Message<BUFFER, TYPE> where
    BUFFER: Send,
    TYPE: Send

impl<BUFFER, TYPE> Sync for Message<BUFFER, TYPE> where
    BUFFER: Sync,
    TYPE: Sync

Blanket Implementations

impl<T> From<T> for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

impl<T, U> TryInto<U> 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<T> for T where
    T: ?Sized
[src]

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

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

impl<T> Same<T> for T[src]

type Output = T

Should always be Self