clean up using directives and type alias

Most C++ style guides try to avoid using directives in headers and also
suggest using type alias carefully, according to which, this change does
the following clean up:

1. used Enum class to represent Certificate type
2. removed all using directives: e.g. the phosphor logging namespace;
instead, this change uses using declarations
3. removed unnecessary type alias; in existing codes, we only support
strings as types of UnitToRestart, InstallPath, UploadPath, etc; this
change uses std::string directly
4. moved all alias outside any class scope into source files or an
internal namespace
5. renamed types, constants, classes as per OpenBMC style guide
6. fixed all compilation errors and some warnings after the refactoring;
built with both Clang & GCC

Reference:
https://docs.microsoft.com/en-us/cpp/cpp/header-files-cpp?view=msvc-170#what-to-put-in-a-header-file
https://google.github.io/styleguide/cppguide.html#Namespaces

Tested:
Unit tests

Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I58e026934a4e969f4d8877801c8f3c671990468a
diff --git a/csr.cpp b/csr.cpp
index 677b48b..81c6f98 100644
--- a/csr.cpp
+++ b/csr.cpp
@@ -12,18 +12,21 @@
 
 namespace phosphor::certs
 {
-using X509_REQ_Ptr = std::unique_ptr<X509_REQ, decltype(&::X509_REQ_free)>;
-using BIO_Ptr = std::unique_ptr<BIO, decltype(&::BIO_free_all)>;
-using InternalFailure =
-    sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
-using namespace phosphor::logging;
+
+using ::phosphor::logging::elog;
+using ::phosphor::logging::entry;
+using ::phosphor::logging::level;
+using ::phosphor::logging::log;
+using ::sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
 namespace fs = std::filesystem;
 
-CSR::CSR(sdbusplus::bus::bus& bus, const char* path,
-         CertInstallPath&& installPath, const Status& status) :
-    CSRIface(bus, path, true),
-    bus(bus), objectPath(path), certInstallPath(std::move(installPath)),
-    csrStatus(status)
+using X509ReqPtr = std::unique_ptr<X509_REQ, decltype(&::X509_REQ_free)>;
+using BIOPtr = std::unique_ptr<BIO, decltype(&::BIO_free_all)>;
+
+CSR::CSR(sdbusplus::bus::bus& bus, const char* path, std::string&& installPath,
+         const Status& status) :
+    internal::CSRInterface(bus, path, true),
+    objectPath(path), certInstallPath(std::move(installPath)), csrStatus(status)
 {
     // Emit deferred signal.
     this->emit_object_added();
@@ -46,8 +49,8 @@
     }
 
     FILE* fp = std::fopen(csrFilePath.c_str(), "r");
-    X509_REQ_Ptr x509Req(PEM_read_X509_REQ(fp, nullptr, nullptr, nullptr),
-                         ::X509_REQ_free);
+    X509ReqPtr x509Req(PEM_read_X509_REQ(fp, nullptr, nullptr, nullptr),
+                       ::X509_REQ_free);
     if (x509Req == nullptr || fp == nullptr)
     {
         if (fp != nullptr)
@@ -60,7 +63,7 @@
     }
     std::fclose(fp);
 
-    BIO_Ptr bio(BIO_new(BIO_s_mem()), ::BIO_free_all);
+    BIOPtr bio(BIO_new(BIO_s_mem()), ::BIO_free_all);
     int ret = PEM_write_bio_X509_REQ(bio.get(), x509Req.get());
     if (ret <= 0)
     {