Skip to main content

pamoja_lorawan_header_parse

Function pamoja_lorawan_header_parse 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pamoja_lorawan_header_parse( bytes: *const u8, bytes_len: usize, out_header: *mut PamojaLorawanHeader, ) -> PamojaStatus
Expand description

Reads a frame far enough to route it, without any key.

A receiver holding many sessions uses this to find which one a frame belongs to: the device address travels in the clear, so it can be read before the session that would verify the frame is even known.

§Arguments

  • bytes - the raw frame as it came off the radio.
  • bytes_len - its length.
  • out_header - receives the header fields.

§Returns

PamojaStatus::Ok on success, with *out_header filled in, or PamojaStatus::Codec if the frame is truncated, carries a message type this build does not read, or declares more frame options than it holds.

§Safety

bytes must point to at least bytes_len readable bytes when that length is non-zero, and out_header must point to a writable PamojaLorawanHeader.