[br-tracker] enhance NetDataBrTracker to support filtering (#11964)

This change enhances `NetDataBrTracker` to support filtering of Border
Routers.

The `NetDataPeerBrTracker` is renamed to `NetDataBrTracker` to reflect
that it can now track all Border Routers, not just peers.

A new `Filter` enum is introduced with `kAllBorderRouters` and
`kExcludeThisDevice` options. This allows callers to specify whether
to include the current device in the list of Border Routers.

The `CountPeerBrs()` and `GetNext()` methods are updated to
`CountBrs()` and `GetNext()` respectively, and now accept a `Filter`
parameter.

This change provides more flexibility to the `NetDataBrTracker` and
makes the code more reusable. The unit tests are also updated to
clean up resources to avoid heap allocation leaks at the end of
tests.
This commit is contained in:
Abtin Keshavarzian
2025-09-29 18:05:55 -07:00
committed by GitHub
parent 14373d5543
commit 7bbdbc69ce
10 changed files with 168 additions and 64 deletions
+1 -1
View File
@@ -163,7 +163,7 @@ void Notifier::EmitEvents(void)
#if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
Get<BorderRouter::RoutingManager>().HandleNotifierEvents(events);
#if OPENTHREAD_CONFIG_BORDER_ROUTING_TRACK_PEER_BR_INFO_ENABLE
Get<BorderRouter::NetDataPeerBrTracker>().HandleNotifierEvents(events);
Get<BorderRouter::NetDataBrTracker>().HandleNotifierEvents(events);
#endif
#endif
#if OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE