Skip to main content

pamoja_lorawan_session_decode

Function pamoja_lorawan_session_decode 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pamoja_lorawan_session_decode( session: *const PamojaLorawanSession, bytes: *const u8, bytes_len: usize, fcnt: u32, out_rx: *mut *mut PamojaLorawanRx, ) -> PamojaStatus
Expand description

Decodes a received data frame: verifies the MIC, then decrypts the payload.

§Arguments

  • session - the session the frame belongs to.
  • bytes - the frame exactly as it came off the radio.
  • bytes_len - its length.
  • fcnt - the full 32-bit frame counter expected for this frame; its low 16 bits must match the counter the frame carries.
  • out_rx - receives the decoded frame.

§Returns

PamojaStatus::Ok on success, with *out_rx set to a handle the caller must release with pamoja_lorawan_rx_free, PamojaStatus::Auth if the MIC does not verify or the counter does not match, or PamojaStatus::Codec if the frame is truncated or is not a data frame.

§Safety

bytes must point to at least bytes_len readable bytes when that length is non-zero, and out_rx must point to a writable *mut PamojaLorawanRx.