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
diff --git a/tests/unit-tests/bench.t.cpp b/tests/unit-tests/bench.t.cpp
index 5e48bc8..a36f16f 100644
--- a/tests/unit-tests/bench.t.cpp
+++ b/tests/unit-tests/bench.t.cpp
@@ -103,7 +103,7 @@
   CaProfile item;
   item.m_caPrefix = Name("/ndn");
   item.m_cert = std::make_shared<security::Certificate>(cert);
-  requester::RequesterState state(m_keyChain, item, RequestType::NEW);
+  requester::RequestContext state(m_keyChain, item, RequestType::NEW);
   auto newInterest = requester::Requester::genNewInterest(state, Name("/ndn/alice"),
                                                time::system_clock::now(),
                                                time::system_clock::now() + time::days(1));
diff --git a/tests/unit-tests/ca-module.t.cpp b/tests/unit-tests/ca-module.t.cpp
index ab8f440..fddfabd 100644
--- a/tests/unit-tests/ca-module.t.cpp
+++ b/tests/unit-tests/ca-module.t.cpp
@@ -231,7 +231,7 @@
   CaProfile item;
   item.m_caPrefix = Name("/ndn");
   item.m_cert = std::make_shared<security::Certificate>(cert);
-  requester::RequesterState state(m_keyChain, item, RequestType::NEW);
+  requester::RequestContext state(m_keyChain, item, RequestType::NEW);
   auto interest = requester::Requester::genNewInterest(state, Name("/ndn/zhiyi"),
                                             time::system_clock::now(),
                                             time::system_clock::now() + time::days(1));
@@ -282,7 +282,7 @@
   CaProfile item;
   item.m_caPrefix = Name("/ndn");
   item.m_cert = std::make_shared<security::Certificate>(cert);
-  requester::RequesterState state(m_keyChain, item, RequestType::NEW);
+  requester::RequestContext state(m_keyChain, item, RequestType::NEW);
   auto current_tp = time::system_clock::now();
   auto interest1 = requester::Requester::genNewInterest(state, Name("/ndn/zhiyi"), current_tp, current_tp - time::hours(1));
   auto interest2 = requester::Requester::genNewInterest(state, Name("/ndn/zhiyi"), current_tp, current_tp + time::days(361));
@@ -313,7 +313,7 @@
   CaProfile item;
   item.m_caPrefix = Name("/ndn");
   item.m_cert = std::make_shared<security::Certificate>(cert);
-  requester::RequesterState state(m_keyChain, item, RequestType::NEW);
+  requester::RequestContext state(m_keyChain, item, RequestType::NEW);
 
   auto interest1 = requester::Requester::genNewInterest(state, Name("/ndn/a"), time::system_clock::now(),
                                               time::system_clock::now() + time::days(1));
@@ -354,7 +354,7 @@
   CaProfile item;
   item.m_caPrefix = Name("/ndn");
   item.m_cert = std::make_shared<security::Certificate>(cert);
-  requester::RequesterState state(m_keyChain, item, RequestType::NEW);
+  requester::RequestContext state(m_keyChain, item, RequestType::NEW);
 
   auto current_tp = time::system_clock::now();
   auto interest1 = requester::Requester::genNewInterest(state, Name("/ndn"), current_tp, current_tp + time::days(1));
@@ -385,7 +385,7 @@
   CaProfile item;
   item.m_caPrefix = Name("/ndn");
   item.m_cert = std::make_shared<security::Certificate>(cert);
-  requester::RequesterState state(m_keyChain, item, RequestType::NEW);
+  requester::RequestContext state(m_keyChain, item, RequestType::NEW);
 
   auto newInterest = requester::Requester::genNewInterest(state, Name("/ndn/zhiyi"), time::system_clock::now(),
                                                 time::system_clock::now() + time::days(1));
@@ -474,7 +474,7 @@
   CaProfile item;
   item.m_caPrefix = Name("/ndn");
   item.m_cert = std::make_shared<security::Certificate>(cert);
-  requester::RequesterState state(m_keyChain, item, RequestType::REVOKE);
+  requester::RequestContext state(m_keyChain, item, RequestType::REVOKE);
 
   auto interest = requester::Requester::genRevokeInterest(state, issuedCert);
 
@@ -537,7 +537,7 @@
   CaProfile item;
   item.m_caPrefix = Name("/ndn");
   item.m_cert = std::make_shared<security::Certificate>(cert);
-  requester::RequesterState state(m_keyChain, item, RequestType::NEW);
+  requester::RequestContext state(m_keyChain, item, RequestType::NEW);
 
   auto interest = requester::Requester::genRevokeInterest(state, clientCert);
 
diff --git a/tests/unit-tests/requester.t.cpp b/tests/unit-tests/requester.t.cpp
index 16197b4..ffb70a1 100644
--- a/tests/unit-tests/requester.t.cpp
+++ b/tests/unit-tests/requester.t.cpp
@@ -109,7 +109,7 @@
   CaProfile item;
   item.m_caPrefix = Name("/site");
   item.m_cert = std::make_shared<security::Certificate>(cert);
-  RequesterState state(m_keyChain, item, RequestType::NEW);
+  RequestContext state(m_keyChain, item, RequestType::NEW);
 
   Data errorPacket;
   errorPacket.setName(Name("/site/pretend/this/is/error/packet"));
diff --git a/tools/ndncert-client.cpp b/tools/ndncert-client.cpp
index 224ea51..f1b99dd 100644
--- a/tools/ndncert-client.cpp
+++ b/tools/ndncert-client.cpp
@@ -43,7 +43,7 @@
 size_t nStep = 1;
 Face face;
 security::KeyChain keyChain;
-shared_ptr<RequesterState> requesterState = nullptr;
+shared_ptr<RequestContext> requesterState = nullptr;
 
 static void
 captureParams(std::vector<std::tuple<std::string, std::string>>& requirement)
@@ -394,7 +394,7 @@
   int validityPeriod = captureValidityPeriod();
   auto now = time::system_clock::now();
   std::cerr << "The validity period of your certificate will be: " << validityPeriod << " hours" << std::endl;
-  requesterState =std::make_shared<RequesterState>(keyChain, profile, RequestType::NEW);
+  requesterState =std::make_shared<RequestContext>(keyChain, profile, RequestType::NEW);
   auto interest = Requester::genNewInterest(*requesterState, identityName, now, now + time::hours(validityPeriod));
   if (interest != nullptr) {
     face.expressInterest(*interest, bind(&newCb, _2), bind(&onNackCb), bind(&timeoutCb));