Struct Icmpv6Packet

Source
pub struct Icmpv6Packet {
    pub typ: u8,
    pub code: u8,
    pub checksum: u16,
    pub message: Icmpv6Message,
}

Fields§

§typ: u8§code: u8§checksum: u16§message: Icmpv6Message

Implementations§

Source§

impl Icmpv6Packet

Source

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

Construct a packet by parsing the provided bytes.

Source

pub fn get_bytes(&self, with_checksum: bool) -> Vec<u8>

Get this packet serialized to bytes suitable for sending on the wire.

Source

pub fn calculate_checksum(&self, source: &Ipv6Addr, dest: &Ipv6Addr) -> u16

Calculate the checksum for the packet given the provided source and destination addresses.

Source

pub fn with_checksum(self, source: &Ipv6Addr, dest: &Ipv6Addr) -> Self

Fill the checksum for the packet using the given source and destination addresses.

Source

pub fn with_packet_too_big( mtu: u32, packet: Vec<u8>, ) -> Result<Self, IcmpPacketBuildError>

Construct a packet for Packet Too Big messages.

Trait Implementations§

Source§

impl Debug for Icmpv6Packet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl TryFrom<&[u8]> for Icmpv6Packet

Source§

type Error = PacketParseError

The type returned in the event of a conversion error.
Source§

fn try_from(b: &[u8]) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl WithEchoReply for Icmpv6Packet

Source§

type Packet = Icmpv6Packet

Source§

fn with_echo_reply( identifier: u16, sequence: u16, payload: Vec<u8>, ) -> Result<Self, IcmpPacketBuildError>

Source§

impl WithEchoRequest for Icmpv6Packet

Source§

type Packet = Icmpv6Packet

Source§

fn with_echo_request( identifier: u16, sequence: u16, payload: Vec<u8>, ) -> Result<Self::Packet, IcmpPacketBuildError>

Source§

impl WithParameterProblem for Icmpv6Packet

Source§

impl WithTimeExceeded for Icmpv6Packet

Source§

impl WithUnreachable for Icmpv6Packet

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.