Skip to main content

Ipv6HeaderExt

Struct Ipv6HeaderExt 

Source
pub struct Ipv6HeaderExt<'a> {
    pub header: &'a Ipv6Header,
    pub raw_extensions: &'a [u8],
}
Expand description

IPv6 Header with extension headers

Fields§

§header: &'a Ipv6Header§raw_extensions: &'a [u8]

Implementations§

Source§

impl<'a> Ipv6HeaderExt<'a>

Source

pub fn extensions(&'a self) -> Ipv6ExtensionHeadersIter<'a>

Get IPv6 extension headers iterator

Source

pub fn ext_headers_len(&self) -> usize

Get the total header length including extensions

Methods from Deref<Target = Ipv6Header>§

Source

pub fn version(&self) -> u8

Returns the IP version (should always be 6)

Source

pub fn traffic_class(&self) -> u8

Returns the Traffic Class (8 bits) Equivalent to DSCP + ECN in IPv4

Source

pub fn dscp(&self) -> u8

Returns the DSCP portion of Traffic Class (6 bits)

Source

pub fn ecn(&self) -> u8

Returns the ECN portion of Traffic Class (2 bits)

Source

pub fn flow_label(&self) -> u32

Returns the Flow Label (20 bits) Used for QoS and flow identification

Source

pub fn payload_length(&self) -> usize

Returns the payload length in bytes Note: This does NOT include the IPv6 header itself (40 bytes)

Source

pub fn total_length(&self) -> usize

Returns the total packet length (header + payload)

Source

pub fn next_header(&self) -> IpProto

Returns the next header type This indicates the protocol of the next header (TCP, UDP, extension header, etc.)

Source

pub fn hop_limit(&self) -> u8

Returns the hop limit Equivalent to TTL in IPv4

Source

pub fn src_ip(&self) -> Ipv6Addr

Returns the source IPv6 address as Ipv6Addr

Source

pub fn dst_ip(&self) -> Ipv6Addr

Returns the destination IPv6 address as Ipv6Addr

Source

pub fn src_ip_raw(&self) -> [u8; 16]

Returns the source IPv6 address as raw bytes

Source

pub fn dst_ip_raw(&self) -> [u8; 16]

Returns the destination IPv6 address as raw bytes

Source

pub fn has_extension_headers(&self) -> bool

Check if this packet uses extension headers

Source

pub fn is_transport_protocol(&self) -> bool

Check if the next header is a transport protocol (TCP/UDP)

Source

pub fn total_header_len(&self, buf: &[u8], bytes_available: usize) -> usize

Calculate the total header length including extension headers

Returns the total length of IPv6 header + all extension headers, or 0 if the packet is fragmented or if there’s an error parsing.

buf should start at the beginning of the IPv6 header and contain at least bytes_available bytes.

Source

pub fn upper_layer_protocol( &self, buf: &[u8], bytes_available: usize, ) -> Option<(IpProto, bool)>

Get the upper layer protocol after skipping all extension headers Returns the protocol number and whether fragmentation was encountered

Source

pub fn should_parse_extensions(&self) -> bool

Check if there are extension headers to parse

Trait Implementations§

Source§

impl<'a> Clone for Ipv6HeaderExt<'a>

Source§

fn clone(&self) -> Ipv6HeaderExt<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for Ipv6HeaderExt<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for Ipv6HeaderExt<'_>

Source§

type Target = Ipv6Header

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl Display for Ipv6HeaderExt<'_>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Ipv6HeaderExt<'a>

§

impl<'a> RefUnwindSafe for Ipv6HeaderExt<'a>

§

impl<'a> Send for Ipv6HeaderExt<'a>

§

impl<'a> Sync for Ipv6HeaderExt<'a>

§

impl<'a> Unpin for Ipv6HeaderExt<'a>

§

impl<'a> UnsafeUnpin for Ipv6HeaderExt<'a>

§

impl<'a> UnwindSafe for Ipv6HeaderExt<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToSmolStr for T
where T: Display + ?Sized,

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.