test treewide: iwyu

These changes are done by running iwyu manually under clang14.

Suppressed some obvious impl or details headers. Kept the recommended
public headers.

IWYU can increase readability, make maintenance easier, and avoid errors
in some cases. See details in
https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/WhyIWYU.md.

This commit also uses its best effort to correct obvious errors through
iwyu pragma.
See reference here:
https://github.com/include-what-you-use/include-what-you-use#how-to-correct-iwyu-mistakes

Tested: unit test passed.

Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I983b6f75601707cbb0f2f04546c3362ff4ba7fee
diff --git a/redfish-core/include/privileges.hpp b/redfish-core/include/privileges.hpp
index f20cede..6227681 100644
--- a/redfish-core/include/privileges.hpp
+++ b/redfish-core/include/privileges.hpp
@@ -15,15 +15,25 @@
 */
 #pragma once
 
+#include "logging.hpp"
+
 #include <boost/beast/http/verb.hpp>
 #include <boost/container/flat_map.hpp>
-#include <logging.hpp>
+#include <boost/container/vector.hpp>
+#include <boost/move/algo/move.hpp>
 
 #include <array>
 #include <bitset>
-#include <cstdint>
+#include <cstddef>
+#include <functional>
+#include <initializer_list>
+#include <string>
+#include <string_view>
+#include <utility>
 #include <vector>
 
+// IWYU pragma: no_include <stddef.h>
+
 namespace redfish
 {
 
diff --git a/redfish-core/include/registries.hpp b/redfish-core/include/registries.hpp
index 26e1941..a995d76 100644
--- a/redfish-core/include/registries.hpp
+++ b/redfish-core/include/registries.hpp
@@ -15,9 +15,14 @@
 */
 #pragma once
 
+#include <array>
+#include <cstddef>
 #include <span>
 #include <string>
 #include <string_view>
+#include <utility>
+
+// IWYU pragma: no_include <stddef.h>
 
 namespace redfish::registries
 {
diff --git a/redfish-core/include/utils/hex_utils.hpp b/redfish-core/include/utils/hex_utils.hpp
index 0b3be2b..f3728ea 100644
--- a/redfish-core/include/utils/hex_utils.hpp
+++ b/redfish-core/include/utils/hex_utils.hpp
@@ -2,6 +2,7 @@
 
 #include <array>
 #include <cstddef>
+#include <cstdint>
 #include <string>
 #include <vector>
 
diff --git a/redfish-core/include/utils/ip_utils.hpp b/redfish-core/include/utils/ip_utils.hpp
index ff65eb6..815243e 100644
--- a/redfish-core/include/utils/ip_utils.hpp
+++ b/redfish-core/include/utils/ip_utils.hpp
@@ -1,6 +1,8 @@
 #pragma once
 
 #include <boost/asio/ip/address.hpp>
+#include <boost/asio/ip/address_v4.hpp>
+#include <boost/asio/ip/address_v6.hpp>
 
 #include <string>
 
diff --git a/redfish-core/include/utils/json_utils.hpp b/redfish-core/include/utils/json_utils.hpp
index 3ae57fb..66e0619 100644
--- a/redfish-core/include/utils/json_utils.hpp
+++ b/redfish-core/include/utils/json_utils.hpp
@@ -15,12 +15,33 @@
 */
 #pragma once
 
-#include <error_messages.hpp>
-#include <http_request.hpp>
-#include <http_response.hpp>
-#include <nlohmann/json.hpp>
+#include "error_messages.hpp"
+#include "http_request.hpp"
+#include "http_response.hpp"
+#include "logging.hpp"
+#include "nlohmann/json.hpp"
 
+#include <array>
+#include <cmath>
+#include <cstddef>
+#include <cstdint>
+#include <limits>
+#include <map>
+#include <optional>
 #include <span>
+#include <string>
+#include <string_view>
+#include <type_traits>
+#include <utility>
+#include <variant>
+#include <vector>
+
+// IWYU pragma: no_include <stdint.h>
+
+namespace crow
+{
+struct Request;
+} // namespace crow
 
 namespace redfish
 {
diff --git a/redfish-core/include/utils/query_param.hpp b/redfish-core/include/utils/query_param.hpp
index 0e86ec5..3a70c6c 100644
--- a/redfish-core/include/utils/query_param.hpp
+++ b/redfish-core/include/utils/query_param.hpp
@@ -1,17 +1,41 @@
 #pragma once
+#include "bmcweb_config.h"
+
 #include "app.hpp"
 #include "async_resp.hpp"
 #include "error_messages.hpp"
 #include "http_request.hpp"
 #include "http_response.hpp"
-#include "routing.hpp"
+#include "logging.hpp"
 
+#include <sys/types.h>
+
+#include <boost/beast/http/message.hpp> // IWYU pragma: keep
+#include <boost/beast/http/status.hpp>
+#include <boost/beast/http/verb.hpp>
+#include <boost/url/params_view.hpp>
+#include <boost/url/string.hpp>
+#include <nlohmann/json.hpp>
+
+#include <algorithm>
 #include <charconv>
+#include <cstdint>
+#include <functional>
+#include <limits>
+#include <map>
+#include <memory>
+#include <optional>
 #include <string>
 #include <string_view>
+#include <system_error>
 #include <utility>
 #include <vector>
 
+// IWYU pragma: no_include <boost/url/impl/params_view.hpp>
+// IWYU pragma: no_include <boost/beast/http/impl/message.hpp>
+// IWYU pragma: no_include <boost/intrusive/detail/list_iterator.hpp>
+// IWYU pragma: no_include <stdint.h>
+
 namespace redfish
 {
 namespace query_param
diff --git a/redfish-core/include/utils/query_param_test.cpp b/redfish-core/include/utils/query_param_test.cpp
index 077447f..2d8cfbb 100644
--- a/redfish-core/include/utils/query_param_test.cpp
+++ b/redfish-core/include/utils/query_param_test.cpp
@@ -4,10 +4,16 @@
 #include <boost/url/url_view.hpp>
 #include <nlohmann/json.hpp>
 
-#include <cstddef>
+#include <new>
 
-#include <gmock/gmock-matchers.h>
-#include <gtest/gtest.h>
+#include <gmock/gmock.h> // IWYU pragma: keep
+#include <gtest/gtest.h> // IWYU pragma: keep
+
+// IWYU pragma: no_include <gtest/gtest-message.h>
+// IWYU pragma: no_include <gtest/gtest-test-part.h>
+// IWYU pragma: no_include "gtest/gtest_pred_impl.h"
+// IWYU pragma: no_include <boost/url/impl/url_view.hpp>
+// IWYU pragma: no_include <gmock/gmock-matchers.h>
 
 namespace redfish::query_param
 {
diff --git a/redfish-core/include/utils/time_utils.hpp b/redfish-core/include/utils/time_utils.hpp
index b4bc778..e814c51 100644
--- a/redfish-core/include/utils/time_utils.hpp
+++ b/redfish-core/include/utils/time_utils.hpp
@@ -8,12 +8,16 @@
 #include <cmath>
 #include <compare>
 #include <cstddef>
+#include <cstdint>
 #include <optional>
 #include <ratio>
 #include <string>
 #include <string_view>
 #include <system_error>
 
+// IWYU pragma: no_include <stddef.h>
+// IWYU pragma: no_include <stdint.h>
+
 namespace redfish
 {