mgmt: expose link layer counters in Face Dataset
refs #1767
Change-Id: If0b66ead4c2f2741c83396f251cce9a0d83c1520
diff --git a/daemon/face/face-counters.hpp b/daemon/face/face-counters.hpp
index 05303b5..6dc1d6a 100644
--- a/daemon/face/face-counters.hpp
+++ b/daemon/face/face-counters.hpp
@@ -67,7 +67,6 @@
rep m_value;
};
-
/** \brief represents a counter of number of bytes
*/
// ByteCounter is noncopyable, because increment should be called on the counter,
@@ -104,7 +103,6 @@
rep m_value;
};
-
/** \brief contains network layer packet counters
*/
class NetworkLayerCounters : noncopyable
@@ -162,6 +160,20 @@
return m_nOutDatas;
}
+protected:
+ /** \brief copy current obseverations to a struct
+ * \param recipient an object with set methods for counters
+ */
+ template<typename R>
+ void
+ copyTo(R& recipient) const
+ {
+ recipient.setNInInterests(this->getNInInterests());
+ recipient.setNInDatas(this->getNInDatas());
+ recipient.setNOutInterests(this->getNOutInterests());
+ recipient.setNOutDatas(this->getNOutDatas());
+ }
+
private:
PacketCounter m_nInInterests;
PacketCounter m_nInDatas;
@@ -169,7 +181,6 @@
PacketCounter m_nOutDatas;
};
-
/** \brief contains link layer byte counters
*/
class LinkLayerCounters : noncopyable
@@ -201,16 +212,38 @@
return m_nOutBytes;
}
+protected:
+ /** \brief copy current obseverations to a struct
+ * \param recipient an object with set methods for counters
+ */
+ template<typename R>
+ void
+ copyTo(R& recipient) const
+ {
+ recipient.setNInBytes(this->getNInBytes());
+ recipient.setNOutBytes(this->getNOutBytes());
+ }
+
private:
ByteCounter m_nInBytes;
ByteCounter m_nOutBytes;
};
-
/** \brief contains counters on face
*/
class FaceCounters : public NetworkLayerCounters, public LinkLayerCounters
{
+public:
+ /** \brief copy current obseverations to a struct
+ * \param recipient an object with set methods for counters
+ */
+ template<typename R>
+ void
+ copyTo(R& recipient) const
+ {
+ this->NetworkLayerCounters::copyTo(recipient);
+ this->LinkLayerCounters::copyTo(recipient);
+ }
};
} // namespace nfd