Struct lorawan::parser::DecryptedDataPayload
source · pub struct DecryptedDataPayload<T>(/* private fields */);
Expand description
DecryptedDataPayload represents a decrypted DataPayload.
It can be built either directly through the new or using the EncryptedDataPayload.decrypt function.
Implementations§
source§impl<T> DecryptedDataPayload<T>
impl<T> DecryptedDataPayload<T>
source§impl<T: AsRef<[u8]>> DecryptedDataPayload<T>
impl<T: AsRef<[u8]>> DecryptedDataPayload<T>
sourcepub fn frm_payload(&self) -> FRMPayload<'_>
pub fn frm_payload(&self) -> FRMPayload<'_>
Returns FRMPayload that can represent either application payload or mac commands if fport is 0.
source§impl<T: AsRef<[u8]> + AsMut<[u8]>> DecryptedDataPayload<T>
impl<T: AsRef<[u8]> + AsMut<[u8]>> DecryptedDataPayload<T>
sourcepub fn new<'a>(
data: T,
nwk_skey: &'a AES128,
app_skey: Option<&'a AES128>,
fcnt: u32
) -> Result<Self, Error>
pub fn new<'a>( data: T, nwk_skey: &'a AES128, app_skey: Option<&'a AES128>, fcnt: u32 ) -> Result<Self, Error>
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§
source§impl<T: AsRef<[u8]>> DataHeader for DecryptedDataPayload<T>
impl<T: AsRef<[u8]>> DataHeader for DecryptedDataPayload<T>
source§fn is_confirmed(&self) -> bool
fn is_confirmed(&self) -> bool
Gives whether the frame is confirmed
source§fn fhdr_length(&self) -> usize
fn fhdr_length(&self) -> usize
Gives the length of the FHDR field.
source§impl<T: Debug> Debug for DecryptedDataPayload<T>
impl<T: Debug> Debug for DecryptedDataPayload<T>
source§impl<T: PartialEq> PartialEq for DecryptedDataPayload<T>
impl<T: PartialEq> PartialEq for DecryptedDataPayload<T>
source§fn eq(&self, other: &DecryptedDataPayload<T>) -> bool
fn eq(&self, other: &DecryptedDataPayload<T>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<T: Eq> Eq for DecryptedDataPayload<T>
impl<T> StructuralEq for DecryptedDataPayload<T>
impl<T> StructuralPartialEq for DecryptedDataPayload<T>
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§
source§impl<T> AsPhyPayloadBytes for Twhere
T: DataHeader,
impl<T> AsPhyPayloadBytes for Twhere
T: DataHeader,
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more