Struct smoltcp::wire::Ipv4Packet
[−]
[src]
pub struct Ipv4Packet<T: AsRef<[u8]>> { /* fields omitted */ }
A read/write wrapper around an Internet 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 IPv4 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 version(&self) -> u8
[src]
Return the version field.
fn header_len(&self) -> u8
[src]
Return the header length, in octets.
fn dscp(&self) -> u8
[src]
Return the Differential Services Code Point field.
fn ecn(&self) -> u8
[src]
Return the Explicit Congestion Notification field.
fn total_len(&self) -> u16
[src]
Return the total length field.
fn ident(&self) -> u16
[src]
Return the fragment identification field.
fn dont_frag(&self) -> bool
[src]
Return the "don't fragment" flag.
fn more_frags(&self) -> bool
[src]
Return the "more fragments" flag.
fn frag_offset(&self) -> u16
[src]
Return the fragment offset, in octets.
fn ttl(&self) -> u8
[src]
Return the time to live field.
fn protocol(&self) -> Protocol
[src]
Return the protocol field.
fn checksum(&self) -> u16
[src]
Return the header checksum field.
fn src_addr(&self) -> Address
[src]
Return the source address field.
fn dst_addr(&self) -> Address
[src]
Return the destination address 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_version(&mut self, value: u8)
[src]
Set the version field.
fn set_header_len(&mut self, value: u8)
[src]
Set the header length, in octets.
fn set_dscp(&mut self, value: u8)
[src]
Set the Differential Services Code Point field.
fn set_ecn(&mut self, value: u8)
[src]
Set the Explicit Congestion Notification field.
fn set_total_len(&mut self, value: u16)
[src]
Set the total length field.
fn set_ident(&mut self, value: u16)
[src]
Set the fragment identification field.
fn clear_flags(&mut self)
[src]
Clear the entire flags field.
fn set_dont_frag(&mut self, value: bool)
[src]
Set the "don't fragment" flag.
fn set_more_frags(&mut self, value: bool)
[src]
Set the "more fragments" flag.
fn set_frag_offset(&mut self, value: u16)
[src]
Set the fragment offset, in octets.
fn set_ttl(&mut self, value: u8)
[src]
Set the time to live field.
fn set_protocol(&mut self, value: Protocol)
[src]
Set the protocol field.
fn set_checksum(&mut self, value: u16)
[src]
Set the header checksum field.
fn set_src_addr(&mut self, value: Address)
[src]
Set the source address field.
fn set_dst_addr(&mut self, value: Address)
[src]
Set the destination address field.
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]
fn payload_mut(&mut self) -> &mut [u8]
[src]
Return a mutable pointer to the payload.
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