[dataset] add ApplyConfiguration() overload without default parameter (#10013)

This commit is contained in:
Abtin Keshavarzian
2024-04-11 08:20:45 -07:00
committed by GitHub
parent 30aa3e881d
commit 423c0bef37
3 changed files with 25 additions and 12 deletions
+11 -9
View File
@@ -509,7 +509,14 @@ void Dataset::RemoveTlv(Tlv *aTlv)
}
}
Error Dataset::ApplyConfiguration(Instance &aInstance, bool *aIsNetworkKeyUpdated) const
Error Dataset::ApplyConfiguration(Instance &aInstance) const
{
bool isNetworkKeyUpdated;
return ApplyConfiguration(aInstance, isNetworkKeyUpdated);
}
Error Dataset::ApplyConfiguration(Instance &aInstance, bool &aIsNetworkKeyUpdated) const
{
Mac::Mac &mac = aInstance.Get<Mac::Mac>();
KeyManager &keyManager = aInstance.Get<KeyManager>();
@@ -517,10 +524,7 @@ Error Dataset::ApplyConfiguration(Instance &aInstance, bool *aIsNetworkKeyUpdate
VerifyOrExit(IsValid(), error = kErrorParse);
if (aIsNetworkKeyUpdated)
{
*aIsNetworkKeyUpdated = false;
}
aIsNetworkKeyUpdated = false;
for (const Tlv *cur = GetTlvsStart(); cur < GetTlvsEnd(); cur = cur->GetNext())
{
@@ -559,9 +563,9 @@ Error Dataset::ApplyConfiguration(Instance &aInstance, bool *aIsNetworkKeyUpdate
keyManager.GetNetworkKey(networkKey);
if (aIsNetworkKeyUpdated && (cur->ReadValueAs<NetworkKeyTlv>() != networkKey))
if (cur->ReadValueAs<NetworkKeyTlv>() != networkKey)
{
*aIsNetworkKeyUpdated = true;
aIsNetworkKeyUpdated = true;
}
keyManager.SetNetworkKey(cur->ReadValueAs<NetworkKeyTlv>());
@@ -569,11 +573,9 @@ Error Dataset::ApplyConfiguration(Instance &aInstance, bool *aIsNetworkKeyUpdate
}
#if OPENTHREAD_FTD
case Tlv::kPskc:
keyManager.SetPskc(cur->ReadValueAs<PskcTlv>());
break;
#endif
case Tlv::kMeshLocalPrefix:
+13 -2
View File
@@ -886,13 +886,24 @@ public:
* Applies the Active or Pending Dataset to the Thread interface.
*
* @param[in] aInstance A reference to the OpenThread instance.
* @param[out] aIsNetworkKeyUpdated A pointer to where to place whether network key was updated.
*
* @retval kErrorNone Successfully applied configuration.
* @retval kErrorParse The dataset has at least one TLV with invalid format.
*
*/
Error ApplyConfiguration(Instance &aInstance, bool *aIsNetworkKeyUpdated = nullptr) const;
Error ApplyConfiguration(Instance &aInstance) const;
/**
* Applies the Active or Pending Dataset to the Thread interface.
*
* @param[in] aInstance A reference to the OpenThread instance.
* @param[out] aIsNetworkKeyUpdated Variable to return whether network key was updated.
*
* @retval kErrorNone Successfully applied configuration, @p aIsNetworkKeyUpdated is changed.
* @retval kErrorParse The dataset has at least one TLV with invalid format.
*
*/
Error ApplyConfiguration(Instance &aInstance, bool &aIsNetworkKeyUpdated) const;
/**
* Converts a Pending Dataset to an Active Dataset.
+1 -1
View File
@@ -124,7 +124,7 @@ Error DatasetManager::Save(const Dataset &aDataset)
if (IsActiveDataset())
{
SuccessOrExit(error = aDataset.ApplyConfiguration(GetInstance(), &isNetworkKeyUpdated));
SuccessOrExit(error = aDataset.ApplyConfiguration(GetInstance(), isNetworkKeyUpdated));
}
}