Skip to main content

pamoja_lorawan_grant_session

Function pamoja_lorawan_grant_session 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pamoja_lorawan_grant_session( grant: PamojaLorawanGrant, cflist: *const u8, cflist_len: usize, app_key: *const u8, app_key_len: usize, dev_nonce: u16, out_session: *mut *mut PamojaLorawanSession, ) -> PamojaStatus
Expand description

Derives the session a grant activates, the same one the device computes.

§Arguments

  • grant - the address and settings granted.
  • cflist - the optional 16-byte channel list, or null for none.
  • cflist_len - its length, either 0 or 16.
  • app_key - the 16-byte application root key the device shares.
  • app_key_len - its length, which must be PAMOJA_LORAWAN_KEY_LEN.
  • dev_nonce - the nonce the matching join-request carried.
  • out_session - receives the session.

§Returns

PamojaStatus::Ok on success, with *out_session set to a handle the caller must release with pamoja_lorawan_session_free, or PamojaStatus::InvalidArgument if the key or the channel list is the wrong length.

§Safety

cflist and app_key must each point to at least their stated lengths in readable bytes, and out_session must point to a writable *mut PamojaLorawanSession.