iwyu: Cleanup include headers

Triggered iwyu and add/remove used headers.

Change-Id: Iadbdb459563b3c89baf2d56f90a540342d020cd5
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/subprojects/libcr51sign/include/libcr51sign/libcr51sign_support.h b/subprojects/libcr51sign/include/libcr51sign/libcr51sign_support.h
index 87b4401..3a50628 100644
--- a/subprojects/libcr51sign/include/libcr51sign/libcr51sign_support.h
+++ b/subprojects/libcr51sign/include/libcr51sign/libcr51sign_support.h
@@ -16,8 +16,6 @@
 #ifndef PLATFORMS_HAVEN_LIBCR51SIGN_LIBCR51SIGN_SUPPORT_H_
 #define PLATFORMS_HAVEN_LIBCR51SIGN_LIBCR51SIGN_SUPPORT_H_
 
-#include "libcr51sign.h"
-
 #include <openssl/sha.h>
 
 #ifdef __cplusplus
diff --git a/subprojects/libcr51sign/src/libcr51sign.c b/subprojects/libcr51sign/src/libcr51sign.c
index c631408..fff1826 100644
--- a/subprojects/libcr51sign/src/libcr51sign.c
+++ b/subprojects/libcr51sign/src/libcr51sign.c
@@ -13,10 +13,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include <assert.h>
 #include <libcr51sign/libcr51sign.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
 
 #ifdef __cplusplus
diff --git a/subprojects/libcr51sign/src/libcr51sign_support.c b/subprojects/libcr51sign/src/libcr51sign_support.c
index 6dddf23..ce5103d 100644
--- a/subprojects/libcr51sign/src/libcr51sign_support.c
+++ b/subprojects/libcr51sign/src/libcr51sign_support.c
@@ -13,13 +13,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
+#include <libcr51sign/libcr51sign.h>
 #include <libcr51sign/libcr51sign_support.h>
 #include <openssl/err.h>
 #include <openssl/evp.h>
 #include <openssl/pem.h>
 #include <openssl/rsa.h>
 #include <stdio.h>
-#include <string.h>
 
 #ifdef __cplusplus
 extern "C"
diff --git a/subprojects/ncsid/src/ncsi_sockio.cpp b/subprojects/ncsid/src/ncsi_sockio.cpp
index 2158264..259386c 100644
--- a/subprojects/ncsid/src/ncsi_sockio.cpp
+++ b/subprojects/ncsid/src/ncsi_sockio.cpp
@@ -18,13 +18,14 @@
 #include "net_iface.h"
 
 #include <linux/filter.h>
+#include <linux/if.h>
+#include <linux/if_ether.h>
 #include <netinet/in.h>
 #include <poll.h>
 #include <sys/socket.h>
-#include <sys/types.h>
 
-#include <cstdio>
 #include <cstring>
