ReceivedPacketRef

Struct ReceivedPacketRef 

Source
pub struct ReceivedPacketRef<'a> { /* private fields */ }
Expand description

Borrowed view of one accepted inbound packet together with parsed on-wire metadata.

ReceivedPacketRef is meant to stay close to the original packet rather than eagerly translating it into application-level events. It includes the accepted wire bytes, the decrypted/usable payload slice, parsed header and option metadata, resolved sender and channel information, and security details such as frame counter, salt, MIC bytes, and authentication status.

Implementations§

Source§

impl<'a> ReceivedPacketRef<'a>

Source

pub fn new( wire: &'a [u8], payload_bytes: &'a [u8], header: PacketHeader, options: ParsedOptions, from_key: Option<PublicKey>, from_hint: Option<NodeHint>, source_authenticated: bool, channel: Option<ChannelInfoRef<'a>>, rx: RxMetadata, ) -> Self

Source

pub fn packet_type(&self) -> PacketType

Source

pub fn packet_family(&self) -> PacketFamily

Return the coarse packet family for this frame.

Source

pub fn header(&self) -> &PacketHeader

Source

pub fn options(&self) -> &ParsedOptions

Source

pub fn wire_bytes(&self) -> &'a [u8]

Source

pub fn payload(&self) -> &'a [u8]

Return the payload bytes after any successful decryption/authentication work.

This is the application payload body only; it does not include the leading typed-payload byte. Use Self::payload_type or Self::payload_bytes to inspect the application envelope.

Source

pub fn payload_type(&self) -> PayloadType

Return the application payload type carried by this frame.

Source

pub fn payload_bytes(&self) -> &'a [u8]

Return the exact application payload bytes including the leading typed-payload byte when present.

Source

pub fn wire_body(&self) -> &'a [u8]

Return the exact on-wire body region before higher-layer payload parsing.

Source

pub fn is_beacon(&self) -> bool

Source

pub fn from_key(&self) -> Option<PublicKey>

Source

pub fn from_hint(&self) -> Option<NodeHint>

Source

pub fn source_authenticated(&self) -> bool

Source

pub fn rx(&self) -> &RxMetadata

Local radio observations captured when this frame was received.

Source

pub fn rssi(&self) -> Option<i16>

Source

pub fn snr(&self) -> Option<Snr>

Source

pub fn lqi(&self) -> Option<NonZeroU8>

Source

pub fn received_at_ms(&self) -> Option<u64>

Source

pub fn has_full_source(&self) -> bool

True when the source address in the accepted frame used the full public key form.

Source

pub fn channel(&self) -> Option<ChannelInfoRef<'a>>

Resolved channel metadata, when this packet was accepted via a known private channel.

Source

pub fn ack_requested(&self) -> bool

Source

pub fn is_secure(&self) -> bool

Whether the accepted frame carried a valid SECINFO block.

Source

pub fn sec_info(&self) -> Option<SecInfo>

Source

pub fn encrypted(&self) -> bool

Source

pub fn frame_counter(&self) -> Option<u32>

Source

pub fn salt(&self) -> Option<u16>

Source

pub fn mic_size(&self) -> Option<MicSize>

Source

pub fn mic(&self) -> &'a [u8]

Return the authenticated MIC bytes from the original wire frame.

Source

pub fn mic_len(&self) -> usize

Source

pub fn flood_hops(&self) -> Option<FloodHops>

Source

pub fn region_code(&self) -> Option<[u8; 2]>

Source

pub fn min_rssi(&self) -> Option<i16>

Source

pub fn min_snr(&self) -> Option<i8>

Source

pub fn has_unknown_critical_options(&self) -> bool

Source

pub fn source_route(&self) -> Option<&'a [u8]>

Source

pub fn source_route_hops(&self) -> RouteHops<'a>

Iterate decoded source-route hops from the packed option bytes.

Source

pub fn trace_route(&self) -> Option<&'a [u8]>

Source

pub fn trace_route_hops(&self) -> RouteHops<'a>

Iterate decoded trace-route hops from the packed option bytes.

Source

pub fn source_route_hop_count(&self) -> usize

Source

pub fn trace_route_hop_count(&self) -> usize

Trait Implementations§

Source§

impl<'a> Clone for ReceivedPacketRef<'a>

Source§

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

Returns a duplicate of the value. Read more
1.0.0§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for ReceivedPacketRef<'a>

Source§

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

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

impl<'a> PartialEq for ReceivedPacketRef<'a>

Source§

fn eq(&self, other: &ReceivedPacketRef<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0§

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<'a> Eq for ReceivedPacketRef<'a>

Source§

impl<'a> StructuralPartialEq for ReceivedPacketRef<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for ReceivedPacketRef<'a>

§

impl<'a> RefUnwindSafe for ReceivedPacketRef<'a>

§

impl<'a> Send for ReceivedPacketRef<'a>

§

impl<'a> Sync for ReceivedPacketRef<'a>

§

impl<'a> Unpin for ReceivedPacketRef<'a>

§

impl<'a> UnwindSafe for ReceivedPacketRef<'a>

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

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

§

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
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

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> Same for T

Source§

type Output = T

Should always be Self
§

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

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

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

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

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

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.