Skip to main content

pamoja_lorawan_session_new

Function pamoja_lorawan_session_new 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pamoja_lorawan_session_new( dev_addr: u32, nwk_skey: *const u8, nwk_skey_len: usize, app_skey: *const u8, app_skey_len: usize, out_session: *mut *mut PamojaLorawanSession, ) -> PamojaStatus
Expand description

Creates a session from a device address and its two session keys.

§Arguments

  • dev_addr - the device address the network assigned.
  • nwk_skey - the 16-byte network session key, which authenticates frames.
  • nwk_skey_len - its length, which must be PAMOJA_LORAWAN_KEY_LEN.
  • app_skey - the 16-byte application session key, which encrypts payloads.
  • app_skey_len - its length, which must be PAMOJA_LORAWAN_KEY_LEN.
  • out_session - receives the new 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 either key is the wrong length.

§Safety

Each key pointer must point to at least its stated length in readable bytes, and out_session must point to a writable *mut PamojaLorawanSession.