diff --git a/etc/visual-studio/libopenthread.vcxproj b/etc/visual-studio/libopenthread.vcxproj
index 9013c15f8..bac790528 100644
--- a/etc/visual-studio/libopenthread.vcxproj
+++ b/etc/visual-studio/libopenthread.vcxproj
@@ -112,8 +112,8 @@
-
-
+
+
@@ -190,8 +190,8 @@
-
-
+
+
@@ -203,4 +203,4 @@
-
\ No newline at end of file
+
diff --git a/etc/visual-studio/libopenthread_k.vcxproj b/etc/visual-studio/libopenthread_k.vcxproj
index 869db620f..04f014b23 100644
--- a/etc/visual-studio/libopenthread_k.vcxproj
+++ b/etc/visual-studio/libopenthread_k.vcxproj
@@ -121,8 +121,8 @@
-
-
+
+
@@ -204,8 +204,8 @@
-
-
+
+
@@ -216,4 +216,4 @@
-
\ No newline at end of file
+
diff --git a/etc/visual-studio/libopenthread_k.vcxproj.filters b/etc/visual-studio/libopenthread_k.vcxproj.filters
index 8e67620ff..917167c07 100644
--- a/etc/visual-studio/libopenthread_k.vcxproj.filters
+++ b/etc/visual-studio/libopenthread_k.vcxproj.filters
@@ -168,10 +168,10 @@
Source Files\thread
-
+
Source Files\thread
-
+
Source Files\thread
@@ -395,10 +395,10 @@
Header Files\thread
-
+
Header Files\thread
-
+
Header Files\thread
@@ -501,4 +501,4 @@
Header Files
-
\ No newline at end of file
+
diff --git a/include/openthread-types.h b/include/openthread-types.h
index 92ba11e31..762e425d1 100644
--- a/include/openthread-types.h
+++ b/include/openthread-types.h
@@ -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.
diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp
index 69cefd22b..e06edd3c2 100644
--- a/src/cli/cli.cpp
+++ b/src/cli/cli.cpp
@@ -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(value);
- index++;
+ SuccessOrExit(error = ParseLong(argv[paramIndex++], value));
+ payload[payloadIndex++] = static_cast(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:
diff --git a/src/core/Makefile.am b/src/core/Makefile.am
index 19b78f04d..87c0327a1 100644
--- a/src/core/Makefile.am
+++ b/src/core/Makefile.am
@@ -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 \
diff --git a/src/core/mac/mac.cpp b/src/core/mac/mac.cpp
index 9ff50c94e..c86d9fb72 100644
--- a/src/core/mac/mac.cpp
+++ b/src/core/mac/mac.cpp
@@ -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;
diff --git a/src/core/mac/mac.hpp b/src/core/mac/mac.hpp
index feeb9f85d..080e0e75e 100644
--- a/src/core/mac/mac.hpp
+++ b/src/core/mac/mac.hpp
@@ -43,6 +43,7 @@
#include
#include
#include
+#include
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.
*
diff --git a/src/core/thread/network_diag.cpp b/src/core/thread/network_diagnostic.cpp
similarity index 82%
rename from src/core/thread/network_diag.cpp
rename to src/core/thread/network_diagnostic.cpp
index db3c3029f..7a46d3f06 100644
--- a/src/core/thread/network_diag.cpp
+++ b/src/core/thread/network_diagnostic.cpp
@@ -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
#include
@@ -46,8 +46,8 @@
#include
#include
#include
-#include
-#include
+#include
+#include
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(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(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(&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(&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));
diff --git a/src/core/thread/network_diag.hpp b/src/core/thread/network_diagnostic.hpp
similarity index 99%
rename from src/core/thread/network_diag.hpp
rename to src/core/thread/network_diagnostic.hpp
index 3422c460a..deb5d780d 100644
--- a/src/core/thread/network_diag.hpp
+++ b/src/core/thread/network_diagnostic.hpp
@@ -129,6 +129,7 @@ private:
Coap::Client &mCoapClient;
Mle::MleRouter &mMle;
+ Mac::Mac &mMac;
ThreadNetif &mNetif;
};
diff --git a/src/core/thread/network_diag_tlvs.cpp b/src/core/thread/network_diagnostic_tlvs.cpp
similarity index 98%
rename from src/core/thread/network_diag_tlvs.cpp
rename to src/core/thread/network_diagnostic_tlvs.cpp
index 145e0dd4a..121a0d7c0 100644
--- a/src/core/thread/network_diag_tlvs.cpp
+++ b/src/core/thread/network_diagnostic_tlvs.cpp
@@ -33,7 +33,7 @@
#include
#include
-#include
+#include
namespace Thread {
namespace NetworkDiagnostic {
diff --git a/src/core/thread/network_diag_tlvs.hpp b/src/core/thread/network_diagnostic_tlvs.hpp
similarity index 89%
rename from src/core/thread/network_diag_tlvs.hpp
rename to src/core/thread/network_diagnostic_tlvs.hpp
index def4d8042..e7f4a3103 100644
--- a/src/core/thread/network_diag_tlvs.hpp
+++ b/src/core/thread/network_diagnostic_tlvs.hpp
@@ -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;
+
/**
* @}
*
diff --git a/src/core/thread/thread_netif.hpp b/src/core/thread/thread_netif.hpp
index 14b40ce13..0058f0d78 100644
--- a/src/core/thread/thread_netif.hpp
+++ b/src/core/thread/thread_netif.hpp
@@ -58,7 +58,7 @@
#include
#include
#include
-#include
+#include
#include
#include
#include