pub struct Ipv6HeaderSlice<'a> { /* private fields */ }
Expand description
A slice containing an ipv6 header of a network package.
Implementations§
Source§impl<'a> Ipv6HeaderSlice<'a>
impl<'a> Ipv6HeaderSlice<'a>
Sourcepub fn from_slice(
slice: &'a [u8],
) -> Result<Ipv6HeaderSlice<'a>, HeaderSliceError>
pub fn from_slice( slice: &'a [u8], ) -> Result<Ipv6HeaderSlice<'a>, HeaderSliceError>
Creates a slice containing an ipv6 header (without header extensions).
Sourcepub fn traffic_class(&self) -> u8
pub fn traffic_class(&self) -> u8
Read the “traffic class” field from the slice.
Sourcepub fn flow_label(&self) -> Ipv6FlowLabel
pub fn flow_label(&self) -> Ipv6FlowLabel
Read the “flow label” field from the slice.
Sourcepub fn payload_length(&self) -> u16
pub fn payload_length(&self) -> u16
Read the “payload length” field from the slice. The length should contain the length of all extension headers and payload.
Sourcepub fn next_header(&self) -> IpNumber
pub fn next_header(&self) -> IpNumber
Sourcepub fn hop_limit(&self) -> u8
pub fn hop_limit(&self) -> u8
Read the “hop limit” field from the slice. The hop limit specifies the number of hops the packet can take before it is discarded.
Sourcepub fn source_addr(&self) -> Ipv6Addr
pub fn source_addr(&self) -> Ipv6Addr
Return the ipv6 source address as an core::net::Ipv6Addr
Sourcepub fn destination(&self) -> [u8; 16]
pub fn destination(&self) -> [u8; 16]
Returns a slice containing the IPv6 destination address.
Sourcepub fn destination_addr(&self) -> Ipv6Addr
pub fn destination_addr(&self) -> Ipv6Addr
Return the ipv6 destination address as an core::net::Ipv6Addr
Sourcepub fn to_header(&self) -> Ipv6Header
pub fn to_header(&self) -> Ipv6Header
Decode all the fields and copy the results to a Ipv6Header struct
Sourcepub const fn header_len(&self) -> usize
pub const fn header_len(&self) -> usize
Returns the length of the IPv6 header in bytes (same as crate::Ipv6Header::LEN
).
Trait Implementations§
Source§impl<'a> Clone for Ipv6HeaderSlice<'a>
impl<'a> Clone for Ipv6HeaderSlice<'a>
Source§fn clone(&self) -> Ipv6HeaderSlice<'a>
fn clone(&self) -> Ipv6HeaderSlice<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more