Remove genChallengeInfo and add genSelectParamsJson and genValidateParamsJson

Change-Id: Ic389fcaf52a713ff5b0fefe7025a5630d7b0f7cc
diff --git a/src/challenge-module.cpp b/src/challenge-module.cpp
index f1eb5bc..6a28866 100644
--- a/src/challenge-module.cpp
+++ b/src/challenge-module.cpp
@@ -71,10 +71,17 @@
 }
 
 JsonSection
-ChallengeModule::genRequestChallengeInfo(const std::string& interestType, const std::string& status,
-                                         const std::list<std::string>& paramList)
+ChallengeModule::genSelectParamsJson(const std::string& status,
+                                     const std::list<std::string>& paramList)
 {
-  return genChallengeInfo(interestType, status, paramList);
+  return doGenSelectParamsJson(status, paramList);
+}
+
+JsonSection
+ChallengeModule::genValidateParamsJson(const std::string& status,
+                                     const std::list<std::string>& paramList)
+{
+  return doGenValidateParamsJson(status, paramList);
 }
 
 JsonSection
diff --git a/src/challenge-module.hpp b/src/challenge-module.hpp
index 1cc22ad..7e36d4c 100644
--- a/src/challenge-module.hpp
+++ b/src/challenge-module.hpp
@@ -58,6 +58,7 @@
   static unique_ptr<ChallengeModule>
   createChallengeModule(const std::string& ChallengeType);
 
+  // For CA
   /**
    * @brief Handle the challenge related interest and update certificate request.
    * @note Should be used by CA Module
@@ -73,6 +74,7 @@
   JsonSection
   handleChallengeRequest(const Interest& interest, CertificateRequest& request);
 
+  // For Client
   /**
    * @brief Get requirements for requester before sending SELECT interest.
    * @note Should be used by Client Module
@@ -105,28 +107,45 @@
   getRequirementForValidate(const std::string& status);
 
   /**
-   * @brief Generate ChallengeInfo part for SELECT and VALIDATE interest.
+   * @brief Generate ChallengeInfo part for SELECT interest.
    * @note Should be used by Client Module
    *
    * After requester provides required information, client should invoke the function to
    * generate the ChallengeInfo part of the interest.
    *
-   * @param interestType of the request
    * @param status of the challenge
    * @param paramList contains all the input from requester
    * @return the JSON file of ChallengeInfo
    */
   JsonSection
-  genRequestChallengeInfo(const std::string& interestType, const std::string& status,
-                          const std::list<std::string>& paramList);
+  genSelectParamsJson(const std::string& status, const std::list<std::string>& paramList);
+
+  /**
+   * @brief Generate ChallengeInfo part for VALIDATE interest.
+   * @note Should be used by Client Module
+   *
+   * After requester provides required information, client should invoke the function to
+   * generate the ChallengeInfo part of the interest.
+   *
+   * @param status of the challenge
+   * @param paramList contains all the input from requester
+   * @return the JSON file of ChallengeInfo
+   */
+  JsonSection
+  genValidateParamsJson(const std::string& status, const std::list<std::string>& paramList);
 
 PUBLIC_WITH_TESTS_ELSE_PROTECTED:
+  // For CA
   virtual JsonSection
   processSelectInterest(const Interest& interest, CertificateRequest& request) = 0;
 
   virtual JsonSection
   processValidateInterest(const Interest& interest, CertificateRequest& request) = 0;
 
+  virtual JsonSection
+  processStatusInterest(const Interest& interest, const CertificateRequest& request);
+
+  // For Client
   virtual std::list<std::string>
   getSelectRequirements() = 0;
 
@@ -134,12 +153,12 @@
   getValidateRequirements(const std::string& status) = 0;
 
   virtual JsonSection
-  genChallengeInfo(const std::string& interestType, const std::string& status,
-                   const std::list<std::string>& paramList) = 0;
+  doGenSelectParamsJson(const std::string& status, const std::list<std::string>& paramList) = 0;
 
   virtual JsonSection
-  processStatusInterest(const Interest& interest, const CertificateRequest& request);
+  doGenValidateParamsJson(const std::string& status, const std::list<std::string>& paramList) = 0;
 
+  // Helpers
   static JsonSection
   getJsonFromNameComponent(const Name& name, int pos);
 
diff --git a/src/challenge-module/challenge-pin.cpp b/src/challenge-module/challenge-pin.cpp
index c5825f9..1aa96ce 100644
--- a/src/challenge-module/challenge-pin.cpp
+++ b/src/challenge-module/challenge-pin.cpp
@@ -115,17 +115,21 @@
 }
 
 JsonSection
-ChallengePin::genChallengeInfo(const std::string& interestType, const std::string& status,
-                               const std::list<std::string>& paramList)
+ChallengePin::doGenSelectParamsJson(const std::string& status,
+                                    const std::list<std::string>& paramList)
 {
   JsonSection result;
-  if (interestType == "_SELECT") {
-    BOOST_ASSERT(paramList.size() == 0);
-  }
-  else if (interestType == "_VALIDATE") {
-    BOOST_ASSERT(paramList.size() == 1);
-    result.put(JSON_PIN_CODE, paramList.front());
-  }
+  BOOST_ASSERT(paramList.size() == 0);
+  return result;
+}
+
+JsonSection
+ChallengePin::doGenValidateParamsJson(const std::string& status,
+                                      const std::list<std::string>& paramList)
+{
+  JsonSection result;
+  BOOST_ASSERT(paramList.size() == 1);
+  result.put(JSON_PIN_CODE, paramList.front());
   return result;
 }
 
diff --git a/src/challenge-module/challenge-pin.hpp b/src/challenge-module/challenge-pin.hpp
index d6094c7..31ea05f 100644
--- a/src/challenge-module/challenge-pin.hpp
+++ b/src/challenge-module/challenge-pin.hpp
@@ -63,8 +63,12 @@
   getValidateRequirements(const std::string& status) override;
 
   JsonSection
-  genChallengeInfo(const std::string& interestType, const std::string& status,
-                   const std::list<std::string>& paramList) override;
+  doGenSelectParamsJson(const std::string& status,
+                        const std::list<std::string>& paramList) override;
+
+  JsonSection
+  doGenValidateParamsJson(const std::string& status,
+                          const std::list<std::string>& paramList) override;
 
 PUBLIC_WITH_TESTS_ELSE_PRIVATE:
   static std::tuple<time::system_clock::TimePoint, std::string, int>