fw: ForwarderCounters

refs #1199

Change-Id: I0664825d7b09b4e7e893876aefc5af10e53b90b1
diff --git a/daemon/fw/forwarder-counter.hpp b/daemon/fw/forwarder-counter.hpp
new file mode 100644
index 0000000..e1461d3
--- /dev/null
+++ b/daemon/fw/forwarder-counter.hpp
@@ -0,0 +1,31 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (C) 2014 Named Data Networking Project
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NFD_FW_FORWARDER_COUNTER_HPP
+#define NFD_FW_FORWARDER_COUNTER_HPP
+
+#include "face/face-counter.hpp"
+
+namespace nfd {
+
+/** \class ForwarderCounter
+ *  \brief represents a counter on forwarder
+ *
+ *  \todo This class should be noncopyable
+ */
+typedef uint64_t ForwarderCounter;
+
+
+/** \brief contains counters on forwarder
+ */
+class ForwarderCounters : public FaceCounters
+{
+};
+
+
+} // namespace nfd
+
+#endif // NFD_FW_FORWARDER_COUNTER_HPP
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index 3a8a91f..e6d3438 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -37,6 +37,7 @@
   if (interest.getInterestLifetime() < 0) {
     const_cast<Interest&>(interest).setInterestLifetime(DEFAULT_INTEREST_LIFETIME);
   }
+  m_counters.getInInterest() ++;
 
   // /localhost scope control
   bool isViolatingLocalhost = !inFace.isLocal() &&
@@ -154,6 +155,7 @@
 
   // send Interest
   outFace.sendInterest(interest);
+  m_counters.getOutInterest() ++;
 }
 
 void
@@ -184,6 +186,7 @@
   // receive Data
   NFD_LOG_DEBUG("onIncomingData face=" << inFace.getId() << " data=" << data.getName());
   const_cast<Data&>(data).setIncomingFaceId(inFace.getId());
+  m_counters.getInData() ++;
 
   // /localhost scope control
   bool isViolatingLocalhost = !inFace.isLocal() &&
@@ -279,6 +282,7 @@
 
   // send Data
   outFace.sendData(data);
+  m_counters.getOutData() ++;
 }
 
 static inline bool
diff --git a/daemon/fw/forwarder.hpp b/daemon/fw/forwarder.hpp
index 8e7c0d2..c6e3529 100644
--- a/daemon/fw/forwarder.hpp
+++ b/daemon/fw/forwarder.hpp
@@ -9,6 +9,7 @@
 
 #include "common.hpp"
 #include "core/scheduler.hpp"
+#include "forwarder-counter.hpp"
 #include "face-table.hpp"
 #include "table/fib.hpp"
 #include "table/pit.hpp"
@@ -31,6 +32,9 @@
 public:
   Forwarder();
 
+  const ForwarderCounters&
+  getCounters() const;
+
 public: // faces
   FaceTable&
   getFaceTable();
@@ -141,6 +145,8 @@
 #endif
 
 private:
+  ForwarderCounters m_counters;
+
   FaceTable m_faceTable;
 
   // tables
@@ -158,6 +164,12 @@
   friend class fw::Strategy;
 };
 
+inline const ForwarderCounters&
+Forwarder::getCounters() const
+{
+  return m_counters;
+}
+
 inline FaceTable&
 Forwarder::getFaceTable()
 {