Struct icmp_socket::packet::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
sourceimpl Icmpv6Packet
impl Icmpv6Packet
sourcepub fn parse<B: AsRef<[u8]>>(bytes: B) -> Result<Self, PacketParseError>
pub fn parse<B: AsRef<[u8]>>(bytes: B) -> Result<Self, PacketParseError>
Construct a packet by parsing the provided bytes.
sourcepub fn get_bytes(&self, with_checksum: bool) -> Vec<u8>
pub fn get_bytes(&self, with_checksum: bool) -> Vec<u8>
Get this packet serialized to bytes suitable for sending on the wire.
sourcepub fn calculate_checksum(&self, source: &Ipv6Addr, dest: &Ipv6Addr) -> u16
pub fn calculate_checksum(&self, source: &Ipv6Addr, dest: &Ipv6Addr) -> u16
Calculate the checksum for the packet given the provided source and destination addresses.
sourcepub fn with_checksum(self, source: &Ipv6Addr, dest: &Ipv6Addr) -> Self
pub fn with_checksum(self, source: &Ipv6Addr, dest: &Ipv6Addr) -> Self
Fill the checksum for the packet using the given source and destination addresses.
sourcepub fn with_packet_too_big(
mtu: u32,
packet: Vec<u8>
) -> Result<Self, IcmpPacketBuildError>
pub fn with_packet_too_big(
mtu: u32,
packet: Vec<u8>
) -> Result<Self, IcmpPacketBuildError>
Construct a packet for Packet Too Big messages.
Trait Implementations
sourceimpl Debug for Icmpv6Packet
impl Debug for Icmpv6Packet
sourceimpl WithEchoReply for Icmpv6Packet
impl WithEchoReply for Icmpv6Packet
type Packet = Icmpv6Packet
fn with_echo_reply(
identifier: u16,
sequence: u16,
payload: Vec<u8>
) -> Result<Self, IcmpPacketBuildError>
sourceimpl WithEchoRequest for Icmpv6Packet
impl WithEchoRequest for Icmpv6Packet
type Packet = Icmpv6Packet
fn with_echo_request(
identifier: u16,
sequence: u16,
payload: Vec<u8>
) -> Result<Self::Packet, IcmpPacketBuildError>
sourceimpl WithParameterProblem for Icmpv6Packet
impl WithParameterProblem for Icmpv6Packet
type Packet = Icmpv6Packet
type Pointer = u32
fn with_parameter_problem(
code: u8,
pointer: Self::Pointer,
packet: Vec<u8>
) -> Result<Self, IcmpPacketBuildError>
sourceimpl WithTimeExceeded for Icmpv6Packet
impl WithTimeExceeded for Icmpv6Packet
type Packet = Icmpv6Packet
fn with_time_exceeded(
code: u8,
packet: Vec<u8>
) -> Result<Self, IcmpPacketBuildError>
sourceimpl WithUnreachable for Icmpv6Packet
impl WithUnreachable for Icmpv6Packet
type Packet = Icmpv6Packet
fn with_unreachable(
code: u8,
packet: Vec<u8>
) -> Result<Self, IcmpPacketBuildError>
Auto Trait Implementations
impl RefUnwindSafe for Icmpv6Packet
impl Send for Icmpv6Packet
impl Sync for Icmpv6Packet
impl Unpin for Icmpv6Packet
impl UnwindSafe for Icmpv6Packet
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more