Struct smoltcp::wire::Icmpv4Packet
[−]
[src]
pub struct Icmpv4Packet<T: AsRef<[u8]>> { /* fields omitted */ }
A read/write wrapper around an Internet Control Message Protocol version 4 packet buffer.
Methods
impl<T: AsRef<[u8]>> Packet<T>
[src]
fn new(buffer: T) -> Packet<T>
[src]
Imbue a raw octet buffer with ICMPv4 packet structure.
fn new_checked(buffer: T) -> Result<Packet<T>>
[src]
fn check_len(&self) -> Result<()>
[src]
Ensure that no accessor method will panic if called.
Returns Err(Error::Truncated)
if the buffer is too short.
The result of this check is invalidated by calling set_header_len.
fn into_inner(self) -> T
[src]
Consume the packet, returning the underlying buffer.
fn msg_type(&self) -> Message
[src]
Return the message type field.
fn msg_code(&self) -> u8
[src]
Return the message code field.
fn checksum(&self) -> u16
[src]
Return the checksum field.
fn echo_ident(&self) -> u16
[src]
Return the identifier field (for echo request and reply packets).
Panics
This function may panic if this packet is not an echo request or reply packet.
fn echo_seq_no(&self) -> u16
[src]
Return the sequence number field (for echo request and reply packets).
Panics
This function may panic if this packet is not an echo request or reply packet.
fn header_len(&self) -> usize
[src]
Return the header length. The result depends on the value of the message type field.
fn verify_checksum(&self) -> bool
[src]
impl<'a, T: AsRef<[u8]> + ?Sized> Packet<&'a T>
[src]
impl<T: AsRef<[u8]> + AsMut<[u8]>> Packet<T>
[src]
fn set_msg_type(&mut self, value: Message)
[src]
Set the message type field.
fn set_msg_code(&mut self, value: u8)
[src]
Set the message code field.
fn set_checksum(&mut self, value: u16)
[src]
Set the checksum field.
fn set_echo_ident(&mut self, value: u16)
[src]
Set the identifier field (for echo request and reply packets).
Panics
This function may panic if this packet is not an echo request or reply packet.
fn set_echo_seq_no(&mut self, value: u16)
[src]
Set the sequence number field (for echo request and reply packets).
Panics
This function may panic if this packet is not an echo request or reply packet.
fn fill_checksum(&mut self)
[src]
Compute and fill in the header checksum.
impl<'a, T: AsRef<[u8]> + AsMut<[u8]> + ?Sized> Packet<&'a mut T>
[src]
Trait Implementations
impl<T: Debug + AsRef<[u8]>> Debug for Packet<T>
[src]
impl<'a, T: AsRef<[u8]> + ?Sized> Display for Packet<&'a T>
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<T: AsRef<[u8]>> PrettyPrint for Packet<T>
[src]
fn pretty_print(
buffer: &AsRef<[u8]>,
f: &mut Formatter,
indent: &mut PrettyIndent
) -> Result
[src]
buffer: &AsRef<[u8]>,
f: &mut Formatter,
indent: &mut PrettyIndent
) -> Result
Write a concise, formatted representation of a packet contained in the provided buffer, and any nested packets it may contain. Read more