Struct Ipv6Packet
pub struct Ipv6Packet<'a> { /* private fields */ }Expand description
A read/write wrapper around an Internet Protocol version 6 packet buffer.
Implementations§
§impl<'a> Packet<'a>
impl<'a> Packet<'a>
pub const fn new_unchecked(buffer: &'a mut [u8]) -> Packet<'a>
pub const fn new_unchecked(buffer: &'a mut [u8]) -> Packet<'a>
Create a raw octet buffer with an IPv6 packet structure.
pub fn new_checked(buffer: &'a mut [u8]) -> Result<Packet<'a>, Malformed>
pub fn new_checked(buffer: &'a mut [u8]) -> Result<Packet<'a>, Malformed>
Shorthand for a combination of new_unchecked and check_len.
pub fn check_len(&self) -> Result<(), Malformed>
pub fn check_len(&self) -> Result<(), Malformed>
Ensure that no accessor method will panic if called.
The result of this check is invalidated by calling set_payload_len.
§Errors
Malformed: if the buffer is too short.
pub const fn header_len(&self) -> usize
pub const fn header_len(&self) -> usize
Return the header length.
pub fn traffic_class(&self) -> u8
pub fn traffic_class(&self) -> u8
Return the traffic class.
pub fn flow_label(&self) -> u32
pub fn flow_label(&self) -> u32
Return the flow label field.
pub fn payload_len(&self) -> u16
pub fn payload_len(&self) -> u16
Return the payload length field.
pub fn next_header(&self) -> Protocol
pub fn next_header(&self) -> Protocol
Return the next header field.
pub fn set_version(&mut self, value: u8)
pub fn set_version(&mut self, value: u8)
Set the version field.
pub fn set_traffic_class(&mut self, value: u8)
pub fn set_traffic_class(&mut self, value: u8)
Set the traffic class field.
pub fn set_flow_label(&mut self, value: u32)
pub fn set_flow_label(&mut self, value: u32)
Set the flow label field.
pub fn set_payload_len(&mut self, value: u16)
pub fn set_payload_len(&mut self, value: u16)
Set the payload length field.
pub fn set_next_header(&mut self, value: Protocol)
pub fn set_next_header(&mut self, value: Protocol)
Set the next header field.
pub fn set_hop_limit(&mut self, value: u8)
pub fn set_hop_limit(&mut self, value: u8)
Set the hop limit field.
pub fn set_src_addr(&mut self, value: Ipv6Addr)
pub fn set_src_addr(&mut self, value: Ipv6Addr)
Set the source address field.
pub fn set_dst_addr(&mut self, value: Ipv6Addr)
pub fn set_dst_addr(&mut self, value: Ipv6Addr)
Set the destination address field.
pub fn payload_mut(&mut self) -> &mut [u8] ⓘ
pub fn payload_mut(&mut self) -> &mut [u8] ⓘ
Return a mutable pointer to the payload.
Trait Implementations§
impl<'a> Eq for Packet<'a>
impl<'a> StructuralPartialEq for Packet<'a>
Auto Trait Implementations§
impl<'a> !UnwindSafe for Packet<'a>
impl<'a> Freeze for Packet<'a>
impl<'a> RefUnwindSafe for Packet<'a>
impl<'a> Send for Packet<'a>
impl<'a> Sync for Packet<'a>
impl<'a> Unpin for Packet<'a>
impl<'a> UnsafeUnpin for Packet<'a>
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