[dua] add IsDomainUnicast() helper method (#5230)

This commit is contained in:
Rongli Sun
2020-07-13 20:53:43 -07:00
committed by GitHub
parent b9a7903f19
commit 9c660f6425
2 changed files with 16 additions and 0 deletions
+5
View File
@@ -288,6 +288,11 @@ void Leader::UpdateDomainPrefixConfig(void)
#endif
}
bool Leader::IsDomainUnicast(const Ip6::Address &aAddress) const
{
return HasDomainPrefix() && aAddress.PrefixMatch(mDomainPrefix.mPrefix) >= mDomainPrefix.mLength;
}
} // namespace BackboneRouter
} // namespace ot
+11
View File
@@ -152,6 +152,17 @@ public:
*/
bool HasDomainPrefix(void) const { return (mDomainPrefix.mLength > 0); }
/**
* This method indicates whether or not the address is a Domain Unicast Address.
*
* @param[in] aAddress A reference to the address.
*
* @retval true @p aAddress is a domain unicast address.
* @retval false @p aAddress is not a domain unicast address.
*
*/
bool IsDomainUnicast(const Ip6::Address &aAddress) const;
private:
void UpdateBackboneRouterPrimary(void);
void UpdateDomainPrefixConfig(void);