[routing-manager] map otBorderRoutingDhcp6PdState to core type (#11240)

This commit updates `otBorderRoutingDhcp6PdState` to be properly
mapped using `DefineMapEnum()` to its related core-internal `enum`
definition. This avoids the use of `static_cast` for conversion and
ensures only associated `enum` types can be mapped to each other.
This commit is contained in:
Abtin Keshavarzian
2025-02-12 10:29:49 -08:00
committed by GitHub
parent eadf514084
commit d1cb89cede
3 changed files with 3 additions and 3 deletions
+1 -2
View File
@@ -221,8 +221,7 @@ void otBorderRoutingDhcp6PdSetEnabled(otInstance *aInstance, bool aEnabled)
otBorderRoutingDhcp6PdState otBorderRoutingDhcp6PdGetState(otInstance *aInstance)
{
return static_cast<otBorderRoutingDhcp6PdState>(
AsCoreType(aInstance).Get<BorderRouter::RoutingManager>().GetDhcp6PdState());
return MapEnum(AsCoreType(aInstance).Get<BorderRouter::RoutingManager>().GetDhcp6PdState());
}
void otBorderRoutingDhcp6PdSetRequestCallback(otInstance *aInstance,
+1 -1
View File
@@ -4034,7 +4034,7 @@ void RoutingManager::PdPrefixManager::EvaluateStateChange(Dhcp6PdState aOldState
// manager will refuse to request the prefix.
// TODO: Either update the comment for the state callback or add a random delay when notifing the upper layer for
// state change.
mStateCallback.InvokeIfSet(static_cast<otBorderRoutingDhcp6PdState>(newState));
mStateCallback.InvokeIfSet(MapEnum(newState));
exit:
return;
@@ -1640,6 +1640,7 @@ template <> void RoutingManager::RxRaTracker::Entry<RoutingManager::RxRaTracker:
} // namespace BorderRouter
DefineMapEnum(otBorderRoutingState, BorderRouter::RoutingManager::State);
DefineMapEnum(otBorderRoutingDhcp6PdState, BorderRouter::RoutingManager::Dhcp6PdState);
} // namespace ot