[simulation] support transmit security at simulation radio (#5118)

This commit adds transmit security support for simulation radio so
that security Enh-ACK could be handled at radio layer. This commit
also fixes issue #5041.
This commit is contained in:
Jintao Lin
2020-06-22 12:23:16 -07:00
committed by GitHub
parent 4e1a3bf670
commit 5c722a770c
4 changed files with 213 additions and 17 deletions
+43
View File
@@ -159,3 +159,46 @@ void otMacFrameSetCslIe(otRadioFrame *aFrame, uint16_t aCslPeriod, uint16_t aCsl
static_cast<Mac::Frame *>(aFrame)->SetCslIe(aCslPeriod, aCslPhase);
}
#endif // OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
bool otMacFrameIsSecurityEnabled(otRadioFrame *aFrame)
{
return static_cast<const Mac::Frame *>(aFrame)->GetSecurityEnabled();
}
bool otMacFrameIsKeyIdMode1(otRadioFrame *aFrame)
{
uint8_t keyIdMode;
otError error;
error = static_cast<const Mac::Frame *>(aFrame)->GetKeyIdMode(keyIdMode);
return (error == OT_ERROR_NONE) ? (keyIdMode == Mac::Frame::kKeyIdMode1) : false;
}
uint8_t otMacFrameGetKeyId(otRadioFrame *aFrame)
{
uint8_t keyId = 0;
IgnoreError(static_cast<const Mac::Frame *>(aFrame)->GetKeyId(keyId));
return keyId;
}
void otMacFrameSetKeyId(otRadioFrame *aFrame, uint8_t aKeyId)
{
static_cast<Mac::Frame *>(aFrame)->SetKeyId(aKeyId);
}
uint32_t otMacFrameGetFrameCounter(otRadioFrame *aFrame)
{
uint32_t frameCounter = UINT32_MAX;
IgnoreError(static_cast<Mac::Frame *>(aFrame)->GetFrameCounter(frameCounter));
return frameCounter;
}
void otMacFrameSetFrameCounter(otRadioFrame *aFrame, uint32_t aFrameCounter)
{
static_cast<Mac::Frame *>(aFrame)->SetFrameCounter(aFrameCounter);
}