mirror of
https://github.com/espressif/openthread.git
synced 2026-08-14 14:47:46 +00:00
[api] change type from uint8_t * to otMeshLocalPrefix (#2966)
This commit is contained in:
@@ -1671,7 +1671,7 @@ otThreadGetMeshLocalEid(
|
||||
}
|
||||
|
||||
OTAPI
|
||||
const uint8_t *
|
||||
const otMeshLocalPrefix *
|
||||
OTCALL
|
||||
otThreadGetMeshLocalPrefix(
|
||||
_In_ otInstance *aInstance
|
||||
@@ -1685,7 +1685,7 @@ otThreadGetMeshLocalPrefix(
|
||||
free(Result);
|
||||
Result = nullptr;
|
||||
}
|
||||
return (uint8_t*)Result;
|
||||
return Result;
|
||||
}
|
||||
|
||||
OTAPI
|
||||
@@ -1693,11 +1693,11 @@ otError
|
||||
OTCALL
|
||||
otThreadSetMeshLocalPrefix(
|
||||
_In_ otInstance *aInstance,
|
||||
const uint8_t *aMeshLocalPrefix
|
||||
const otMeshLocalPrefix *aMeshLocalPrefix
|
||||
)
|
||||
{
|
||||
if (aInstance == nullptr) return OT_ERROR_INVALID_ARGS;
|
||||
return DwordToThreadError(SetIOCTL(aInstance, IOCTL_OTLWF_OT_MESH_LOCAL_PREFIX, (const otMeshLocalPrefix*)aMeshLocalPrefix));
|
||||
return DwordToThreadError(SetIOCTL(aInstance, IOCTL_OTLWF_OT_MESH_LOCAL_PREFIX, aMeshLocalPrefix));
|
||||
}
|
||||
|
||||
OTAPI
|
||||
|
||||
@@ -1936,12 +1936,13 @@ otLwfIoCtl_otMeshLocalPrefix(
|
||||
|
||||
if (InBufferLength >= sizeof(otMeshLocalPrefix))
|
||||
{
|
||||
status = ThreadErrorToNtstatus(otThreadSetMeshLocalPrefix(pFilter->otCtx, InBuffer));
|
||||
status = ThreadErrorToNtstatus(otThreadSetMeshLocalPrefix(pFilter->otCtx, (otMeshLocalPrefix*)InBuffer));
|
||||
*OutBufferLength = 0;
|
||||
}
|
||||
else if (*OutBufferLength >= sizeof(otMeshLocalPrefix))
|
||||
{
|
||||
memcpy(OutBuffer, otThreadGetMeshLocalPrefix(pFilter->otCtx), sizeof(otMeshLocalPrefix));
|
||||
const otMeshLocalPrefix* aMeshLocalPrefix = otThreadGetMeshLocalPrefix(pFilter->otCtx);
|
||||
memcpy(OutBuffer, aMeshLocalPrefix, sizeof(otMeshLocalPrefix));
|
||||
*OutBufferLength = sizeof(otMeshLocalPrefix);
|
||||
status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -104,10 +104,17 @@ typedef struct otExtendedPanId otExtendedPanId;
|
||||
* This structure represents a Mesh Local Prefix.
|
||||
*
|
||||
*/
|
||||
typedef struct otMeshLocalPrefix
|
||||
OT_TOOL_PACKED_BEGIN
|
||||
struct otMeshLocalPrefix
|
||||
{
|
||||
uint8_t m8[OT_MESH_LOCAL_PREFIX_SIZE]; ///< Byte values
|
||||
} otMeshLocalPrefix;
|
||||
} OT_TOOL_PACKED_END;
|
||||
|
||||
/**
|
||||
* This structure represents a Mesh Local Prefix
|
||||
*
|
||||
*/
|
||||
typedef struct otMeshLocalPrefix otMeshLocalPrefix;
|
||||
|
||||
#define OT_PSKC_MAX_SIZE 16 ///< Maximum size of the PSKc (bytes)
|
||||
|
||||
|
||||
@@ -364,7 +364,7 @@ OTAPI const otIp6Address *OTCALL otThreadGetMeshLocalEid(otInstance *aInstance);
|
||||
* @returns A pointer to the Mesh Local Prefix.
|
||||
*
|
||||
*/
|
||||
OTAPI const uint8_t *OTCALL otThreadGetMeshLocalPrefix(otInstance *aInstance);
|
||||
OTAPI const otMeshLocalPrefix *OTCALL otThreadGetMeshLocalPrefix(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function sets the Mesh Local Prefix.
|
||||
@@ -380,7 +380,7 @@ OTAPI const uint8_t *OTCALL otThreadGetMeshLocalPrefix(otInstance *aInstance);
|
||||
* @retval OT_ERROR_INVALID_STATE Thread protocols are enabled.
|
||||
*
|
||||
*/
|
||||
OTAPI otError OTCALL otThreadSetMeshLocalPrefix(otInstance *aInstance, const uint8_t *aMeshLocalPrefix);
|
||||
OTAPI otError OTCALL otThreadSetMeshLocalPrefix(otInstance *aInstance, const otMeshLocalPrefix *aMeshLocalPrefix);
|
||||
|
||||
/**
|
||||
* This function returns the Thread link-local IPv6 address.
|
||||
|
||||
+12
-12
@@ -66,20 +66,20 @@ const otExtendedPanId *otThreadGetExtendedPanId(otInstance *aInstance)
|
||||
|
||||
otError otThreadSetExtendedPanId(otInstance *aInstance, const otExtendedPanId *aExtendedPanId)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
uint8_t mlPrefix[8];
|
||||
otError error = OT_ERROR_NONE;
|
||||
Instance & instance = *static_cast<Instance *>(aInstance);
|
||||
otMeshLocalPrefix prefix;
|
||||
|
||||
VerifyOrExit(instance.GetThreadNetif().GetMle().GetRole() == OT_DEVICE_ROLE_DISABLED,
|
||||
error = OT_ERROR_INVALID_STATE);
|
||||
|
||||
instance.GetThreadNetif().GetMac().SetExtendedPanId(*aExtendedPanId);
|
||||
|
||||
mlPrefix[0] = 0xfd;
|
||||
memcpy(mlPrefix + 1, aExtendedPanId->m8, 5);
|
||||
mlPrefix[6] = 0x00;
|
||||
mlPrefix[7] = 0x00;
|
||||
instance.GetThreadNetif().GetMle().SetMeshLocalPrefix(mlPrefix);
|
||||
prefix.m8[0] = 0xfd;
|
||||
memcpy(&prefix.m8[1], aExtendedPanId->m8, 5);
|
||||
prefix.m8[6] = 0x00;
|
||||
prefix.m8[7] = 0x00;
|
||||
instance.GetThreadNetif().GetMle().SetMeshLocalPrefix(prefix);
|
||||
|
||||
instance.GetThreadNetif().GetActiveDataset().Clear();
|
||||
instance.GetThreadNetif().GetPendingDataset().Clear();
|
||||
@@ -191,14 +191,14 @@ const otIp6Address *otThreadGetMeshLocalEid(otInstance *aInstance)
|
||||
return &instance.GetThreadNetif().GetMle().GetMeshLocal64();
|
||||
}
|
||||
|
||||
const uint8_t *otThreadGetMeshLocalPrefix(otInstance *aInstance)
|
||||
const otMeshLocalPrefix *otThreadGetMeshLocalPrefix(otInstance *aInstance)
|
||||
{
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
return instance.GetThreadNetif().GetMle().GetMeshLocalPrefix();
|
||||
return &instance.GetThreadNetif().GetMle().GetMeshLocalPrefix();
|
||||
}
|
||||
|
||||
otError otThreadSetMeshLocalPrefix(otInstance *aInstance, const uint8_t *aMeshLocalPrefix)
|
||||
otError otThreadSetMeshLocalPrefix(otInstance *aInstance, const otMeshLocalPrefix *aMeshLocalPrefix)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
@@ -206,7 +206,7 @@ otError otThreadSetMeshLocalPrefix(otInstance *aInstance, const uint8_t *aMeshLo
|
||||
VerifyOrExit(instance.GetThreadNetif().GetMle().GetRole() == OT_DEVICE_ROLE_DISABLED,
|
||||
error = OT_ERROR_INVALID_STATE);
|
||||
|
||||
error = instance.GetThreadNetif().GetMle().SetMeshLocalPrefix(aMeshLocalPrefix);
|
||||
error = instance.GetThreadNetif().GetMle().SetMeshLocalPrefix(*aMeshLocalPrefix);
|
||||
instance.GetThreadNetif().GetActiveDataset().Clear();
|
||||
instance.GetThreadNetif().GetPendingDataset().Clear();
|
||||
|
||||
|
||||
@@ -174,8 +174,8 @@ void Dataset::Get(otOperationalDataset &aDataset) const
|
||||
|
||||
case Tlv::kMeshLocalPrefix:
|
||||
{
|
||||
const MeshLocalPrefixTlv *tlv = static_cast<const MeshLocalPrefixTlv *>(cur);
|
||||
memcpy(aDataset.mMeshLocalPrefix.m8, tlv->GetMeshLocalPrefix(), sizeof(aDataset.mMeshLocalPrefix));
|
||||
const MeshLocalPrefixTlv *tlv = static_cast<const MeshLocalPrefixTlv *>(cur);
|
||||
aDataset.mMeshLocalPrefix = tlv->GetMeshLocalPrefix();
|
||||
aDataset.mComponents.mIsMeshLocalPrefixPresent = true;
|
||||
break;
|
||||
}
|
||||
@@ -318,7 +318,7 @@ otError Dataset::Set(const otOperationalDataset &aDataset)
|
||||
{
|
||||
MeshCoP::MeshLocalPrefixTlv tlv;
|
||||
tlv.Init();
|
||||
tlv.SetMeshLocalPrefix(aDataset.mMeshLocalPrefix.m8);
|
||||
tlv.SetMeshLocalPrefix(aDataset.mMeshLocalPrefix);
|
||||
Set(tlv);
|
||||
}
|
||||
|
||||
|
||||
@@ -178,7 +178,8 @@ otError DatasetManager::Set(Coap::Header &aHeader, Message &aMessage, const Ip6:
|
||||
// check mesh local prefix
|
||||
if (Tlv::GetTlv(aMessage, Tlv::kMeshLocalPrefix, sizeof(meshLocalPrefix), meshLocalPrefix) == OT_ERROR_NONE &&
|
||||
meshLocalPrefix.IsValid() &&
|
||||
memcmp(meshLocalPrefix.GetMeshLocalPrefix(), netif.GetMle().GetMeshLocalPrefix(), meshLocalPrefix.GetLength()))
|
||||
memcmp(&meshLocalPrefix.GetMeshLocalPrefix(), &netif.GetMle().GetMeshLocalPrefix(),
|
||||
meshLocalPrefix.GetLength()))
|
||||
{
|
||||
doesAffectConnectivity = true;
|
||||
}
|
||||
@@ -429,7 +430,7 @@ otError DatasetManager::SendSetRequest(const otOperationalDataset &aDataset, con
|
||||
{
|
||||
MeshLocalPrefixTlv localprefix;
|
||||
localprefix.Init();
|
||||
localprefix.SetMeshLocalPrefix(aDataset.mMeshLocalPrefix.m8);
|
||||
localprefix.SetMeshLocalPrefix(aDataset.mMeshLocalPrefix);
|
||||
SuccessOrExit(error = message->Append(&localprefix, sizeof(localprefix)));
|
||||
}
|
||||
|
||||
|
||||
@@ -591,7 +591,7 @@ public:
|
||||
* @returns The Mesh Local Prefix value.
|
||||
*
|
||||
*/
|
||||
const uint8_t *GetMeshLocalPrefix(void) const { return mMeshLocalPrefix; }
|
||||
const otMeshLocalPrefix &GetMeshLocalPrefix(void) const { return mMeshLocalPrefix; }
|
||||
|
||||
/**
|
||||
* This method sets the Mesh Local Prefix value.
|
||||
@@ -599,13 +599,10 @@ public:
|
||||
* @param[in] aMeshLocalPrefix A pointer to the Mesh Local Prefix value.
|
||||
*
|
||||
*/
|
||||
void SetMeshLocalPrefix(const uint8_t *aMeshLocalPrefix)
|
||||
{
|
||||
memcpy(mMeshLocalPrefix, aMeshLocalPrefix, sizeof(mMeshLocalPrefix));
|
||||
}
|
||||
void SetMeshLocalPrefix(const otMeshLocalPrefix &aMeshLocalPrefix) { mMeshLocalPrefix = aMeshLocalPrefix; }
|
||||
|
||||
private:
|
||||
uint8_t mMeshLocalPrefix[8];
|
||||
otMeshLocalPrefix mMeshLocalPrefix;
|
||||
} OT_TOOL_PACKED_END;
|
||||
|
||||
/**
|
||||
|
||||
@@ -385,7 +385,7 @@ otError Dhcp6Client::Solicit(uint16_t aRloc16)
|
||||
SuccessOrExit(error = AppendIaAddress(*message, aRloc16));
|
||||
SuccessOrExit(error = AppendRapidCommit(*message));
|
||||
|
||||
memcpy(messageInfo.GetPeerAddr().mFields.m8, netif.GetMle().GetMeshLocalPrefix(), 8);
|
||||
memcpy(messageInfo.GetPeerAddr().mFields.m8, netif.GetMle().GetMeshLocalPrefix().m8, sizeof(otMeshLocalPrefix));
|
||||
messageInfo.GetPeerAddr().mFields.m16[4] = HostSwap16(0x0000);
|
||||
messageInfo.GetPeerAddr().mFields.m16[5] = HostSwap16(0x00ff);
|
||||
messageInfo.GetPeerAddr().mFields.m16[6] = HostSwap16(0xfe00);
|
||||
|
||||
@@ -153,7 +153,7 @@ otError Dhcp6Server::UpdateService(void)
|
||||
if (!mAgentsAloc[i].mValid)
|
||||
{
|
||||
address = &(mAgentsAloc[i].GetAddress());
|
||||
memcpy(address, netif.GetMle().GetMeshLocalPrefix(), 8);
|
||||
memcpy(address, netif.GetMle().GetMeshLocalPrefix().m8, sizeof(otMeshLocalPrefix));
|
||||
address->mFields.m16[4] = HostSwap16(0x0000);
|
||||
address->mFields.m16[5] = HostSwap16(0x00ff);
|
||||
address->mFields.m16[6] = HostSwap16(0xfe00);
|
||||
|
||||
+10
-10
@@ -110,7 +110,7 @@ Mle::Mle(Instance &aInstance)
|
||||
, mAlternateTimestamp(0)
|
||||
, mNotifierCallback(&Mle::HandleStateChanged, this)
|
||||
{
|
||||
uint8_t meshLocalPrefix[8];
|
||||
otMeshLocalPrefix meshLocalPrefix;
|
||||
|
||||
memset(&mLeaderData, 0, sizeof(mLeaderData));
|
||||
memset(&mParentLeaderData, 0, sizeof(mParentLeaderData));
|
||||
@@ -157,10 +157,10 @@ Mle::Mle(Instance &aInstance)
|
||||
#endif
|
||||
|
||||
// initialize Mesh Local Prefix
|
||||
meshLocalPrefix[0] = 0xfd;
|
||||
memcpy(meshLocalPrefix + 1, GetNetif().GetMac().GetExtendedPanId().m8, 5);
|
||||
meshLocalPrefix[6] = 0x00;
|
||||
meshLocalPrefix[7] = 0x00;
|
||||
meshLocalPrefix.m8[0] = 0xfd;
|
||||
memcpy(&meshLocalPrefix.m8[1], GetNetif().GetMac().GetExtendedPanId().m8, 5);
|
||||
meshLocalPrefix.m8[6] = 0x00;
|
||||
meshLocalPrefix.m8[7] = 0x00;
|
||||
|
||||
// mesh-local 64
|
||||
Random::FillBuffer(mMeshLocal64.GetAddress().mFields.m8 + OT_IP6_PREFIX_SIZE,
|
||||
@@ -830,16 +830,16 @@ otError Mle::UpdateLinkLocalAddress(void)
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
const uint8_t *Mle::GetMeshLocalPrefix(void) const
|
||||
const otMeshLocalPrefix &Mle::GetMeshLocalPrefix(void) const
|
||||
{
|
||||
return mMeshLocal16.GetAddress().mFields.m8;
|
||||
return reinterpret_cast<const otMeshLocalPrefix &>(mMeshLocal16.GetAddress());
|
||||
}
|
||||
|
||||
otError Mle::SetMeshLocalPrefix(const uint8_t *aMeshLocalPrefix)
|
||||
otError Mle::SetMeshLocalPrefix(const otMeshLocalPrefix &aMeshLocalPrefix)
|
||||
{
|
||||
ThreadNetif &netif = GetNetif();
|
||||
|
||||
if (memcmp(mMeshLocal64.GetAddress().mFields.m8, aMeshLocalPrefix, 8) == 0)
|
||||
if (memcmp(mMeshLocal64.GetAddress().mFields.m8, aMeshLocalPrefix.m8, sizeof(aMeshLocalPrefix)) == 0)
|
||||
{
|
||||
GetNotifier().SignalIfFirst(OT_CHANGED_THREAD_ML_ADDR);
|
||||
ExitNow();
|
||||
@@ -851,7 +851,7 @@ otError Mle::SetMeshLocalPrefix(const uint8_t *aMeshLocalPrefix)
|
||||
netif.UnsubscribeMulticast(mLinkLocalAllThreadNodes);
|
||||
netif.UnsubscribeMulticast(mRealmLocalAllThreadNodes);
|
||||
|
||||
memcpy(mMeshLocal64.GetAddress().mFields.m8, aMeshLocalPrefix, 8);
|
||||
memcpy(mMeshLocal64.GetAddress().mFields.m8, aMeshLocalPrefix.m8, sizeof(aMeshLocalPrefix));
|
||||
memcpy(mMeshLocal16.GetAddress().mFields.m8, mMeshLocal64.GetAddress().mFields.m8, 8);
|
||||
|
||||
#if OPENTHREAD_ENABLE_SERVICE
|
||||
|
||||
@@ -691,20 +691,20 @@ public:
|
||||
/**
|
||||
* This method returns a pointer to the Mesh Local Prefix.
|
||||
*
|
||||
* @returns A pointer to the Mesh Local Prefix.
|
||||
* @returns A reference to the Mesh Local Prefix.
|
||||
*
|
||||
*/
|
||||
const uint8_t *GetMeshLocalPrefix(void) const;
|
||||
const otMeshLocalPrefix &GetMeshLocalPrefix(void) const;
|
||||
|
||||
/**
|
||||
* This method sets the Mesh Local Prefix.
|
||||
*
|
||||
* @param[in] aPrefix A pointer to the Mesh Local Prefix.
|
||||
* @param[in] aPrefix A reference to the Mesh Local Prefix.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the Mesh Local Prefix.
|
||||
*
|
||||
*/
|
||||
otError SetMeshLocalPrefix(const uint8_t *aPrefix);
|
||||
otError SetMeshLocalPrefix(const otMeshLocalPrefix &aPrefix);
|
||||
|
||||
/**
|
||||
* This method returns a reference to the Thread link-local address.
|
||||
|
||||
@@ -79,9 +79,9 @@ otError LeaderBase::GetContext(const Ip6::Address &aAddress, Lowpan::Context &aC
|
||||
|
||||
aContext.mPrefixLength = 0;
|
||||
|
||||
if (PrefixMatch(netif.GetMle().GetMeshLocalPrefix(), aAddress.mFields.m8, 64) >= 0)
|
||||
if (PrefixMatch(netif.GetMle().GetMeshLocalPrefix().m8, aAddress.mFields.m8, 64) >= 0)
|
||||
{
|
||||
aContext.mPrefix = netif.GetMle().GetMeshLocalPrefix();
|
||||
aContext.mPrefix = netif.GetMle().GetMeshLocalPrefix().m8;
|
||||
aContext.mPrefixLength = 64;
|
||||
aContext.mContextId = 0;
|
||||
aContext.mCompressFlag = true;
|
||||
@@ -129,7 +129,7 @@ otError LeaderBase::GetContext(uint8_t aContextId, Lowpan::Context &aContext)
|
||||
|
||||
if (aContextId == 0)
|
||||
{
|
||||
aContext.mPrefix = GetNetif().GetMle().GetMeshLocalPrefix();
|
||||
aContext.mPrefix = GetNetif().GetMle().GetMeshLocalPrefix().m8;
|
||||
aContext.mPrefixLength = 64;
|
||||
aContext.mContextId = 0;
|
||||
aContext.mCompressFlag = true;
|
||||
@@ -200,7 +200,7 @@ bool LeaderBase::IsOnMesh(const Ip6::Address &aAddress)
|
||||
PrefixTlv *prefix;
|
||||
bool rval = false;
|
||||
|
||||
if (memcmp(aAddress.mFields.m8, GetNetif().GetMle().GetMeshLocalPrefix(), 8) == 0)
|
||||
if (memcmp(aAddress.mFields.m8, GetNetif().GetMle().GetMeshLocalPrefix().m8, sizeof(otMeshLocalPrefix)) == 0)
|
||||
{
|
||||
ExitNow(rval = true);
|
||||
}
|
||||
|
||||
@@ -57,8 +57,8 @@ otError Local::AddOnMeshPrefix(const uint8_t *aPrefix, uint8_t aPrefixLength, in
|
||||
PrefixTlv * prefixTlv;
|
||||
BorderRouterTlv *brTlv;
|
||||
|
||||
VerifyOrExit(Ip6::Address::PrefixMatch(aPrefix, GetNetif().GetMle().GetMeshLocalPrefix(), (aPrefixLength + 7) / 8) <
|
||||
Ip6::Address::kMeshLocalPrefixLength,
|
||||
VerifyOrExit(Ip6::Address::PrefixMatch(aPrefix, GetNetif().GetMle().GetMeshLocalPrefix().m8,
|
||||
(aPrefixLength + 7) / 8) < Ip6::Address::kMeshLocalPrefixLength,
|
||||
error = OT_ERROR_INVALID_ARGS);
|
||||
|
||||
RemoveOnMeshPrefix(aPrefix, aPrefixLength);
|
||||
|
||||
@@ -104,7 +104,7 @@ otError Child::GetMeshLocalIp6Address(Instance &aInstance, Ip6::Address &aAddres
|
||||
|
||||
VerifyOrExit(!IsAllZero(mMeshLocalIid, sizeof(mMeshLocalIid)), error = OT_ERROR_NOT_FOUND);
|
||||
|
||||
memcpy(aAddress.mFields.m8, aInstance.GetThreadNetif().GetMle().GetMeshLocalPrefix(),
|
||||
memcpy(aAddress.mFields.m8, aInstance.GetThreadNetif().GetMle().GetMeshLocalPrefix().m8,
|
||||
Ip6::Address::kMeshLocalPrefixSize);
|
||||
|
||||
aAddress.SetIid(mMeshLocalIid);
|
||||
|
||||
@@ -1046,13 +1046,13 @@ exit:
|
||||
|
||||
template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_IPV6_ML_PREFIX>(void)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
const uint8_t *mlPrefix = otThreadGetMeshLocalPrefix(mInstance);
|
||||
otIp6Address addr;
|
||||
otError error = OT_ERROR_NONE;
|
||||
const otMeshLocalPrefix *mlPrefix = otThreadGetMeshLocalPrefix(mInstance);
|
||||
otIp6Address addr;
|
||||
|
||||
VerifyOrExit(mlPrefix != NULL); // If `mlPrefix` is NULL send empty response.
|
||||
|
||||
memcpy(addr.mFields.m8, mlPrefix, 8);
|
||||
memcpy(addr.mFields.m8, mlPrefix->m8, 8);
|
||||
|
||||
// Zero out the last 8 bytes.
|
||||
memset(addr.mFields.m8 + 8, 0, 8);
|
||||
@@ -1066,15 +1066,15 @@ exit:
|
||||
|
||||
template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_IPV6_ML_PREFIX>(void)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
const uint8_t *meshLocalPrefix;
|
||||
uint8_t prefixLength;
|
||||
otError error = OT_ERROR_NONE;
|
||||
const otIp6Address *meshLocalPrefix;
|
||||
uint8_t prefixLength;
|
||||
|
||||
SuccessOrExit(error = mDecoder.ReadIp6Address(meshLocalPrefix));
|
||||
SuccessOrExit(error = mDecoder.ReadUint8(prefixLength));
|
||||
VerifyOrExit(prefixLength == 64, error = OT_ERROR_INVALID_ARGS);
|
||||
|
||||
error = otThreadSetMeshLocalPrefix(mInstance, meshLocalPrefix);
|
||||
error = otThreadSetMeshLocalPrefix(mInstance, reinterpret_cast<const otMeshLocalPrefix *>(meshLocalPrefix));
|
||||
|
||||
exit:
|
||||
return error;
|
||||
|
||||
@@ -109,7 +109,7 @@ void TestIphcVector::GetUncompressedStream(Message &aMessage)
|
||||
*/
|
||||
static void Init()
|
||||
{
|
||||
uint8_t meshLocalPrefix[] = {0xfd, 0x00, 0xca, 0xfe, 0xfa, 0xce, 0x12, 0x34};
|
||||
otMeshLocalPrefix meshLocalPrefix = {{0xfd, 0x00, 0xca, 0xfe, 0xfa, 0xce, 0x12, 0x34}};
|
||||
sThreadNetif->GetMle().SetMeshLocalPrefix(meshLocalPrefix);
|
||||
|
||||
// Emulate global prefixes with contextes.
|
||||
|
||||
Reference in New Issue
Block a user