[ip6-address] update and use Ip6::InterfaceIdentifier class (#5194)

This commit updates `Ip6::InterfaceIdentifier` class adding new helper
methods to it (e.g., generate random IID, or convert IID to/from a MAC
Extended Address). It also updates the `Ip6::Address` methods (related
to getting/setting/checking IID) to use the `Ip6::InterfaceIdentifier`
type.

The larger change in this commit is to update other core classes and
modules (`Lowpan`, `Mle`, `Settings`, 'AddressResolver', `Child`,
etc.) to use the `Ip6::InterfaceIdentifier`/`Ip6::Address` type and
their new/changed methods.

This commit also adds a new `struct` type `otIp6AddressComponents` to
the public OT API header `ip6.h`. This type represents the components
of a (unicast) IPv6 address, i.e. a network prefix and an IID. The
`otIp6Address` uses the new type as one of its `union` representations
of an IPv6 address.
This commit is contained in:
Abtin Keshavarzian
2020-07-07 18:02:34 -07:00
committed by GitHub
parent e29143b089
commit eee173af0b
32 changed files with 521 additions and 505 deletions
+2 -2
View File
@@ -627,7 +627,7 @@ void Interpreter::ProcessDua(uint8_t aArgsLength, char *aArgs[])
if (iid != nullptr)
{
OutputBytes(iid->m8, sizeof(otIp6InterfaceIdentifier));
OutputBytes(iid->mFields.m8, sizeof(otIp6InterfaceIdentifier));
mServer->OutputFormat("\r\n");
}
break;
@@ -641,7 +641,7 @@ void Interpreter::ProcessDua(uint8_t aArgsLength, char *aArgs[])
{
otIp6InterfaceIdentifier iid;
VerifyOrExit(Hex2Bin(aArgs[1], iid.m8, sizeof(otIp6InterfaceIdentifier)) ==
VerifyOrExit(Hex2Bin(aArgs[1], iid.mFields.m8, sizeof(otIp6InterfaceIdentifier)) ==
sizeof(otIp6InterfaceIdentifier),
error = OT_ERROR_INVALID_ARGS);
SuccessOrExit(error = otThreadSetFixedDuaInterfaceIdentifier(mInstance, &iid));