Remove _ from _PROBE, _NEW, _CHALLENGE
Change-Id: I5e7d660536ee3f118516f3e18c0e2016808715f2
diff --git a/src/ca-module.cpp b/src/ca-module.cpp
index 5e789f7..63db04f 100644
--- a/src/ca-module.cpp
+++ b/src/ca-module.cpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
+/**
* Copyright (c) 2017-2020, Regents of the University of California.
*
* This file is part of ndncert, a certificate management system based on NDN.
@@ -76,22 +76,22 @@
prefixId = m_face.registerPrefix(prefix,
[&] (const Name& name) {
// register PROBE prefix
- auto filterId = m_face.setInterestFilter(Name(name).append("_PROBE"),
+ auto filterId = m_face.setInterestFilter(Name(name).append("PROBE"),
bind(&CaModule::onProbe, this, _2));
m_interestFilterHandles.push_back(filterId);
// register NEW prefix
- filterId = m_face.setInterestFilter(Name(name).append("_NEW"),
+ filterId = m_face.setInterestFilter(Name(name).append("NEW"),
bind(&CaModule::onNew, this, _2));
m_interestFilterHandles.push_back(filterId);
// register SELECT prefix
- filterId = m_face.setInterestFilter(Name(name).append("_CHALLENGE"),
+ filterId = m_face.setInterestFilter(Name(name).append("CHALLENGE"),
bind(&CaModule::onChallenge, this, _2));
m_interestFilterHandles.push_back(filterId);
// register DOWNLOAD prefix
- filterId = m_face.setInterestFilter(Name(name).append("_DOWNLOAD"),
+ filterId = m_face.setInterestFilter(Name(name).append("DOWNLOAD"),
bind(&CaModule::onDownload, this, _2));
m_interestFilterHandles.push_back(filterId);
_LOG_TRACE("Prefix " << name << " got registered");
@@ -238,7 +238,7 @@
else if (probeToken != nullptr) {
// check whether the carried probe token is a PROBE Data packet
Name prefix = m_config.m_caName;
- prefix.append("CA").append("_PROBE");
+ prefix.append("CA").append("PROBE");
if (!prefix.isPrefixOf(probeToken->getName())) {
_LOG_ERROR("Carried PROBE token is not a valid PROBE Data packet.");
return;
diff --git a/src/client-module.cpp b/src/client-module.cpp
index 0daa72c..eff4e90 100644
--- a/src/client-module.cpp
+++ b/src/client-module.cpp
@@ -51,7 +51,7 @@
Name interestName = caName;
if (readString(caName.at(-1)) != "CA")
interestName.append("CA");
- interestName.append("_PROBE").append("INFO");
+ interestName.append("PROBE").append("INFO");
auto interest = make_shared<Interest>(interestName);
interest->setMustBeFresh(true);
interest->setCanBePrefix(false);
@@ -97,7 +97,7 @@
ClientModule::generateProbeInterest(const ClientCaItem& ca, const std::string& probeInfo)
{
Name interestName = ca.m_caName;
- interestName.append("CA").append("_PROBE");
+ interestName.append("CA").append("PROBE");
auto interest = make_shared<Interest>(interestName);
interest->setMustBeFresh(true);
interest->setCanBePrefix(false);
@@ -190,7 +190,7 @@
// generate Interest packet
Name interestName = m_ca.m_caName;
- interestName.append("CA").append("_NEW");
+ interestName.append("CA").append("NEW");
auto interest = make_shared<Interest>(interestName);
interest->setMustBeFresh(true);
interest->setCanBePrefix(false);
@@ -238,7 +238,7 @@
m_challengeType = paramJson.get(JSON_CLIENT_SELECTED_CHALLENGE, "");
Name interestName = m_ca.m_caName;
- interestName.append("CA").append("_CHALLENGE").append(m_requestId);
+ interestName.append("CA").append("CHALLENGE").append(m_requestId);
auto interest = make_shared<Interest>(interestName);
interest->setMustBeFresh(true);
interest->setCanBePrefix(false);
@@ -279,7 +279,7 @@
ClientModule::generateDownloadInterest()
{
Name interestName = m_ca.m_caName;
- interestName.append("CA").append("_DOWNLOAD").append(m_requestId);
+ interestName.append("CA").append("DOWNLOAD").append(m_requestId);
auto interest = make_shared<Interest>(interestName);
interest->setMustBeFresh(true);
interest->setCanBePrefix(false);
diff --git a/tests/unit-tests/ca-module.t.cpp b/tests/unit-tests/ca-module.t.cpp
index a72a3d8..e300288 100644
--- a/tests/unit-tests/ca-module.t.cpp
+++ b/tests/unit-tests/ca-module.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2017-2019, Regents of the University of California.
+ * Copyright (c) 2017-2020, Regents of the University of California.
*
* This file is part of ndncert, a certificate management system based on NDN.
*
@@ -66,7 +66,7 @@
});
advanceClocks(time::milliseconds(20), 60);
- Interest interest("/ndn/CA/_PROBE");
+ Interest interest("/ndn/CA/PROBE");
interest.setCanBePrefix(false);
JsonSection paramJson;
paramJson.add(JSON_CLIENT_PROBE_INFO, "zhiyi");
@@ -98,7 +98,7 @@
});
advanceClocks(time::milliseconds(20), 60);
- Interest interest("/ndn/CA/_PROBE/INFO");
+ Interest interest("/ndn/CA/PROBE/INFO");
interest.setCanBePrefix(false);
int count = 0;
@@ -128,7 +128,7 @@
CaModule ca(face, m_keyChain, "tests/unit-tests/ca.conf.test", "ca-storage-memory");
advanceClocks(time::milliseconds(20), 60);
- Interest interest("/ndn/CA/_PROBE");
+ Interest interest("/ndn/CA/PROBE");
interest.setCanBePrefix(false);
JsonSection paramJson;
paramJson.add(JSON_CLIENT_PROBE_INFO, "zhiyi");
@@ -238,7 +238,7 @@
item.m_anchor = cert;
client.getClientConf().m_caItems.push_back(item);
- auto data = make_shared<Data>(Name("/ndn/CA/_PROBE/123"));
+ auto data = make_shared<Data>(Name("/ndn/CA/PROBE/123"));
m_keyChain.sign(*data, signingByIdentity(ca.m_config.m_caName));
auto interest = client.generateNewInterest(time::system_clock::now(),
@@ -283,7 +283,7 @@
int count = 0;
face.onSendData.connect([&] (const Data& response) {
- if (Name("/ndn/CA/_NEW").isPrefixOf(response.getName())) {
+ if (Name("/ndn/CA/NEW").isPrefixOf(response.getName())) {
auto contentJson = ClientModule::getJsonFromData(response);
client.onNewResponse(response);
auto paramJson = pinChallenge.getRequirementForChallenge(client.m_status, client.m_challengeStatus);
@@ -291,7 +291,7 @@
client.m_challengeStatus,
paramJson));
}
- else if (Name("/ndn/CA/_CHALLENGE").isPrefixOf(response.getName()) && count == 0) {
+ else if (Name("/ndn/CA/CHALLENGE").isPrefixOf(response.getName()) && count == 0) {
count++;
BOOST_CHECK(security::verifySignature(response, cert));
@@ -304,7 +304,7 @@
client.m_challengeStatus,
paramJson));
}
- else if (Name("/ndn/CA/_CHALLENGE").isPrefixOf(response.getName()) && count == 1) {
+ else if (Name("/ndn/CA/CHALLENGE").isPrefixOf(response.getName()) && count == 1) {
count++;
BOOST_CHECK(security::verifySignature(response, cert));
@@ -323,7 +323,7 @@
client.m_challengeStatus,
paramJson));
}
- else if (Name("/ndn/CA/_CHALLENGE").isPrefixOf(response.getName()) && count == 2) {
+ else if (Name("/ndn/CA/CHALLENGE").isPrefixOf(response.getName()) && count == 2) {
count++;
BOOST_CHECK(security::verifySignature(response, cert));
diff --git a/tests/unit-tests/client-module.t.cpp b/tests/unit-tests/client-module.t.cpp
index 9dde9dd..5da0330 100644
--- a/tests/unit-tests/client-module.t.cpp
+++ b/tests/unit-tests/client-module.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2017-2019, Regents of the University of California.
+ * Copyright (c) 2017-2020, Regents of the University of California.
*
* This file is part of ndncert, a certificate management system based on NDN.
*
@@ -60,7 +60,7 @@
auto firstInterest = client.generateProbeInterest(item, "zhiyi@cs.ucla.edu:987654321:Zhiyi Zhang");
BOOST_CHECK(firstInterest->getName().at(-1).isParametersSha256Digest());
// ignore the last name component (ParametersSha256Digest)
- BOOST_CHECK_EQUAL(firstInterest->getName().getPrefix(-1), "/site/CA/_PROBE");
+ BOOST_CHECK_EQUAL(firstInterest->getName().getPrefix(-1), "/site/CA/PROBE");
BOOST_CHECK_EQUAL(CaModule::jsonFromBlock(firstInterest->getApplicationParameters()).get<std::string>("email"),
"zhiyi@cs.ucla.edu");
}