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>
impl<'a> ReceivedPacketRef<'a>
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
pub fn packet_type(&self) -> PacketType
Sourcepub fn packet_family(&self) -> PacketFamily
pub fn packet_family(&self) -> PacketFamily
Return the coarse packet family for this frame.
pub fn header(&self) -> &PacketHeader
pub fn options(&self) -> &ParsedOptions
pub fn wire_bytes(&self) -> &'a [u8] ⓘ
Sourcepub fn payload(&self) -> &'a [u8] ⓘ
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.
Sourcepub fn payload_type(&self) -> PayloadType
pub fn payload_type(&self) -> PayloadType
Return the application payload type carried by this frame.
Sourcepub fn payload_bytes(&self) -> &'a [u8] ⓘ
pub fn payload_bytes(&self) -> &'a [u8] ⓘ
Return the exact application payload bytes including the leading typed-payload byte when present.
Sourcepub fn wire_body(&self) -> &'a [u8] ⓘ
pub fn wire_body(&self) -> &'a [u8] ⓘ
Return the exact on-wire body region before higher-layer payload parsing.
pub fn is_beacon(&self) -> bool
pub fn from_key(&self) -> Option<PublicKey>
pub fn from_hint(&self) -> Option<NodeHint>
pub fn source_authenticated(&self) -> bool
Sourcepub fn rx(&self) -> &RxMetadata
pub fn rx(&self) -> &RxMetadata
Local radio observations captured when this frame was received.
pub fn rssi(&self) -> Option<i16>
pub fn snr(&self) -> Option<Snr>
pub fn lqi(&self) -> Option<NonZeroU8>
pub fn received_at_ms(&self) -> Option<u64>
Sourcepub fn has_full_source(&self) -> bool
pub fn has_full_source(&self) -> bool
True when the source address in the accepted frame used the full public key form.
Sourcepub fn channel(&self) -> Option<ChannelInfoRef<'a>>
pub fn channel(&self) -> Option<ChannelInfoRef<'a>>
Resolved channel metadata, when this packet was accepted via a known private channel.
pub fn ack_requested(&self) -> bool
pub fn sec_info(&self) -> Option<SecInfo>
pub fn encrypted(&self) -> bool
pub fn frame_counter(&self) -> Option<u32>
pub fn salt(&self) -> Option<u16>
pub fn mic_size(&self) -> Option<MicSize>
Sourcepub fn mic(&self) -> &'a [u8] ⓘ
pub fn mic(&self) -> &'a [u8] ⓘ
Return the authenticated MIC bytes from the original wire frame.
pub fn mic_len(&self) -> usize
pub fn flood_hops(&self) -> Option<FloodHops>
pub fn region_code(&self) -> Option<[u8; 2]>
pub fn min_rssi(&self) -> Option<i16>
pub fn min_snr(&self) -> Option<i8>
pub fn has_unknown_critical_options(&self) -> bool
pub fn source_route(&self) -> Option<&'a [u8]>
Sourcepub fn source_route_hops(&self) -> RouteHops<'a> ⓘ
pub fn source_route_hops(&self) -> RouteHops<'a> ⓘ
Iterate decoded source-route hops from the packed option bytes.
pub fn trace_route(&self) -> Option<&'a [u8]>
Sourcepub fn trace_route_hops(&self) -> RouteHops<'a> ⓘ
pub fn trace_route_hops(&self) -> RouteHops<'a> ⓘ
Iterate decoded trace-route hops from the packed option bytes.
pub fn source_route_hop_count(&self) -> usize
pub fn trace_route_hop_count(&self) -> usize
Trait Implementations§
Source§impl<'a> Clone for ReceivedPacketRef<'a>
impl<'a> Clone for ReceivedPacketRef<'a>
Source§fn clone(&self) -> ReceivedPacketRef<'a>
fn clone(&self) -> ReceivedPacketRef<'a>
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for ReceivedPacketRef<'a>
impl<'a> Debug for ReceivedPacketRef<'a>
Source§impl<'a> PartialEq for ReceivedPacketRef<'a>
impl<'a> PartialEq for ReceivedPacketRef<'a>
impl<'a> Eq for ReceivedPacketRef<'a>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)