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:
Buke Po
2017-04-28 07:32:35 +08:00
committed by Jonathan Hui
parent 0759f874e0
commit 024c44de5c
18 changed files with 396 additions and 4 deletions
+21
View File
@@ -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);