fix cr
Change-Id: I683943c014a8615711bd8a7b570acfe8d3b51a3e
diff --git a/src/detail/ca-memory.cpp b/src/detail/ca-memory.cpp
index f2a3b12..48a0903 100644
--- a/src/detail/ca-memory.cpp
+++ b/src/detail/ca-memory.cpp
@@ -48,21 +48,21 @@
void
CaMemory::addRequest(const RequestState& request)
{
- auto search = m_requests.find(request.m_requestId);
+ auto search = m_requests.find(request.requestId);
if (search == m_requests.end()) {
- m_requests.insert(std::make_pair(request.m_requestId, request));
+ m_requests.insert(std::make_pair(request.requestId, request));
}
else {
- NDN_THROW(std::runtime_error("Request " + toHex(request.m_requestId.data(), request.m_requestId.size()) + " already exists"));
+ NDN_THROW(std::runtime_error("Request " + toHex(request.requestId.data(), request.requestId.size()) + " already exists"));
}
}
void
CaMemory::updateRequest(const RequestState& request)
{
- auto search = m_requests.find(request.m_requestId);
+ auto search = m_requests.find(request.requestId);
if (search == m_requests.end()) {
- m_requests.insert(std::make_pair(request.m_requestId, request));
+ m_requests.insert(std::make_pair(request.requestId, request));
}
else {
search->second = request;
@@ -73,7 +73,7 @@
CaMemory::deleteRequest(const RequestId& requestId)
{
auto search = m_requests.find(requestId);
- auto keyName = search->second.m_cert.getKeyName();
+ auto keyName = search->second.cert.getKeyName();
if (search != m_requests.end()) {
m_requests.erase(search);
}
@@ -94,7 +94,7 @@
{
std::list<RequestState> result;
for (const auto& entry : m_requests) {
- if (entry.second.m_caPrefix == caName) {
+ if (entry.second.caPrefix == caName) {
result.push_back(entry.second);
}
}
diff --git a/src/detail/ca-request-state.cpp b/src/detail/ca-request-state.cpp
index adb453f..55b5cf9 100644
--- a/src/detail/ca-request-state.cpp
+++ b/src/detail/ca-request-state.cpp
@@ -58,23 +58,23 @@
const time::system_clock::TimePoint& challengeTp,
size_t remainingTries, time::seconds remainingTime,
JsonSection&& challengeSecrets)
- : m_challengeStatus(challengeStatus)
- , m_timestamp(challengeTp)
- , m_remainingTries(remainingTries)
- , m_remainingTime(remainingTime)
- , m_secrets(std::move(challengeSecrets))
+ : challengeStatus(challengeStatus)
+ , timestamp(challengeTp)
+ , remainingTries(remainingTries)
+ , remainingTime(remainingTime)
+ , secrets(std::move(challengeSecrets))
{
}
RequestState::RequestState(const Name& caName, const RequestId& requestId, RequestType requestType, Status status,
const security::Certificate& cert, std::array<uint8_t, 16>&& encryptionKey, uint32_t aesBlockCounter)
- : m_caPrefix(caName)
- , m_requestId(requestId)
- , m_requestType(requestType)
- , m_status(status)
- , m_cert(cert)
- , m_encryptionKey(std::move(encryptionKey))
- , m_aesBlockCounter(aesBlockCounter)
+ : caPrefix(caName)
+ , requestId(requestId)
+ , requestType(requestType)
+ , status(status)
+ , cert(cert)
+ , encryptionKey(std::move(encryptionKey))
+ , aesBlockCounter(aesBlockCounter)
{
}
@@ -83,34 +83,34 @@
const std::string& challengeStatus, const time::system_clock::TimePoint& challengeTp,
size_t remainingTries, time::seconds remainingTime, JsonSection&& challengeSecrets,
std::array<uint8_t, 16>&& encryptionKey, uint32_t aesBlockCounter)
- : m_caPrefix(caName)
- , m_requestId(requestId)
- , m_requestType(requestType)
- , m_status(status)
- , m_cert(cert)
- , m_encryptionKey(std::move(encryptionKey))
- , m_aesBlockCounter(aesBlockCounter)
- , m_challengeType(challengeType)
- , m_challengeState(ChallengeState(challengeStatus, challengeTp, remainingTries, remainingTime, std::move(challengeSecrets)))
+ : caPrefix(caName)
+ , requestId(requestId)
+ , requestType(requestType)
+ , status(status)
+ , cert(cert)
+ , encryptionKey(std::move(encryptionKey))
+ , aesBlockCounter(aesBlockCounter)
+ , challengeType(challengeType)
+ , challengeState(ChallengeState(challengeStatus, challengeTp, remainingTries, remainingTime, std::move(challengeSecrets)))
{
}
std::ostream&
operator<<(std::ostream& os, const RequestState& request)
{
- os << "Request's CA name: " << request.m_caPrefix << "\n";
- os << "Request's request ID: " << toHex(request.m_requestId.data(), request.m_requestId.size()) << "\n";
- os << "Request's status: " << statusToString(request.m_status) << "\n";
- os << "Request's challenge type: " << request.m_challengeType << "\n";
- if (request.m_challengeState) {
- os << "Challenge Status: " << request.m_challengeState->m_challengeStatus << "\n";
- os << "Challenge remaining tries:" << request.m_challengeState->m_remainingTries << " times\n";
- os << "Challenge remaining time: " << request.m_challengeState->m_remainingTime.count() << " seconds\n";
- os << "Challenge last update: " << time::toIsoString(request.m_challengeState->m_timestamp) << "\n";
+ os << "Request's CA name: " << request.caPrefix << "\n";
+ os << "Request's request ID: " << toHex(request.requestId.data(), request.requestId.size()) << "\n";
+ os << "Request's status: " << statusToString(request.status) << "\n";
+ os << "Request's challenge type: " << request.challengeType << "\n";
+ if (request.challengeState) {
+ os << "Challenge Status: " << request.challengeState->challengeStatus << "\n";
+ os << "Challenge remaining tries:" << request.challengeState->remainingTries << " times\n";
+ os << "Challenge remaining time: " << request.challengeState->remainingTime.count() << " seconds\n";
+ os << "Challenge last update: " << time::toIsoString(request.challengeState->timestamp) << "\n";
}
os << "Certificate:\n";
util::IndentedStream os2(os, " ");
- os2 << request.m_cert;
+ os2 << request.cert;
return os;
}
diff --git a/src/detail/ca-request-state.hpp b/src/detail/ca-request-state.hpp
index 160760e..1857509 100644
--- a/src/detail/ca-request-state.hpp
+++ b/src/detail/ca-request-state.hpp
@@ -62,23 +62,23 @@
/**
* @brief The status of the challenge.
*/
- std::string m_challengeStatus;
+ std::string challengeStatus;
/**
* @brief The timestamp of the last update of the challenge state.
*/
- time::system_clock::TimePoint m_timestamp;
+ time::system_clock::TimePoint timestamp;
/**
* @brief Remaining tries of the challenge.
*/
- size_t m_remainingTries;
+ size_t remainingTries;
/**
* @brief Remaining time of the challenge.
*/
- time::seconds m_remainingTime;
+ time::seconds remainingTime;
/**
* @brief The secret for the challenge.
*/
- JsonSection m_secrets;
+ JsonSection secrets;
};
/**
@@ -107,40 +107,40 @@
/**
* @brief The CA that the request is under.
*/
- Name m_caPrefix;
+ Name caPrefix;
/**
* @brief The ID of the request.
*/
- RequestId m_requestId;
+ RequestId requestId;
/**
* @brief The type of the request.
*/
- RequestType m_requestType = RequestType::NOTINITIALIZED;
+ RequestType requestType = RequestType::NOTINITIALIZED;
/**
* @brief The status of the request.
*/
- Status m_status;
+ Status status;
/**
* @brief The self-signed certificate in the request.
*/
- security::Certificate m_cert;
+ security::Certificate cert;
/**
* @brief The encryption key for the requester.
*/
- std::array<uint8_t, 16> m_encryptionKey;
+ std::array<uint8_t, 16> encryptionKey;
/**
* @brief The AES block counter for the requester.
*/
- uint32_t m_aesBlockCounter = 0;
+ uint32_t aesBlockCounter = 0;
/**
* @brief The challenge type.
*/
- std::string m_challengeType;
+ std::string challengeType;
/**
* @brief The challenge state.
*/
- optional<ChallengeState> m_challengeState;
+ optional<ChallengeState> challengeState;
};
std::ostream&
diff --git a/src/detail/ca-sqlite.cpp b/src/detail/ca-sqlite.cpp
index 6ef80bc..db37397 100644
--- a/src/detail/ca-sqlite.cpp
+++ b/src/detail/ca-sqlite.cpp
@@ -172,24 +172,24 @@
cert_request, challenge_type, challenge_status, challenge_secrets,
challenge_tp, remaining_tries, remaining_time, encryption_key, aes_block_counter)
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?))_SQLTEXT_");
- statement.bind(1, request.m_requestId.data(), request.m_requestId.size(), SQLITE_TRANSIENT);
- statement.bind(2, request.m_caPrefix.wireEncode(), SQLITE_TRANSIENT);
- statement.bind(3, static_cast<int>(request.m_status));
- statement.bind(4, static_cast<int>(request.m_requestType));
- statement.bind(5, request.m_cert.wireEncode(), SQLITE_TRANSIENT);
- statement.bind(12, request.m_encryptionKey.data(), request.m_encryptionKey.size(), SQLITE_TRANSIENT);
- statement.bind(13, request.m_aesBlockCounter);
- if (request.m_challengeState) {
- statement.bind(6, request.m_challengeType, SQLITE_TRANSIENT);
- statement.bind(7, request.m_challengeState->m_challengeStatus, SQLITE_TRANSIENT);
- statement.bind(8, convertJson2String(request.m_challengeState->m_secrets),
+ statement.bind(1, request.requestId.data(), request.requestId.size(), SQLITE_TRANSIENT);
+ statement.bind(2, request.caPrefix.wireEncode(), SQLITE_TRANSIENT);
+ statement.bind(3, static_cast<int>(request.status));
+ statement.bind(4, static_cast<int>(request.requestType));
+ statement.bind(5, request.cert.wireEncode(), SQLITE_TRANSIENT);
+ statement.bind(12, request.encryptionKey.data(), request.encryptionKey.size(), SQLITE_TRANSIENT);
+ statement.bind(13, request.aesBlockCounter);
+ if (request.challengeState) {
+ statement.bind(6, request.challengeType, SQLITE_TRANSIENT);
+ statement.bind(7, request.challengeState->challengeStatus, SQLITE_TRANSIENT);
+ statement.bind(8, convertJson2String(request.challengeState->secrets),
SQLITE_TRANSIENT);
- statement.bind(9, time::toIsoString(request.m_challengeState->m_timestamp), SQLITE_TRANSIENT);
- statement.bind(10, request.m_challengeState->m_remainingTries);
- statement.bind(11, request.m_challengeState->m_remainingTime.count());
+ statement.bind(9, time::toIsoString(request.challengeState->timestamp), SQLITE_TRANSIENT);
+ statement.bind(10, request.challengeState->remainingTries);
+ statement.bind(11, request.challengeState->remainingTime.count());
}
if (statement.step() != SQLITE_DONE) {
- NDN_THROW(std::runtime_error("Request " + toHex(request.m_requestId.data(), request.m_requestId.size()) + " cannot be added to database"));
+ NDN_THROW(std::runtime_error("Request " + toHex(request.requestId.data(), request.requestId.size()) + " cannot be added to database"));
}
}
@@ -201,14 +201,14 @@
SET status = ?, challenge_type = ?, challenge_status = ?, challenge_secrets = ?,
challenge_tp = ?, remaining_tries = ?, remaining_time = ?, aes_block_counter = ?
WHERE request_id = ?)_SQLTEXT_");
- statement.bind(1, static_cast<int>(request.m_status));
- statement.bind(2, request.m_challengeType, SQLITE_TRANSIENT);
- if (request.m_challengeState) {
- statement.bind(3, request.m_challengeState->m_challengeStatus, SQLITE_TRANSIENT);
- statement.bind(4, convertJson2String(request.m_challengeState->m_secrets), SQLITE_TRANSIENT);
- statement.bind(5, time::toIsoString(request.m_challengeState->m_timestamp), SQLITE_TRANSIENT);
- statement.bind(6, request.m_challengeState->m_remainingTries);
- statement.bind(7, request.m_challengeState->m_remainingTime.count());
+ statement.bind(1, static_cast<int>(request.status));
+ statement.bind(2, request.challengeType, SQLITE_TRANSIENT);
+ if (request.challengeState) {
+ statement.bind(3, request.challengeState->challengeStatus, SQLITE_TRANSIENT);
+ statement.bind(4, convertJson2String(request.challengeState->secrets), SQLITE_TRANSIENT);
+ statement.bind(5, time::toIsoString(request.challengeState->timestamp), SQLITE_TRANSIENT);
+ statement.bind(6, request.challengeState->remainingTries);
+ statement.bind(7, request.challengeState->remainingTime.count());
}
else {
statement.bind(3, "", SQLITE_TRANSIENT);
@@ -217,8 +217,8 @@
statement.bind(6, 0);
statement.bind(7, 0);
}
- statement.bind(8, request.m_aesBlockCounter);
- statement.bind(9, request.m_requestId.data(), request.m_requestId.size(), SQLITE_TRANSIENT);
+ statement.bind(8, request.aesBlockCounter);
+ statement.bind(9, request.requestId.data(), request.requestId.size(), SQLITE_TRANSIENT);
if (statement.step() != SQLITE_DONE) {
addRequest(request);
diff --git a/src/detail/challenge-encoder.cpp b/src/detail/challenge-encoder.cpp
index 41a0f8f..12eb7cf 100644
--- a/src/detail/challenge-encoder.cpp
+++ b/src/detail/challenge-encoder.cpp
@@ -27,21 +27,21 @@
challengetlv::encodeDataContent(ca::RequestState& request, const Name& issuedCertName)
{
Block response(tlv::EncryptedPayload);
- response.push_back(makeNonNegativeIntegerBlock(tlv::Status, static_cast<uint64_t>(request.m_status)));
- if (request.m_challengeState) {
- response.push_back(makeStringBlock(tlv::ChallengeStatus, request.m_challengeState->m_challengeStatus));
+ response.push_back(makeNonNegativeIntegerBlock(tlv::Status, static_cast<uint64_t>(request.status)));
+ if (request.challengeState) {
+ response.push_back(makeStringBlock(tlv::ChallengeStatus, request.challengeState->challengeStatus));
response.push_back(
- makeNonNegativeIntegerBlock(tlv::RemainingTries, request.m_challengeState->m_remainingTries));
+ makeNonNegativeIntegerBlock(tlv::RemainingTries, request.challengeState->remainingTries));
response.push_back(
- makeNonNegativeIntegerBlock(tlv::RemainingTime, request.m_challengeState->m_remainingTime.count()));
+ makeNonNegativeIntegerBlock(tlv::RemainingTime, request.challengeState->remainingTime.count()));
}
if (!issuedCertName.empty()) {
response.push_back(makeNestedBlock(tlv::IssuedCertName, issuedCertName));
}
response.encode();
- return encodeBlockWithAesGcm128(ndn::tlv::Content, request.m_encryptionKey.data(),
+ return encodeBlockWithAesGcm128(ndn::tlv::Content, request.encryptionKey.data(),
response.value(), response.value_size(),
- request.m_requestId.data(), request.m_requestId.size(), request.m_aesBlockCounter);
+ request.requestId.data(), request.requestId.size(), request.aesBlockCounter);
}
void
diff --git a/src/detail/probe-encoder.cpp b/src/detail/probe-encoder.cpp
index e8f5218..d671aef 100644
--- a/src/detail/probe-encoder.cpp
+++ b/src/detail/probe-encoder.cpp
@@ -24,7 +24,7 @@
namespace ndncert {
Block
-probetlv::encodeApplicationParameters(std::multimap<std::string, std::string>&& parameters)
+probetlv::encodeApplicationParameters(const std::multimap<std::string, std::string>& parameters)
{
Block content(ndn::tlv::ApplicationParameters);
for (const auto& items : parameters) {
diff --git a/src/detail/probe-encoder.hpp b/src/detail/probe-encoder.hpp
index 2b63cc1..bde8a87 100644
--- a/src/detail/probe-encoder.hpp
+++ b/src/detail/probe-encoder.hpp
@@ -29,7 +29,7 @@
// For Client use
Block
-encodeApplicationParameters(std::multimap<std::string, std::string>&& parameters);
+encodeApplicationParameters(const std::multimap<std::string, std::string>& parameters);
void
decodeDataContent(const Block& block, std::vector<std::pair<Name, int>>& availableNames,