Code Review fix 1
Change-Id: I92fa40b6dd0a05913461006acc87542884c1f3a5
diff --git a/src/detail/ca-request-state.cpp b/src/detail/ca-request-state.cpp
index 0de0820..923f9be 100644
--- a/src/detail/ca-request-state.cpp
+++ b/src/detail/ca-request-state.cpp
@@ -24,7 +24,8 @@
namespace ndn {
namespace ndncert {
-std::string statusToString(Status status) {
+std::string statusToString(Status status)
+{
switch (status)
{
case Status::BEFORE_CHALLENGE:
@@ -46,6 +47,15 @@
}
}
+Status
+statusFromBlock(const Block& block)
+{
+ auto status_int = readNonNegativeInteger(block);
+ if (status_int > 6)
+ NDN_THROW(std::runtime_error("Unrecognized Status"));
+ return static_cast<Status>(status_int);
+}
+
namespace ca {
ChallengeState::ChallengeState(const std::string& challengeStatus,