From 79757a69f68808899128ffdbea3efe641ea91c01 Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Mon, 25 Apr 2022 06:19:38 -0700 Subject: [PATCH] [meshcop] remove unnecessary `MeshCoP::` qualifier (#7628) --- src/core/meshcop/border_agent.cpp | 2 +- src/core/meshcop/commissioner.cpp | 12 ++++++------ src/core/meshcop/dataset.cpp | 5 ++--- src/core/meshcop/dataset.hpp | 4 ++-- src/core/meshcop/dataset_manager.cpp | 8 ++++---- src/core/meshcop/dataset_manager_ftd.cpp | 4 ++-- src/core/meshcop/dataset_updater.cpp | 16 ++++++++-------- src/core/meshcop/dataset_updater.hpp | 2 +- src/core/meshcop/dtls.cpp | 6 +++--- src/core/meshcop/joiner.cpp | 2 +- src/core/meshcop/joiner_router.cpp | 4 ++-- src/core/meshcop/meshcop.cpp | 8 ++++---- src/core/meshcop/meshcop.hpp | 8 ++++---- src/core/meshcop/meshcop_tlvs.cpp | 8 ++++---- src/core/meshcop/meshcop_tlvs.hpp | 8 ++++---- 15 files changed, 48 insertions(+), 49 deletions(-) diff --git a/src/core/meshcop/border_agent.cpp b/src/core/meshcop/border_agent.cpp index 8bde4b8ee..1e5883e1c 100644 --- a/src/core/meshcop/border_agent.cpp +++ b/src/core/meshcop/border_agent.cpp @@ -303,7 +303,7 @@ void BorderAgent::HandleNotifierEvents(Events aEvents) VerifyOrExit(aEvents.ContainsAny(kEventThreadRoleChanged | kEventCommissionerStateChanged)); #if OPENTHREAD_CONFIG_COMMISSIONER_ENABLE && OPENTHREAD_FTD - VerifyOrExit(Get().IsDisabled()); + VerifyOrExit(Get().IsDisabled()); #endif if (Get().IsAttached()) diff --git a/src/core/meshcop/commissioner.cpp b/src/core/meshcop/commissioner.cpp index 500041bf0..a15d991a8 100644 --- a/src/core/meshcop/commissioner.cpp +++ b/src/core/meshcop/commissioner.cpp @@ -304,7 +304,7 @@ Error Commissioner::Start(StateCallback aStateCallback, JoinerCallback aJoinerCa VerifyOrExit(mState == kStateDisabled, error = kErrorAlready); #if OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE - Get().Stop(); + Get().Stop(); #endif SuccessOrExit(error = Get().Start(SendRelayTransmit, this)); @@ -359,7 +359,7 @@ Error Commissioner::Stop(ResignMode aResignMode) } #if OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE - Get().Start(); + Get().Start(); #endif exit: @@ -687,7 +687,7 @@ Error Commissioner::SendMgmtCommissionerGetRequest(const uint8_t *aTlvs, uint8_t Error error = kErrorNone; Coap::Message * message; Tmf::MessageInfo messageInfo(GetInstance()); - MeshCoP::Tlv tlv; + Tlv tlv; VerifyOrExit((message = Get().NewPriorityMessage()) != nullptr, error = kErrorNoBufs); @@ -700,7 +700,7 @@ Error Commissioner::SendMgmtCommissionerGetRequest(const uint8_t *aTlvs, uint8_t if (aLength > 0) { - tlv.SetType(MeshCoP::Tlv::kGet); + tlv.SetType(Tlv::kGet); tlv.SetLength(aLength); SuccessOrExit(error = message->Append(tlv)); SuccessOrExit(error = message->AppendBytes(aTlvs, aLength)); @@ -752,12 +752,12 @@ Error Commissioner::SendMgmtCommissionerSetRequest(const Dataset &aDataset, cons if (aDataset.IsLocatorSet()) { - SuccessOrExit(error = Tlv::Append(*message, aDataset.GetLocator())); + SuccessOrExit(error = Tlv::Append(*message, aDataset.GetLocator())); } if (aDataset.IsSessionIdSet()) { - SuccessOrExit(error = Tlv::Append(*message, aDataset.GetSessionId())); + SuccessOrExit(error = Tlv::Append(*message, aDataset.GetSessionId())); } if (aDataset.IsSteeringDataSet()) diff --git a/src/core/meshcop/dataset.cpp b/src/core/meshcop/dataset.cpp index ad6adec48..74d9a0919 100644 --- a/src/core/meshcop/dataset.cpp +++ b/src/core/meshcop/dataset.cpp @@ -555,12 +555,11 @@ Error Dataset::ApplyConfiguration(Instance &aInstance, bool *aIsNetworkKeyUpdate break; case Tlv::kExtendedPanId: - aInstance.Get().SetExtPanId(As(cur)->GetExtendedPanId()); + aInstance.Get().SetExtPanId(As(cur)->GetExtendedPanId()); break; case Tlv::kNetworkName: - IgnoreError( - aInstance.Get().SetNetworkName(As(cur)->GetNetworkName())); + IgnoreError(aInstance.Get().SetNetworkName(As(cur)->GetNetworkName())); break; case Tlv::kNetworkKey: diff --git a/src/core/meshcop/dataset.hpp b/src/core/meshcop/dataset.hpp index 36b08fe17..5990a4896 100644 --- a/src/core/meshcop/dataset.hpp +++ b/src/core/meshcop/dataset.hpp @@ -339,7 +339,7 @@ public: * @returns The Extended PAN ID in the Dataset. * */ - const MeshCoP::ExtendedPanId &GetExtendedPanId(void) const { return AsCoreType(&mExtendedPanId); } + const ExtendedPanId &GetExtendedPanId(void) const { return AsCoreType(&mExtendedPanId); } /** * This method sets the Extended PAN ID in the Dataset. @@ -347,7 +347,7 @@ public: * @param[in] aExtendedPanId An Extended PAN ID. * */ - void SetExtendedPanId(const MeshCoP::ExtendedPanId &aExtendedPanId) + void SetExtendedPanId(const ExtendedPanId &aExtendedPanId) { mExtendedPanId = aExtendedPanId; mComponents.mIsExtendedPanIdPresent = true; diff --git a/src/core/meshcop/dataset_manager.cpp b/src/core/meshcop/dataset_manager.cpp index 1c00ea8c9..b0bf93ce4 100644 --- a/src/core/meshcop/dataset_manager.cpp +++ b/src/core/meshcop/dataset_manager.cpp @@ -227,10 +227,10 @@ void DatasetManager::SignalDatasetChange(void) const Error DatasetManager::GetChannelMask(Mac::ChannelMask &aChannelMask) const { - Error error; - const MeshCoP::ChannelMaskTlv *channelMaskTlv; - uint32_t mask; - Dataset dataset; + Error error; + const ChannelMaskTlv *channelMaskTlv; + uint32_t mask; + Dataset dataset; SuccessOrExit(error = Read(dataset)); diff --git a/src/core/meshcop/dataset_manager_ftd.cpp b/src/core/meshcop/dataset_manager_ftd.cpp index 7893bcc30..da57c5f03 100644 --- a/src/core/meshcop/dataset_manager_ftd.cpp +++ b/src/core/meshcop/dataset_manager_ftd.cpp @@ -334,7 +334,7 @@ Error ActiveDataset::GenerateLocal(void) if (dataset.GetTlv() == nullptr) { - IgnoreError(dataset.SetTlv(Tlv::kExtendedPanId, Get().GetExtPanId())); + IgnoreError(dataset.SetTlv(Tlv::kExtendedPanId, Get().GetExtPanId())); } if (dataset.GetTlv() == nullptr) @@ -352,7 +352,7 @@ Error ActiveDataset::GenerateLocal(void) if (dataset.GetTlv() == nullptr) { - MeshCoP::NameData nameData = Get().GetNetworkName().GetAsData(); + NameData nameData = Get().GetNetworkName().GetAsData(); IgnoreError(dataset.SetTlv(Tlv::kNetworkName, nameData.GetBuffer(), nameData.GetLength())); } diff --git a/src/core/meshcop/dataset_updater.cpp b/src/core/meshcop/dataset_updater.cpp index c3c97662d..c1ca78e90 100644 --- a/src/core/meshcop/dataset_updater.cpp +++ b/src/core/meshcop/dataset_updater.cpp @@ -54,7 +54,7 @@ DatasetUpdater::DatasetUpdater(Instance &aInstance) { } -Error DatasetUpdater::RequestUpdate(const MeshCoP::Dataset::Info &aDataset, Callback aCallback, void *aContext) +Error DatasetUpdater::RequestUpdate(const Dataset::Info &aDataset, Callback aCallback, void *aContext) { Error error = kErrorNone; Message *message = nullptr; @@ -105,9 +105,9 @@ void DatasetUpdater::HandleTimer(void) void DatasetUpdater::PreparePendingDataset(void) { - Dataset dataset; - MeshCoP::Dataset::Info requestedDataset; - Error error; + Dataset dataset; + Dataset::Info requestedDataset; + Error error; VerifyOrExit(!Get().IsDisabled(), error = kErrorInvalidState); @@ -178,8 +178,8 @@ void DatasetUpdater::Finish(Error aError) void DatasetUpdater::HandleNotifierEvents(Events aEvents) { - MeshCoP::Dataset::Info requestedDataset; - MeshCoP::Dataset::Info dataset; + Dataset::Info requestedDataset; + Dataset::Info dataset; VerifyOrExit(mDataset != nullptr); @@ -187,7 +187,7 @@ void DatasetUpdater::HandleNotifierEvents(Events aEvents) IgnoreError(mDataset->Read(0, requestedDataset)); - if (aEvents.Contains(kEventActiveDatasetChanged) && Get().Read(dataset) == kErrorNone) + if (aEvents.Contains(kEventActiveDatasetChanged) && Get().Read(dataset) == kErrorNone) { if (requestedDataset.IsSubsetOf(dataset)) { @@ -199,7 +199,7 @@ void DatasetUpdater::HandleNotifierEvents(Events aEvents) } } - if (aEvents.Contains(kEventPendingDatasetChanged) && Get().Read(dataset) == kErrorNone) + if (aEvents.Contains(kEventPendingDatasetChanged) && Get().Read(dataset) == kErrorNone) { if (!requestedDataset.IsSubsetOf(dataset)) { diff --git a/src/core/meshcop/dataset_updater.hpp b/src/core/meshcop/dataset_updater.hpp index cd7a806bb..b3b94c0c6 100644 --- a/src/core/meshcop/dataset_updater.hpp +++ b/src/core/meshcop/dataset_updater.hpp @@ -94,7 +94,7 @@ public: * @retval kErrorNoBufs Could not allocated buffer to save Dataset. * */ - Error RequestUpdate(const MeshCoP::Dataset::Info &aDataset, Callback aCallback, void *aContext); + Error RequestUpdate(const Dataset::Info &aDataset, Callback aCallback, void *aContext); /** * This method cancels an ongoing (if any) Operational Dataset update request. diff --git a/src/core/meshcop/dtls.cpp b/src/core/meshcop/dtls.cpp index aa2834500..7a558aa3d 100644 --- a/src/core/meshcop/dtls.cpp +++ b/src/core/meshcop/dtls.cpp @@ -176,10 +176,10 @@ void Dtls::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessageI { switch (mState) { - case MeshCoP::Dtls::kStateClosed: + case Dtls::kStateClosed: ExitNow(); - case MeshCoP::Dtls::kStateOpen: + case Dtls::kStateOpen: IgnoreError(mSocket.Connect(Ip6::SockAddr(aMessageInfo.GetPeerAddr(), aMessageInfo.GetPeerPort()))); mMessageInfo.SetPeerAddr(aMessageInfo.GetPeerAddr()); @@ -204,7 +204,7 @@ void Dtls::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessageI } #ifdef MBEDTLS_SSL_SRV_C - if (mState == MeshCoP::Dtls::kStateConnecting) + if (mState == Dtls::kStateConnecting) { IgnoreError(SetClientId(mMessageInfo.GetPeerAddr().mFields.m8, sizeof(mMessageInfo.GetPeerAddr().mFields))); } diff --git a/src/core/meshcop/joiner.cpp b/src/core/meshcop/joiner.cpp index 9d67941c4..33f7966ae 100644 --- a/src/core/meshcop/joiner.cpp +++ b/src/core/meshcop/joiner.cpp @@ -581,7 +581,7 @@ void Joiner::HandleJoinerEntrust(Coap::Message &aMessage, const Ip6::MessageInfo datasetInfo.SetChannel(Get().GetPanChannel()); datasetInfo.SetPanId(Get().GetPanId()); - IgnoreError(Get().Save(datasetInfo)); + IgnoreError(Get().Save(datasetInfo)); LogInfo("Joiner successful!"); diff --git a/src/core/meshcop/joiner_router.cpp b/src/core/meshcop/joiner_router.cpp index 48995b4ae..dff14114c 100644 --- a/src/core/meshcop/joiner_router.cpp +++ b/src/core/meshcop/joiner_router.cpp @@ -325,10 +325,10 @@ Coap::Message *JoinerRouter::PrepareJoinerEntrustMessage(void) Get().GetNetworkKey(networkKey); SuccessOrExit(error = Tlv::Append(*message, networkKey)); SuccessOrExit(error = Tlv::Append(*message, Get().GetMeshLocalPrefix())); - SuccessOrExit(error = Tlv::Append(*message, Get().GetExtPanId())); + SuccessOrExit(error = Tlv::Append(*message, Get().GetExtPanId())); networkName.Init(); - networkName.SetNetworkName(Get().GetNetworkName().GetAsData()); + networkName.SetNetworkName(Get().GetNetworkName().GetAsData()); SuccessOrExit(error = networkName.AppendTo(*message)); IgnoreError(Get().Read(dataset)); diff --git a/src/core/meshcop/meshcop.cpp b/src/core/meshcop/meshcop.cpp index cc53a3bfa..a61b0ae31 100644 --- a/src/core/meshcop/meshcop.cpp +++ b/src/core/meshcop/meshcop.cpp @@ -316,10 +316,10 @@ exit: } #if OPENTHREAD_FTD -Error GeneratePskc(const char * aPassPhrase, - const MeshCoP::NetworkName & aNetworkName, - const MeshCoP::ExtendedPanId &aExtPanId, - Pskc & aPskc) +Error GeneratePskc(const char * aPassPhrase, + const NetworkName & aNetworkName, + const ExtendedPanId &aExtPanId, + Pskc & aPskc) { Error error = kErrorNone; const char saltPrefix[] = "Thread"; diff --git a/src/core/meshcop/meshcop.hpp b/src/core/meshcop/meshcop.hpp index 96b8514d8..0de104702 100644 --- a/src/core/meshcop/meshcop.hpp +++ b/src/core/meshcop/meshcop.hpp @@ -420,10 +420,10 @@ private: * @retval kErrorInvalidArgs If the length of passphrase is out of range. * */ -Error GeneratePskc(const char * aPassPhrase, - const MeshCoP::NetworkName & aNetworkName, - const MeshCoP::ExtendedPanId &aExtPanId, - Pskc & aPskc); +Error GeneratePskc(const char * aPassPhrase, + const NetworkName & aNetworkName, + const ExtendedPanId &aExtPanId, + Pskc & aPskc); /** * This function computes the Joiner ID from a factory-assigned IEEE EUI-64. diff --git a/src/core/meshcop/meshcop_tlvs.cpp b/src/core/meshcop/meshcop_tlvs.cpp index 7c2708ad2..c047ed9f4 100644 --- a/src/core/meshcop/meshcop_tlvs.cpp +++ b/src/core/meshcop/meshcop_tlvs.cpp @@ -280,9 +280,9 @@ void ChannelMaskTlv::SetChannelMask(uint32_t aChannelMask) entry->SetChannelPage(OT_RADIO_CHANNEL_PAGE_2); entry->SetMask(aChannelMask & OT_RADIO_915MHZ_OQPSK_CHANNEL_MASK); - length += sizeof(MeshCoP::ChannelMaskEntry); + length += sizeof(ChannelMaskEntry); - entry = static_cast(entry->GetNext()); + entry = static_cast(entry->GetNext()); } #endif @@ -294,7 +294,7 @@ void ChannelMaskTlv::SetChannelMask(uint32_t aChannelMask) entry->SetChannelPage(OT_RADIO_CHANNEL_PAGE_0); entry->SetMask(aChannelMask & OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MASK); - length += sizeof(MeshCoP::ChannelMaskEntry); + length += sizeof(ChannelMaskEntry); } #endif @@ -306,7 +306,7 @@ void ChannelMaskTlv::SetChannelMask(uint32_t aChannelMask) entry->SetChannelPage(OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_PAGE); entry->SetMask(aChannelMask & OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_MASK); - length += sizeof(MeshCoP::ChannelMaskEntry); + length += sizeof(ChannelMaskEntry); } #endif diff --git a/src/core/meshcop/meshcop_tlvs.hpp b/src/core/meshcop/meshcop_tlvs.hpp index a7d264c73..ffe14a47d 100644 --- a/src/core/meshcop/meshcop_tlvs.hpp +++ b/src/core/meshcop/meshcop_tlvs.hpp @@ -447,7 +447,7 @@ private: * */ OT_TOOL_PACKED_BEGIN -class ExtendedPanIdTlv : public Tlv, public SimpleTlvInfo +class ExtendedPanIdTlv : public Tlv, public SimpleTlvInfo { public: /** @@ -475,7 +475,7 @@ public: * @returns The Extended PAN ID value. * */ - const MeshCoP::ExtendedPanId &GetExtendedPanId(void) const { return mExtendedPanId; } + const ExtendedPanId &GetExtendedPanId(void) const { return mExtendedPanId; } /** * This method sets the Extended PAN ID value. @@ -483,10 +483,10 @@ public: * @param[in] aExtendedPanId An Extended PAN ID value. * */ - void SetExtendedPanId(const MeshCoP::ExtendedPanId &aExtendedPanId) { mExtendedPanId = aExtendedPanId; } + void SetExtendedPanId(const ExtendedPanId &aExtendedPanId) { mExtendedPanId = aExtendedPanId; } private: - MeshCoP::ExtendedPanId mExtendedPanId; + ExtendedPanId mExtendedPanId; } OT_TOOL_PACKED_END; /**