pingserver: add --quiet option

Change-Id: I7e61383e587044fd65a50e4dee58a020d3b292ad
Refs: #4673
diff --git a/tools/ping/server/ndn-ping-server.cpp b/tools/ping/server/ndn-ping-server.cpp
index a51519c..28c6871 100644
--- a/tools/ping/server/ndn-ping-server.cpp
+++ b/tools/ping/server/ndn-ping-server.cpp
@@ -111,7 +111,10 @@
                     "maximum number of pings to be satisfied (0=infinite)")
     ("size,s",      po::value(&payloadSize)->default_value(payloadSize),
                     "size of response payload")
-    ("timestamp,t", po::bool_switch(&options.wantTimestamp), "log timestamp with responses")
+    ("timestamp,t", po::bool_switch(&options.wantTimestamp),
+                    "prepend a timestamp to each log message")
+    ("quiet,q",     po::bool_switch(&options.wantQuiet),
+                    "do not print a log message each time a ping packet is received")
     ("version,V",   "print program version and exit")
     ;
 
diff --git a/tools/ping/server/ping-server.hpp b/tools/ping/server/ping-server.hpp
index 2d81e5f..3a43a6d 100644
--- a/tools/ping/server/ping-server.hpp
+++ b/tools/ping/server/ping-server.hpp
@@ -39,6 +39,7 @@
   size_t nMaxPings = 0;                     //!< max number of pings to satisfy (0 == no limit)
   size_t payloadSize = 0;                   //!< response payload size (0 == no payload)
   bool wantTimestamp = false;               //!< print timestamp when response sent
+  bool wantQuiet = false;                   //!< suppress printing per-packet log message
 };
 
 /**
diff --git a/tools/ping/server/tracer.cpp b/tools/ping/server/tracer.cpp
index 5f5150a..51b191c 100644
--- a/tools/ping/server/tracer.cpp
+++ b/tools/ping/server/tracer.cpp
@@ -28,7 +28,9 @@
 Tracer::Tracer(PingServer& pingServer, const Options& options)
   : m_options(options)
 {
-  pingServer.afterReceive.connect([this] (const Name& name) { onReceive(name); });
+  if (!m_options.wantQuiet) {
+    pingServer.afterReceive.connect([this] (const Name& name) { onReceive(name); });
+  }
 }
 
 void