[][src]Struct lorawan::parser::DecryptedDataPayload

pub struct DecryptedDataPayload<T>(_);

DecryptedDataPayload represents a decrypted DataPayload.

It can be built either directly through the new or using the EncryptedDataPayload.decrypt function.

Implementations

impl<T: AsRef<[u8]>> DecryptedDataPayload<T>[src]

pub fn frm_payload(&self) -> Result<FRMPayload, &str>[src]

Returns FRMPayload that can represent either application payload or mac commands if fport is 0.

impl<T: AsRef<[u8]> + AsMut<[u8]>> DecryptedDataPayload<T>[src]

pub fn new<'a, 'b>(
    data: T,
    nwk_skey: &'a AES128,
    app_skey: Option<&'a AES128>,
    fcnt: u32
) -> Result<Self, &'b str>
[src]

Creates a DecryptedDataPayload from the bytes of a DataPayload.

The DataPayload payload is automatically decrypted and the mic is verified.

Argument

  • nwk_skey - the Network Session key used to decrypt the mac commands in case the payload is transporting those.
  • app_skey - the Application Session key used to decrypt the application payload in case the payload is transporting that.
  • fcnt - the counter used to encrypt the payload.

Examples

let mut data = vec![0x40, 0x04, 0x03, 0x02, 0x01, 0x80, 0x01, 0x00, 0x01,
    0xa6, 0x94, 0x64, 0x26, 0x15, 0xd6, 0xc3, 0xb5, 0x82];
let nwk_skey = lorawan::keys::AES128([2; 16]);
let app_skey = lorawan::keys::AES128([1; 16]);
let dec_phy = lorawan::parser::DecryptedDataPayload::new(data,
    &nwk_skey,
    Some(&app_skey),
    1).unwrap();

Trait Implementations

impl<T: AsRef<[u8]>> DataHeader for DecryptedDataPayload<T>[src]

impl<T: Debug> Debug for DecryptedDataPayload<T>[src]

impl<T: PartialEq> PartialEq<DecryptedDataPayload<T>> for DecryptedDataPayload<T>[src]

impl<T> StructuralPartialEq for DecryptedDataPayload<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for DecryptedDataPayload<T> where
    T: RefUnwindSafe

impl<T> Send for DecryptedDataPayload<T> where
    T: Send

impl<T> Sync for DecryptedDataPayload<T> where
    T: Sync

impl<T> Unpin for DecryptedDataPayload<T> where
    T: Unpin

impl<T> UnwindSafe for DecryptedDataPayload<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> AsPhyPayloadBytes for T where
    T: DataHeader
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> MHDRAble for T where
    T: AsPhyPayloadBytes
[src]

impl<T> MICAble for T where
    T: AsPhyPayloadBytes
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.