face: Incrementing Face counters
Change-Id: Ia1d7917bb52cf01ab2ff304638bc9f6cbdb2626f
Refs: #1178
diff --git a/daemon/face/face.cpp b/daemon/face/face.cpp
index 7268ee4..1fb1109 100644
--- a/daemon/face/face.cpp
+++ b/daemon/face/face.cpp
@@ -11,11 +11,22 @@
NFD_LOG_INIT("Face")
+template<class Packet>
+static inline void
+increaseCounter(const Packet& packet, FaceCounter& counter)
+{
+ ++counter;
+}
+
Face::Face(const FaceUri& uri, bool isLocal)
: m_id(INVALID_FACEID)
, m_isLocal(isLocal)
, m_uri(uri)
{
+ onReceiveInterest += bind(&increaseCounter<Interest>, _1, boost::ref(m_counters.getInInterest()));
+ onReceiveData += bind(&increaseCounter<Data>, _1, boost::ref(m_counters.getInData()));
+ onSendInterest += bind(&increaseCounter<Interest>, _1, boost::ref(m_counters.getOutInterest()));
+ onSendData += bind(&increaseCounter<Data>, _1, boost::ref(m_counters.getOutData()));
}
Face::~Face()