[netdiag] rename namespace NetworkDiagnostic to NetDiag (#13154)

This commit renames the `NetworkDiagnostic` namespace in `src/core/thread/`
and its related types to `NetDiag` for brevity. It updates the
corresponding filenames and header guards as well.
This commit is contained in:
Abtin Keshavarzian
2026-05-26 20:19:48 -07:00
committed by GitHub
parent 337d424d4f
commit 3ce616d835
26 changed files with 159 additions and 173 deletions
+7 -7
View File
@@ -733,6 +733,12 @@ openthread_core_files = [
"thread/neighbor.hpp",
"thread/neighbor_table.cpp",
"thread/neighbor_table.hpp",
"thread/net_diag.cpp",
"thread/net_diag.hpp",
"thread/net_diag_tlvs.cpp",
"thread/net_diag_tlvs.hpp",
"thread/net_diag_types.cpp",
"thread/net_diag_types.hpp",
"thread/network_data.cpp",
"thread/network_data.hpp",
"thread/network_data_leader.cpp",
@@ -750,12 +756,6 @@ openthread_core_files = [
"thread/network_data_tlvs.hpp",
"thread/network_data_types.cpp",
"thread/network_data_types.hpp",
"thread/network_diagnostic.cpp",
"thread/network_diagnostic.hpp",
"thread/network_diagnostic_tlvs.cpp",
"thread/network_diagnostic_tlvs.hpp",
"thread/network_diagnostic_types.cpp",
"thread/network_diagnostic_types.hpp",
"thread/panid_query_server.cpp",
"thread/panid_query_server.hpp",
"thread/peer.cpp",
@@ -908,8 +908,8 @@ source_set("libopenthread_core_config") {
"config/misc.h",
"config/mle.h",
"config/nat64.h",
"config/net_diag.h",
"config/netdata_publisher.h",
"config/network_diagnostic.h",
"config/openthread-core-config-check.h",
"config/p2p.h",
"config/parent_search.h",
+3 -3
View File
@@ -257,6 +257,9 @@ set(COMMON_SOURCES
thread/mlr_types.cpp
thread/neighbor.cpp
thread/neighbor_table.cpp
thread/net_diag.cpp
thread/net_diag_tlvs.cpp
thread/net_diag_types.cpp
thread/network_data.cpp
thread/network_data_leader.cpp
thread/network_data_leader_ftd.cpp
@@ -266,9 +269,6 @@ set(COMMON_SOURCES
thread/network_data_service.cpp
thread/network_data_tlvs.cpp
thread/network_data_types.cpp
thread/network_diagnostic.cpp
thread/network_diagnostic_tlvs.cpp
thread/network_diagnostic_types.cpp
thread/panid_query_server.cpp
thread/peer.cpp
thread/peer_table.cpp
+8 -8
View File
@@ -46,7 +46,7 @@ otError otThreadGetNextDiagnosticTlv(const otMessage *aMessage,
AssertPointerIsNotNull(aIterator);
AssertPointerIsNotNull(aNetworkDiagTlv);
return NetworkDiagnostic::Client::GetNextDiagTlv(AsCoapMessage(aMessage), *aIterator, *aNetworkDiagTlv);
return NetDiag::Client::GetNextDiagTlv(AsCoapMessage(aMessage), *aIterator, *aNetworkDiagTlv);
}
otError otThreadSendDiagnosticGet(otInstance *aInstance,
@@ -56,8 +56,8 @@ otError otThreadSendDiagnosticGet(otInstance *aInstance,
otReceiveDiagnosticGetCallback aCallback,
void *aCallbackContext)
{
return AsCoreType(aInstance).Get<NetworkDiagnostic::Client>().SendDiagnosticGet(
AsCoreType(aDestination), aTlvTypes, aCount, aCallback, aCallbackContext);
return AsCoreType(aInstance).Get<NetDiag::Client>().SendDiagnosticGet(AsCoreType(aDestination), aTlvTypes, aCount,
aCallback, aCallbackContext);
}
otError otThreadSendDiagnosticReset(otInstance *aInstance,
@@ -65,8 +65,8 @@ otError otThreadSendDiagnosticReset(otInstance *aInstance,
const uint8_t aTlvTypes[],
uint8_t aCount)
{
return AsCoreType(aInstance).Get<NetworkDiagnostic::Client>().SendDiagnosticReset(AsCoreType(aDestination),
aTlvTypes, aCount);
return AsCoreType(aInstance).Get<NetDiag::Client>().SendDiagnosticReset(AsCoreType(aDestination), aTlvTypes,
aCount);
}
#endif // OPENTHREAD_CONFIG_TMF_NETDIAG_CLIENT_ENABLE
@@ -118,17 +118,17 @@ otError otThreadSetVendorOui(otInstance *aInstance, uint32_t aVendorOui)
void otThreadSetNonPreferredChannels(otInstance *aInstance, otChannelMask aChannelMask)
{
return AsCoreType(aInstance).Get<NetworkDiagnostic::Server>().SetNonPreferredChannels(aChannelMask);
return AsCoreType(aInstance).Get<NetDiag::Server>().SetNonPreferredChannels(aChannelMask);
}
otChannelMask otThreadGetNonPreferredChannels(otInstance *aInstance)
{
return AsCoreType(aInstance).Get<NetworkDiagnostic::Server>().GetNonPreferredChannels();
return AsCoreType(aInstance).Get<NetDiag::Server>().GetNonPreferredChannels();
}
void otThreadSetNonPreferredChannelsResetCallback(otInstance *aInstance,
otThreadNonPreferredChannelsResetCallback aCallback,
void *aContext)
{
AsCoreType(aInstance).Get<NetworkDiagnostic::Server>().SetNonPreferredChannelsResetCallback(aCallback, aContext);
AsCoreType(aInstance).Get<NetDiag::Server>().SetNonPreferredChannelsResetCallback(aCallback, aContext);
}
@@ -31,8 +31,8 @@
* This file includes compile-time configurations for the Network Diagnostics.
*/
#ifndef OT_CORE_CONFIG_NETWORK_DIAGNOSTIC_H_
#define OT_CORE_CONFIG_NETWORK_DIAGNOSTIC_H_
#ifndef OT_CORE_CONFIG_NET_DIAG_H_
#define OT_CORE_CONFIG_NET_DIAG_H_
/**
* @addtogroup config-network-diagnostic
@@ -122,4 +122,4 @@
* @}
*/
#endif // OT_CORE_CONFIG_NETWORK_DIAGNOSTIC_H_
#endif // OT_CORE_CONFIG_NET_DIAG_H_
+2 -2
View File
@@ -170,9 +170,9 @@ Instance::Instance(void)
#endif
, mNetworkDataServiceManager(*this)
, mVendorInfo(*this)
, mNetworkDiagnosticServer(*this)
, mNetDiagServer(*this)
#if OPENTHREAD_CONFIG_TMF_NETDIAG_CLIENT_ENABLE
, mNetworkDiagnosticClient(*this)
, mNetDiagClient(*this)
#endif
#if OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE
, mBorderAgentTxtData(*this)
+5 -5
View File
@@ -137,11 +137,11 @@
#include "thread/message_framer.hpp"
#include "thread/mle.hpp"
#include "thread/mlr_manager.hpp"
#include "thread/net_diag.hpp"
#include "thread/network_data_local.hpp"
#include "thread/network_data_notifier.hpp"
#include "thread/network_data_publisher.hpp"
#include "thread/network_data_service.hpp"
#include "thread/network_diagnostic.hpp"
#include "thread/panid_query_server.hpp"
#include "thread/radio_selector.hpp"
#include "thread/thread_netif.hpp"
@@ -711,9 +711,9 @@ private:
VendorInfo mVendorInfo;
NetworkDiagnostic::Server mNetworkDiagnosticServer;
NetDiag::Server mNetDiagServer;
#if OPENTHREAD_CONFIG_TMF_NETDIAG_CLIENT_ENABLE
NetworkDiagnostic::Client mNetworkDiagnosticClient;
NetDiag::Client mNetDiagClient;
#endif
#if OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE
@@ -1128,10 +1128,10 @@ template <> inline Dns::Multicast::Core &Instance::Get(void) { return mMdnsCore;
template <> inline VendorInfo &Instance::Get(void) { return mVendorInfo; }
template <> inline NetworkDiagnostic::Server &Instance::Get(void) { return mNetworkDiagnosticServer; }
template <> inline NetDiag::Server &Instance::Get(void) { return mNetDiagServer; }
#if OPENTHREAD_CONFIG_TMF_NETDIAG_CLIENT_ENABLE
template <> inline NetworkDiagnostic::Client &Instance::Get(void) { return mNetworkDiagnosticClient; }
template <> inline NetDiag::Client &Instance::Get(void) { return mNetDiagClient; }
#endif
#if OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE
+2 -3
View File
@@ -39,7 +39,7 @@
#include "common/error.hpp"
#include "crypto/storage.hpp"
#include "instance/instance.hpp"
#include "thread/network_diagnostic.hpp"
#include "thread/net_diag.hpp"
namespace ot {
namespace MeshCoP {
@@ -626,8 +626,7 @@ Error TcatAgent::HandleGetDiagnosticTlvs(const Message &aIncomingMessage,
extTlv.SetLength(0);
SuccessOrExit(error = aOutgoingMessage.Append(extTlv));
error =
Get<NetworkDiagnostic::Server>().AppendRequestedTlvsForTcat(aIncomingMessage, aOutgoingMessage, aOffsetRange);
error = Get<NetDiag::Server>().AppendRequestedTlvsForTcat(aIncomingMessage, aOutgoingMessage, aOffsetRange);
// Ensure enough message buffers are left for transmission of the result. Report error otherwise.
if (Get<MessagePool>().GetFreeBufferCount() < kBufferReserve)
+1 -1
View File
@@ -97,8 +97,8 @@
#include "config/misc.h"
#include "config/mle.h"
#include "config/nat64.h"
#include "config/net_diag.h"
#include "config/netdata_publisher.h"
#include "config/network_diagnostic.h"
#include "config/p2p.h"
#include "config/parent_search.h"
#include "config/ping_sender.h"
@@ -31,7 +31,7 @@
* This file implements Thread's Network Diagnostic processing.
*/
#include "network_diagnostic.hpp"
#include "net_diag.hpp"
#include "instance/instance.hpp"
@@ -39,7 +39,7 @@ namespace ot {
RegisterLogModule("NetDiag");
namespace NetworkDiagnostic {
namespace NetDiag {
//---------------------------------------------------------------------------------------------------------------------
// Server
@@ -1338,6 +1338,6 @@ const char *Client::UriToString(Uri aUri)
#endif // OPENTHREAD_CONFIG_TMF_NETDIAG_CLIENT_ENABLE
} // namespace NetworkDiagnostic
} // namespace NetDiag
} // namespace ot
@@ -31,8 +31,8 @@
* This file includes definitions for handle network diagnostic.
*/
#ifndef OT_CORE_THREAD_NETWORK_DIAGNOSTIC_HPP_
#define OT_CORE_THREAD_NETWORK_DIAGNOSTIC_HPP_
#ifndef OT_CORE_THREAD_NET_DIAG_HPP_
#define OT_CORE_THREAD_NET_DIAG_HPP_
#include "openthread-core-config.h"
@@ -44,8 +44,8 @@
#include "common/non_copyable.hpp"
#include "common/numeric_limits.hpp"
#include "net/udp6.hpp"
#include "thread/network_diagnostic_tlvs.hpp"
#include "thread/network_diagnostic_types.hpp"
#include "thread/net_diag_tlvs.hpp"
#include "thread/net_diag_types.hpp"
#include "thread/tmf.hpp"
#include "thread/uri_paths.hpp"
@@ -59,7 +59,7 @@ namespace MeshCoP {
class TcatAgent;
}
namespace NetworkDiagnostic {
namespace NetDiag {
/**
* @addtogroup core-netdiag
@@ -303,8 +303,8 @@ DeclareTmfHandler(Client, kUriDiagnosticReset);
/**
* @}
*/
} // namespace NetworkDiagnostic
} // namespace NetDiag
} // namespace ot
#endif // OT_CORE_THREAD_NETWORK_DIAGNOSTIC_HPP_
#endif // OT_CORE_THREAD_NET_DIAG_HPP_
@@ -31,12 +31,12 @@
* This file implements methods for generating and processing Network Diagnostics TLVs.
*/
#include "network_diagnostic_tlvs.hpp"
#include "net_diag_tlvs.hpp"
#include "common/time.hpp"
namespace ot {
namespace NetworkDiagnostic {
namespace NetDiag {
//---------------------------------------------------------------------------------------------------------------------
// ChildTableTlvEntry
@@ -292,5 +292,5 @@ void MleCountersTlv::Read(MleCounters &aDiagMleCounters) const
aDiagMleCounters.mLeaderTime = BigEndian::HostSwap64(mLeaderTime);
}
} // namespace NetworkDiagnostic
} // namespace NetDiag
} // namespace ot
@@ -31,8 +31,8 @@
* This file includes definitions for generating and processing Network Diagnostics TLVs.
*/
#ifndef OT_CORE_THREAD_NETWORK_DIAGNOSTIC_TLVS_HPP_
#define OT_CORE_THREAD_NETWORK_DIAGNOSTIC_TLVS_HPP_
#ifndef OT_CORE_THREAD_NET_DIAG_TLVS_HPP_
#define OT_CORE_THREAD_NET_DIAG_TLVS_HPP_
#include "openthread-core-config.h"
@@ -54,7 +54,7 @@
#include "thread/router.hpp"
namespace ot {
namespace NetworkDiagnostic {
namespace NetDiag {
/**
* Implements Network Diagnostic TLV generation and parsing.
@@ -299,7 +299,7 @@ typedef TlvInfo<Tlv::kConnectivity> ConnectivityTlv;
class RouteTlv : public Mle::RouteTlv
{
public:
static constexpr uint8_t kType = ot::NetworkDiagnostic::Tlv::kRoute; ///< The TLV Type value.
static constexpr uint8_t kType = ot::NetDiag::Tlv::kRoute; ///< The TLV Type value.
/**
* Finds and parses a Route TLV in a given message.
@@ -354,7 +354,7 @@ public:
/**
* Reads the counters from TLV.
*
* @param[out] aDiagMacCounters A reference to `NetworkDiagnostic::MacCounters` to populate.
* @param[out] aDiagMacCounters A reference to `NetDiag::MacCounters` to populate.
*/
void Read(MacCounters &aDiagMacCounters) const;
@@ -895,7 +895,7 @@ public:
*
* Reads the counters from TLV.
*
* @param[out] aDiagMleCounters A reference to `NetworkDiagnostic::MleCounters` to populate.
* @param[out] aDiagMleCounters A reference to `NetDiag::MleCounters` to populate.
*/
void Read(MleCounters &aDiagMleCounters) const;
@@ -917,10 +917,10 @@ private:
uint64_t mLeaderTime; // Milliseconds device has been in leader role.
} OT_TOOL_PACKED_END;
} // namespace NetworkDiagnostic
} // namespace NetDiag
DefineCoreType(otNetworkDiagConnectivity, NetworkDiagnostic::Connectivity);
DefineCoreType(otNetworkDiagConnectivity, NetDiag::Connectivity);
} // namespace ot
#endif // OT_CORE_THREAD_NETWORK_DIAGNOSTIC_TLVS_HPP_
#endif // OT_CORE_THREAD_NET_DIAG_TLVS_HPP_
@@ -31,12 +31,12 @@
* This file implements methods for Network Diagnostics helper types and classes.
*/
#include "network_diagnostic_types.hpp"
#include "net_diag_types.hpp"
#include "instance/instance.hpp"
namespace ot {
namespace NetworkDiagnostic {
namespace NetDiag {
AnswerBuilder::AnswerBuilder(Instance &aInstance)
: InstanceLocator(aInstance)
@@ -104,5 +104,5 @@ exit:
return error;
}
} // namespace NetworkDiagnostic
} // namespace NetDiag
} // namespace ot
@@ -31,12 +31,12 @@
* This file includes definitions for Network Diagnostics helper types and classes.
*/
#ifndef OT_CORE_THREAD_NETWORK_DIAGNOSTIC_TYPES_HPP_
#define OT_CORE_THREAD_NETWORK_DIAGNOSTIC_TYPES_HPP_
#ifndef OT_CORE_THREAD_NET_DIAG_TYPES_HPP_
#define OT_CORE_THREAD_NET_DIAG_TYPES_HPP_
#include "openthread-core-config.h"
#include "network_diagnostic_tlvs.hpp"
#include "net_diag_tlvs.hpp"
#include "coap/coap_message.hpp"
#include "common/error.hpp"
#include "common/locator.hpp"
@@ -44,7 +44,7 @@
#include "thread/uri_paths.hpp"
namespace ot {
namespace NetworkDiagnostic {
namespace NetDiag {
/**
* Represents an object for tracking and managing Network Diagnostic answer messages.
@@ -133,7 +133,7 @@ private:
Message::Priority mPriority;
};
} // namespace NetworkDiagnostic
} // namespace NetDiag
} // namespace ot
#endif // OT_CORE_THREAD_NETWORK_DIAGNOSTIC_TYPES_HPP_
#endif // OT_CORE_THREAD_NET_DIAG_TYPES_HPP_
+4 -4
View File
@@ -131,12 +131,12 @@ bool Agent::HandleResource(const char *aUriPath, Msg &aMsg)
Case(kUriAnycastLocate, AnycastLocator);
#endif
Case(kUriDiagnosticGetRequest, NetworkDiagnostic::Server);
Case(kUriDiagnosticGetQuery, NetworkDiagnostic::Server);
Case(kUriDiagnosticReset, NetworkDiagnostic::Server);
Case(kUriDiagnosticGetRequest, NetDiag::Server);
Case(kUriDiagnosticGetQuery, NetDiag::Server);
Case(kUriDiagnosticReset, NetDiag::Server);
#if OPENTHREAD_CONFIG_TMF_NETDIAG_CLIENT_ENABLE
Case(kUriDiagnosticGetAnswer, NetworkDiagnostic::Client);
Case(kUriDiagnosticGetAnswer, NetDiag::Client);
#endif
#if OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE && OPENTHREAD_CONFIG_HISTORY_TRACKER_SERVER_ENABLE
+5 -5
View File
@@ -41,7 +41,7 @@
#include "common/error.hpp"
#include "common/locator.hpp"
#include "common/non_copyable.hpp"
#include "thread/network_diagnostic_tlvs.hpp"
#include "thread/net_diag_tlvs.hpp"
namespace ot {
@@ -177,10 +177,10 @@ private:
static constexpr uint32_t kOuiMask = 0xffffff;
// String buffer types (max size specified by corresponding TLV)
typedef NetworkDiagnostic::VendorNameTlv::StringType NameStringType;
typedef NetworkDiagnostic::VendorModelTlv::StringType ModelStringType;
typedef NetworkDiagnostic::VendorSwVersionTlv::StringType SwVersionStringType;
typedef NetworkDiagnostic::VendorAppUrlTlv::StringType AppUrlStringType;
typedef NetDiag::VendorNameTlv::StringType NameStringType;
typedef NetDiag::VendorModelTlv::StringType ModelStringType;
typedef NetDiag::VendorSwVersionTlv::StringType SwVersionStringType;
typedef NetDiag::VendorAppUrlTlv::StringType AppUrlStringType;
static const char kName[];
static const char kModel[];
+2 -2
View File
@@ -42,7 +42,7 @@
#include "common/encoding.hpp"
#include "common/tlvs.hpp"
#include "thread/network_diagnostic_tlvs.hpp"
#include "thread/net_diag_tlvs.hpp"
#include "utils/history_tracker.hpp"
namespace ot {
@@ -75,7 +75,7 @@ typedef UintTlvInfo<Tlv::kQueryId, uint16_t> QueryIdTlv;
/**
* Represents an Answer TLV value.
*/
typedef NetworkDiagnostic::AnswerTlvValue AnswerTlvValue;
typedef NetDiag::AnswerTlvValue AnswerTlvValue;
/**
* Defines Answer TLV constants and types.
+1 -1
View File
@@ -40,7 +40,7 @@
namespace ot {
namespace Utils {
using namespace NetworkDiagnostic;
using namespace NetDiag;
RegisterLogModule("MeshDiag");
+6 -6
View File
@@ -49,8 +49,8 @@
#include "common/message.hpp"
#include "common/timer.hpp"
#include "net/ip6_address.hpp"
#include "thread/network_diagnostic.hpp"
#include "thread/network_diagnostic_tlvs.hpp"
#include "thread/net_diag.hpp"
#include "thread/net_diag_tlvs.hpp"
#include "thread/tmf.hpp"
struct otMeshDiagIp6AddrIterator
@@ -69,7 +69,7 @@ namespace Utils {
*/
class MeshDiag : public InstanceLocator
{
friend class ot::NetworkDiagnostic::Client;
friend class ot::NetDiag::Client;
public:
static constexpr uint16_t kVersionUnknown = OT_MESH_DIAG_VERSION_UNKNOWN; ///< Unknown version.
@@ -242,7 +242,7 @@ public:
void Cancel(void);
private:
typedef ot::NetworkDiagnostic::Tlv Tlv;
typedef ot::NetDiag::Tlv Tlv;
static constexpr uint32_t kResponseTimeout = OPENTHREAD_CONFIG_MESH_DIAG_RESPONSE_TIMEOUT;
static constexpr uint32_t kMinResponseTimeout = 50;
@@ -286,7 +286,7 @@ private:
friend class MeshDiag;
private:
void SetFrom(const NetworkDiagnostic::ChildTlvValue &aChildTlvValue);
void SetFrom(const NetDiag::ChildTlvValue &aChildTlvValue);
};
class RouterNeighborEntry : public otMeshDiagRouterNeighborEntry
@@ -294,7 +294,7 @@ private:
friend class MeshDiag;
private:
void SetFrom(const NetworkDiagnostic::RouterNeighborTlvValue &aTlvValue);
void SetFrom(const NetDiag::RouterNeighborTlvValue &aTlvValue);
};
Error SendQuery(uint16_t aRloc16, const uint8_t *aTlvs, uint8_t aTlvsLength);