[api] expose Thread-specific link information structure (#2052)

This commit is contained in:
Łukasz Duda
2017-08-03 08:42:50 -07:00
committed by Jonathan Hui
parent d4944ff373
commit 134e23695c
6 changed files with 115 additions and 88 deletions
+49 -8
View File
@@ -427,19 +427,47 @@ struct otIp6Address
*/
typedef struct otIp6Address otIp6Address;
/**
* This structure represents the local and peer IPv6 socket addresses.
*/
typedef struct otMessageInfo
{
otIp6Address mSockAddr; ///< The local IPv6 address.
otIp6Address mPeerAddr; ///< The peer IPv6 address.
uint16_t mSockPort; ///< The local transport-layer port.
uint16_t mPeerPort; ///< The peer transport-layer port.
int8_t mInterfaceId; ///< An IPv6 interface identifier.
uint8_t mHopLimit; ///< The IPv6 Hop Limit.
const void *mLinkInfo; ///< A pointer to link-specific information.
/**
* The local IPv6 address.
*/
otIp6Address mSockAddr;
/**
* The peer IPv6 address.
*/
otIp6Address mPeerAddr;
/**
* The local transport-layer port.
*/
uint16_t mSockPort;
/**
* The peer transport-layer port.
*/
uint16_t mPeerPort;
/**
* An IPv6 interface identifier.
*/
int8_t mInterfaceId;
/**
* The IPv6 Hop Limit.
*/
uint8_t mHopLimit;
/**
* A pointer to link-specific information. In case @p mInterfaceId is set to OT_NETIF_INTERFACE_ID_THREAD,
* @p mLinkInfo points to @sa otThreadLinkInfo. This field is only valid for messages received from the
* Thread radio and is ignored on transmission.
*/
const void *mLinkInfo;
} otMessageInfo;
/**
@@ -1033,6 +1061,19 @@ typedef struct otSockAddr
int8_t mScopeId; ///< An IPv6 scope identifier.
} otSockAddr;
/**
* This structure represents link-specific information for messages received from the Thread radio.
*
*/
typedef struct otThreadLinkInfo
{
uint16_t mPanId; ///< Source PAN ID
uint8_t mChannel; ///< 802.15.4 Channel
int8_t mRss; ///< Received Signal Strength in dBm.
uint8_t mLqi; ///< Link Quality Indicator for a received message.
bool mLinkSecurity; ///< Indicates whether or not link security is enabled.
} otThreadLinkInfo;
#ifdef OTDLL
/**
+37 -37
View File
@@ -1785,7 +1785,7 @@ void MeshForwarder::HandleReceivedFrame(Mac::Receiver &aReceiver, Mac::Frame &aF
void MeshForwarder::HandleReceivedFrame(Mac::Frame &aFrame)
{
ThreadNetif &netif = GetNetif();
ThreadMessageInfo messageInfo;
otThreadLinkInfo linkInfo;
Mac::Address macDest;
Mac::Address macSource;
uint8_t *payload;
@@ -1802,16 +1802,16 @@ void MeshForwarder::HandleReceivedFrame(Mac::Frame &aFrame)
SuccessOrExit(error = aFrame.GetSrcAddr(macSource));
SuccessOrExit(error = aFrame.GetDstAddr(macDest));
aFrame.GetSrcPanId(messageInfo.mPanId);
messageInfo.mChannel = aFrame.GetChannel();
messageInfo.mRss = aFrame.GetPower();
messageInfo.mLqi = aFrame.GetLqi();
messageInfo.mLinkSecurity = aFrame.GetSecurityEnabled();
aFrame.GetSrcPanId(linkInfo.mPanId);
linkInfo.mChannel = aFrame.GetChannel();
linkInfo.mRss = aFrame.GetPower();
linkInfo.mLqi = aFrame.GetLqi();
linkInfo.mLinkSecurity = aFrame.GetSecurityEnabled();
payload = aFrame.GetPayload();
payloadLength = aFrame.GetPayloadLength();
netif.GetSupervisionListener().UpdateOnReceive(macSource, messageInfo.mLinkSecurity);
netif.GetSupervisionListener().UpdateOnReceive(macSource, linkInfo.mLinkSecurity);
mDataPollManager.CheckFramePending(aFrame);
@@ -1821,16 +1821,16 @@ void MeshForwarder::HandleReceivedFrame(Mac::Frame &aFrame)
if (payloadLength >= sizeof(Lowpan::MeshHeader) &&
reinterpret_cast<Lowpan::MeshHeader *>(payload)->IsMeshHeader())
{
HandleMesh(payload, payloadLength, macSource, messageInfo);
HandleMesh(payload, payloadLength, macSource, linkInfo);
}
else if (payloadLength >= sizeof(Lowpan::FragmentHeader) &&
reinterpret_cast<Lowpan::FragmentHeader *>(payload)->IsFragmentHeader())
{
HandleFragment(payload, payloadLength, macSource, macDest, messageInfo);
HandleFragment(payload, payloadLength, macSource, macDest, linkInfo);
}
else if (payloadLength >= 1 && Lowpan::Lowpan::IsLowpanHc(payload))
{
HandleLowpanHC(payload, payloadLength, macSource, macDest, messageInfo);
HandleLowpanHC(payload, payloadLength, macSource, macDest, linkInfo);
}
else
{
@@ -1847,7 +1847,7 @@ void MeshForwarder::HandleReceivedFrame(Mac::Frame &aFrame)
if (commandId == Mac::Frame::kMacCmdDataRequest)
{
HandleDataRequest(macSource, messageInfo);
HandleDataRequest(macSource, linkInfo);
}
else
{
@@ -1874,7 +1874,7 @@ exit:
}
void MeshForwarder::HandleMesh(uint8_t *aFrame, uint8_t aFrameLength, const Mac::Address &aMacSource,
const ThreadMessageInfo &aMessageInfo)
const otThreadLinkInfo &aLinkInfo)
{
ThreadNetif &netif = GetNetif();
otError error = OT_ERROR_NONE;
@@ -1887,7 +1887,7 @@ void MeshForwarder::HandleMesh(uint8_t *aFrame, uint8_t aFrameLength, const Mac:
VerifyOrExit(meshHeader.Init(aFrame, aFrameLength) == OT_ERROR_NONE, error = OT_ERROR_DROP);
// Security Check: only process Mesh Header frames that had security enabled.
VerifyOrExit(aMessageInfo.mLinkSecurity && meshHeader.IsValid(), error = OT_ERROR_SECURITY);
VerifyOrExit(aLinkInfo.mLinkSecurity && meshHeader.IsValid(), error = OT_ERROR_SECURITY);
meshSource.mLength = sizeof(meshSource.mShortAddress);
meshSource.mShortAddress = meshHeader.GetSource();
@@ -1901,11 +1901,11 @@ void MeshForwarder::HandleMesh(uint8_t *aFrame, uint8_t aFrameLength, const Mac:
if (reinterpret_cast<Lowpan::FragmentHeader *>(aFrame)->IsFragmentHeader())
{
HandleFragment(aFrame, aFrameLength, meshSource, meshDest, aMessageInfo);
HandleFragment(aFrame, aFrameLength, meshSource, meshDest, aLinkInfo);
}
else if (Lowpan::Lowpan::IsLowpanHc(aFrame))
{
HandleLowpanHC(aFrame, aFrameLength, meshSource, meshDest, aMessageInfo);
HandleLowpanHC(aFrame, aFrameLength, meshSource, meshDest, aLinkInfo);
}
else
{
@@ -1925,8 +1925,8 @@ void MeshForwarder::HandleMesh(uint8_t *aFrame, uint8_t aFrameLength, const Mac:
error = OT_ERROR_NO_BUFS);
SuccessOrExit(error = message->SetLength(aFrameLength));
message->Write(0, aFrameLength, aFrame);
message->SetLinkSecurityEnabled(aMessageInfo.mLinkSecurity);
message->SetPanId(aMessageInfo.mPanId);
message->SetLinkSecurityEnabled(aLinkInfo.mLinkSecurity);
message->SetPanId(aLinkInfo.mPanId);
SendMessage(*message);
}
@@ -1943,7 +1943,7 @@ exit:
otThreadErrorToString(error),
aFrameLength,
aMacSource.ToString(srcStringBuffer, sizeof(srcStringBuffer)),
aMessageInfo.mLinkSecurity ? "yes" : "no"
aLinkInfo.mLinkSecurity ? "yes" : "no"
);
OT_UNUSED_VARIABLE(srcStringBuffer);
@@ -1994,7 +1994,7 @@ exit:
void MeshForwarder::HandleFragment(uint8_t *aFrame, uint8_t aFrameLength,
const Mac::Address &aMacSource, const Mac::Address &aMacDest,
const ThreadMessageInfo &aMessageInfo)
const otThreadLinkInfo &aLinkInfo)
{
ThreadNetif &netif = GetNetif();
otError error = OT_ERROR_NONE;
@@ -2011,9 +2011,9 @@ void MeshForwarder::HandleFragment(uint8_t *aFrame, uint8_t aFrameLength,
{
VerifyOrExit((message = GetInstance().mMessagePool.New(Message::kTypeIp6, 0)) != NULL,
error = OT_ERROR_NO_BUFS);
message->SetLinkSecurityEnabled(aMessageInfo.mLinkSecurity);
message->SetPanId(aMessageInfo.mPanId);
message->AddRss(aMessageInfo.mRss);
message->SetLinkSecurityEnabled(aLinkInfo.mLinkSecurity);
message->SetPanId(aLinkInfo.mPanId);
message->AddRss(aLinkInfo.mRss);
headerLength = netif.GetLowpan().Decompress(*message, aMacSource, aMacDest, aFrame, aFrameLength,
fragmentHeader.GetDatagramSize());
VerifyOrExit(headerLength > 0, error = OT_ERROR_PARSE);
@@ -2060,7 +2060,7 @@ void MeshForwarder::HandleFragment(uint8_t *aFrame, uint8_t aFrameLength,
message->GetDatagramTag() == fragmentHeader.GetDatagramTag() &&
message->GetOffset() == fragmentHeader.GetDatagramOffset() &&
message->GetOffset() + aFrameLength <= fragmentHeader.GetDatagramSize() &&
message->IsLinkSecurityEnabled() == aMessageInfo.mLinkSecurity)
message->IsLinkSecurityEnabled() == aLinkInfo.mLinkSecurity)
{
break;
}
@@ -2074,7 +2074,7 @@ void MeshForwarder::HandleFragment(uint8_t *aFrame, uint8_t aFrameLength,
if (GetRxOnWhenIdle() == false)
{
if ((message == NULL) && (aMessageInfo.mLinkSecurity))
if ((message == NULL) && (aLinkInfo.mLinkSecurity))
{
ClearReassemblyList();
}
@@ -2085,7 +2085,7 @@ void MeshForwarder::HandleFragment(uint8_t *aFrame, uint8_t aFrameLength,
// copy Fragment
message->Write(message->GetOffset(), aFrameLength, aFrame);
message->MoveOffset(aFrameLength);
message->AddRss(aMessageInfo.mRss);
message->AddRss(aLinkInfo.mRss);
}
exit:
@@ -2095,7 +2095,7 @@ exit:
if (message->GetOffset() >= message->GetLength())
{
mReassemblyList.Dequeue(*message);
HandleDatagram(*message, aMessageInfo, aMacSource);
HandleDatagram(*message, aLinkInfo, aMacSource);
}
}
else
@@ -2116,7 +2116,7 @@ exit:
fragmentHeader.GetDatagramTag(),
fragmentHeader.GetDatagramOffset(),
fragmentHeader.GetDatagramSize(),
aMessageInfo.mLinkSecurity ? "yes" : "no"
aLinkInfo.mLinkSecurity ? "yes" : "no"
);
if (message != NULL)
@@ -2181,7 +2181,7 @@ void MeshForwarder::HandleReassemblyTimer(void)
void MeshForwarder::HandleLowpanHC(uint8_t *aFrame, uint8_t aFrameLength,
const Mac::Address &aMacSource, const Mac::Address &aMacDest,
const ThreadMessageInfo &aMessageInfo)
const otThreadLinkInfo &aLinkInfo)
{
ThreadNetif &netif = GetNetif();
otError error = OT_ERROR_NONE;
@@ -2190,9 +2190,9 @@ void MeshForwarder::HandleLowpanHC(uint8_t *aFrame, uint8_t aFrameLength,
VerifyOrExit((message = GetInstance().mMessagePool.New(Message::kTypeIp6, 0)) != NULL,
error = OT_ERROR_NO_BUFS);
message->SetLinkSecurityEnabled(aMessageInfo.mLinkSecurity);
message->SetPanId(aMessageInfo.mPanId);
message->AddRss(aMessageInfo.mRss);
message->SetLinkSecurityEnabled(aLinkInfo.mLinkSecurity);
message->SetPanId(aLinkInfo.mPanId);
message->AddRss(aLinkInfo.mRss);
headerLength = netif.GetLowpan().Decompress(*message, aMacSource, aMacDest, aFrame, aFrameLength, 0);
VerifyOrExit(headerLength > 0, error = OT_ERROR_PARSE);
@@ -2210,7 +2210,7 @@ exit:
if (error == OT_ERROR_NONE)
{
HandleDatagram(*message, aMessageInfo, aMacSource);
HandleDatagram(*message, aLinkInfo, aMacSource);
}
else
{
@@ -2227,7 +2227,7 @@ exit:
aFrameLength,
aMacSource.ToString(srcStringBuffer, sizeof(srcStringBuffer)),
aMacDest.ToString(dstStringBuffer, sizeof(dstStringBuffer)),
aMessageInfo.mLinkSecurity ? "yes" : "no"
aLinkInfo.mLinkSecurity ? "yes" : "no"
);
if (message != NULL)
@@ -2237,7 +2237,7 @@ exit:
}
}
otError MeshForwarder::HandleDatagram(Message &aMessage, const ThreadMessageInfo &aMessageInfo,
otError MeshForwarder::HandleDatagram(Message &aMessage, const otThreadLinkInfo &aLinkInfo,
const Mac::Address &aMacSource)
{
ThreadNetif &netif = GetNetif();
@@ -2245,17 +2245,17 @@ otError MeshForwarder::HandleDatagram(Message &aMessage, const ThreadMessageInfo
LogIp6Message(kMessageReceive, aMessage, &aMacSource, OT_ERROR_NONE);
mIpCounters.mRxSuccess++;
return netif.GetIp6().HandleDatagram(aMessage, &netif, netif.GetInterfaceId(), &aMessageInfo, false);
return netif.GetIp6().HandleDatagram(aMessage, &netif, netif.GetInterfaceId(), &aLinkInfo, false);
}
void MeshForwarder::HandleDataRequest(const Mac::Address &aMacSource, const ThreadMessageInfo &aMessageInfo)
void MeshForwarder::HandleDataRequest(const Mac::Address &aMacSource, const otThreadLinkInfo &aLinkInfo)
{
ThreadNetif &netif = GetNetif();
Child *child;
uint16_t indirectMsgCount;
// Security Check: only process secure Data Poll frames.
VerifyOrExit(aMessageInfo.mLinkSecurity);
VerifyOrExit(aLinkInfo.mLinkSecurity);
VerifyOrExit(netif.GetMle().GetRole() != OT_DEVICE_ROLE_DETACHED);
+5 -6
View File
@@ -56,7 +56,6 @@ enum
};
class MleRouter;
struct ThreadMessageInfo;
/**
* @addtogroup core-mesh-forwarding
@@ -263,21 +262,21 @@ private:
otError PrepareDiscoverRequest(void);
void PrepareIndirectTransmission(Message &aMessage, const Child &aChild);
void HandleMesh(uint8_t *aFrame, uint8_t aPayloadLength, const Mac::Address &aMacSource,
const ThreadMessageInfo &aMessageInfo);
const otThreadLinkInfo &aLinkInfo);
void HandleFragment(uint8_t *aFrame, uint8_t aPayloadLength,
const Mac::Address &aMacSource, const Mac::Address &aMacDest,
const ThreadMessageInfo &aMessageInfo);
const otThreadLinkInfo &aLinkInfo);
void HandleLowpanHC(uint8_t *aFrame, uint8_t aPayloadLength,
const Mac::Address &aMacSource, const Mac::Address &aMacDest,
const ThreadMessageInfo &aMessageInfo);
void HandleDataRequest(const Mac::Address &aMacSource, const ThreadMessageInfo &aMessageInfo);
const otThreadLinkInfo &aLinkInfo);
void HandleDataRequest(const Mac::Address &aMacSource, const otThreadLinkInfo &aLinkInfo);
otError SendPoll(Message &aMessage, Mac::Frame &aFrame);
otError SendMesh(Message &aMessage, Mac::Frame &aFrame);
otError SendFragment(Message &aMessage, Mac::Frame &aFrame);
otError SendEmptyFrame(Mac::Frame &aFrame, bool aAckRequest);
otError UpdateIp6Route(Message &aMessage);
otError UpdateMeshRoute(Message &aMessage);
otError HandleDatagram(Message &aMessage, const ThreadMessageInfo &aMessageInfo,
otError HandleDatagram(Message &aMessage, const otThreadLinkInfo &aLinkInfo,
const Mac::Address &aMacSource);
void ClearReassemblyList(void);
+8 -8
View File
@@ -2542,7 +2542,7 @@ otError Mle::HandleParentResponse(const Message &aMessage, const Ip6::MessageInf
{
ThreadNetif &netif = GetNetif();
otError error = OT_ERROR_NONE;
const ThreadMessageInfo *threadMessageInfo = static_cast<const ThreadMessageInfo *>(aMessageInfo.GetLinkInfo());
const otThreadLinkInfo *linkInfo = static_cast<const otThreadLinkInfo *>(aMessageInfo.GetLinkInfo());
ResponseTlv response;
SourceAddressTlv sourceAddress;
LeaderDataTlv leaderData;
@@ -2575,7 +2575,7 @@ otError Mle::HandleParentResponse(const Message &aMessage, const Ip6::MessageInf
SuccessOrExit(error = Tlv::GetTlv(aMessage, Tlv::kLinkMargin, sizeof(linkMarginTlv), linkMarginTlv));
VerifyOrExit(linkMarginTlv.IsValid(), error = OT_ERROR_PARSE);
linkMargin = LinkQualityInfo::ConvertRssToLinkMargin(netif.GetMac().GetNoiseFloor(), threadMessageInfo->mRss);
linkMargin = LinkQualityInfo::ConvertRssToLinkMargin(netif.GetMac().GetNoiseFloor(), linkInfo->mRss);
if (linkMargin > linkMarginTlv.GetLinkMargin())
{
@@ -2660,7 +2660,7 @@ otError Mle::HandleParentResponse(const Message &aMessage, const Ip6::MessageInf
mParentCandidate.SetDeviceMode(ModeTlv::kModeFFD | ModeTlv::kModeRxOnWhenIdle | ModeTlv::kModeFullNetworkData |
ModeTlv::kModeSecureDataRequest);
mParentCandidate.GetLinkInfo().Clear();
mParentCandidate.GetLinkInfo().AddRss(netif.GetMac().GetNoiseFloor(), threadMessageInfo->mRss);
mParentCandidate.GetLinkInfo().AddRss(netif.GetMac().GetNoiseFloor(), linkInfo->mRss);
mParentCandidate.ResetLinkFailures();
mParentCandidate.SetLinkQualityOut(LinkQualityInfo::ConvertLinkMarginToLinkQuality(linkMarginTlv.GetLinkMargin()));
mParentCandidate.SetState(Neighbor::kStateValid);
@@ -3040,7 +3040,7 @@ exit:
otError Mle::HandleDiscoveryResponse(const Message &aMessage, const Ip6::MessageInfo &aMessageInfo)
{
otError error = OT_ERROR_NONE;
const ThreadMessageInfo *threadMessageInfo = static_cast<const ThreadMessageInfo *>(aMessageInfo.GetLinkInfo());
const otThreadLinkInfo *linkInfo = static_cast<const otThreadLinkInfo *>(aMessageInfo.GetLinkInfo());
Tlv tlv;
MeshCoP::Tlv meshcopTlv;
MeshCoP::DiscoveryResponseTlv discoveryResponse;
@@ -3064,10 +3064,10 @@ otError Mle::HandleDiscoveryResponse(const Message &aMessage, const Ip6::Message
end = offset + tlv.GetLength();
memset(&result, 0, sizeof(result));
result.mPanId = threadMessageInfo->mPanId;
result.mChannel = threadMessageInfo->mChannel;
result.mRssi = threadMessageInfo->mRss;
result.mLqi = threadMessageInfo->mLqi;
result.mPanId = linkInfo->mPanId;
result.mChannel = linkInfo->mChannel;
result.mRssi = linkInfo->mRss;
result.mLqi = linkInfo->mLqi;
aMessageInfo.GetPeerAddr().ToExtAddress(*static_cast<Mac::ExtAddress *>(&result.mExtAddress));
// process MeshCoP TLVs
+16 -16
View File
@@ -715,12 +715,12 @@ otError MleRouter::HandleLinkRequest(const Message &aMessage, const Ip6::Message
if (neighbor->GetState() != Neighbor::kStateValid)
{
const ThreadMessageInfo *threadMessageInfo =
static_cast<const ThreadMessageInfo *>(aMessageInfo.GetLinkInfo());
const otThreadLinkInfo *linkInfo =
static_cast<const otThreadLinkInfo *>(aMessageInfo.GetLinkInfo());
neighbor->SetExtAddress(macAddr);
neighbor->GetLinkInfo().Clear();
neighbor->GetLinkInfo().AddRss(GetNetif().GetMac().GetNoiseFloor(), threadMessageInfo->mRss);
neighbor->GetLinkInfo().AddRss(GetNetif().GetMac().GetNoiseFloor(), linkInfo->mRss);
neighbor->ResetLinkFailures();
neighbor->SetState(Neighbor::kStateLinkRequest);
}
@@ -764,7 +764,7 @@ otError MleRouter::SendLinkAccept(const Ip6::MessageInfo &aMessageInfo, Neighbor
const TlvRequestTlv &aTlvRequest, const ChallengeTlv &aChallenge)
{
otError error = OT_ERROR_NONE;
const ThreadMessageInfo *threadMessageInfo = static_cast<const ThreadMessageInfo *>(aMessageInfo.GetLinkInfo());
const otThreadLinkInfo *linkInfo = static_cast<const otThreadLinkInfo *>(aMessageInfo.GetLinkInfo());
static const uint8_t routerTlvs[] = {Tlv::kLinkMargin};
Message *message;
Header::Command command;
@@ -782,7 +782,7 @@ otError MleRouter::SendLinkAccept(const Ip6::MessageInfo &aMessageInfo, Neighbor
SuccessOrExit(error = AppendMleFrameCounter(*message));
// always append a link margin, regardless of whether or not it was requested
linkMargin = LinkQualityInfo::ConvertRssToLinkMargin(GetNetif().GetMac().GetNoiseFloor(), threadMessageInfo->mRss);
linkMargin = LinkQualityInfo::ConvertRssToLinkMargin(GetNetif().GetMac().GetNoiseFloor(), linkInfo->mRss);
SuccessOrExit(error = AppendLinkMargin(*message, linkMargin));
@@ -863,7 +863,7 @@ otError MleRouter::HandleLinkAccept(const Message &aMessage, const Ip6::MessageI
uint32_t aKeySequence, bool aRequest)
{
otError error = OT_ERROR_NONE;
const ThreadMessageInfo *threadMessageInfo = static_cast<const ThreadMessageInfo *>(aMessageInfo.GetLinkInfo());
const otThreadLinkInfo *linkInfo = static_cast<const otThreadLinkInfo *>(aMessageInfo.GetLinkInfo());
Router *router;
Neighbor *neighbor;
Mac::ExtAddress macAddr;
@@ -1013,7 +1013,7 @@ otError MleRouter::HandleLinkAccept(const Message &aMessage, const Ip6::MessageI
router->SetLastHeard(TimerMilli::GetNow());
router->SetDeviceMode(ModeTlv::kModeFFD | ModeTlv::kModeRxOnWhenIdle | ModeTlv::kModeFullNetworkData);
router->GetLinkInfo().Clear();
router->GetLinkInfo().AddRss(GetNetif().GetMac().GetNoiseFloor(), threadMessageInfo->mRss);
router->GetLinkInfo().AddRss(GetNetif().GetMac().GetNoiseFloor(), linkInfo->mRss);
router->ResetLinkFailures();
router->SetState(Neighbor::kStateValid);
router->SetKeySequence(aKeySequence);
@@ -1259,7 +1259,7 @@ otError MleRouter::HandleAdvertisement(const Message &aMessage, const Ip6::Messa
{
ThreadNetif &netif = GetNetif();
otError error = OT_ERROR_NONE;
const ThreadMessageInfo *threadMessageInfo = static_cast<const ThreadMessageInfo *>(aMessageInfo.GetLinkInfo());
const otThreadLinkInfo *linkInfo = static_cast<const otThreadLinkInfo *>(aMessageInfo.GetLinkInfo());
Mac::ExtAddress macAddr;
SourceAddressTlv sourceAddress;
LeaderDataTlv leaderData;
@@ -1437,7 +1437,7 @@ otError MleRouter::HandleAdvertisement(const Message &aMessage, const Ip6::Messa
{
router->SetExtAddress(macAddr);
router->GetLinkInfo().Clear();
router->GetLinkInfo().AddRss(netif.GetMac().GetNoiseFloor(), threadMessageInfo->mRss);
router->GetLinkInfo().AddRss(netif.GetMac().GetNoiseFloor(), linkInfo->mRss);
router->ResetLinkFailures();
router->SetState(Neighbor::kStateLinkRequest);
SendLinkRequest(router);
@@ -1484,7 +1484,7 @@ otError MleRouter::HandleAdvertisement(const Message &aMessage, const Ip6::Messa
{
router->SetExtAddress(macAddr);
router->GetLinkInfo().Clear();
router->GetLinkInfo().AddRss(netif.GetMac().GetNoiseFloor(), threadMessageInfo->mRss);
router->GetLinkInfo().AddRss(netif.GetMac().GetNoiseFloor(), linkInfo->mRss);
router->ResetLinkFailures();
router->SetState(Neighbor::kStateLinkRequest);
router->SetDataRequestPending(false);
@@ -1634,7 +1634,7 @@ void MleRouter::UpdateRoutes(const RouteTlv &aRoute, uint8_t aRouterId)
otError MleRouter::HandleParentRequest(const Message &aMessage, const Ip6::MessageInfo &aMessageInfo)
{
otError error = OT_ERROR_NONE;
const ThreadMessageInfo *threadMessageInfo = static_cast<const ThreadMessageInfo *>(aMessageInfo.GetLinkInfo());
const otThreadLinkInfo *linkInfo = static_cast<const otThreadLinkInfo *>(aMessageInfo.GetLinkInfo());
Mac::ExtAddress macAddr;
VersionTlv version;
ScanMaskTlv scanMask;
@@ -1702,7 +1702,7 @@ otError MleRouter::HandleParentRequest(const Message &aMessage, const Ip6::Messa
// MAC Address
child->SetExtAddress(macAddr);
child->GetLinkInfo().Clear();
child->GetLinkInfo().AddRss(GetNetif().GetMac().GetNoiseFloor(), threadMessageInfo->mRss);
child->GetLinkInfo().AddRss(GetNetif().GetMac().GetNoiseFloor(), linkInfo->mRss);
child->ResetLinkFailures();
child->SetState(Neighbor::kStateParentRequest);
child->SetDataRequestPending(false);
@@ -2029,7 +2029,7 @@ otError MleRouter::HandleChildIdRequest(const Message &aMessage, const Ip6::Mess
{
ThreadNetif &netif = GetNetif();
otError error = OT_ERROR_NONE;
const ThreadMessageInfo *threadMessageInfo = static_cast<const ThreadMessageInfo *>(aMessageInfo.GetLinkInfo());
const otThreadLinkInfo *linkInfo = static_cast<const otThreadLinkInfo *>(aMessageInfo.GetLinkInfo());
Mac::ExtAddress macAddr;
ResponseTlv response;
LinkFrameCounterTlv linkFrameCounter;
@@ -2147,7 +2147,7 @@ otError MleRouter::HandleChildIdRequest(const Message &aMessage, const Ip6::Mess
child->SetMleFrameCounter(mleFrameCounter.GetFrameCounter());
child->SetKeySequence(aKeySequence);
child->SetDeviceMode(mode.GetMode());
child->GetLinkInfo().AddRss(netif.GetMac().GetNoiseFloor(), threadMessageInfo->mRss);
child->GetLinkInfo().AddRss(netif.GetMac().GetNoiseFloor(), linkInfo->mRss);
child->SetTimeout(timeout.GetTimeout());
if (mode.GetMode() & ModeTlv::kModeFullNetworkData)
@@ -2319,7 +2319,7 @@ otError MleRouter::HandleChildUpdateResponse(const Message &aMessage, const Ip6:
uint32_t aKeySequence)
{
otError error = OT_ERROR_NONE;
const ThreadMessageInfo *threadMessageInfo = static_cast<const ThreadMessageInfo *>(aMessageInfo.GetLinkInfo());
const otThreadLinkInfo *linkInfo = static_cast<const otThreadLinkInfo *>(aMessageInfo.GetLinkInfo());
Mac::ExtAddress macAddr;
SourceAddressTlv sourceAddress;
TimeoutTlv timeout;
@@ -2398,7 +2398,7 @@ otError MleRouter::HandleChildUpdateResponse(const Message &aMessage, const Ip6:
SetChildStateToValid(child);
child->SetLastHeard(TimerMilli::GetNow());
child->SetKeySequence(aKeySequence);
child->GetLinkInfo().AddRss(GetNetif().GetMac().GetNoiseFloor(), threadMessageInfo->mRss);
child->GetLinkInfo().AddRss(GetNetif().GetMac().GetNoiseFloor(), linkInfo->mRss);
exit:
return error;
-13
View File
@@ -485,19 +485,6 @@ private:
EnergyScanServer mEnergyScan;
};
/**
* This structure represents Thread-specific link information.
*
*/
struct ThreadMessageInfo
{
uint16_t mPanId; ///< Source PAN ID
uint8_t mChannel; ///< 802.15.4 Channel
int8_t mRss; ///< Received Signal Strength in dBm.
uint8_t mLqi; ///< Link Quality Indicator for a received message.
bool mLinkSecurity; ///< Indicates whether or not link security is enabled.
};
/**
* @}
*/