Struct smoltcp::wire::Ipv6Packet
source · [−]pub struct Ipv6Packet<T: AsRef<[u8]>> { /* private fields */ }Expand description
A read/write wrapper around an Internet Protocol version 6 packet buffer.
Implementations
sourceimpl<T: AsRef<[u8]>> Packet<T>
impl<T: AsRef<[u8]>> Packet<T>
sourcepub fn new_unchecked(buffer: T) -> Packet<T>
pub fn new_unchecked(buffer: T) -> Packet<T>
Create a raw octet buffer with an IPv6 packet structure.
sourcepub fn new_checked(buffer: T) -> Result<Packet<T>>
pub fn new_checked(buffer: T) -> Result<Packet<T>>
Shorthand for a combination of new_unchecked and check_len.
sourcepub fn check_len(&self) -> Result<()>
pub fn check_len(&self) -> Result<()>
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_payload_len.
sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consume the packet, returning the underlying buffer.
sourcepub fn header_len(&self) -> usize
pub fn header_len(&self) -> usize
Return the header length.
sourcepub fn traffic_class(&self) -> u8
pub fn traffic_class(&self) -> u8
Return the traffic class.
sourcepub fn flow_label(&self) -> u32
pub fn flow_label(&self) -> u32
Return the flow label field.
sourcepub fn payload_len(&self) -> u16
pub fn payload_len(&self) -> u16
Return the payload length field.
sourcepub fn next_header(&self) -> Protocol
pub fn next_header(&self) -> Protocol
Return the next header field.
sourceimpl<T: AsRef<[u8]> + AsMut<[u8]>> Packet<T>
impl<T: AsRef<[u8]> + AsMut<[u8]>> Packet<T>
sourcepub fn set_version(&mut self, value: u8)
pub fn set_version(&mut self, value: u8)
Set the version field.
sourcepub fn set_traffic_class(&mut self, value: u8)
pub fn set_traffic_class(&mut self, value: u8)
Set the traffic class field.
sourcepub fn set_flow_label(&mut self, value: u32)
pub fn set_flow_label(&mut self, value: u32)
Set the flow label field.
sourcepub fn set_payload_len(&mut self, value: u16)
pub fn set_payload_len(&mut self, value: u16)
Set the payload length field.
sourcepub fn set_next_header(&mut self, value: Protocol)
pub fn set_next_header(&mut self, value: Protocol)
Set the next header field.
sourcepub fn set_hop_limit(&mut self, value: u8)
pub fn set_hop_limit(&mut self, value: u8)
Set the hop limit field.
sourcepub fn set_src_addr(&mut self, value: Address)
pub fn set_src_addr(&mut self, value: Address)
Set the source address field.
sourcepub fn set_dst_addr(&mut self, value: Address)
pub fn set_dst_addr(&mut self, value: Address)
Set the destination address field.
sourcepub fn payload_mut(&mut self) -> &mut [u8]
pub fn payload_mut(&mut self) -> &mut [u8]
Return a mutable pointer to the payload.
Trait Implementations
sourceimpl<T: AsRef<[u8]>> PrettyPrint for Packet<T>
impl<T: AsRef<[u8]>> PrettyPrint for Packet<T>
sourcefn pretty_print(
buffer: &dyn AsRef<[u8]>,
f: &mut Formatter<'_>,
indent: &mut PrettyIndent
) -> Result
fn pretty_print(
buffer: &dyn 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
impl<T: AsRef<[u8]>> StructuralPartialEq for Packet<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for Packet<T> where
T: RefUnwindSafe,
impl<T> Send for Packet<T> where
T: Send,
impl<T> Sync for Packet<T> where
T: Sync,
impl<T> Unpin for Packet<T> where
T: Unpin,
impl<T> UnwindSafe for Packet<T> where
T: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstablefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
fn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more