mirror of
https://github.com/espressif/openthread.git
synced 2026-07-26 22:09:05 +00:00
[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:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user