+#include <iterator>
 
 namespace ncsi
 {
diff --git a/subprojects/ncsid/src/ncsi_sockio.h b/subprojects/ncsid/src/ncsi_sockio.h
index 09c610a..72cc473 100644
--- a/subprojects/ncsid/src/ncsi_sockio.h
+++ b/subprojects/ncsid/src/ncsi_sockio.h
@@ -19,10 +19,9 @@
 #include "net_iface.h"
 #include "net_sockio.h"
 
-#include <sys/socket.h>
+#include <linux/if_packet.h>
 
 #include <cstddef>
-#include <cstring>
 
 namespace ncsi
 {
diff --git a/subprojects/ncsid/src/net_iface.cpp b/subprojects/ncsid/src/net_iface.cpp
index 0a647b4..f3e0732 100644
--- a/subprojects/ncsid/src/net_iface.cpp
+++ b/subprojects/ncsid/src/net_iface.cpp
@@ -14,12 +14,12 @@
 
 #include "net_iface.h"
 
+#include <linux/if.h>
 #include <linux/if_packet.h>
-#include <net/ethernet.h>
+#include <sys/ioctl.h>
 #include <sys/socket.h>
 #include <unistd.h>
 
-#include <cstdio>
 #include <cstring>
 #include <stdexcept>
 
diff --git a/subprojects/ncsid/src/net_iface.h b/subprojects/ncsid/src/net_iface.h
index d44f23c..23bcb91 100644
--- a/subprojects/ncsid/src/net_iface.h
+++ b/subprojects/ncsid/src/net_iface.h
@@ -18,12 +18,8 @@
 
 #include <linux/if.h>
 #include <linux/if_packet.h>
-#include <net/ethernet.h>
-#include <netinet/in.h>
-#include <sys/ioctl.h>
 #include <sys/socket.h>
 
-#include <functional>
 #include <string>
 
 namespace net
diff --git a/subprojects/ncsid/src/normalize_ip.c b/subprojects/ncsid/src/normalize_ip.c
index 77783cc..aeada4f 100644
--- a/subprojects/ncsid/src/normalize_ip.c
+++ b/subprojects/ncsid/src/normalize_ip.c
@@ -15,7 +15,9 @@
  */
 
 #include <arpa/inet.h>
+#include <netinet/in.h>
 #include <stdio.h>
+#include <sys/socket.h>
 
 int main(int argc, char* argv[])
 {
diff --git a/subprojects/ncsid/src/normalize_mac.c b/subprojects/ncsid/src/normalize_mac.c
index 6c6aa6c..db92cd5 100644
--- a/subprojects/ncsid/src/normalize_mac.c
+++ b/subprojects/ncsid/src/normalize_mac.c
@@ -15,6 +15,7 @@
  */
 
 #include <inttypes.h>
+#include <linux/if_ether.h>
 #include <net/ethernet.h>
 #include <stdio.h>
 
diff --git a/subprojects/ncsid/src/platforms/nemora/portable/ncsi_client.c b/subprojects/ncsid/src/platforms/nemora/portable/ncsi_client.c
index 403f0a7..1ce7f5e 100644
--- a/subprojects/ncsid/src/platforms/nemora/portable/ncsi_client.c
+++ b/subprojects/ncsid/src/platforms/nemora/portable/ncsi_client.c
@@ -26,7 +26,7 @@
 #include <stdint.h>
 #include <string.h>
 
-#include <arpa/inet.h>
+#include <netinet/in.h>
 
 #include "platforms/nemora/portable/ncsi_client.h"
 
diff --git a/subprojects/ncsid/src/platforms/nemora/portable/ncsi_fsm.c b/subprojects/ncsid/src/platforms/nemora/portable/ncsi_fsm.c
index 11d34dd..5b5344c 100644
--- a/subprojects/ncsid/src/platforms/nemora/portable/ncsi_fsm.c
+++ b/subprojects/ncsid/src/platforms/nemora/portable/ncsi_fsm.c
@@ -16,7 +16,7 @@
 
 #include <string.h>
 
-#include <arpa/inet.h>
+#include <netinet/in.h>
 
 #include "platforms/nemora/portable/ncsi.h"
 #include "platforms/nemora/portable/ncsi_client.h"
diff --git a/subprojects/ncsid/src/platforms/nemora/portable/ncsi_fsm.h b/subprojects/ncsid/src/platforms/nemora/portable/ncsi_fsm.h
index de71345..350846d 100644
--- a/subprojects/ncsid/src/platforms/nemora/portable/ncsi_fsm.h
+++ b/subprojects/ncsid/src/platforms/nemora/portable/ncsi_fsm.h
@@ -20,6 +20,7 @@
 /* Nemora NC-SI (Finite) State Machine implementation */
 
 #include <stdint.h>
+#include <stdbool.h>
 
 #include "platforms/nemora/portable/ncsi.h"
 #include "platforms/nemora/portable/net_types.h"
diff --git a/subprojects/ncsid/test/iface_test.cpp b/subprojects/ncsid/test/iface_test.cpp
index 267194c..2ae340a 100644
--- a/subprojects/ncsid/test/iface_test.cpp
+++ b/subprojects/ncsid/test/iface_test.cpp
@@ -14,6 +14,9 @@
 
 #include "net_iface_mock.h"
 
+#include <memory>
+
+#include "gtest/gtest.h"
 #include <gtest/gtest.h>
 
 TEST(TestIFace, TestGetIndex)
diff --git a/subprojects/ncsid/test/net_iface_mock.cpp b/subprojects/ncsid/test/net_iface_mock.cpp
index 4b071ed..5e2d223 100644
--- a/subprojects/ncsid/test/net_iface_mock.cpp
+++ b/subprojects/ncsid/test/net_iface_mock.cpp
@@ -14,6 +14,9 @@
 
 #include "net_iface_mock.h"
 
+#include <linux/if.h>
+#include <sys/ioctl.h>
+
 namespace mock
 {
 
diff --git a/subprojects/ncsid/test/net_iface_mock.h b/subprojects/ncsid/test/net_iface_mock.h
index 0ccf5bf..118ca03 100644
--- a/subprojects/ncsid/test/net_iface_mock.h
+++ b/subprojects/ncsid/test/net_iface_mock.h
@@ -18,6 +18,7 @@
 
 #include <net_iface.h>
 
+#include <string>
 #include <vector>
 
 namespace mock
diff --git a/subprojects/ncsid/test/nic_mock.cpp b/subprojects/ncsid/test/nic_mock.cpp
index c435ffa..20f7f56 100644
--- a/subprojects/ncsid/test/nic_mock.cpp
+++ b/subprojects/ncsid/test/nic_mock.cpp
@@ -15,9 +15,11 @@
 #include "nic_mock.h"
 
 #include "platforms/nemora/portable/ncsi.h"
+#include "platforms/nemora/portable/ncsi_server.h"
 
 #include <algorithm>
 #include <cstddef>
+#include <cstring>
 #include <stdexcept>
 
 namespace mock
diff --git a/subprojects/ncsid/test/nic_mock.h b/subprojects/ncsid/test/nic_mock.h
index 13e5959..be314f8 100644
--- a/subprojects/ncsid/test/nic_mock.h
+++ b/subprojects/ncsid/test/nic_mock.h
@@ -18,12 +18,11 @@
 
 #include "platforms/nemora/portable/ncsi.h"
 #include "platforms/nemora/portable/ncsi_fsm.h"
-#include "platforms/nemora/portable/ncsi_server.h"
+#include "platforms/nemora/portable/net_types.h"
 
 #include <netinet/in.h>
 
 #include <cstdint>
-#include <cstring>
 #include <vector>
 
 namespace mock
diff --git a/subprojects/ncsid/test/sock_test.cpp b/subprojects/ncsid/test/sock_test.cpp
index 6e034de..463bc6f 100644
--- a/subprojects/ncsid/test/sock_test.cpp
+++ b/subprojects/ncsid/test/sock_test.cpp
@@ -15,7 +15,13 @@
 #include "ncsi_sockio.h"
 #include "net_iface_mock.h"
 
-#include <gmock/gmock.h>
+#include <linux/if.h>
+
+#include <vector>
+
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+#include <gtest/gtest.h>
 
 TEST(TestSockIO, TestBind)
 {
diff --git a/subprojects/nemora-postd/nemorad.cpp b/subprojects/nemora-postd/nemorad.cpp
index 0ad8010..0531323 100644
--- a/subprojects/nemora-postd/nemorad.cpp
+++ b/subprojects/nemora-postd/nemorad.cpp
@@ -24,6 +24,7 @@
 
 #include <csignal>
 #include <cstdint>
+#include <iostream>
 #include <regex>
 #include <string>
 #include <thread>
diff --git a/subprojects/nemora-postd/src/host_manager.cpp b/subprojects/nemora-postd/src/host_manager.cpp
index b771146..f690389 100644
--- a/subprojects/nemora-postd/src/host_manager.cpp
+++ b/subprojects/nemora-postd/src/host_manager.cpp
@@ -19,7 +19,6 @@
 #include <sdbusplus/message.hpp>
 
 #include <format>
-#include <functional>
 #include <variant>
 
 using phosphor::logging::level;
diff --git a/subprojects/nemora-postd/src/nemora.cpp b/subprojects/nemora-postd/src/nemora.cpp
index f958b01..403d766 100644
--- a/subprojects/nemora-postd/src/nemora.cpp
+++ b/subprojects/nemora-postd/src/nemora.cpp
@@ -26,8 +26,6 @@
 
 #include <cstdint>
 #include <cstring>
-#include <functional>
-#include <iostream>
 #include <variant>
 
 using phosphor::logging::level;