ping: Code refactoring

Change-Id: I8b4e2c9dd3ba3adfae8d296a5635b048b35cf593
Refs: #3137
diff --git a/tools/ping/server/ping-server.hpp b/tools/ping/server/ping-server.hpp
index 242a54a..ff8e1c7 100644
--- a/tools/ping/server/ping-server.hpp
+++ b/tools/ping/server/ping-server.hpp
@@ -48,14 +48,20 @@
 class PingServer : noncopyable
 {
 public:
-  PingServer(Face& face, const Options& options);
+  PingServer(Face& face, KeyChain& keyChain, const Options& options);
 
   /**
-   * Signals when Interest received
+   * @brief Signals when Interest received
+   *
    * @param name incoming interest name
    */
   signal::Signal<PingServer, Name> afterReceive;
 
+  /**
+   * @brief Signals when finished pinging
+   */
+  signal::Signal<PingServer> afterFinish;
+
   /** @brief starts ping server
    *
    *  If options.shouldLimitSatisfied is false, this method does not return unless there's an error.
@@ -66,11 +72,19 @@
 
   /**
    * @brief starts the Interest filter
+   *
+   * @note This method is non-blocking and caller need to call face.processEvents()
    */
   void
   start();
 
   /**
+   * @brief Unregister set interest filter
+   */
+  void
+  stop();
+
+  /**
    * @brief gets the number of pings received
    */
   int
@@ -78,14 +92,16 @@
 
 private:
   /**
-   * Called when interest received
+   * @brief Called when interest received
+   *
    * @param interest incoming interest
    */
   void
   onInterest(const Interest& interest);
 
   /**
-   * Called when prefix registration failed
+   * @brief Called when prefix registration failed
+   *
    * @param reason reason for failure
    */
   void
@@ -93,15 +109,17 @@
 
 private:
   const Options& m_options;
+  KeyChain& m_keyChain;
   Name m_name;
-  KeyChain m_keyChain;
   int m_nPings;
   Face& m_face;
   Block m_payload;
+
+  const RegisteredPrefixId* m_registeredPrefixId;
 };
 
 } // namespace server
 } // namespace ping
 } // namespace ndn
 
-#endif //NDN_TOOLS_PING_SERVER_PING_SERVER_HPP
\ No newline at end of file
+#endif //NDN_TOOLS_PING_SERVER_PING_SERVER_HPP