pub struct Icmpv6Layer {
pub index: LayerIndex,
}Expand description
An ICMPv6 layer view.
Uses the “Lazy Zero-Copy View” pattern: holds only layer boundaries and reads fields directly from the buffer on demand.
Fields§
§index: LayerIndexImplementations§
Source§impl Icmpv6Layer
impl Icmpv6Layer
Sourcepub fn new(index: LayerIndex) -> Self
pub fn new(index: LayerIndex) -> Self
Create a new ICMPv6 layer view.
Sourcepub fn icmpv6_type(&self, buf: &[u8]) -> Result<u8, FieldError>
pub fn icmpv6_type(&self, buf: &[u8]) -> Result<u8, FieldError>
Get the ICMPv6 type.
Sourcepub fn id(&self, buf: &[u8]) -> Result<Option<u16>, FieldError>
pub fn id(&self, buf: &[u8]) -> Result<Option<u16>, FieldError>
Get the identifier field (for echo request/reply only).
Returns None if this ICMPv6 type doesn’t have an ID field.
Sourcepub fn seq(&self, buf: &[u8]) -> Result<Option<u16>, FieldError>
pub fn seq(&self, buf: &[u8]) -> Result<Option<u16>, FieldError>
Get the sequence number field (for echo request/reply only).
Returns None if this ICMPv6 type doesn’t have a sequence field.
Sourcepub fn target_addr(&self, buf: &[u8]) -> Result<Option<Ipv6Addr>, FieldError>
pub fn target_addr(&self, buf: &[u8]) -> Result<Option<Ipv6Addr>, FieldError>
Get the target address (for Neighbor Solicitation/Advertisement).
Returns None if this ICMPv6 type doesn’t have a target address.
Sourcepub fn mtu(&self, buf: &[u8]) -> Result<Option<u32>, FieldError>
pub fn mtu(&self, buf: &[u8]) -> Result<Option<u32>, FieldError>
Get the MTU (for Packet Too Big only).
Returns None if this is not a Packet Too Big message.
Sourcepub fn set_type(&self, buf: &mut [u8], value: u8) -> Result<(), FieldError>
pub fn set_type(&self, buf: &mut [u8], value: u8) -> Result<(), FieldError>
Set the ICMPv6 type.
Sourcepub fn set_code(&self, buf: &mut [u8], value: u8) -> Result<(), FieldError>
pub fn set_code(&self, buf: &mut [u8], value: u8) -> Result<(), FieldError>
Set the ICMPv6 code.
Sourcepub fn set_checksum(&self, buf: &mut [u8], value: u16) -> Result<(), FieldError>
pub fn set_checksum(&self, buf: &mut [u8], value: u16) -> Result<(), FieldError>
Set the checksum.
Sourcepub fn set_id(&self, buf: &mut [u8], value: u16) -> Result<(), FieldError>
pub fn set_id(&self, buf: &mut [u8], value: u16) -> Result<(), FieldError>
Set the identifier field (for echo request/reply).
Sourcepub fn set_seq(&self, buf: &mut [u8], value: u16) -> Result<(), FieldError>
pub fn set_seq(&self, buf: &mut [u8], value: u16) -> Result<(), FieldError>
Set the sequence number field.
Sourcepub fn get_field(
&self,
buf: &[u8],
name: &str,
) -> Option<Result<FieldValue, FieldError>>
pub fn get_field( &self, buf: &[u8], name: &str, ) -> Option<Result<FieldValue, FieldError>>
Get a field value by name.
Sourcepub fn set_field(
&self,
buf: &mut [u8],
name: &str,
value: FieldValue,
) -> Option<Result<(), FieldError>>
pub fn set_field( &self, buf: &mut [u8], name: &str, value: FieldValue, ) -> Option<Result<(), FieldError>>
Set a field value by name.
Sourcepub fn field_names() -> &'static [&'static str]
pub fn field_names() -> &'static [&'static str]
Get the list of field names for this layer.
Sourcepub fn header_len(&self, _buf: &[u8]) -> usize
pub fn header_len(&self, _buf: &[u8]) -> usize
Get the ICMPv6 header length.
The base header is always 8 bytes. Type-specific fields (like target addresses for NDP) are counted as part of the “body” beyond the 8-byte header.
Trait Implementations§
Source§impl Clone for Icmpv6Layer
impl Clone for Icmpv6Layer
Source§fn clone(&self) -> Icmpv6Layer
fn clone(&self) -> Icmpv6Layer
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Icmpv6Layer
impl Debug for Icmpv6Layer
Source§impl From<Icmpv6Layer> for LayerEnum
impl From<Icmpv6Layer> for LayerEnum
Source§fn from(v: Icmpv6Layer) -> LayerEnum
fn from(v: Icmpv6Layer) -> LayerEnum
Source§impl Layer for Icmpv6Layer
impl Layer for Icmpv6Layer
Source§fn header_len(&self, data: &[u8]) -> usize
fn header_len(&self, data: &[u8]) -> usize
Source§fn answers(&self, data: &[u8], other: &Self, other_data: &[u8]) -> bool
fn answers(&self, data: &[u8], other: &Self, other_data: &[u8]) -> bool
Source§fn field_names(&self) -> &'static [&'static str]
fn field_names(&self) -> &'static [&'static str]
Source§impl LayerDispatch for Icmpv6Layer
impl LayerDispatch for Icmpv6Layer
Source§fn dispatch_kind(&self) -> LayerKind
fn dispatch_kind(&self) -> LayerKind
Source§fn dispatch_index(&self) -> &LayerIndex
fn dispatch_index(&self) -> &LayerIndex
Source§fn dispatch_summary(&self, buf: &[u8]) -> String
fn dispatch_summary(&self, buf: &[u8]) -> String
Source§fn dispatch_header_len(&self, buf: &[u8]) -> usize
fn dispatch_header_len(&self, buf: &[u8]) -> usize
Source§fn dispatch_field_names(&self) -> &'static [&'static str]
fn dispatch_field_names(&self) -> &'static [&'static str]
Source§fn dispatch_get_field(
&self,
buf: &[u8],
name: &str,
) -> Option<Result<FieldValue, FieldError>>
fn dispatch_get_field( &self, buf: &[u8], name: &str, ) -> Option<Result<FieldValue, FieldError>>
Source§fn dispatch_set_field(
&self,
buf: &mut [u8],
name: &str,
value: FieldValue,
) -> Option<Result<(), FieldError>>
fn dispatch_set_field( &self, buf: &mut [u8], name: &str, value: FieldValue, ) -> Option<Result<(), FieldError>>
Auto Trait Implementations§
impl Freeze for Icmpv6Layer
impl RefUnwindSafe for Icmpv6Layer
impl Send for Icmpv6Layer
impl Sync for Icmpv6Layer
impl Unpin for Icmpv6Layer
impl UnsafeUnpin for Icmpv6Layer
impl UnwindSafe for Icmpv6Layer
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more