Skip to main content

NodeInformation

Struct NodeInformation 

Source
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

Source

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.

Source

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).

Source

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.

Source

pub fn nonce_value(&self) -> [u8; 8]

The 64-bit Nonce (RFC 4620 section 4).

Source

pub fn data_value(&self) -> &[u8]

The variable Data field (RFC 4620 section 4), as raw bytes.

Trait Implementations§

Source§

impl Clone for NodeInformation

Source§

fn clone(&self) -> NodeInformation

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for NodeInformation

Source§

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

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

impl<R> Div<R> for NodeInformation
where R: IntoPacket,

Source§

type Output = Packet

The resulting type after applying the / operator.
Source§

fn div(self, rhs: R) -> Self::Output

Performs the / operation. Read more
Source§

impl Eq for NodeInformation

Source§

impl Layer for NodeInformation

Source§

fn name(&self) -> &'static str

Stable layer name used by summaries and generated tools.
Source§

fn summary(&self) -> String

A one-line layer summary.
Source§

fn inspection_fields(&self) -> Vec<(&'static str, String)>

Stable field/value pairs used by packet inspection output.
Source§

fn encoded_len(&self) -> usize

Encoded length for this layer before dependent auto-fill.
Source§

fn compile(&self, _ctx: &LayerContext<'_>, out: &mut Vec<u8>) -> Result<()>

Encode this layer into out.
Source§

fn clone_layer(&self) -> Box<dyn Layer>

Clone this layer behind a trait object.
Source§

fn as_any(&self) -> &dyn Any

Return this layer as Any for typed packet access.
Source§

fn as_any_mut(&mut self) -> &mut dyn Any

Return this layer mutably as Any for typed packet access.
Source§

fn into_any(self: Box<Self>) -> Box<dyn Any>

Convert an owned trait object into Any for downcasting.
Source§

fn encoded_len_with_context(&self, _ctx: &LayerContext<'_>) -> usize

Encoded length for this layer once neighboring-layer context is known. Read more
Source§

fn consumes_following(&self) -> bool

Whether this layer’s compile() emits all following layers itself. Read more
Source§

fn transport_checksum_context( &self, _transport_protocol: u8, ) -> Option<TransportChecksumContext>

Return pseudo-header data for a following transport layer, when present.
Source§

impl PartialEq for NodeInformation

Source§

fn eq(&self, other: &NodeInformation) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for NodeInformation

Auto Trait Implementations§

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<T> IntoPacket for T
where T: Layer,

Source§

fn into_packet(self) -> Packet

Convert this value into a packet.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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, 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.