Update JSON format: add status field in NEW's response
Change-Id: I7a58a92567c5d503bfca4f5efc3d66d09c20aa28
diff --git a/src/json-helper.cpp b/src/json-helper.cpp
index a7cc897..78969fc 100644
--- a/src/json-helper.cpp
+++ b/src/json-helper.cpp
@@ -25,22 +25,24 @@
namespace ndncert {
const JsonSection
-genResponseProbeJson(const Name& identifier, const Name& CaInformation)
+genResponseProbeJson(const Name& identifier, const Name& caInformation)
{
JsonSection root;
root.put(JSON_IDNENTIFIER, identifier.toUri());
- root.put(JSON_CA_INFO, CaInformation.toUri());
+ root.put(JSON_CA_INFO, caInformation.toUri());
return root;
}
const JsonSection
-genResponseNewJson(const std::string& requestId, const std::list<std::string>& challenges)
+genResponseNewJson(const std::string& requestId, const std::string& status,
+ const std::list<std::string>& challenges)
{
JsonSection root;
JsonSection challengesSection;
root.put(JSON_REQUEST_ID, requestId);
+ root.put(JSON_STATUS, status);
for (const auto& entry : challenges) {
JsonSection challenge;
diff --git a/src/json-helper.hpp b/src/json-helper.hpp
index c34c631..791fc12 100644
--- a/src/json-helper.hpp
+++ b/src/json-helper.hpp
@@ -40,19 +40,20 @@
*
* Target JSON format:
* {
- * "identifier": "",
- * "ca-info": ""
+ * "identifier": "@p identifier",
+ * "ca-info": "@p caInformation"
* }
*/
const JsonSection
-genResponseProbeJson(const Name& identifier, const Name& CaInformation);
+genResponseProbeJson(const Name& identifier, const Name& caInformation);
/**
* @brief Generate JSON file to response NEW interest
*
* Target JSON format:
* {
- * "request-id": "",
+ * "request-id": "@p requestId",
+ * "status": "@p status",
* "challenges": [
* {
* "challenge-type": ""
@@ -65,7 +66,8 @@
* }
*/
const JsonSection
-genResponseNewJson(const std::string& requestId, const std::list<std::string>& challenges);
+genResponseNewJson(const std::string& requestId, const std::string& status,
+ const std::list<std::string>& challenges);
/**
* @brief Generate JSON file to response _SELECT, _VALIDATE, and _STATUS interest
@@ -98,8 +100,8 @@
*
* Target JSON format:
* {
- * "status": "",
- * "error-info": ""
+ * "status": "error",
+ * "error-info": "@p errorInfo"
* }
*/
const JsonSection