mirror of
https://github.com/espressif/openthread.git
synced 2026-09-05 00:30:07 +00:00
[api] add API to extract an extended address from an IPv6 address (#11933)
The application of the P2P module may only record the P2P peer's link-local address for communication. This commit adds an API to convert the peer's link-local unicast address to the peer's extended address for tearing down the P2P link.
This commit is contained in:
@@ -52,7 +52,7 @@ extern "C" {
|
||||
*
|
||||
* @note This number versions both OpenThread platform and user APIs.
|
||||
*/
|
||||
#define OPENTHREAD_API_VERSION (545)
|
||||
#define OPENTHREAD_API_VERSION (546)
|
||||
|
||||
/**
|
||||
* @addtogroup api-instance
|
||||
|
||||
@@ -576,6 +576,14 @@ bool otIp6IsLinkLocalUnicast(const otIp6Address *aAddress);
|
||||
*/
|
||||
void otIp6FormLinkLocalAddressFromExtAddress(const otExtAddress *aExtAddress, otIp6Address *aAddress);
|
||||
|
||||
/**
|
||||
* Extracts the MAC Extended Address from the Interface Identifier of the given IPv6 address.
|
||||
*
|
||||
* @param[in] aAddress A pointer to the IPv6 address.
|
||||
* @param[out] aExtAddress A pointer to output the MAC Extended Address (generated from the IID).
|
||||
*/
|
||||
void otIp6ExtractExtAddressFromIp6AddressIid(const otIp6Address *aAddress, otExtAddress *aExtAddress);
|
||||
|
||||
/**
|
||||
* Test if two IPv6 prefixes are the same.
|
||||
*
|
||||
|
||||
@@ -178,6 +178,11 @@ void otIp6FormLinkLocalAddressFromExtAddress(const otExtAddress *aExtAddress, ot
|
||||
AsCoreType(aAddress).SetToLinkLocalAddress(AsCoreType(aExtAddress));
|
||||
}
|
||||
|
||||
void otIp6ExtractExtAddressFromIp6AddressIid(const otIp6Address *aAddress, otExtAddress *aExtAddress)
|
||||
{
|
||||
AsCoreType(aExtAddress).SetFromIid(AsCoreType(aAddress).GetIid());
|
||||
}
|
||||
|
||||
bool otIp6ArePrefixesEqual(const otIp6Prefix *aFirst, const otIp6Prefix *aSecond)
|
||||
{
|
||||
return AsCoreType(aFirst) == AsCoreType(aSecond);
|
||||
|
||||
Reference in New Issue
Block a user