[topology] adding 'Neighbor::AddressMatcher' (#5354)

This commit adds new a type `Neighbor::AddressMactehr` which is used
to filter and find a neighbor (child/router) with a given MAC address
matching a given `Neighbor::StateFilter`. This new type helps simplify
related code in `ChildTable`/`RouterTbale`.
This commit is contained in:
Abtin Keshavarzian
2020-08-10 09:07:52 -07:00
committed by Jonathan Hui
parent 5bac12f9d6
commit 6c75a53bdc
7 changed files with 189 additions and 111 deletions
+8
View File
@@ -96,9 +96,17 @@ static bool StateMatchesFilter(Child::State aState, Child::StateFilter aFilter)
rval = child.IsStateValidOrAttaching();
break;
case Child::kInStateInvalid:
rval = child.IsStateInvalid();
break;
case Child::kInStateAnyExceptValidOrRestoring:
rval = !child.IsStateValidOrRestoring();
break;
case Child::kInStateAny:
rval = true;
break;
}
return rval;