remove m_ prefix
Change-Id: I67aa409174fcd3f8df477be8aa4efb8ca96cf012
diff --git a/src/detail/ca-configuration.cpp b/src/detail/ca-configuration.cpp
index d44b36b..7d27bfb 100644
--- a/src/detail/ca-configuration.cpp
+++ b/src/detail/ca-configuration.cpp
@@ -40,7 +40,7 @@
NDN_THROW(std::runtime_error("No JSON configuration found in file: " + fileName));
}
caProfile = CaProfile::fromJson(configJson);
- if (caProfile.m_supportedChallenges.size() == 0) {
+ if (caProfile.supportedChallenges.size() == 0) {
NDN_THROW(std::runtime_error("At least one challenge should be specified."));
}
// parse redirection section if appears
diff --git a/src/detail/ca-profile.cpp b/src/detail/ca-profile.cpp
index 5216ae0..7986830 100644
--- a/src/detail/ca-profile.cpp
+++ b/src/detail/ca-profile.cpp
@@ -31,22 +31,22 @@
{
CaProfile profile;
// CA prefix
- profile.m_caPrefix = Name(json.get(CONFIG_CA_PREFIX, ""));
- if (profile.m_caPrefix.empty()) {
+ profile.caPrefix = Name(json.get(CONFIG_CA_PREFIX, ""));
+ if (profile.caPrefix.empty()) {
NDN_THROW(std::runtime_error("Cannot parse ca-prefix from the config file"));
}
// CA info
- profile.m_caInfo = json.get(CONFIG_CA_INFO, "");
+ profile.caInfo = json.get(CONFIG_CA_INFO, "");
// CA max validity period
- profile.m_maxValidityPeriod = time::seconds(json.get(CONFIG_MAX_VALIDITY_PERIOD, 86400));
+ profile.maxValidityPeriod = time::seconds(json.get(CONFIG_MAX_VALIDITY_PERIOD, 86400));
// CA max suffix length
- profile.m_maxSuffixLength = nullopt;
+ profile.maxSuffixLength = nullopt;
auto maxSuffixLength = json.get_optional<size_t>(CONFIG_MAX_SUFFIX_LENGTH);
if (maxSuffixLength) {
- profile.m_maxSuffixLength = *maxSuffixLength;
+ profile.maxSuffixLength = *maxSuffixLength;
}
// probe parameter keys
- profile.m_probeParameterKeys.clear();
+ profile.probeParameterKeys.clear();
auto probeParametersJson = json.get_child_optional(CONFIG_PROBE_PARAMETERS);
if (probeParametersJson) {
for (const auto& item : *probeParametersJson) {
@@ -55,11 +55,11 @@
if (probeParameter == "") {
NDN_THROW(std::runtime_error("Probe parameter key cannot be empty."));
}
- profile.m_probeParameterKeys.push_back(probeParameter);
+ profile.probeParameterKeys.push_back(probeParameter);
}
}
// supported challenges
- profile.m_supportedChallenges.clear();
+ profile.supportedChallenges.clear();
auto challengeListJson = json.get_child_optional(CONFIG_SUPPORTED_CHALLENGES);
if (challengeListJson) {
for (const auto& item : *challengeListJson) {
@@ -71,15 +71,15 @@
if (!ChallengeModule::isChallengeSupported(challengeType)) {
NDN_THROW(std::runtime_error("Challenge " + challengeType + " is not supported."));
}
- profile.m_supportedChallenges.push_back(challengeType);
+ profile.supportedChallenges.push_back(challengeType);
}
}
// anchor certificate
- profile.m_cert = nullptr;
+ profile.cert = nullptr;
auto certificateStr = json.get(CONFIG_CERTIFICATE, "");
if (certificateStr != "") {
std::istringstream ss(certificateStr);
- profile.m_cert = io::load<security::Certificate>(ss);
+ profile.cert = io::load<security::Certificate>(ss);
}
return profile;
}
@@ -88,33 +88,33 @@
CaProfile::toJson() const
{
JsonSection caItem;
- caItem.put(CONFIG_CA_PREFIX, m_caPrefix.toUri());
- caItem.put(CONFIG_CA_INFO, m_caInfo);
- caItem.put(CONFIG_MAX_VALIDITY_PERIOD, m_maxValidityPeriod.count());
- if (m_maxSuffixLength) {
- caItem.put(CONFIG_MAX_SUFFIX_LENGTH, *m_maxSuffixLength);
+ caItem.put(CONFIG_CA_PREFIX, caPrefix.toUri());
+ caItem.put(CONFIG_CA_INFO, caInfo);
+ caItem.put(CONFIG_MAX_VALIDITY_PERIOD, maxValidityPeriod.count());
+ if (maxSuffixLength) {
+ caItem.put(CONFIG_MAX_SUFFIX_LENGTH, *maxSuffixLength);
}
- if (!m_probeParameterKeys.empty()) {
+ if (!probeParameterKeys.empty()) {
JsonSection probeParametersJson;
- for (const auto& key : m_probeParameterKeys) {
+ for (const auto& key : probeParameterKeys) {
JsonSection keyJson;
keyJson.put(CONFIG_PROBE_PARAMETER, key);
probeParametersJson.push_back(std::make_pair("", keyJson));
}
caItem.add_child("", probeParametersJson);
}
- if (!m_supportedChallenges.empty()) {
+ if (!supportedChallenges.empty()) {
JsonSection challengeListJson;
- for (const auto& challenge : m_supportedChallenges) {
+ for (const auto& challenge : supportedChallenges) {
JsonSection challengeJson;
challengeJson.put(CONFIG_CHALLENGE, challenge);
challengeListJson.push_back(std::make_pair("", challengeJson));
}
caItem.add_child("", challengeListJson);
}
- if (m_cert != nullptr) {
+ if (cert != nullptr) {
std::stringstream ss;
- io::save(*m_cert, ss);
+ io::save(*cert, ss);
caItem.put("certificate", ss.str());
}
return caItem;
diff --git a/src/detail/ca-profile.hpp b/src/detail/ca-profile.hpp
index b3e31be..69adf43 100644
--- a/src/detail/ca-profile.hpp
+++ b/src/detail/ca-profile.hpp
@@ -60,37 +60,37 @@
/**
* @brief CA Name prefix (without /CA suffix).
*/
- Name m_caPrefix;
+ Name caPrefix;
/**
* @brief CA Information.
*/
- std::string m_caInfo;
+ std::string caInfo;
/**
* @brief A list of parameter-keys for PROBE.
*/
- std::vector<std::string> m_probeParameterKeys;
+ std::vector<std::string> probeParameterKeys;
/**
* @brief Maximum allowed validity period of the certificate being requested.
*
* The value is in the unit of second.
* Default: one day (86400 seconds).
*/
- time::seconds m_maxValidityPeriod;
+ time::seconds maxValidityPeriod;
/**
* @brief Maximum allowed suffix length of requested name.
*
* E.g., When its value is 2, at most 2 name components can be assigned after m_caPrefix.
* Default: none.
*/
- optional<size_t> m_maxSuffixLength = nullopt;
+ optional<size_t> maxSuffixLength = nullopt;
/**
* @brief A list of supported challenges. Only CA side will have m_supportedChallenges.
*/
- std::vector<std::string> m_supportedChallenges;
+ std::vector<std::string> supportedChallenges;
/**
* @brief CA's certificate. Only Client side will have m_cert.
*/
- std::shared_ptr<security::Certificate> m_cert;
+ std::shared_ptr<security::Certificate> cert;
};
} // namespace ndncert
diff --git a/src/detail/info-encoder.cpp b/src/detail/info-encoder.cpp
index 17e798c..79f617f 100644
--- a/src/detail/info-encoder.cpp
+++ b/src/detail/info-encoder.cpp
@@ -27,19 +27,19 @@
infotlv::encodeDataContent(const CaProfile& caConfig, const security::Certificate& certificate)
{
Block content(ndn::tlv::Content);
- content.push_back(makeNestedBlock(tlv::CaPrefix, caConfig.m_caPrefix));
+ content.push_back(makeNestedBlock(tlv::CaPrefix, caConfig.caPrefix));
std::string caInfo = "";
- if (caConfig.m_caInfo == "") {
+ if (caConfig.caInfo == "") {
caInfo = "Issued by " + certificate.getSignatureInfo().getKeyLocator().getName().toUri();
}
else {
- caInfo = caConfig.m_caInfo;
+ caInfo = caConfig.caInfo;
}
content.push_back(makeStringBlock(tlv::CaInfo, caInfo));
- for (const auto& key : caConfig.m_probeParameterKeys) {
+ for (const auto& key : caConfig.probeParameterKeys) {
content.push_back(makeStringBlock(tlv::ParameterKey, key));
}
- content.push_back(makeNonNegativeIntegerBlock(tlv::MaxValidityPeriod, caConfig.m_maxValidityPeriod.count()));
+ content.push_back(makeNonNegativeIntegerBlock(tlv::MaxValidityPeriod, caConfig.maxValidityPeriod.count()));
content.push_back(makeNestedBlock(tlv::CaCertificate, certificate));
content.encode();
return content;
@@ -54,20 +54,20 @@
switch (item.type()) {
case tlv::CaPrefix:
item.parse();
- result.m_caPrefix.wireDecode(item.get(ndn::tlv::Name));
+ result.caPrefix.wireDecode(item.get(ndn::tlv::Name));
break;
case tlv::CaInfo:
- result.m_caInfo = readString(item);
+ result.caInfo = readString(item);
break;
case tlv::ParameterKey:
- result.m_probeParameterKeys.push_back(readString(item));
+ result.probeParameterKeys.push_back(readString(item));
break;
case tlv::MaxValidityPeriod:
- result.m_maxValidityPeriod = time::seconds(readNonNegativeInteger(item));
+ result.maxValidityPeriod = time::seconds(readNonNegativeInteger(item));
break;
case tlv::CaCertificate:
item.parse();
- result.m_cert = std::make_shared<security::Certificate>(item.get(ndn::tlv::Data));
+ result.cert = std::make_shared<security::Certificate>(item.get(ndn::tlv::Data));
break;
default:
continue;
diff --git a/src/detail/profile-storage.cpp b/src/detail/profile-storage.cpp
index 2917382..7ae3c08 100644
--- a/src/detail/profile-storage.cpp
+++ b/src/detail/profile-storage.cpp
@@ -49,7 +49,7 @@
for (auto item : caList) {
CaProfile caItem;
caItem = CaProfile::fromJson(item.second);
- if (caItem.m_cert == nullptr) {
+ if (caItem.cert == nullptr) {
NDN_THROW(std::runtime_error("No CA certificate is loaded from JSON configuration."));
}
m_caProfiles.push_back(std::move(caItem));
@@ -74,14 +74,14 @@
void
ProfileStorage::removeCaProfile(const Name& caName)
{
- m_caProfiles.remove_if([&](const CaProfile& item) { return item.m_caPrefix == caName; });
+ m_caProfiles.remove_if([&](const CaProfile& item) { return item.caPrefix == caName; });
}
void
ProfileStorage::addCaProfile(const CaProfile& profile)
{
for (auto& item : m_caProfiles) {
- if (item.m_caPrefix == profile.m_caPrefix) {
+ if (item.caPrefix == profile.caPrefix) {
item = profile;
return;
}