adjust client command line tool to reflect the library change
Change-Id: Ie0628470b5b96848b930d131ad92fd196de8f64c
diff --git a/src/ca-module.cpp b/src/ca-module.cpp
index f12011e..715fe1d 100644
--- a/src/ca-module.cpp
+++ b/src/ca-module.cpp
@@ -478,20 +478,19 @@
const JsonSection
CaModule::genProbeResponseJson(const Name& identifier, const std::string& m_probe, const JsonSection& parameterJson)
{
- std::vector<std::string> fields;
- std::string delimiter = ":";
- size_t last = 0;
- size_t next = 0;
- while ((next = m_probe.find(delimiter, last)) != std::string::npos) {
- fields.push_back(m_probe.substr(last, next - last));
- last = next + 1;
- }
- fields.push_back(m_probe.substr(last));
-
+ std::vector<std::string> fields;
+ std::string delimiter = ":";
+ size_t last = 0;
+ size_t next = 0;
+ while ((next = m_probe.find(delimiter, last)) != std::string::npos) {
+ fields.push_back(m_probe.substr(last, next - last));
+ last = next + 1;
+ }
+ fields.push_back(m_probe.substr(last));
JsonSection root;
for (size_t i = 0; i < fields.size(); ++i) {
- root.put(fields.at(i), parameterJson.get(fields.at(i), ""));
+ root.put(fields.at(i), parameterJson.get(fields.at(i), ""));
}
root.put(JSON_CA_NAME, identifier.toUri());
diff --git a/src/client-module.cpp b/src/client-module.cpp
index b3af7dd..f8d73f6 100644
--- a/src/client-module.cpp
+++ b/src/client-module.cpp
@@ -111,6 +111,9 @@
if (nameUri != "") {
m_identityName = Name(nameUri);
}
+ else {
+ NDN_LOG_TRACE("The JSON_CA_NAME is empty.");
+ }
}
shared_ptr<Interest>
@@ -137,6 +140,7 @@
// do nothing
}
else {
+ NDN_LOG_TRACE("Randomly create a new name because m_identityName is empty and the param is empty.");
auto id = std::to_string(random::generateSecureWord64());
m_identityName = m_ca.m_caName;
m_identityName.append(id);
diff --git a/tools/ndncert-client.cpp b/tools/ndncert-client.cpp
index 50057ae..4b926c7 100644
--- a/tools/ndncert-client.cpp
+++ b/tools/ndncert-client.cpp
@@ -213,6 +213,7 @@
static void
probeCb(const Data& reply)
{
+ client.onProbeResponse(reply);
std::cerr << "Step " << nStep++
<< ": Please type in your expected validity period of your certificate."
<< " Type in a number in unit of hour. The CA may change the validity"
@@ -220,8 +221,10 @@
std::string periodStr;
getline(std::cin, periodStr);
int hours = std::stoi(periodStr);
+ auto probeToken = make_shared<Data>(reply);
face.expressInterest(*client.generateNewInterest(time::system_clock::now(),
- time::system_clock::now() + time::hours(hours)),
+ time::system_clock::now() + time::hours(hours),
+ Name(), probeToken),
bind(&newCb, _2),
bind(&onNackCb),
bind(&timeoutCb));