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 more