mirror of
https://github.com/espressif/openthread.git
synced 2026-08-06 18:57:47 +00:00
[netdiag] introduce types for diagnostic TLV data structures (#11897)
This commit introduces new types `otNetworkDiagData`, `otNetworkDiagIp6AddrList`, and `otNetworkDiagChildTable` to represent common data structures within Network Diagnostic TLVs. These new types replace the previous anonymous structs within the `otNetworkDiagTlv` union, improving code structure and readability. The `mNetworkData`, `mIp6AddrList`, `mChildTable`, and `mChannelPages` fields now use these named types.
This commit is contained in:
@@ -52,7 +52,7 @@ extern "C" {
|
||||
*
|
||||
* @note This number versions both OpenThread platform and user APIs.
|
||||
*/
|
||||
#define OPENTHREAD_API_VERSION (533)
|
||||
#define OPENTHREAD_API_VERSION (534)
|
||||
|
||||
/**
|
||||
* @addtogroup api-instance
|
||||
|
||||
@@ -98,6 +98,24 @@ extern "C" {
|
||||
|
||||
typedef uint16_t otNetworkDiagIterator; ///< Used to iterate through Network Diagnostic TLV.
|
||||
|
||||
/**
|
||||
* Represents a Network Diagnostics IPv6 Address List TLV value.
|
||||
*/
|
||||
typedef struct otNetworkDiagIp6AddrList
|
||||
{
|
||||
uint8_t mCount; ///< Number of IPv6 addresses.
|
||||
otIp6Address mList[OT_NETWORK_BASE_TLV_MAX_LENGTH / sizeof(otIp6Address)]; ///< Array of IPv6 addresses.
|
||||
} otNetworkDiagIp6AddrList;
|
||||
|
||||
/**
|
||||
* Represents a Network Diagnostic TLV Data.
|
||||
*/
|
||||
typedef struct otNetworkDiagData
|
||||
{
|
||||
uint8_t mCount; ///< Number of bytes in the data.
|
||||
uint8_t m8[OT_NETWORK_BASE_TLV_MAX_LENGTH]; ///< Array containing the data bytes.
|
||||
} otNetworkDiagData;
|
||||
|
||||
/**
|
||||
* Represents a Network Diagnostic Connectivity value.
|
||||
*/
|
||||
@@ -234,6 +252,15 @@ typedef struct otNetworkDiagChildEntry
|
||||
otLinkModeConfig mMode; ///< Link mode.
|
||||
} otNetworkDiagChildEntry;
|
||||
|
||||
/**
|
||||
* Represents a Network Diagnostic Child Table TLV value.
|
||||
*/
|
||||
typedef struct otNetworkDiagChildTable
|
||||
{
|
||||
uint8_t mCount; ///< Number of child entries in the table.
|
||||
otNetworkDiagChildEntry mTable[OT_NETWORK_BASE_TLV_MAX_LENGTH / sizeof(otNetworkDiagChildEntry)]; ///< Child table.
|
||||
} otNetworkDiagChildTable;
|
||||
|
||||
/**
|
||||
* Represents a Network Diagnostic TLV.
|
||||
*/
|
||||
@@ -252,6 +279,8 @@ typedef struct otNetworkDiagTlv
|
||||
otNetworkDiagRoute mRoute;
|
||||
otNetworkDiagEnhRoute mEnhRoute;
|
||||
otLeaderData mLeaderData;
|
||||
otNetworkDiagData mNetworkData;
|
||||
otNetworkDiagIp6AddrList mIp6AddrList;
|
||||
otNetworkDiagMacCounters mMacCounters;
|
||||
otNetworkDiagMleCounters mMleCounters;
|
||||
uint8_t mBatteryLevel;
|
||||
@@ -264,26 +293,8 @@ typedef struct otNetworkDiagTlv
|
||||
char mThreadStackVersion[OT_NETWORK_DIAGNOSTIC_MAX_THREAD_STACK_VERSION_TLV_LENGTH + 1];
|
||||
char mVendorAppUrl[OT_NETWORK_DIAGNOSTIC_MAX_VENDOR_APP_URL_TLV_LENGTH + 1];
|
||||
otChannelMask mNonPreferredChannels;
|
||||
struct
|
||||
{
|
||||
uint8_t mCount;
|
||||
uint8_t m8[OT_NETWORK_BASE_TLV_MAX_LENGTH];
|
||||
} mNetworkData;
|
||||
struct
|
||||
{
|
||||
uint8_t mCount;
|
||||
otIp6Address mList[OT_NETWORK_BASE_TLV_MAX_LENGTH / sizeof(otIp6Address)];
|
||||
} mIp6AddrList;
|
||||
struct
|
||||
{
|
||||
uint8_t mCount;
|
||||
otNetworkDiagChildEntry mTable[OT_NETWORK_BASE_TLV_MAX_LENGTH / sizeof(otNetworkDiagChildEntry)];
|
||||
} mChildTable;
|
||||
struct
|
||||
{
|
||||
uint8_t mCount;
|
||||
uint8_t m8[OT_NETWORK_BASE_TLV_MAX_LENGTH];
|
||||
} mChannelPages;
|
||||
otNetworkDiagData mChannelPages;
|
||||
otNetworkDiagChildTable mChildTable;
|
||||
} mData;
|
||||
} otNetworkDiagTlv;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user