mirror of
https://github.com/espressif/openthread.git
synced 2026-07-11 06:40:19 +00:00
Add PSKc API (#1635)
* add pskc api * add pskc cli * add NCP api of PSKc * apply PSKc from network * implement PSKC api for windows * add name for pskc property * clear active and pending dataset when settings pskc
This commit is contained in:
@@ -163,6 +163,27 @@ ThreadError otThreadSetLinkMode(otInstance *aInstance, otLinkModeConfig aConfig)
|
||||
return aInstance->mThreadNetif.GetMle().SetDeviceMode(mode);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_FTD
|
||||
const uint8_t *otThreadGetPSKc(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetKeyManager().GetPSKc();
|
||||
}
|
||||
|
||||
ThreadError otThreadSetPSKc(otInstance *aInstance, const uint8_t *aPSKc)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
VerifyOrExit(aInstance->mThreadNetif.GetMle().GetDeviceState() == Mle::kDeviceStateDisabled,
|
||||
error = kThreadError_InvalidState);
|
||||
|
||||
aInstance->mThreadNetif.GetKeyManager().SetPSKc(aPSKc);
|
||||
aInstance->mThreadNetif.GetActiveDataset().Clear(false);
|
||||
aInstance->mThreadNetif.GetPendingDataset().Clear(false);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
#endif
|
||||
|
||||
const uint8_t *otThreadGetMasterKey(otInstance *aInstance, uint8_t *aKeyLength)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetKeyManager().GetMasterKey(aKeyLength);
|
||||
|
||||
Reference in New Issue
Block a user