pub struct NodeInformation { /* private fields */ }Expand description
Node Information message body (RFC 4620 section 4, experimental): the 64-bit Nonce and the variable Data that follow the fixed 8-byte ICMPv6 header.
On the wire a Node Information message is ICMPv6 type 139 (Query) or 140
(Response), a Code, a 16-bit Qtype, a 16-bit Flags field, the 64-bit Nonce,
then a variable Data field. A single body type is reused across Query and
Response — the type byte on the Icmpv6 header distinguishes them — the
same way the wire format shares one layout.
Following the Icmpv6 typed-body pattern, the Qtype and Flags fields are the
Icmpv6 header’s four-byte rest-of-header (set on the header — not in this
body — by Icmpv6::node_information_query /
Icmpv6::node_information_response) so the split matches the wire layout
and the way the NDP / MLD messages keep their rest-of-header fields on the
header. This body carries exactly the part after the fixed 8-byte header: the
8-byte Nonce and the Data. The Data’s shape varies by Qtype and Code, so it is
kept as inspectable raw bytes rather than fully typed for every Qtype. The
header auto-fills the ICMPv6 checksum over the IPv6 pseudo-header, covering
this body’s bytes.
Implementations§
Source§impl NodeInformation
impl NodeInformation
Sourcepub fn new(nonce: [u8; 8]) -> Self
pub fn new(nonce: [u8; 8]) -> Self
Create a Node Information body with the given 64-bit nonce and no Data
(RFC 4620 section 4).
Add Data — the Subject of a Query or the answer of a Response — with
NodeInformation::data. Compose this body under an Icmpv6 header
(type 139 / 140) — or, more simply, use
Icmpv6::node_information_query / Icmpv6::node_information_response,
which set the header type / code and the Qtype / Flags rest-of-header for
you.
Sourcepub fn nonce(self, nonce: [u8; 8]) -> Self
pub fn nonce(self, nonce: [u8; 8]) -> Self
Set the 64-bit Nonce (RFC 4620 section 4: the opaque value a Querier picks and a Responder echoes).
Sourcepub fn data(self, data: impl Into<Vec<u8>>) -> Self
pub fn data(self, data: impl Into<Vec<u8>>) -> Self
Set the variable Data field (RFC 4620 section 4).
On a Query this is the Subject (an IPv6 address, a DNS name, or an IPv4 address, selected by the ICMPv6 Code); on a Response it is the answer (TTL-prefixed addresses, DNS names, etc., selected by the Qtype). The Data’s shape varies by Qtype / Code, so it is carried as raw bytes — build the exact Subject / answer bytes the Qtype requires and pass them here.
Sourcepub fn nonce_value(&self) -> [u8; 8]
pub fn nonce_value(&self) -> [u8; 8]
The 64-bit Nonce (RFC 4620 section 4).
Sourcepub fn data_value(&self) -> &[u8] ⓘ
pub fn data_value(&self) -> &[u8] ⓘ
The variable Data field (RFC 4620 section 4), as raw bytes.
Trait Implementations§
Source§impl Clone for NodeInformation
impl Clone for NodeInformation
Source§fn clone(&self) -> NodeInformation
fn clone(&self) -> NodeInformation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NodeInformation
impl Debug for NodeInformation
Source§impl<R> Div<R> for NodeInformationwhere
R: IntoPacket,
impl<R> Div<R> for NodeInformationwhere
R: IntoPacket,
impl Eq for NodeInformation
Source§impl Layer for NodeInformation
impl Layer for NodeInformation
Source§fn inspection_fields(&self) -> Vec<(&'static str, String)>
fn inspection_fields(&self) -> Vec<(&'static str, String)>
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn compile(&self, _ctx: &LayerContext<'_>, out: &mut Vec<u8>) -> Result<()>
fn compile(&self, _ctx: &LayerContext<'_>, out: &mut Vec<u8>) -> Result<()>
out.Source§fn clone_layer(&self) -> Box<dyn Layer>
fn clone_layer(&self) -> Box<dyn Layer>
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Any for typed packet access.Source§fn into_any(self: Box<Self>) -> Box<dyn Any>
fn into_any(self: Box<Self>) -> Box<dyn Any>
Any for downcasting.Source§fn encoded_len_with_context(&self, _ctx: &LayerContext<'_>) -> usize
fn encoded_len_with_context(&self, _ctx: &LayerContext<'_>) -> usize
Source§fn consumes_following(&self) -> bool
fn consumes_following(&self) -> bool
compile() emits all following layers itself. Read moreSource§fn transport_checksum_context(
&self,
_transport_protocol: u8,
) -> Option<TransportChecksumContext>
fn transport_checksum_context( &self, _transport_protocol: u8, ) -> Option<TransportChecksumContext>
Source§impl PartialEq for NodeInformation
impl PartialEq for NodeInformation
Source§fn eq(&self, other: &NodeInformation) -> bool
fn eq(&self, other: &NodeInformation) -> bool
self and other values to be equal, and is used by ==.