iwyu

This changes uses its best effort to clean up headers according to iwyu.

Reference:
https://include-what-you-use.org/

Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: Ibd8bd8735238d6ec101a2428241bb1727e3ac9a9
diff --git a/argument.cpp b/argument.cpp
index 389fa54..f0ee94d 100644
--- a/argument.cpp
+++ b/argument.cpp
@@ -15,9 +15,9 @@
  */
 #include "argument.hpp"
 
-#include <algorithm>
+#include <cstdlib>
 #include <iostream>
-#include <iterator>
+#include <utility>
 
 namespace phosphor::certs::util
 {
diff --git a/certificate.cpp b/certificate.cpp
index 6dfed96..09a9222 100644
--- a/certificate.cpp
+++ b/certificate.cpp
@@ -4,16 +4,32 @@
 
 #include "certs_manager.hpp"
 
+#include <openssl/asn1.h>
 #include <openssl/bio.h>
-#include <openssl/crypto.h>
+#include <openssl/buffer.h>
 #include <openssl/err.h>
 #include <openssl/evp.h>
+#include <openssl/obj_mac.h>
+#include <openssl/objects.h>
+#include <openssl/opensslv.h>
 #include <openssl/pem.h>
-#include <openssl/ssl.h>
+#include <openssl/ssl3.h>
 #include <openssl/x509v3.h>
 
+#include <cstdint>
+#include <cstdio>
+#include <cstdlib>
+#include <ctime>
+#include <exception>
+#include <filesystem>
 #include <fstream>
+#include <map>
 #include <phosphor-logging/elog-errors.hpp>
+#include <phosphor-logging/elog.hpp>
+#include <phosphor-logging/log.hpp>
+#include <utility>
+#include <vector>
+#include <watch.hpp>
 #include <xyz/openbmc_project/Certs/error.hpp>
 #include <xyz/openbmc_project/Common/error.hpp>
 
diff --git a/certificate.hpp b/certificate.hpp
index 46479e4..c96017f 100644
--- a/certificate.hpp
+++ b/certificate.hpp
@@ -2,13 +2,15 @@
 
 #include "watch.hpp"
 
+#include <openssl/ossl_typ.h>
 #include <openssl/x509.h>
 
-#include <filesystem>
 #include <functional>
 #include <memory>
-#include <optional>
-#include <phosphor-logging/elog.hpp>
+#include <sdbusplus/server/object.hpp>
+#include <string>
+#include <string_view>
+#include <unordered_map>
 #include <xyz/openbmc_project/Certs/Certificate/server.hpp>
 #include <xyz/openbmc_project/Certs/Replace/server.hpp>
 #include <xyz/openbmc_project/Object/Delete/server.hpp>
diff --git a/certs_manager.cpp b/certs_manager.cpp
index 6bfc37a..831928f 100644
--- a/certs_manager.cpp
+++ b/certs_manager.cpp
@@ -1,11 +1,36 @@
+#include "config.h"
+
 #include "certs_manager.hpp"
 
+#include <openssl/asn1.h>
+#include <openssl/bn.h>
+#include <openssl/ec.h>
 #include <openssl/evp.h>
+#include <openssl/obj_mac.h>
+#include <openssl/objects.h>
+#include <openssl/opensslv.h>
 #include <openssl/pem.h>
+#include <openssl/rsa.h>
 #include <unistd.h>
 
 #include <algorithm>
+#include <array>
+#include <cerrno>
+#include <chrono>
+#include <csignal>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <exception>
 #include <phosphor-logging/elog-errors.hpp>
+#include <phosphor-logging/elog.hpp>
+#include <phosphor-logging/log.hpp>
+#include <sdbusplus/bus.hpp>
+#include <sdbusplus/exception.hpp>
+#include <sdbusplus/message.hpp>
+#include <sdeventplus/source/base.hpp>
+#include <sdeventplus/source/child.hpp>
+#include <utility>
 #include <xyz/openbmc_project/Certs/error.hpp>
 #include <xyz/openbmc_project/Common/error.hpp>
 
diff --git a/certs_manager.hpp b/certs_manager.hpp
index 44908d7..89887f7 100644
--- a/certs_manager.hpp
+++ b/certs_manager.hpp
@@ -1,13 +1,21 @@
 #pragma once
-#include "config.h"
 
 #include "certificate.hpp"
 #include "csr.hpp"
 #include "watch.hpp"
 
+#include <openssl/evp.h>
+#include <openssl/ossl_typ.h>
+#include <openssl/x509.h>
+
+#include <cstdint>
 #include <filesystem>
+#include <memory>
+#include <sdbusplus/server/object.hpp>
 #include <sdeventplus/source/child.hpp>
 #include <sdeventplus/source/event.hpp>
+#include <string>
+#include <vector>
 #include <xyz/openbmc_project/Certs/CSR/Create/server.hpp>
 #include <xyz/openbmc_project/Certs/Install/server.hpp>
 #include <xyz/openbmc_project/Collection/DeleteAll/server.hpp>
diff --git a/csr.cpp b/csr.cpp
index 81c6f98..9ba8f00 100644
--- a/csr.cpp
+++ b/csr.cpp
@@ -2,11 +2,19 @@
 
 #include "csr.hpp"
 
+#include <openssl/bio.h>
+#include <openssl/buffer.h>
+#include <openssl/ossl_typ.h>
 #include <openssl/pem.h>
+#include <openssl/x509.h>
 
+#include <cstdio>
 #include <filesystem>
+#include <memory>
 #include <phosphor-logging/elog-errors.hpp>
 #include <phosphor-logging/elog.hpp>
+#include <phosphor-logging/log.hpp>
+#include <utility>
 #include <xyz/openbmc_project/Certs/error.hpp>
 #include <xyz/openbmc_project/Common/error.hpp>
 
diff --git a/csr.hpp b/csr.hpp
index aa47cf6..eb02df6 100644
--- a/csr.hpp
+++ b/csr.hpp
@@ -1,4 +1,5 @@
 #pragma once
+#include <sdbusplus/server/object.hpp>
 #include <string>
 #include <xyz/openbmc_project/Certs/CSR/server.hpp>
 
diff --git a/mainapp.cpp b/mainapp.cpp
index d1a7568..31c212b 100644
--- a/mainapp.cpp
+++ b/mainapp.cpp
@@ -20,10 +20,16 @@
 #include "certificate.hpp"
 #include "certs_manager.hpp"
 
+#include <stdlib.h>
+#include <systemd/sd-event.h>
+
+#include <cctype>
 #include <iostream>
-#include <locale>
+#include <sdbusplus/bus.hpp>
+#include <sdbusplus/server/manager.hpp>
 #include <sdeventplus/event.hpp>
 #include <string>
+#include <utility>
 
 static void exitWithError(const char* err, char** argv)
 {
diff --git a/test/certs_manager_test.cpp b/test/certs_manager_test.cpp
index 91712d2..6e4c37f 100644
--- a/test/certs_manager_test.cpp
+++ b/test/certs_manager_test.cpp
@@ -2,20 +2,29 @@
 
 #include "certificate.hpp"
 #include "certs_manager.hpp"
+#include "csr.hpp"
 
 #include <openssl/bio.h>
-#include <openssl/crypto.h>
-#include <openssl/err.h>
-#include <openssl/evp.h>
+#include <openssl/ossl_typ.h>
 #include <openssl/pem.h>
-#include <openssl/x509v3.h>
+#include <openssl/x509.h>
+#include <systemd/sd-event.h>
+#include <unistd.h>
 
-#include <algorithm>
+#include <cstdint>
+#include <cstdio>
+#include <cstdlib>
 #include <filesystem>
 #include <fstream>
+#include <iostream>
 #include <iterator>
+#include <memory>
+#include <new>
+#include <sdbusplus/bus.hpp>
 #include <sdeventplus/event.hpp>
 #include <string>
+#include <utility>
+#include <vector>
 #include <xyz/openbmc_project/Certs/error.hpp>
 #include <xyz/openbmc_project/Common/error.hpp>
 
diff --git a/watch.cpp b/watch.cpp
index caf8ce5..a39d492 100644
--- a/watch.cpp
+++ b/watch.cpp
@@ -1,12 +1,19 @@
 #include "watch.hpp"
 
+#include <sys/epoll.h>
 #include <sys/inotify.h>
 #include <unistd.h>
 
+#include <array>
+#include <cerrno>
+#include <climits>
+#include <cstdint>
 #include <cstring>
 #include <filesystem>
 #include <phosphor-logging/elog-errors.hpp>
 #include <phosphor-logging/elog.hpp>
+#include <phosphor-logging/log.hpp>
+#include <sdeventplus/source/io.hpp>
 #include <xyz/openbmc_project/Common/error.hpp>
 
 namespace phosphor::certs
@@ -20,7 +27,7 @@
 namespace fs = std::filesystem;
 
 Watch::Watch(sdeventplus::Event& event, std::string& certFile, Callback cb) :
-    event(event), callback(cb)
+    event(event), callback(std::move(cb))
 {
     // get parent directory of certificate file to watch
     fs::path path = fs::path(certFile).parent_path();