fix diagnostic feature and code cleanup (#1030)

* fix diagnostic feature and code cleanup
This commit is contained in:
rongli
2016-12-02 09:02:16 -08:00
committed by Jonathan Hui
parent 78462001e1
commit d2695ab5f4
13 changed files with 240 additions and 156 deletions
+5 -5
View File
@@ -112,8 +112,8 @@
<ClCompile Include="..\..\src\core\thread\network_data_leader.cpp" />
<ClCompile Include="..\..\src\core\thread\network_data_leader_ftd.cpp" />
<ClCompile Include="..\..\src\core\thread\network_data_local.cpp" />
<ClCompile Include="..\..\src\core\thread\network_diag.cpp" />
<ClCompile Include="..\..\src\core\thread\network_diag_tlvs.cpp" />
<ClCompile Include="..\..\src\core\thread\network_diagnostic.cpp" />
<ClCompile Include="..\..\src\core\thread\network_diagnostic_tlvs.cpp" />
<ClCompile Include="..\..\src\core\thread\panid_query_server.cpp" />
<ClCompile Include="..\..\src\core\thread\thread_netif.cpp" />
<ClCompile Include="..\..\src\core\thread\thread_tlvs.cpp" />
@@ -190,8 +190,8 @@
<ClInclude Include="..\..\src\core\thread\network_data_leader.hpp" />
<ClInclude Include="..\..\src\core\thread\network_data_local.hpp" />
<ClInclude Include="..\..\src\core\thread\network_data_tlvs.hpp" />
<ClInclude Include="..\..\src\core\thread\network_diag.hpp" />
<ClInclude Include="..\..\src\core\thread\network_diag_tlvs.hpp" />
<ClInclude Include="..\..\src\core\thread\network_diagnostic.hpp" />
<ClInclude Include="..\..\src\core\thread\network_diagnostic_tlvs.hpp" />
<ClInclude Include="..\..\src\core\thread\panid_query_server.hpp" />
<ClInclude Include="..\..\src\core\thread\thread_netif.hpp" />
<ClInclude Include="..\..\src\core\thread\thread_tlvs.hpp" />
@@ -203,4 +203,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
+5 -5
View File
@@ -121,8 +121,8 @@
<ClCompile Include="..\..\src\core\thread\network_data_leader.cpp" />
<ClCompile Include="..\..\src\core\thread\network_data_leader_ftd.cpp" />
<ClCompile Include="..\..\src\core\thread\network_data_local.cpp" />
<ClCompile Include="..\..\src\core\thread\network_diag.cpp" />
<ClCompile Include="..\..\src\core\thread\network_diag_tlvs.cpp" />
<ClCompile Include="..\..\src\core\thread\network_diagnostic.cpp" />
<ClCompile Include="..\..\src\core\thread\network_diagnostic_tlvs.cpp" />
<ClCompile Include="..\..\src\core\thread\panid_query_server.cpp" />
<ClCompile Include="..\..\src\core\thread\thread_netif.cpp" />
<ClCompile Include="..\..\src\core\thread\thread_tlvs.cpp" />
@@ -204,8 +204,8 @@
<ClInclude Include="..\..\src\core\thread\network_data_leader.hpp" />
<ClInclude Include="..\..\src\core\thread\network_data_local.hpp" />
<ClInclude Include="..\..\src\core\thread\network_data_tlvs.hpp" />
<ClInclude Include="..\..\src\core\thread\network_diag.hpp" />
<ClInclude Include="..\..\src\core\thread\network_diag_tlvs.hpp" />
<ClInclude Include="..\..\src\core\thread\network_diagnostic.hpp" />
<ClInclude Include="..\..\src\core\thread\network_diagnostic_tlvs.hpp" />
<ClInclude Include="..\..\src\core\thread\panid_query_server.hpp" />
<ClInclude Include="..\..\src\core\thread\thread_netif.hpp" />
<ClInclude Include="..\..\src\core\thread\thread_tlvs.hpp" />
@@ -216,4 +216,4 @@
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
</Project>
</Project>
@@ -168,10 +168,10 @@
<ClCompile Include="..\..\src\core\thread\network_data_local.cpp">
<Filter>Source Files\thread</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\thread\network_diag.cpp">
<ClCompile Include="..\..\src\core\thread\network_diagnostic.cpp">
<Filter>Source Files\thread</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\thread\network_diag_tlvs.cpp">
<ClCompile Include="..\..\src\core\thread\network_diagnostic_tlvs.cpp">
<Filter>Source Files\thread</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\thread\panid_query_server.cpp">
@@ -395,10 +395,10 @@
<ClInclude Include="..\..\src\core\thread\network_data_tlvs.hpp">
<Filter>Header Files\thread</Filter>
</ClInclude>
<ClInclude Include="..\..\src\core\thread\network_diag.hpp">
<ClInclude Include="..\..\src\core\thread\network_diagnostic.hpp">
<Filter>Header Files\thread</Filter>
</ClInclude>
<ClInclude Include="..\..\src\core\thread\network_diag_tlvs.hpp">
<ClInclude Include="..\..\src\core\thread\network_diagnostic_tlvs.hpp">
<Filter>Header Files\thread</Filter>
</ClInclude>
<ClInclude Include="..\..\src\core\thread\panid_query_server.hpp">
@@ -501,4 +501,4 @@
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
</Project>
+2 -1
View File
@@ -199,7 +199,8 @@ typedef enum ThreadError
#define OT_MASTER_KEY_SIZE 16 ///< Size of the Thread Master Key (bytes)
#define OT_NUM_NETDIAG_TLV_TYPES 18 ///< Number of Network Diagnostic TLV types
#define OT_NETWORK_DIAGNOSTIC_TYPELIST_TYPE 18 ///< Concatenated List of Type Identifiers of Other Diagnostics TLVs Used to Request or Reset Multiple Diagnostic Values
#define OT_NETWORK_DIAGNOSTIC_TYPELIST_MAX_ENTRIES 18 ///< Maximum Number of Other Network Diagnostic TLV Types
/**
* This structure represents a Thread Master Key.
+14 -9
View File
@@ -2628,29 +2628,34 @@ void Interpreter::ProcessNetworkDiagnostic(int argc, char *argv[])
{
ThreadError error = kThreadError_None;
struct otIp6Address address;
uint8_t index = 2;
uint8_t tlvTypes[OT_NUM_NETDIAG_TLV_TYPES];
uint8_t count = 0;
uint8_t payload[2 + OT_NETWORK_DIAGNOSTIC_TYPELIST_MAX_ENTRIES]; // TypeList Type(1B), len(1B), type list
uint8_t payloadIndex = 0;
uint8_t paramIndex = 0;
VerifyOrExit(argc > 1 + 1, error = kThreadError_Parse);
SuccessOrExit(error = otIp6AddressFromString(argv[1], &address));
while (index < argc && count < sizeof(tlvTypes))
payloadIndex = 2;
paramIndex = 2;
while (paramIndex < argc && payloadIndex < sizeof(payload))
{
long value;
SuccessOrExit(error = ParseLong(argv[index], value));
tlvTypes[count++] = static_cast<uint8_t>(value);
index++;
SuccessOrExit(error = ParseLong(argv[paramIndex++], value));
payload[payloadIndex++] = static_cast<uint8_t>(value);
}
payload[0] = OT_NETWORK_DIAGNOSTIC_TYPELIST_TYPE; // TypeList TLV Type
payload[1] = payloadIndex - 2; // length
if (strcmp(argv[0], "get") == 0)
{
otSendDiagnosticGet(mInstance, &address, tlvTypes, count);
otSendDiagnosticGet(mInstance, &address, payload, payloadIndex);
}
else if (strcmp(argv[0], "reset") == 0)
{
otSendDiagnosticReset(mInstance, &address, tlvTypes, count);
otSendDiagnosticReset(mInstance, &address, payload, payloadIndex);
}
exit:
+4 -4
View File
@@ -80,8 +80,8 @@ SOURCES_COMMON = \
thread/network_data.cpp \
thread/network_data_leader.cpp \
thread/panid_query_server.cpp \
thread/network_diag.cpp \
thread/network_diag_tlvs.cpp \
thread/network_diagnostic.cpp \
thread/network_diagnostic_tlvs.cpp \
thread/thread_netif.cpp \
thread/thread_tlvs.cpp \
utils/slaac_address.cpp \
@@ -248,8 +248,8 @@ noinst_HEADERS = \
thread/network_data_local_mtd.hpp \
thread/network_data_tlvs.hpp \
thread/panid_query_server.hpp \
thread/network_diag.hpp \
thread/network_diag_tlvs.hpp \
thread/network_diagnostic.hpp \
thread/network_diagnostic_tlvs.hpp \
thread/thread_netif.hpp \
thread/thread_tlvs.hpp \
thread/thread_uris.hpp \
+19
View File
@@ -1470,6 +1470,25 @@ Blacklist &Mac::GetBlacklist(void)
return mBlacklist;
}
void Mac::FillMacCountersTlv(NetworkDiagnostic::MacCountersTlv &aMacCounters) const
{
aMacCounters.SetIfInUnknownProtos(mCounters.mRxOther);
aMacCounters.SetIfInErrors(mCounters.mRxErrNoFrame + mCounters.mRxErrUnknownNeighbor + mCounters.mRxErrInvalidSrcAddr +
mCounters.mRxErrSec + mCounters.mRxErrFcs + mCounters.mRxErrOther);
aMacCounters.SetIfOutErrors(mCounters.mTxErrCca);
aMacCounters.SetIfInUcastPkts(mCounters.mRxUnicast);
aMacCounters.SetIfInBroadcastPkts(mCounters.mRxBroadcast);
aMacCounters.SetIfInDiscards(mCounters.mRxWhitelistFiltered + mCounters.mRxDestAddrFiltered + mCounters.mRxDuplicated);
aMacCounters.SetIfOutUcastPkts(mCounters.mTxUnicast);
aMacCounters.SetIfOutBroadcastPkts(mCounters.mTxBroadcast);
aMacCounters.SetIfOutDiscards(0);
}
void Mac::ResetCounters(void)
{
memset(&mCounters, 0, sizeof(mCounters));
}
otMacCounters &Mac::GetCounters(void)
{
return mCounters;
+15
View File
@@ -43,6 +43,7 @@
#include <platform/radio.h>
#include <thread/key_manager.hpp>
#include <thread/topology.hpp>
#include <thread/network_diagnostic_tlvs.hpp>
namespace Thread {
@@ -492,6 +493,20 @@ public:
*/
void SetPromiscuous(bool aPromiscuous);
/**
* This function fills network diagnostic MacCounterTlv.
*
* @param[in] aMacCountersTlv The reference to the network diagnostic MacCounterTlv.
*
*/
void FillMacCountersTlv(NetworkDiagnostic::MacCountersTlv &aMacCounters) const;
/**
* This function resets mac counters
*
*/
void ResetCounters(void);
/**
* This method returns the MAC counter.
*
@@ -31,7 +31,7 @@
* This file implements Thread's Network Diagnostic processing.
*/
#define WPP_NAME "network_diag.tmh"
#define WPP_NAME "network_diagnostic.tmh"
#include <coap/coap_header.hpp>
#include <common/code_utils.hpp>
@@ -46,8 +46,8 @@
#include <thread/thread_netif.hpp>
#include <thread/thread_tlvs.hpp>
#include <thread/thread_uris.hpp>
#include <thread/network_diag.hpp>
#include <thread/network_diag_tlvs.hpp>
#include <thread/network_diagnostic.hpp>
#include <thread/network_diagnostic_tlvs.hpp>
using Thread::Encoding::BigEndian::HostSwap16;
@@ -61,6 +61,7 @@ NetworkDiagnostic::NetworkDiagnostic(ThreadNetif &aThreadNetif) :
mCoapServer(aThreadNetif.GetCoapServer()),
mCoapClient(aThreadNetif.GetCoapClient()),
mMle(aThreadNetif.GetMle()),
mMac(aThreadNetif.GetMac()),
mNetif(aThreadNetif)
{
mCoapServer.AddResource(mDiagnosticGet);
@@ -202,47 +203,41 @@ exit:
ThreadError NetworkDiagnostic::AppendChildTable(Message &aMessage)
{
ThreadError error = kThreadError_None;
uint8_t count = 0;
uint8_t timeout = 0;
uint8_t numChildren;
const Child *children = mMle.GetChildren(&numChildren);
ChildTableTlv tlv;
ChildTableEntry entry;
{
uint8_t count = 0;
for (int i = 0; i < numChildren; i++)
{
if (children[i].mState != Neighbor::kStateInvalid)
{
continue;
}
count++;
}
ChildTableTlv tlv;
tlv.Init();
tlv.SetLength(count * sizeof(ChildTableEntry));
SuccessOrExit(error = aMessage.Append(&tlv, sizeof(ChildTableTlv)));
}
tlv.Init();
for (int i = 0; i < numChildren; i++)
{
if (children[i].mState != Neighbor::kStateInvalid)
if (children[i].mState == Neighbor::kStateValid)
{
continue;
count++;
}
}
const Child &child = children[i];
ChildTableEntry entry;
uint8_t timeout = 0;
tlv.SetLength(count * sizeof(ChildTableEntry));
while (static_cast<uint32_t>(1 << timeout) < child.mTimeout) { timeout++; }
SuccessOrExit(error = aMessage.Append(&tlv, sizeof(ChildTableTlv)));
entry.SetTimeout(timeout + 4);
entry.SetChildId(child.mValid.mRloc16);
entry.SetMode(child.mMode);
for (int i = 0; i < numChildren; i++)
{
if (children[i].mState == Neighbor::kStateValid)
{
timeout = 0;
SuccessOrExit(error = aMessage.Append(&entry, sizeof(ChildTableEntry)));
while (static_cast<uint32_t>(1 << timeout) < children[i].mTimeout) { timeout++; }
entry.SetTimeout(timeout + 4);
entry.SetChildId(children[i].mValid.mRloc16);
entry.SetMode(children[i].mMode);
SuccessOrExit(error = aMessage.Append(&entry, sizeof(ChildTableEntry)));
}
}
exit:
@@ -253,37 +248,47 @@ exit:
void NetworkDiagnostic::HandleDiagnosticGet(Coap::Header &aHeader, Message &aMessage,
const Ip6::MessageInfo &aMessageInfo)
{
uint8_t tlvTypeSet[kNumTlvTypes];
uint16_t numTlvTypes;
ThreadError error = kThreadError_None;
Message *message = NULL;
uint16_t offset = 0;
uint8_t type;
NetworkDiagnosticTlv networkDiagnosticTlv;
Coap::Header header;
Ip6::MessageInfo messageInfo(aMessageInfo);
VerifyOrExit(aHeader.GetType() == kCoapTypeConfirmable &&
aHeader.GetCode() == kCoapRequestGet, error = kThreadError_Drop);
numTlvTypes = aMessage.Read(aMessage.GetOffset(), kNumTlvTypes, tlvTypeSet);
otLogInfoNetDiag("Received diagnostic get request");
VerifyOrExit((aMessage.Read(aMessage.GetOffset(), sizeof(NetworkDiagnosticTlv),
&networkDiagnosticTlv) == sizeof(NetworkDiagnosticTlv)), error = kThreadError_Drop);
VerifyOrExit(networkDiagnosticTlv.GetType() == NetworkDiagnosticTlv::kTypeList, error = kThreadError_Drop);
VerifyOrExit((static_cast<TypeListTlv *>(&networkDiagnosticTlv)->IsValid()), error = kThreadError_Drop);
VerifyOrExit((message = mCoapServer.NewMessage(0)) != NULL, error = kThreadError_NoBufs);
header.SetDefaultResponseHeader(aHeader);
if (numTlvTypes > 0)
if (networkDiagnosticTlv.GetLength() > 0)
{
header.SetPayloadMarker();
}
SuccessOrExit(error = message->Append(header.GetBytes(), header.GetLength()));
offset = aMessage.GetOffset() + sizeof(NetworkDiagnosticTlv);
for (uint8_t i = 0; i < numTlvTypes; i++)
for (uint8_t i = 0; i < networkDiagnosticTlv.GetLength(); i++)
{
otLogInfoNetDiag("Received diagnostic get type %d", tlvTypeSet[i]);
switch (tlvTypeSet[i])
VerifyOrExit(aMessage.Read(offset, sizeof(type), &type) == sizeof(type), error = kThreadError_Drop);
otLogInfoNetDiag("Received diagnostic get type %d", type);
switch (type)
{
case NetworkDiagnosticTlv::kExtMacAddress:
{
@@ -372,6 +377,7 @@ void NetworkDiagnostic::HandleDiagnosticGet(Coap::Header &aHeader, Message &aMes
MacCountersTlv tlv;
memset(&tlv, 0, sizeof(tlv));
tlv.Init();
mMac.FillMacCountersTlv(tlv);
SuccessOrExit(error = message->Append(&tlv, tlv.GetSize()));
break;
}
@@ -415,10 +421,10 @@ void NetworkDiagnostic::HandleDiagnosticGet(Coap::Header &aHeader, Message &aMes
default:
ExitNow();
}
offset += sizeof(type);
}
memset(&messageInfo.mSockAddr, 0, sizeof(messageInfo.mSockAddr));
otLogInfoNetDiag("Sending diagnostic get acknowledgment");
SuccessOrExit(error = mCoapServer.SendMessage(*message, messageInfo));
otLogInfoNetDiag("Sent diagnostic get acknowledgment");
@@ -443,43 +449,49 @@ void NetworkDiagnostic::HandleDiagnosticReset(Coap::Header &aHeader, Message &aM
const Ip6::MessageInfo &aMessageInfo)
{
ThreadError error = kThreadError_None;
uint8_t tlvTypeSet[kNumResetTlvTypes];
uint16_t numTlvTypes;
Message *message = NULL;
uint16_t offset = 0;
uint8_t type;
NetworkDiagnosticTlv networkDiagnosticTlv;
Coap::Header header;
Ip6::MessageInfo messageInfo(aMessageInfo);
otLogInfoNetDiag("Received diagnostic reset request");
VerifyOrExit(aHeader.GetType() == kCoapTypeConfirmable &&
aHeader.GetCode() == kCoapRequestPost, error = kThreadError_Drop);
otLogInfoNetDiag("Received diagnostic reset request");
numTlvTypes = aMessage.Read(aMessage.GetOffset(), kNumResetTlvTypes, tlvTypeSet);
VerifyOrExit((aMessage.Read(aMessage.GetOffset(), sizeof(NetworkDiagnosticTlv),
&networkDiagnosticTlv) == sizeof(NetworkDiagnosticTlv)), error = kThreadError_Drop);
otLogInfoNetDiag("Received diagnostic reset request");
VerifyOrExit(networkDiagnosticTlv.GetType() == NetworkDiagnosticTlv::kTypeList, error = kThreadError_Drop);
for (uint8_t i = 0; i < numTlvTypes; i++)
{
switch (tlvTypeSet[i])
{
case NetworkDiagnosticTlv::kMacCounters:
break;
VerifyOrExit((static_cast<TypeListTlv *>(&networkDiagnosticTlv)->IsValid()), error = kThreadError_Drop);
default:
ExitNow();
}
}
otLogInfoNetDiag("Received diagnostic reset request");
VerifyOrExit((message = mCoapServer.NewMessage(0)) != NULL, error = kThreadError_NoBufs);
otLogInfoNetDiag("Received diagnostic reset request");
header.SetDefaultResponseHeader(aHeader);
SuccessOrExit(error = message->Append(header.GetBytes(), header.GetLength()));
memset(&messageInfo.mSockAddr, 0, sizeof(messageInfo.mSockAddr));
offset = aMessage.GetOffset() + sizeof(NetworkDiagnosticTlv);
for (uint8_t i = 0; i < networkDiagnosticTlv.GetLength(); i++)
{
VerifyOrExit(aMessage.Read(offset, sizeof(type), &type) == sizeof(type), error = kThreadError_Drop);
switch (type)
{
case NetworkDiagnosticTlv::kMacCounters:
mMac.ResetCounters();
otLogInfoNetDiag("Received diagnostic reset type kMacCounters(9)");
break;
default:
otLogInfoNetDiag("Received diagnostic reset other type %d not resetable", type);
break;
}
}
SuccessOrExit(error = mCoapServer.SendMessage(*message, messageInfo));
@@ -129,6 +129,7 @@ private:
Coap::Client &mCoapClient;
Mle::MleRouter &mMle;
Mac::Mac &mMac;
ThreadNetif &mNetif;
};
@@ -33,7 +33,7 @@
#include <common/code_utils.hpp>
#include <common/message.hpp>
#include <thread/network_diag_tlvs.hpp>
#include <thread/network_diagnostic_tlvs.hpp>
namespace Thread {
namespace NetworkDiagnostic {
@@ -94,6 +94,7 @@ public:
kSupplyVoltage = 15, ///< Supply Voltage TLV
kChildTable = 16, ///< Child Table TLV
kChannelPages = 17, ///< Channel Pages TLV
kTypeList = 18, ///< Type List TLV
kInvalid = 255,
};
@@ -917,148 +918,147 @@ public:
bool IsValid(void) const { return GetLength() == sizeof(*this) - sizeof(NetworkDiagnosticTlv); }
/**
* This method returns a pointer to the Response value.
* This method returns the IfInUnknownProtos counter.
*
* @returns A pointer to the Response value.
* @returns The IfInUnknownProtos counter
*
*/
uint32_t GetIfInUnknownProtos(void) const { return mIfInUnknownProtos; }
uint32_t GetIfInUnknownProtos(void) const { return HostSwap32(mIfInUnknownProtos); }
/**
* This method sets the Response value.
* This method sets the IfInUnknownProtos counter.
*
* @param[in] aResponse A pointer to the Response value.
* @param[in] aIfInUnknownProtos The IfInUnknownProtos counter
*
*/
void SetIfInUnknownProtos(const uint32_t aIfInUnknownProtos) { mIfInUnknownProtos = aIfInUnknownProtos; }
void SetIfInUnknownProtos(const uint32_t aIfInUnknownProtos) { mIfInUnknownProtos = HostSwap32(aIfInUnknownProtos); }
/**
* This method returns a pointer to the Response value.
* This method returns the IfInErrors counter.
*
* @returns A pointer to the Response value.
* @returns The IfInErrors counter
*
*/
uint32_t GetIfInErrors(void) const { return mIfInErrors; }
uint32_t GetIfInErrors(void) const { return HostSwap32(mIfInErrors); }
/**
* This method sets the Response value.
* This method sets the IfInErrors counter.
*
* @param[in] aResponse A pointer to the Response value.
* @param[in] aIfInErrors The IfInErrors counter
*
*/
void SetIfInErrors(const uint32_t aIfInErrors) { mIfInErrors = aIfInErrors; }
void SetIfInErrors(const uint32_t aIfInErrors) { mIfInErrors = HostSwap32(aIfInErrors); }
/**
* This method returns a pointer to the Response value.
* This method returns the IfOutErrors counter.
*
* @returns A pointer to the Response value.
* @returns The IfOutErrors counter
*
*/
uint32_t GetIfOutErrors(void) const { return mIfOutErrors; }
uint32_t GetIfOutErrors(void) const { return HostSwap32(mIfOutErrors); }
/**
* This method sets the Response value.
* This method sets the IfOutErrors counter.
*
* @param[in] aResponse A pointer to the Response value.
* @param[in] aIfOutErrors The IfOutErrors counter.
*
*/
void SetIfOutErrors(const uint32_t aIfOutErrors) { mIfOutErrors = aIfOutErrors; }
void SetIfOutErrors(const uint32_t aIfOutErrors) { mIfOutErrors = HostSwap32(aIfOutErrors); }
/**
* This method returns a pointer to the Response value.
* This method returns the IfInUcastPkts counter.
*
* @returns A pointer to the Response value.
* @returns The IfInUcastPkts counter
*
*/
uint32_t GetIfInUcastPkts(void) const { return mIfInUcastPkts; }
uint32_t GetIfInUcastPkts(void) const { return HostSwap32(mIfInUcastPkts); }
/**
* This method sets the Response value.
* This method sets the IfInUcastPkts counter.
*
* @param[in] aResponse A pointer to the Response value.
* @param[in] aIfInUcastPkts The IfInUcastPkts counter.
*
*/
void SetIfInUcastPkts(const uint32_t aIfInUcastPkts) { mIfInUcastPkts = aIfInUcastPkts; }
void SetIfInUcastPkts(const uint32_t aIfInUcastPkts) { mIfInUcastPkts = HostSwap32(aIfInUcastPkts); }
/**
* This method returns the IfInBroadcastPkts counter.
*
* @returns The IfInBroadcastPkts counter
*
*/
uint32_t GetIfInBroadcastPkts(void) const { return HostSwap32(mIfInBroadcastPkts); }
/**
* This method returns a pointer to the Response value.
* This method sets the IfInBroadcastPkts counter.
*
* @returns A pointer to the Response value.
* @param[in] aIfInBroadcastPkts The IfInBroadcastPkts counter.
*
*/
uint32_t GetIfInBroadcastPkts(void) const { return mIfInBroadcastPkts; }
void SetIfInBroadcastPkts(const uint32_t aIfInBroadcastPkts) { mIfInBroadcastPkts = HostSwap32(aIfInBroadcastPkts); }
/**
* This method sets the Response value.
* This method returns the IfInDiscards counter.
*
* @param[in] aResponse A pointer to the Response value.
* @returns The IfInDiscards counter
*
*/
void SetIfInBroadcastPkts(const uint32_t aIfInBroadcastPkts) { mIfInBroadcastPkts = aIfInBroadcastPkts; }
uint32_t GetIfInDiscards(void) const { return HostSwap32(mIfInDiscards); }
/**
* This method returns a pointer to the Response value.
* This method sets the IfInDiscards counter.
*
* @returns A pointer to the Response value.
* @param[in] aIfInDiscards The IfInDiscards counter.
*
*/
uint32_t GetIfInDiscards(void) const { return mIfInDiscards; }
void SetIfInDiscards(const uint32_t aIfInDiscards) { mIfInDiscards = HostSwap32(aIfInDiscards); }
/**
* This method sets the Response value.
* This method returns the IfOutUcastPkts counter.
*
* @param[in] aResponse A pointer to the Response value.
* @returns The IfOutUcastPkts counter
*
*/
void SetIfInDiscards(const uint32_t aIfInDiscards) { mIfInDiscards = aIfInDiscards; }
uint32_t GetIfOutUcastPkts(void) const { return HostSwap32(mIfOutUcastPkts); }
/**
* This method returns a pointer to the Response value.
* This method sets the IfOutUcastPkts counter.
*
* @returns A pointer to the Response value.
* @param[in] aIfOutUcastPkts The IfOutUcastPkts counter.
*
*/
uint32_t GetIfOutUcastPkts(void) const { return mIfOutUcastPkts; }
void SetIfOutUcastPkts(const uint32_t aIfOutUcastPkts) { mIfOutUcastPkts = HostSwap32(aIfOutUcastPkts); }
/**
* This method sets the Response value.
* This method returns the IfOutBroadcastPkts counter.
*
* @param[in] aResponse A pointer to the Response value.
* @returns The IfOutBroadcastPkts counter
*
*/
void SetIfOutUcastPkts(const uint32_t aIfOutUcastPkts) { mIfOutUcastPkts = aIfOutUcastPkts; }
uint32_t GetIfOutBroadcastPkts(void) const { return HostSwap32(mIfOutBroadcastPkts); }
/**
* This method returns a pointer to the Response value.
* This method sets the IfOutBroadcastPkts counter.
*
* @returns A pointer to the Response value.
* @param[in] aIfOutBroadcastPkts The IfOutBroadcastPkts counter.
*
*/
uint32_t GetIfOutBroadcastPkts(void) const { return mIfOutBroadcastPkts; }
void SetIfOutBroadcastPkts(const uint32_t aIfOutBroadcastPkts) { mIfOutBroadcastPkts = HostSwap32(aIfOutBroadcastPkts); }
/**
* This method sets the Response value.
* This method returns the IfOutDiscards counter.
*
* @param[in] aResponse A pointer to the Response value.
* @returns The IfOutDiscards counter
*
*/
void SetIfOutBroadcastPkts(const uint32_t aIfOutBroadcastPkts) { mIfOutBroadcastPkts = aIfOutBroadcastPkts; }
uint32_t GetIfOutDiscards(void) const { return HostSwap32(mIfOutDiscards); }
/**
* This method returns a pointer to the Response value.
* This method sets the IfOutDiscards counter.
*
* @returns A pointer to the Response value.
* @param[in] aIfOutDiscards The IfOutDiscards counter.
*
*/
uint32_t GetIfOutDiscards(void) const { return mIfOutDiscards; }
/**
* This method sets the Response value.
*
* @param[in] aResponse A pointer to the Response value.
*
*/
void SetIfOutDiscards(const uint32_t aIfOutDiscards) { mIfOutDiscards = aIfOutDiscards; }
void SetIfOutDiscards(const uint32_t aIfOutDiscards) { mIfOutDiscards = HostSwap32(aIfOutDiscards); }
private:
uint32_t mIfInUnknownProtos;
@@ -1233,13 +1233,12 @@ public:
private:
uint8_t mTimeout: 5;
uint8_t mReserved: 2;
uint16_t mTimeout: 5;
uint16_t mReserved: 2;
uint16_t mChildId: 9;
uint8_t mMode: 8;
uint8_t mMode;
} OT_TOOL_PACKED_END;
/**
* This class implements Child Table TLV generation and parsing.
*
@@ -1302,6 +1301,38 @@ public:
private:
uint8_t mChannelPages[1];
} OT_TOOL_PACKED_END;
/**
* This class implements IPv6 Address List TLV generation and parsing.
*
*/
OT_TOOL_PACKED_BEGIN
class TypeListTlv: public NetworkDiagnosticTlv
{
public:
/**
* This method initializes the TLV.
*
*/
void Init(void) { SetType(kTypeList); 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() <= OT_NETWORK_DIAGNOSTIC_TYPELIST_MAX_ENTRIES; }
/**
* This method returns a pointer to the Challenge value.
*
* @returns A pointer to the Challenge value.
*
*/
} OT_TOOL_PACKED_END;
/**
* @}
*
+1 -1
View File
@@ -58,7 +58,7 @@
#include <thread/address_resolver.hpp>
#include <thread/announce_begin_server.hpp>
#include <thread/energy_scan_server.hpp>
#include <thread/network_diag.hpp>
#include <thread/network_diagnostic.hpp>
#include <thread/key_manager.hpp>
#include <thread/mesh_forwarder.hpp>
#include <thread/mle.hpp>