mirror of
https://github.com/espressif/openthread.git
synced 2026-07-30 15:47:46 +00:00
[netdata] enhance FindContext() methods and Lowpan::Context (#11836)
This commit enhances the `FindContext()` methods and converts the `Lowpan::Context` struct into a class. The `FindContext()` methods are updated as follows: - Renamed to `FindContextForAddress()` and `FindContextForId()` to more accurately reflect their function. - The return type is changed from `Error` to `void`. Success is now indicated by checking the `IsValid()` state of the output `Context` object (matching how `Lowpan` class uses the `Context`). This change simplifies the callers and harmonizes the context check across different modules. The `Lowpan::Context` struct is converted into a class, encapsulating its members by making them private and introducing public getters.
This commit is contained in:
@@ -1910,14 +1910,16 @@ Error Mle::ProcessAddressRegistrationTlv(RxInfo &aRxInfo, Child &aChild)
|
||||
IgnoreError(aRxInfo.mMessage.Read(offsetRange, address.GetIid()));
|
||||
offsetRange.AdvanceOffset(sizeof(Ip6::InterfaceIdentifier));
|
||||
|
||||
if (Get<NetworkData::Leader>().GetContext(contextId, context) != kErrorNone)
|
||||
Get<NetworkData::Leader>().FindContextForId(contextId, context);
|
||||
|
||||
if (!context.IsValid())
|
||||
{
|
||||
LogWarn("Failed to get context %u for compressed address from child 0x%04x", contextId,
|
||||
aChild.GetRloc16());
|
||||
continue;
|
||||
}
|
||||
|
||||
address.SetPrefix(context.mPrefix);
|
||||
address.SetPrefix(context.GetPrefix());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user