[diag-tlvs] remove unused TLV types (#5215)

This commit removes unused simple `NetworkDiagnosticTlv` sub-types.
For simple TLVs we use helper method to directly parse/append the TLV
from/to a message, so the TLV sub-type class is not needed or used.
This commit is contained in:
Abtin Keshavarzian
2020-07-08 22:43:46 -07:00
committed by GitHub
parent 9acd16a1a2
commit 83d5bcf70b
-329
View File
@@ -118,194 +118,6 @@ public:
} OT_TOOL_PACKED_END;
/**
* This class implements Extended Address TLV generation and parsing.
*
*/
OT_TOOL_PACKED_BEGIN
class ExtMacAddressTlv : public NetworkDiagnosticTlv
{
public:
/**
* This method initializes the TLV.
*
*/
void Init(void)
{
SetType(kExtMacAddress);
SetLength(sizeof(*this) - sizeof(NetworkDiagnosticTlv));
}
/**
* This method indicates whether or not the TLV appears to be well-formed.
*
* @retval TRUE If the TLV appears to be well-formed.
* @retval FALSE If the TLV does not appear to be well-formed.
*
*/
bool IsValid(void) const { return GetLength() >= sizeof(*this) - sizeof(NetworkDiagnosticTlv); }
/**
* This method returns a pointer to the Extended MAC Address.
*
* @returns A pointer to the Extended MAC Address.
*
*/
const Mac::ExtAddress *GetMacAddr(void) const { return &mMacAddr; }
/**
* This method sets the Extended MAC Address.
*
* @param[in] aAddress A reference to the Extended MAC Address.
*
*/
void SetMacAddr(const Mac::ExtAddress &aAddress) { mMacAddr = aAddress; }
private:
Mac::ExtAddress mMacAddr;
} OT_TOOL_PACKED_END;
/**
* This class implements Source Address TLV generation and parsing.
*
*/
OT_TOOL_PACKED_BEGIN
class Address16Tlv : public NetworkDiagnosticTlv
{
public:
/**
* This method initializes the TLV.
*
*/
void Init(void)
{
SetType(kAddress16);
SetLength(sizeof(*this) - sizeof(NetworkDiagnosticTlv));
}
/**
* This method indicates whether or not the TLV appears to be well-formed.
*
* @retval TRUE If the TLV appears to be well-formed.
* @retval FALSE If the TLV does not appear to be well-formed.
*
*/
bool IsValid(void) const { return GetLength() >= sizeof(*this) - sizeof(NetworkDiagnosticTlv); }
/**
* This method returns the RLOC16 value.
*
* @returns The RLOC16 value.
*
*/
uint16_t GetRloc16(void) const { return HostSwap16(mRloc16); }
/**
* This method sets the RLOC16 value.
*
* @param[in] aRloc16 The RLOC16 value.
*
*/
void SetRloc16(uint16_t aRloc16) { mRloc16 = HostSwap16(aRloc16); }
private:
uint16_t mRloc16;
} OT_TOOL_PACKED_END;
/**
* This class implements Mode TLV generation and parsing.
*
*/
OT_TOOL_PACKED_BEGIN
class ModeTlv : public NetworkDiagnosticTlv
{
public:
/**
* This method initializes the TLV.
*
*/
void Init(void)
{
SetType(kMode);
SetLength(sizeof(*this) - sizeof(NetworkDiagnosticTlv));
}
/**
* This method indicates whether or not the TLV appears to be well-formed.
*
* @retval TRUE If the TLV appears to be well-formed.
* @retval FALSE If the TLV does not appear to be well-formed.
*
*/
bool IsValid(void) const { return GetLength() >= sizeof(*this) - sizeof(NetworkDiagnosticTlv); }
/**
* This method returns the Device Mode.
*
* @returns The Device Mode.
*
*/
Mle::DeviceMode GetMode(void) const { return Mle::DeviceMode(mMode); }
/**
* This method sets the Device Mode
*
* @param[in] aMode The Device Mode
*
*/
void SetMode(Mle::DeviceMode aMode) { mMode = aMode.Get(); }
private:
uint8_t mMode;
} OT_TOOL_PACKED_END;
/**
* This class implements Timeout TLV generation and parsing.
*
*/
OT_TOOL_PACKED_BEGIN
class TimeoutTlv : public NetworkDiagnosticTlv
{
public:
/**
* This method initializes the TLV.
*
*/
void Init(void)
{
SetType(kTimeout);
SetLength(sizeof(*this) - sizeof(NetworkDiagnosticTlv));
}
/**
* This method indicates whether or not the TLV appears to be well-formed.
*
* @retval TRUE If the TLV appears to be well-formed.
* @retval FALSE If the TLV does not appear to be well-formed.
*
*/
bool IsValid(void) const { return GetLength() >= sizeof(*this) - sizeof(NetworkDiagnosticTlv); }
/**
* This method returns the Timeout value.
*
* @returns The Timeout value.
*
*/
uint32_t GetTimeout(void) const { return HostSwap32(mTimeout); }
/**
* This method sets the Timeout value.
*
* @param[in] aTimeout The Timeout value.
*
*/
void SetTimeout(uint32_t aTimeout) { mTimeout = HostSwap32(aTimeout); }
private:
uint32_t mTimeout;
} OT_TOOL_PACKED_END;
/**
* This class implements Connectivity TLV generation and parsing.
*
@@ -1092,100 +904,6 @@ private:
uint32_t mIfOutDiscards;
} OT_TOOL_PACKED_END;
/**
* This class implements Battery Level TLV generation and parsing.
*
*/
OT_TOOL_PACKED_BEGIN
class BatteryLevelTlv : public NetworkDiagnosticTlv
{
public:
/**
* This method initializes the TLV.
*
*/
void Init(void)
{
SetType(kBatteryLevel);
SetLength(sizeof(*this) - sizeof(NetworkDiagnosticTlv));
}
/**
* This method indicates whether or not the TLV appears to be well-formed.
*
* @retval TRUE If the TLV appears to be well-formed.
* @retval FALSE If the TLV does not appear to be well-formed.
*
*/
bool IsValid(void) const { return GetLength() >= sizeof(*this) - sizeof(NetworkDiagnosticTlv); }
/**
* This method returns the Status value.
*
* @returns The Status value.
*
*/
uint8_t GetBatteryLevel(void) const { return mBatteryLevel; }
/**
* This method sets the Status value.
*
* @param[in] aStatus The Status value.
*
*/
void SetBatteryLevel(uint8_t aBatteryLevel) { mBatteryLevel = aBatteryLevel; }
private:
uint8_t mBatteryLevel;
} OT_TOOL_PACKED_END;
/**
* This class implements Supply Voltage TLV generation and parsing.
*
*/
OT_TOOL_PACKED_BEGIN
class SupplyVoltageTlv : public NetworkDiagnosticTlv
{
public:
/**
* This method initializes the TLV.
*
*/
void Init(void)
{
SetType(kSupplyVoltage);
SetLength(sizeof(*this) - sizeof(NetworkDiagnosticTlv));
}
/**
* This method indicates whether or not the TLV appears to be well-formed.
*
* @retval TRUE If the TLV appears to be well-formed.
* @retval FALSE If the TLV does not appear to be well-formed.
*
*/
bool IsValid(void) const { return GetLength() >= sizeof(*this) - sizeof(NetworkDiagnosticTlv); }
/**
* This method returns the Status value.
*
* @returns The Status value.
*
*/
uint16_t GetSupplyVoltage(void) const { return mSupplyVoltage; }
/**
* This method sets the SupplyVoltage value.
*
* @param[in] aSupplyVoltage The SupplyVoltage value.
*
*/
void SetSupplyVoltage(uint16_t aSupplyVoltage) { mSupplyVoltage = aSupplyVoltage; }
private:
uint16_t mSupplyVoltage;
} OT_TOOL_PACKED_END;
/**
* This class implements Child Table Entry generation and parsing.
*
@@ -1428,53 +1146,6 @@ public:
}
} OT_TOOL_PACKED_END;
/**
* This class implements Max Child Timeout TLV generation and parsing.
*
*/
OT_TOOL_PACKED_BEGIN
class MaxChildTimeoutTlv : public NetworkDiagnosticTlv
{
public:
/**
* This method initializes the TLV.
*
*/
void Init(void)
{
SetType(kMaxChildTimeout);
SetLength(sizeof(*this) - sizeof(NetworkDiagnosticTlv));
}
/**
* This method indicates whether or not the TLV appears to be well-formed.
*
* @retval TRUE If the TLV appears to be well-formed.
* @retval FALSE If the TLV does not appear to be well-formed.
*
*/
bool IsValid(void) const { return GetLength() >= sizeof(*this) - sizeof(NetworkDiagnosticTlv); }
/**
* This method returns the Timeout value.
*
* @returns The Timeout value.
*
*/
uint32_t GetTimeout(void) const { return HostSwap32(mTimeout); }
/**
* This method sets the Timeout value.
*
* @param[in] aTimeout The Timeout value.
*
*/
void SetTimeout(uint32_t aTimeout) { mTimeout = HostSwap32(aTimeout); }
private:
uint32_t mTimeout;
} OT_TOOL_PACKED_END;
/**
* @}
*