mirror of
https://github.com/espressif/openthread.git
synced 2026-08-14 06:37:46 +00:00
[ip6] adding Ip6::Prefix class (#5306)
This commit adds `Ip6::Prefix` class as a sub-class of `otIp6Prefix` representing an IPv6 Prefix. Helper methods are provided in `Prefix` and `Address` to perform prefix matching. Different core modules such as `network-data`, `lowpan`, `dhcp6`, `slaac`, and, `backbone-router` are updated to use the new `Prefix` and its helper methods. This commit also updates the unit test `test_ip6_address` to verify behavior of `Prefix` and its helper methods.
This commit is contained in:
@@ -63,7 +63,7 @@ void PrintExternalRouteConfig(const ExternalRouteConfig &aConfig)
|
||||
}
|
||||
|
||||
// Returns true if the two given ExternalRouteConfig match (intentionally ignoring mNextHopIsThisDevice).
|
||||
bool CompareExternalRouteConfig(const ExternalRouteConfig &aConfig1, const ExternalRouteConfig &aConfig2)
|
||||
bool CompareExternalRouteConfig(const otExternalRouteConfig &aConfig1, const otExternalRouteConfig &aConfig2)
|
||||
{
|
||||
return (memcmp(aConfig1.mPrefix.mPrefix.mFields.m8, aConfig2.mPrefix.mPrefix.mFields.m8,
|
||||
sizeof(aConfig1.mPrefix.mPrefix)) == 0) &&
|
||||
@@ -85,7 +85,7 @@ void TestNetworkDataIterator(void)
|
||||
0xFD, 0x00, 0x12, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
|
||||
0xC8, 0x00, 0x40, 0x01, 0x03, 0x54, 0x00, 0x00};
|
||||
|
||||
ExternalRouteConfig routes[] = {
|
||||
otExternalRouteConfig routes[] = {
|
||||
{
|
||||
{{{{0xfd, 0x00, 0x12, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}},
|
||||
64},
|
||||
@@ -126,7 +126,7 @@ void TestNetworkDataIterator(void)
|
||||
0x31, 0x00, 0x02, 0x0F, 0x00, 0x40, 0xFD, 0x00, 0xAB, 0xBA, 0xCD, 0xDC, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00,
|
||||
0x00, 0x03, 0x0E, 0x00, 0x20, 0xFD, 0x00, 0xAB, 0xBA, 0x01, 0x06, 0x54, 0x00, 0x00, 0x04, 0x00, 0x00};
|
||||
|
||||
ExternalRouteConfig routes[] = {
|
||||
otExternalRouteConfig routes[] = {
|
||||
{{{{{0xfd, 0x00, 0x12, 0x34, 0x56, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}}, 64},
|
||||
0x1000,
|
||||
1,
|
||||
|
||||
Reference in New Issue
Block a user