rename requesterState to RequestContext
Change-Id: I747559b4da11b350b01494c7c54a674c3d3d45f9
diff --git a/src/detail/challenge-encoder.cpp b/src/detail/challenge-encoder.cpp
index fed4110..33559c8 100644
--- a/src/detail/challenge-encoder.cpp
+++ b/src/detail/challenge-encoder.cpp
@@ -40,7 +40,7 @@
}
void
-ChallengeEncoder::decodeDataContent(const Block& data, requester::RequesterState& state)
+ChallengeEncoder::decodeDataContent(const Block& data, requester::RequestContext& state)
{
data.parse();
state.m_status = static_cast<Status>(readNonNegativeInteger(data.get(tlv::Status)));
diff --git a/src/detail/challenge-encoder.hpp b/src/detail/challenge-encoder.hpp
index 541ad60..e499094 100644
--- a/src/detail/challenge-encoder.hpp
+++ b/src/detail/challenge-encoder.hpp
@@ -34,7 +34,7 @@
encodeDataContent(const ca::RequestState& request);
static void
- decodeDataContent(const Block& data, requester::RequesterState& state);
+ decodeDataContent(const Block& data, requester::RequestContext& state);
};
} // namespace ndncert
diff --git a/src/requester-state.cpp b/src/requester-state.cpp
index 0c4755d..3e14de5 100644
--- a/src/requester-state.cpp
+++ b/src/requester-state.cpp
@@ -24,7 +24,7 @@
namespace ndncert {
namespace requester {
-RequesterState::RequesterState(security::KeyChain& keyChain, const CaProfile& caItem, RequestType requestType)
+RequestContext::RequestContext(security::KeyChain& keyChain, const CaProfile& caItem, RequestType requestType)
: m_caItem(caItem)
, m_keyChain(keyChain)
, m_type(requestType)
diff --git a/src/requester-state.hpp b/src/requester-state.hpp
index a6f1028..3f6bba9 100644
--- a/src/requester-state.hpp
+++ b/src/requester-state.hpp
@@ -29,9 +29,9 @@
namespace ndncert {
namespace requester {
-struct RequesterState {
+struct RequestContext {
explicit
- RequesterState(security::KeyChain& keyChain, const CaProfile& caItem, RequestType requestType);
+ RequestContext(security::KeyChain& keyChain, const CaProfile& caItem, RequestType requestType);
/**
* @brief The CA profile for this request.
diff --git a/src/requester.cpp b/src/requester.cpp
index b0f65d5..7b1df5f 100644
--- a/src/requester.cpp
+++ b/src/requester.cpp
@@ -113,7 +113,7 @@
}
shared_ptr<Interest>
-Requester::genNewInterest(RequesterState& state, const Name& identityName,
+Requester::genNewInterest(RequestContext& state, const Name& identityName,
const time::system_clock::TimePoint& notBefore,
const time::system_clock::TimePoint& notAfter)
{
@@ -173,7 +173,7 @@
}
shared_ptr<Interest>
-Requester::genRevokeInterest(RequesterState& state, const security::Certificate& certificate)
+Requester::genRevokeInterest(RequestContext& state, const security::Certificate& certificate)
{
if (!state.m_caItem.m_caPrefix.isPrefixOf(certificate.getName())) {
return nullptr;
@@ -190,7 +190,7 @@
}
std::list<std::string>
-Requester::onNewRenewRevokeResponse(RequesterState& state, const Data& reply)
+Requester::onNewRenewRevokeResponse(RequestContext& state, const Data& reply)
{
if (!security::verifySignature(reply, *state.m_caItem.m_cert)) {
NDN_LOG_ERROR("Cannot verify replied Data packet signature.");
@@ -213,7 +213,7 @@
}
std::vector<std::tuple<std::string, std::string>>
-Requester::selectOrContinueChallenge(RequesterState& state, const std::string& challengeSelected)
+Requester::selectOrContinueChallenge(RequestContext& state, const std::string& challengeSelected)
{
auto challenge = ChallengeModule::createChallengeModule(challengeSelected);
if (challenge == nullptr) {
@@ -224,7 +224,7 @@
}
shared_ptr<Interest>
-Requester::genChallengeInterest(RequesterState& state,
+Requester::genChallengeInterest(RequestContext& state,
std::vector<std::tuple<std::string, std::string>>&& parameters)
{
if (state.m_challengeType == "") {
@@ -254,7 +254,7 @@
}
void
-Requester::onChallengeResponse(RequesterState& state, const Data& reply)
+Requester::onChallengeResponse(RequestContext& state, const Data& reply)
{
if (!security::verifySignature(reply, *state.m_caItem.m_cert)) {
NDN_LOG_ERROR("Cannot verify replied Data packet signature.");
@@ -269,7 +269,7 @@
}
shared_ptr<Interest>
-Requester::genCertFetchInterest(const RequesterState& state)
+Requester::genCertFetchInterest(const RequestContext& state)
{
Name interestName = state.m_issuedCertName;
auto interest =std::make_shared<Interest>(interestName);
@@ -292,7 +292,7 @@
}
void
-Requester::endSession(RequesterState& state)
+Requester::endSession(RequestContext& state)
{
if (state.m_status == Status::SUCCESS || state.m_status == Status::ENDED) {
return;
diff --git a/src/requester.hpp b/src/requester.hpp
index b37f90a..4e2a1b1 100644
--- a/src/requester.hpp
+++ b/src/requester.hpp
@@ -112,7 +112,7 @@
* @return The shared pointer to the encoded interest.
*/
static shared_ptr<Interest>
- genNewInterest(RequesterState& state, const Name& identityName,
+ genNewInterest(RequestContext& state, const Name& identityName,
const time::system_clock::TimePoint& notBefore,
const time::system_clock::TimePoint& notAfter);
@@ -124,7 +124,7 @@
* @return The shared pointer to the encoded interest.
*/
static shared_ptr<Interest>
- genRevokeInterest(RequesterState& state, const security::Certificate& certificate);
+ genRevokeInterest(RequestContext& state, const security::Certificate& certificate);
/**
* @brief Decodes the replied data of NEW, RENEW, or REVOKE interest from the CA.
@@ -135,7 +135,7 @@
* @throw std::runtime_error if the decoding fails or receiving an error packet.
*/
static std::list<std::string>
- onNewRenewRevokeResponse(RequesterState& state, const Data& reply);
+ onNewRenewRevokeResponse(RequestContext& state, const Data& reply);
// CHALLENGE helpers
/**
@@ -148,7 +148,7 @@
* @throw std::runtime_error if the challenge is not supported.
*/
static std::vector<std::tuple<std::string, std::string>>
- selectOrContinueChallenge(RequesterState& state, const std::string& challengeSelected);
+ selectOrContinueChallenge(RequestContext& state, const std::string& challengeSelected);
/**
* @brief Generates the CHALLENGE interest for the request.
@@ -159,7 +159,7 @@
* @throw std::runtime_error if the challenge is not selected or is not supported.
*/
static shared_ptr<Interest>
- genChallengeInterest(RequesterState& state,
+ genChallengeInterest(RequestContext& state,
std::vector<std::tuple<std::string, std::string>>&& parameters);
/**
@@ -170,7 +170,7 @@
* @throw std::runtime_error if the decoding fails or receiving an error packet.
*/
static void
- onChallengeResponse(RequesterState& state, const Data& reply);
+ onChallengeResponse(RequestContext& state, const Data& reply);
/**
* @brief Generate the interest to fetch the issued certificate
@@ -179,7 +179,7 @@
* @return The shared pointer to the encoded interest
*/
static shared_ptr<Interest>
- genCertFetchInterest(const RequesterState& state);
+ genCertFetchInterest(const RequestContext& state);
/**
* @brief Decoded and installs the response certificate from the certificate fetch.
@@ -196,7 +196,7 @@
* @param state, the requester state for the request.
*/
static void
- endSession(RequesterState& state);
+ endSession(RequestContext& state);
private:
static void