Struct icmp_socket::packet::Icmpv4Packet [−][src]
An Icmpv4 Packet.
Fields
typ: u8
code: u8
checksum: u16
message: Icmpv4Message
Implementations
impl Icmpv4Packet
[src]
pub fn parse<B: AsRef<[u8]>>(bytes: B) -> Result<Self, PacketParseError>
[src]
Parse an Icmpv4Packet from bytes.
pub fn get_bytes(&self, with_checksum: bool) -> Vec<u8>
[src]
Get this packet serialized to bytes suitable for sending on the wire.
pub fn calculate_checksum(&self) -> u16
[src]
Calculate the checksum for the packet given the provided source and destination addresses.
pub fn with_checksum(mut self: Self) -> Self
[src]
Populate the checksum field of this Packet.
Trait Implementations
impl Debug for Icmpv4Packet
[src]
impl TryFrom<&'_ [u8]> for Icmpv4Packet
[src]
type Error = PacketParseError
The type returned in the event of a conversion error.
fn try_from(b: &[u8]) -> Result<Self, Self::Error>
[src]
impl WithEchoRequest for Icmpv4Packet
[src]
type Packet = Icmpv4Packet
fn with_echo_request(
identifier: u16,
sequence: u16,
payload: Vec<u8>
) -> Result<Self::Packet, IcmpPacketBuildError>
[src]
identifier: u16,
sequence: u16,
payload: Vec<u8>
) -> Result<Self::Packet, IcmpPacketBuildError>
impl WithParameterProblem for Icmpv4Packet
[src]
type Packet = Icmpv4Packet
type Pointer = u8
fn with_parameter_problem(
code: u8,
pointer: Self::Pointer,
packet: Vec<u8>
) -> Result<Self::Packet, IcmpPacketBuildError>
[src]
code: u8,
pointer: Self::Pointer,
packet: Vec<u8>
) -> Result<Self::Packet, IcmpPacketBuildError>
impl WithTimeExceeded for Icmpv4Packet
[src]
type Packet = Icmpv4Packet
fn with_time_exceeded(
code: u8,
packet: Vec<u8>
) -> Result<Self::Packet, IcmpPacketBuildError>
[src]
code: u8,
packet: Vec<u8>
) -> Result<Self::Packet, IcmpPacketBuildError>
impl WithUnreachable for Icmpv4Packet
[src]
type Packet = Icmpv4Packet
fn with_unreachable(
code: u8,
packet: Vec<u8>
) -> Result<Self::Packet, IcmpPacketBuildError>
[src]
code: u8,
packet: Vec<u8>
) -> Result<Self::Packet, IcmpPacketBuildError>
Auto Trait Implementations
impl RefUnwindSafe for Icmpv4Packet
[src]
impl Send for Icmpv4Packet
[src]
impl Sync for Icmpv4Packet
[src]
impl Unpin for Icmpv4Packet
[src]
impl UnwindSafe for Icmpv4Packet
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,