[netdata] add NetworkData::Type enum for full or stable subset (#7328)

This commit adds `NetworkData::Type` enumeration to indicate full set
or stable subset. It also adds helper method `GetNetworkDataType()`
in `Neighbor` and `Mle` to indicate what type of Network Data device
requests.
This commit is contained in:
Abtin Keshavarzian
2022-01-20 11:50:18 -08:00
committed by GitHub
parent 0dccf05473
commit 72676c542e
20 changed files with 105 additions and 137 deletions
+2 -1
View File
@@ -74,7 +74,8 @@ otError otBorderRoutingGetNat64Prefix(otInstance *aInstance, otIp6Prefix *aPrefi
otError otBorderRouterGetNetData(otInstance *aInstance, bool aStable, uint8_t *aData, uint8_t *aDataLength)
{
return AsCoreType(aInstance).Get<NetworkData::Local>().CopyNetworkData(aStable, aData, *aDataLength);
return AsCoreType(aInstance).Get<NetworkData::Local>().CopyNetworkData(
aStable ? NetworkData::kStableSubset : NetworkData::kFullSet, aData, *aDataLength);
}
otError otBorderRouterAddOnMeshPrefix(otInstance *aInstance, const otBorderRouterConfig *aConfig)
+4 -3
View File
@@ -42,7 +42,8 @@ using namespace ot;
otError otNetDataGet(otInstance *aInstance, bool aStable, uint8_t *aData, uint8_t *aDataLength)
{
return AsCoreType(aInstance).Get<NetworkData::Leader>().CopyNetworkData(aStable, aData, *aDataLength);
return AsCoreType(aInstance).Get<NetworkData::Leader>().CopyNetworkData(
aStable ? NetworkData::kStableSubset : NetworkData::kFullSet, aData, *aDataLength);
}
otError otNetDataGetNextOnMeshPrefix(otInstance * aInstance,
@@ -85,12 +86,12 @@ exit:
uint8_t otNetDataGetVersion(otInstance *aInstance)
{
return AsCoreType(aInstance).Get<Mle::MleRouter>().GetLeaderData().GetDataVersion();
return AsCoreType(aInstance).Get<Mle::MleRouter>().GetLeaderData().GetDataVersion(NetworkData::kFullSet);
}
uint8_t otNetDataGetStableVersion(otInstance *aInstance)
{
return AsCoreType(aInstance).Get<Mle::MleRouter>().GetLeaderData().GetStableDataVersion();
return AsCoreType(aInstance).Get<Mle::MleRouter>().GetLeaderData().GetDataVersion(NetworkData::kStableSubset);
}
otError otNetDataSteeringDataCheckJoiner(otInstance *aInstance, const otExtAddress *aEui64)
+2 -1
View File
@@ -44,7 +44,8 @@ using namespace ot;
otError otServerGetNetDataLocal(otInstance *aInstance, bool aStable, uint8_t *aData, uint8_t *aDataLength)
{
return AsCoreType(aInstance).Get<NetworkData::Local>().CopyNetworkData(aStable, aData, *aDataLength);
return AsCoreType(aInstance).Get<NetworkData::Local>().CopyNetworkData(
aStable ? NetworkData::kStableSubset : NetworkData::kFullSet, aData, *aDataLength);
}
otError otServerAddService(otInstance *aInstance, const otServiceConfig *aConfig)
+14 -22
View File
@@ -1002,8 +1002,8 @@ exit:
const LeaderData &Mle::GetLeaderData(void)
{
mLeaderData.SetDataVersion(Get<NetworkData::Leader>().GetVersion());
mLeaderData.SetStableDataVersion(Get<NetworkData::Leader>().GetStableVersion());
mLeaderData.SetDataVersion(Get<NetworkData::Leader>().GetVersion(NetworkData::kFullSet));
mLeaderData.SetStableDataVersion(Get<NetworkData::Leader>().GetVersion(NetworkData::kStableSubset));
return mLeaderData;
}
@@ -1166,8 +1166,8 @@ Error Mle::AppendLeaderData(Message &aMessage)
{
LeaderDataTlv leaderDataTlv;
mLeaderData.SetDataVersion(Get<NetworkData::Leader>().GetVersion());
mLeaderData.SetStableDataVersion(Get<NetworkData::Leader>().GetStableVersion());
mLeaderData.SetDataVersion(Get<NetworkData::Leader>().GetVersion(NetworkData::kFullSet));
mLeaderData.SetStableDataVersion(Get<NetworkData::Leader>().GetVersion(NetworkData::kStableSubset));
leaderDataTlv.Init();
leaderDataTlv.Set(mLeaderData);
@@ -1188,7 +1188,7 @@ exit:
return error;
}
Error Mle::AppendNetworkData(Message &aMessage, bool aStableOnly)
Error Mle::AppendNetworkData(Message &aMessage, NetworkData::Type aType)
{
Error error = kErrorNone;
uint8_t networkData[NetworkData::NetworkData::kMaxSize];
@@ -1197,7 +1197,7 @@ Error Mle::AppendNetworkData(Message &aMessage, bool aStableOnly)
VerifyOrExit(!mRetrieveNewNetworkData, error = kErrorInvalidState);
length = sizeof(networkData);
IgnoreError(Get<NetworkData::Leader>().CopyNetworkData(aStableOnly, networkData, length));
IgnoreError(Get<NetworkData::Leader>().CopyNetworkData(aType, networkData, length));
error = Tlv::Append<NetworkDataTlv>(aMessage, networkData, length);
@@ -3140,16 +3140,8 @@ exit:
bool Mle::IsNetworkDataNewer(const LeaderData &aLeaderData)
{
int8_t diff;
if (IsFullNetworkData())
{
diff = static_cast<int8_t>(aLeaderData.GetDataVersion() - Get<NetworkData::Leader>().GetVersion());
}
else
{
diff = static_cast<int8_t>(aLeaderData.GetStableDataVersion() - Get<NetworkData::Leader>().GetStableVersion());
}
int8_t diff = static_cast<int8_t>(aLeaderData.GetDataVersion(GetNetworkDataType()) -
Get<NetworkData::Leader>().GetVersion(GetNetworkDataType()));
return (diff > 0);
}
@@ -3242,9 +3234,9 @@ Error Mle::HandleLeaderData(const Message &aMessage, const Ip6::MessageInfo &aMe
if (Tlv::FindTlvOffset(aMessage, Tlv::kNetworkData, networkDataOffset) == kErrorNone)
{
error =
Get<NetworkData::Leader>().SetNetworkData(leaderData.GetDataVersion(), leaderData.GetStableDataVersion(),
!IsFullNetworkData(), aMessage, networkDataOffset);
error = Get<NetworkData::Leader>().SetNetworkData(leaderData.GetDataVersion(NetworkData::kFullSet),
leaderData.GetDataVersion(NetworkData::kStableSubset),
GetNetworkDataType(), aMessage, networkDataOffset);
SuccessOrExit(error);
}
else
@@ -3740,9 +3732,9 @@ void Mle::HandleChildIdResponse(const Message & aMessage,
mParent.SetRloc16(sourceAddress);
IgnoreError(Get<NetworkData::Leader>().SetNetworkData(leaderData.GetDataVersion(),
leaderData.GetStableDataVersion(), !IsFullNetworkData(),
aMessage, networkDataOffset));
IgnoreError(Get<NetworkData::Leader>().SetNetworkData(leaderData.GetDataVersion(NetworkData::kFullSet),
leaderData.GetDataVersion(NetworkData::kStableSubset),
GetNetworkDataType(), aMessage, networkDataOffset));
SetStateChild(shortAddress);
+11 -10
View File
@@ -50,6 +50,7 @@
#include "thread/mle_tlvs.hpp"
#include "thread/mle_types.hpp"
#include "thread/neighbor_table.hpp"
#include "thread/network_data_types.hpp"
#include "thread/topology.hpp"
namespace ot {
@@ -307,14 +308,6 @@ public:
*/
bool IsFullThreadDevice(void) const { return mDeviceMode.IsFullThreadDevice(); }
/**
* This method indicates whether or not the device requests Full Network Data.
*
* @returns TRUE if requests Full Network Data, FALSE otherwise.
*
*/
bool IsFullNetworkData(void) const { return mDeviceMode.IsFullNetworkData(); }
/**
* This method indicates whether or not the device is a Minimal End Device.
*
@@ -323,6 +316,14 @@ public:
*/
bool IsMinimalEndDevice(void) const { return mDeviceMode.IsMinimalEndDevice(); }
/**
* This method gets the Network Data type (full set or stable subset) that this device requests.
*
* @returns The Network Data type requested by this device.
*
*/
NetworkData::Type GetNetworkDataType(void) const { return mDeviceMode.GetNetworkDataType(); }
/**
* This method returns a pointer to the Mesh Local Prefix.
*
@@ -1122,13 +1123,13 @@ protected:
* This method appends a Network Data TLV to the message.
*
* @param[in] aMessage A reference to the message.
* @param[in] aStableOnly TRUE to append stable data, FALSE otherwise.
* @param[in] aType The Network Data type to append, full set or stable subset.
*
* @retval kErrorNone Successfully appended the Network Data TLV.
* @retval kErrorNoBufs Insufficient buffers available to append the Network Data TLV.
*
*/
Error AppendNetworkData(Message &aMessage, bool aStableOnly);
Error AppendNetworkData(Message &aMessage, NetworkData::Type aType);
/**
* This method appends a TLV Request TLV to a message.
+12 -45
View File
@@ -965,7 +965,8 @@ Error MleRouter::HandleLinkAccept(const Message & aMessage,
VerifyOrExit(leaderData.GetPartitionId() == mLeaderData.GetPartitionId());
if (mRetrieveNewNetworkData ||
(static_cast<int8_t>(leaderData.GetDataVersion() - Get<NetworkData::Leader>().GetVersion()) > 0))
(static_cast<int8_t>(leaderData.GetDataVersion(NetworkData::kFullSet) -
Get<NetworkData::Leader>().GetVersion(NetworkData::kFullSet)) > 0))
{
IgnoreError(SendDataRequest(aMessageInfo.GetPeerAddr(), dataRequestTlvs, sizeof(dataRequestTlvs), 0));
}
@@ -2360,15 +2361,7 @@ void MleRouter::HandleChildIdRequest(const Message & aMessage,
child->ClearLastRxFragmentTag();
#endif
if (mode.IsFullNetworkData())
{
child->SetNetworkDataVersion(mLeaderData.GetDataVersion());
}
else
{
child->SetNetworkDataVersion(mLeaderData.GetStableDataVersion());
}
child->SetNetworkDataVersion(mLeaderData.GetDataVersion(mode.GetNetworkDataType()));
child->ClearRequestTlvs();
for (numTlvs = 0; numTlvs < requestedTlvs.mNumTlvs; numTlvs++)
@@ -2497,14 +2490,7 @@ void MleRouter::HandleChildUpdateRequest(const Message &aMessage, const Ip6::Mes
switch (ReadLeaderData(aMessage, leaderData))
{
case kErrorNone:
if (child->IsFullNetworkData())
{
child->SetNetworkDataVersion(leaderData.GetDataVersion());
}
else
{
child->SetNetworkDataVersion(leaderData.GetStableDataVersion());
}
child->SetNetworkDataVersion(leaderData.GetDataVersion(child->GetNetworkDataType()));
break;
case kErrorNotFound:
break;
@@ -2742,14 +2728,7 @@ void MleRouter::HandleChildUpdateResponse(const Message & aMessage,
switch (ReadLeaderData(aMessage, leaderData))
{
case kErrorNone:
if (child->IsFullNetworkData())
{
child->SetNetworkDataVersion(leaderData.GetDataVersion());
}
else
{
child->SetNetworkDataVersion(leaderData.GetStableDataVersion());
}
child->SetNetworkDataVersion(leaderData.GetDataVersion(child->GetNetworkDataType()));
break;
case kErrorNotFound:
break;
@@ -2857,23 +2836,12 @@ void MleRouter::SynchronizeChildNetworkData(void)
for (Child &child : Get<ChildTable>().Iterate(Child::kInStateValid))
{
uint8_t version;
if (child.IsRxOnWhenIdle())
{
continue;
}
if (child.IsFullNetworkData())
{
version = Get<NetworkData::Leader>().GetVersion();
}
else
{
version = Get<NetworkData::Leader>().GetStableVersion();
}
if (child.GetNetworkDataVersion() == version)
if (child.GetNetworkDataVersion() == Get<NetworkData::Leader>().GetVersion(child.GetNetworkDataType()))
{
continue;
}
@@ -3136,7 +3104,7 @@ Error MleRouter::SendChildIdResponse(Child &aChild)
switch (aChild.GetRequestTlv(i))
{
case Tlv::kNetworkData:
SuccessOrExit(error = AppendNetworkData(*message, !aChild.IsFullNetworkData()));
SuccessOrExit(error = AppendNetworkData(*message, aChild.GetNetworkDataType()));
break;
case Tlv::kRoute:
@@ -3219,7 +3187,7 @@ Error MleRouter::SendChildUpdateRequest(Child &aChild)
SuccessOrExit(error = AppendHeader(*message, kCommandChildUpdateRequest));
SuccessOrExit(error = AppendSourceAddress(*message));
SuccessOrExit(error = AppendLeaderData(*message));
SuccessOrExit(error = AppendNetworkData(*message, !aChild.IsFullNetworkData()));
SuccessOrExit(error = AppendNetworkData(*message, aChild.GetNetworkDataType()));
SuccessOrExit(error = AppendActiveTimestamp(*message));
SuccessOrExit(error = AppendPendingTimestamp(*message));
@@ -3279,7 +3247,7 @@ void MleRouter::SendChildUpdateResponse(Child * aChild,
break;
case Tlv::kNetworkData:
SuccessOrExit(error = AppendNetworkData(*message, !aChild->IsFullNetworkData()));
SuccessOrExit(error = AppendNetworkData(*message, aChild->GetNetworkDataType()));
SuccessOrExit(error = AppendActiveTimestamp(*message));
SuccessOrExit(error = AppendPendingTimestamp(*message));
break;
@@ -3341,7 +3309,6 @@ void MleRouter::SendDataResponse(const Ip6::Address &aDestination,
Error error = kErrorNone;
Message * message = nullptr;
Neighbor *neighbor;
bool stableOnly;
if (mRetrieveNewNetworkData)
{
@@ -3362,9 +3329,9 @@ void MleRouter::SendDataResponse(const Ip6::Address &aDestination,
switch (aTlvs[i])
{
case Tlv::kNetworkData:
neighbor = mNeighborTable.FindNeighbor(aDestination);
stableOnly = neighbor != nullptr ? !neighbor->IsFullNetworkData() : false;
SuccessOrExit(error = AppendNetworkData(*message, stableOnly));
neighbor = mNeighborTable.FindNeighbor(aDestination);
SuccessOrExit(error = AppendNetworkData(*message, (neighbor != nullptr) ? neighbor->GetNetworkDataType()
: NetworkData::kFullSet));
break;
case Tlv::kActiveDataset:
+2 -2
View File
@@ -692,8 +692,8 @@ public:
{
mPartitionId = HostSwap32(aLeaderData.GetPartitionId());
mWeighting = aLeaderData.GetWeighting();
mDataVersion = aLeaderData.GetDataVersion();
mStableDataVersion = aLeaderData.GetStableDataVersion();
mDataVersion = aLeaderData.GetDataVersion(NetworkData::kFullSet);
mStableDataVersion = aLeaderData.GetDataVersion(NetworkData::kStableSubset);
mLeaderRouterId = aLeaderData.GetLeaderRouterId();
}
+2 -2
View File
@@ -42,7 +42,7 @@ void DeviceMode::Get(ModeConfig &aModeConfig) const
{
aModeConfig.mRxOnWhenIdle = IsRxOnWhenIdle();
aModeConfig.mDeviceType = IsFullThreadDevice();
aModeConfig.mNetworkData = IsFullNetworkData();
aModeConfig.mNetworkData = (GetNetworkDataType() == NetworkData::kFullSet);
}
void DeviceMode::Set(const ModeConfig &aModeConfig)
@@ -58,7 +58,7 @@ DeviceMode::InfoString DeviceMode::ToString(void) const
InfoString string;
string.Append("rx-on:%s ftd:%s full-net:%s", ToYesNo(IsRxOnWhenIdle()), ToYesNo(IsFullThreadDevice()),
ToYesNo(IsFullNetworkData()));
ToYesNo(GetNetworkDataType() == NetworkData::kFullSet));
return string;
}
+15 -15
View File
@@ -50,6 +50,7 @@
#include "common/string.hpp"
#include "mac/mac_types.hpp"
#include "net/ip6_address.hpp"
#include "thread/network_data_types.hpp"
namespace ot {
namespace Mle {
@@ -380,13 +381,15 @@ public:
bool IsFullThreadDevice(void) const { return (mMode & kModeFullThreadDevice) != 0; }
/**
* This method indicates whether or not the device requests Full Network Data.
* This method gets the Network Data type (full set or stable subset) that the device requests.
*
* @retval TRUE If the device requests Full Network Data.
* @retval FALSE If the device does not request Full Network Data (only stable Network Data).
* @returns The Network Data type requested by this device.
*
*/
bool IsFullNetworkData(void) const { return (mMode & kModeFullNetworkData) != 0; }
NetworkData::Type GetNetworkDataType(void) const
{
return (mMode & kModeFullNetworkData) ? NetworkData::kFullSet : NetworkData::kStableSubset;
}
/**
* This method indicates whether or not the device is a Minimal End Device.
@@ -482,12 +485,17 @@ public:
void SetWeighting(uint8_t aWeighting) { mWeighting = aWeighting; }
/**
* This method returns the Data Version value.
* This method returns the Data Version value for a type (full set or stable subset).
*
* @returns The Data Version value.
* @param[in] aType The Network Data type (full set or stable subset).
*
* @returns The Data Version value for @p aType.
*
*/
uint8_t GetDataVersion(void) const { return mDataVersion; }
uint8_t GetDataVersion(NetworkData::Type aType) const
{
return (aType == NetworkData::kFullSet) ? mDataVersion : mStableDataVersion;
}
/**
* This method sets the Data Version value.
@@ -497,14 +505,6 @@ public:
*/
void SetDataVersion(uint8_t aVersion) { mDataVersion = aVersion; }
/**
* This method returns the Stable Data Version value.
*
* @returns The Stable Data Version value.
*
*/
uint8_t GetStableDataVersion(void) const { return mStableDataVersion; }
/**
* This method sets the Stable Data Version value.
*
+4 -4
View File
@@ -47,19 +47,19 @@
namespace ot {
namespace NetworkData {
Error NetworkData::CopyNetworkData(bool aStable, uint8_t *aData, uint8_t &aDataLength) const
Error NetworkData::CopyNetworkData(Type aType, uint8_t *aData, uint8_t &aDataLength) const
{
Error error;
MutableNetworkData netDataCopy(GetInstance(), aData, 0, aDataLength);
SuccessOrExit(error = CopyNetworkData(aStable, netDataCopy));
SuccessOrExit(error = CopyNetworkData(aType, netDataCopy));
aDataLength = netDataCopy.GetLength();
exit:
return error;
}
Error NetworkData::CopyNetworkData(bool aStable, MutableNetworkData &aNetworkData) const
Error NetworkData::CopyNetworkData(Type aType, MutableNetworkData &aNetworkData) const
{
Error error = kErrorNone;
@@ -68,7 +68,7 @@ Error NetworkData::CopyNetworkData(bool aStable, MutableNetworkData &aNetworkDat
memcpy(aNetworkData.GetBytes(), mTlvs, mLength);
aNetworkData.SetLength(mLength);
if (aStable)
if (aType == kStableSubset)
{
aNetworkData.RemoveTemporaryData();
}
+6 -6
View File
@@ -168,28 +168,28 @@ public:
/**
* This method provides full or stable copy of the Thread Network Data.
*
* @param[in] aStable TRUE when copying the stable version, FALSE when copying the full version.
* @param[in] aType The Network Data type to copy, the full set or stable subset.
* @param[out] aData A pointer to the data buffer to copy the Network Data into.
* @param[inout] aDataLength On entry, size of the data buffer pointed to by @p aData.
* On exit, number of copied bytes.
*
* @retval kErrorNone Successfully copied full Thread Network Data.
* @retval kErrorNone Successfully copied Thread Network Data.
* @retval kErrorNoBufs Not enough space in @p aData to fully copy Thread Network Data.
*
*/
Error CopyNetworkData(bool aStable, uint8_t *aData, uint8_t &aDataLength) const;
Error CopyNetworkData(Type aType, uint8_t *aData, uint8_t &aDataLength) const;
/**
* This method provides full or stable copy of the Thread Network Data.
*
* @param[in] aStable TRUE when copying the stable version, FALSE when copying the full version.
* @param[in] aType The Network Data type to copy, the full set or stable subset.
* @param[out] aNetworkData A reference to a `MutableNetworkData` to copy the Network Data into.
*
* @retval kErrorNone Successfully copied full Thread Network Data.
* @retval kErrorNone Successfully copied Thread Network Data.
* @retval kErrorNoBufs Not enough space in @p aNetworkData to fully copy Thread Network Data.
*
*/
Error CopyNetworkData(bool aStable, MutableNetworkData &aNetworkData) const;
Error CopyNetworkData(Type aType, MutableNetworkData &aNetworkData) const;
/**
* This method provides the next On Mesh prefix in the Thread Network Data.
+2 -2
View File
@@ -346,7 +346,7 @@ Error LeaderBase::DefaultRouteLookup(const PrefixTlv &aPrefix, uint16_t *aRloc16
Error LeaderBase::SetNetworkData(uint8_t aVersion,
uint8_t aStableVersion,
bool aStableOnly,
Type aType,
const Message &aMessage,
uint16_t aMessageOffset)
{
@@ -363,7 +363,7 @@ Error LeaderBase::SetNetworkData(uint8_t aVersion,
mVersion = aVersion;
mStableVersion = aStableVersion;
if (aStableOnly)
if (aType == kStableSubset)
{
RemoveTemporaryData();
}
+7 -13
View File
@@ -85,20 +85,14 @@ public:
void Reset(void);
/**
* This method returns the Thread Network Data version.
* This method returns the Data Version value for a type (full set or stable subset).
*
* @returns The Thread Network Data version.
* @param[in] aType The Network Data type (full set or stable subset).
*
* @returns The Data Version value for @p aType.
*
*/
uint8_t GetVersion(void) const { return mVersion; }
/**
* This method returns the Thread Network Data stable version.
*
* @returns The Thread Network Data stable version.
*
*/
uint8_t GetStableVersion(void) const { return mStableVersion; }
uint8_t GetVersion(Type aType) const { return (aType == kFullSet) ? mVersion : mStableVersion; }
/**
* This method retrieves the 6LoWPAN Context information based on a given IPv6 address.
@@ -157,7 +151,7 @@ public:
*
* @param[in] aVersion The Version value.
* @param[in] aStableVersion The Stable Version value.
* @param[in] aStableOnly TRUE if storing only the stable data, FALSE otherwise.
* @param[in] aType The Network Data type to set, the full set or stable subset.
* @param[in] aMessage A reference to the MLE message.
* @param[in] aMessageOffset The offset in @p aMessage for the Network Data TLV.
*
@@ -167,7 +161,7 @@ public:
*/
Error SetNetworkData(uint8_t aVersion,
uint8_t aStableVersion,
bool aStableOnly,
Type aType,
const Message &aMessage,
uint16_t aMessageOffset);
+10
View File
@@ -68,6 +68,16 @@ class HasRouteEntry;
class ServiceTlv;
class ServerTlv;
/**
* This enumeration represents the Network Data type.
*
*/
enum Type : uint8_t
{
kFullSet, ///< Full Network Data set.
kStableSubset, ///< Stable Network Data subset.
};
/**
* This enumeration type represents the route preference values as a signed integer (per RFC-4191).
*
+3 -3
View File
@@ -346,8 +346,8 @@ Error NetworkDiagnostic::FillRequestedTlvs(const Message & aRequest,
tlv.Init();
tlv.SetPartitionId(leaderData.GetPartitionId());
tlv.SetWeighting(leaderData.GetWeighting());
tlv.SetDataVersion(leaderData.GetDataVersion());
tlv.SetStableDataVersion(leaderData.GetStableDataVersion());
tlv.SetDataVersion(leaderData.GetDataVersion(NetworkData::kFullSet));
tlv.SetStableDataVersion(leaderData.GetDataVersion(NetworkData::kStableSubset));
tlv.SetLeaderRouterId(leaderData.GetLeaderRouterId());
SuccessOrExit(error = tlv.AppendTo(aResponse));
@@ -646,7 +646,7 @@ static inline void ParseMode(const Mle::DeviceMode &aMode, otLinkModeConfig &aLi
{
aLinkModeConfig.mRxOnWhenIdle = aMode.IsRxOnWhenIdle();
aLinkModeConfig.mDeviceType = aMode.IsFullThreadDevice();
aLinkModeConfig.mNetworkData = aMode.IsFullNetworkData();
aLinkModeConfig.mNetworkData = (aMode.GetNetworkDataType() == NetworkData::kFullSet);
}
static inline void ParseConnectivity(const ConnectivityTlv & aConnectivityTlv,
+2 -2
View File
@@ -79,7 +79,7 @@ void Neighbor::Info::SetFrom(const Neighbor &aNeighbor)
mMessageErrorRate = aNeighbor.GetLinkInfo().GetMessageErrorRate();
mRxOnWhenIdle = aNeighbor.IsRxOnWhenIdle();
mFullThreadDevice = aNeighbor.IsFullThreadDevice();
mFullNetworkData = aNeighbor.IsFullNetworkData();
mFullNetworkData = (aNeighbor.GetNetworkDataType() == NetworkData::kFullSet);
}
void Neighbor::Init(Instance &aInstance)
@@ -242,7 +242,7 @@ void Child::Info::SetFrom(const Child &aChild)
mVersion = aChild.GetVersion();
mRxOnWhenIdle = aChild.IsRxOnWhenIdle();
mFullThreadDevice = aChild.IsFullThreadDevice();
mFullNetworkData = aChild.IsFullNetworkData();
mFullNetworkData = (aChild.GetNetworkDataType() == NetworkData::kFullSet);
mIsStateRestoring = aChild.IsStateRestoring();
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE
mIsCslSynced = aChild.IsCslSynchronized();
+4 -3
View File
@@ -56,6 +56,7 @@
#include "thread/link_quality.hpp"
#include "thread/mle_tlvs.hpp"
#include "thread/mle_types.hpp"
#include "thread/network_data_types.hpp"
#include "thread/radio_selector.hpp"
namespace ot {
@@ -353,12 +354,12 @@ public:
bool IsFullThreadDevice(void) const { return GetDeviceMode().IsFullThreadDevice(); }
/**
* This method indicates whether or not the device requests Full Network Data.
* This method gets the Network Data type (full set or stable subset) that the device requests.
*
* @returns TRUE if requests Full Network Data, FALSE otherwise.
* @returns The Network Data type.
*
*/
bool IsFullNetworkData(void) const { return GetDeviceMode().IsFullNetworkData(); }
NetworkData::Type GetNetworkDataType(void) const { return GetDeviceMode().GetNetworkDataType(); }
/**
* This method sets all bytes of the Extended Address to zero.
+1 -1
View File
@@ -345,7 +345,7 @@ void HistoryTracker::RecordNetworkDataChange(void)
}
}
SuccessOrAssert(Get<NetworkData::Leader>().CopyNetworkData(/* aSatble */ false, mPreviousNetworkData));
SuccessOrAssert(Get<NetworkData::Leader>().CopyNetworkData(NetworkData::kFullSet, mPreviousNetworkData));
}
void HistoryTracker::RecordOnMeshPrefixEvent(NetDataEvent aEvent, const NetworkData::OnMeshPrefixConfig &aPrefix)
+1 -1
View File
@@ -155,7 +155,7 @@ void Otns::EmitTransmit(const Mac::TxFrame &aFrame)
void Otns::EmitDeviceMode(Mle::DeviceMode aMode)
{
EmitStatus("mode=%s%s%s", aMode.IsRxOnWhenIdle() ? "r" : "", aMode.IsFullThreadDevice() ? "d" : "",
aMode.IsFullNetworkData() ? "n" : "");
(aMode.GetNetworkDataType() == NetworkData::kFullSet) ? "n" : "");
}
void Otns::EmitCoapSend(const Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo)
+1 -1
View File
@@ -129,7 +129,7 @@ static void Init(void)
SuccessOrQuit(message->AppendBytes(mockNetworkData, sizeof(mockNetworkData)));
IgnoreError(sInstance->Get<NetworkData::Leader>().SetNetworkData(0, 0, true, *message, 0));
IgnoreError(sInstance->Get<NetworkData::Leader>().SetNetworkData(0, 0, NetworkData::kStableSubset, *message, 0));
}
/**