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
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§
Source§impl Debug for Icmpv6Packet
impl Debug for Icmpv6Packet
Source§impl TryFrom<&[u8]> for Icmpv6Packet
impl TryFrom<&[u8]> for Icmpv6Packet
Source§impl WithEchoReply for Icmpv6Packet
impl WithEchoReply for Icmpv6Packet
type Packet = Icmpv6Packet
fn with_echo_reply( identifier: u16, sequence: u16, payload: Vec<u8>, ) -> Result<Self, IcmpPacketBuildError>
Source§impl 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>
Source§impl WithParameterProblem for Icmpv6Packet
impl WithParameterProblem for Icmpv6Packet
Source§impl WithTimeExceeded for Icmpv6Packet
impl WithTimeExceeded for Icmpv6Packet
type Packet = Icmpv6Packet
fn with_time_exceeded( code: u8, packet: Vec<u8>, ) -> Result<Self, IcmpPacketBuildError>
Source§impl 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 Freeze for Icmpv6Packet
impl RefUnwindSafe for Icmpv6Packet
impl Send for Icmpv6Packet
impl Sync for Icmpv6Packet
impl Unpin for Icmpv6Packet
impl UnwindSafe for Icmpv6Packet
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more