security: Make Face optional in Validator
Change-Id: I75760e358878d8031439dd33a8200e21c69db3f8
Refs: #2124
diff --git a/src/security/validator.hpp b/src/security/validator.hpp
index 9a3b4a3..3fe58f3 100644
--- a/src/security/validator.hpp
+++ b/src/security/validator.hpp
@@ -54,8 +54,18 @@
}
};
- Validator();
+ /**
+ * @brief Validator constructor
+ *
+ * @param face Pointer to face through which validator may retrieve certificates.
+ * Passing a null pointer implies the validator is in offline mode.
+ *
+ * @note Make sure the lifetime of the passed Face is longer than validator.
+ */
+ explicit
+ Validator(Face* face = nullptr);
+ /// @deprecated Use the constructor taking Face* as parameter.
explicit
Validator(Face& face);
@@ -300,10 +310,9 @@
const OnFailure& onFailure);
protected:
- bool m_hasFace;
- Face& m_face;
+ Face* m_face;
};
} // namespace ndn
-#endif //NDN_SECURITY_VALIDATOR_HPP
+#endif // NDN_SECURITY_VALIDATOR_HPP