[−][src]Struct lorawan::parser::DecryptedDataPayload
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]
data: T,
nwk_skey: &'a AES128,
app_skey: Option<&'a AES128>,
fcnt: u32
) -> Result<Self, &'b str>
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]
pub fn as_data_bytes(&self) -> &[u8]
[src]
pub fn fhdr(&self) -> FHDR<'_>
[src]
pub fn is_uplink(&self) -> bool
[src]
pub fn f_port(&self) -> Option<u8>
[src]
pub fn fhdr_length(&self) -> usize
[src]
impl<T: Debug> Debug for DecryptedDataPayload<T>
[src]
impl<T: PartialEq> PartialEq<DecryptedDataPayload<T>> for DecryptedDataPayload<T>
[src]
pub fn eq(&self, other: &DecryptedDataPayload<T>) -> bool
[src]
pub fn ne(&self, other: &DecryptedDataPayload<T>) -> bool
[src]
impl<T> StructuralPartialEq for DecryptedDataPayload<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for DecryptedDataPayload<T> where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<T> Send for DecryptedDataPayload<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for DecryptedDataPayload<T> where
T: Sync,
[src]
T: Sync,
impl<T> Unpin for DecryptedDataPayload<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> UnwindSafe for DecryptedDataPayload<T> where
T: UnwindSafe,
[src]
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> AsPhyPayloadBytes for T where
T: DataHeader,
[src]
T: DataHeader,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> MHDRAble for T where
T: AsPhyPayloadBytes,
[src]
T: AsPhyPayloadBytes,
impl<T> MICAble for T where
T: AsPhyPayloadBytes,
[src]
T: AsPhyPayloadBytes,
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]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,