mirror of
https://github.com/espressif/openthread.git
synced 2026-08-05 02:17:47 +00:00
[child-table] move max child IP addresses logic from Mle (#13159)
This commit moves the state and logic for managing the maximum number of IP addresses per child from `Mle` to `ChildTable`. The logic for checking the limit is also moved to the `Child` class itself. This change better encapsulates the child table properties.
This commit is contained in:
@@ -1820,34 +1820,6 @@ exit:
|
||||
LogSendError(kTypeParentResponse, error);
|
||||
}
|
||||
|
||||
uint8_t Mle::GetMaxChildIpAddresses(void) const
|
||||
{
|
||||
uint8_t num = kMaxChildIpAddresses;
|
||||
|
||||
#if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE
|
||||
if (mMaxChildIpAddresses != 0)
|
||||
{
|
||||
num = mMaxChildIpAddresses;
|
||||
}
|
||||
#endif
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE
|
||||
Error Mle::SetMaxChildIpAddresses(uint8_t aMaxIpAddresses)
|
||||
{
|
||||
Error error = kErrorNone;
|
||||
|
||||
VerifyOrExit(aMaxIpAddresses <= kMaxChildIpAddresses, error = kErrorInvalidArgs);
|
||||
|
||||
mMaxChildIpAddresses = aMaxIpAddresses;
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
#endif
|
||||
|
||||
Error Mle::ProcessAddressRegistrationTlv(RxInfo &aRxInfo, Child &aChild)
|
||||
{
|
||||
Error error;
|
||||
@@ -1927,21 +1899,7 @@ Error Mle::ProcessAddressRegistrationTlv(RxInfo &aRxInfo, Child &aChild)
|
||||
IgnoreError(aRxInfo.mMessage.ReadAndAdvance(offsetRange, address));
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE
|
||||
if (mMaxChildIpAddresses > 0 && storedCount >= mMaxChildIpAddresses)
|
||||
{
|
||||
// Skip remaining address registration entries but keep logging
|
||||
// skipped addresses.
|
||||
error = kErrorNoBufs;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
// We try to accept/add as many IPv6 addresses as possible.
|
||||
// "Child ID/Update Response" will indicate the accepted
|
||||
// addresses.
|
||||
error = aChild.AddIp6Address(address);
|
||||
}
|
||||
error = aChild.AddIp6Address(address);
|
||||
|
||||
if (error == kErrorNone)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user