Add missing includes (#21790)

diff --git a/src/app/DataVersionFilter.h b/src/app/DataVersionFilter.h
index 83ad9320..069a61d 100644
--- a/src/app/DataVersionFilter.h
+++ b/src/app/DataVersionFilter.h
@@ -19,6 +19,7 @@
 #pragma once
 
 #include <app/util/basic-types.h>
+#include <lib/core/Optional.h>
 
 namespace chip {
 namespace app {
diff --git a/src/app/GlobalAttributes.h b/src/app/GlobalAttributes.h
index 4221294..82980a7 100644
--- a/src/app/GlobalAttributes.h
+++ b/src/app/GlobalAttributes.h
@@ -18,6 +18,7 @@
 #pragma once
 
 #include <app-common/zap-generated/ids/Attributes.h>
+#include <lib/support/CodeUtils.h>
 
 namespace chip {
 namespace app {
diff --git a/src/app/InteractionModelHelper.h b/src/app/InteractionModelHelper.h
index 530ba2b..fe46b4d 100644
--- a/src/app/InteractionModelHelper.h
+++ b/src/app/InteractionModelHelper.h
@@ -18,7 +18,10 @@
 
 #pragma once
 
+#include <app/StatusResponse.h>
 #include <system/SystemPacketBuffer.h>
+#include <system/TLVPacketBufferBackingStore.h>
+
 namespace chip {
 namespace app {
 
diff --git a/src/app/InteractionModelRevision.h b/src/app/InteractionModelRevision.h
index 3de6993..8f38a34 100644
--- a/src/app/InteractionModelRevision.h
+++ b/src/app/InteractionModelRevision.h
@@ -17,6 +17,9 @@
 
 #pragma once
 
+#include <inttypes.h>
+#include <stddef.h>
+
 /**
  * CHIP_DEVICE_INTERACTION_MODEL_REVISION
  *
diff --git a/src/app/ReadHandler.h b/src/app/ReadHandler.h
index 3e192a2..88b8ad8 100644
--- a/src/app/ReadHandler.h
+++ b/src/app/ReadHandler.h
@@ -32,6 +32,8 @@
 #include <app/EventManagement.h>
 #include <app/EventPathParams.h>
 #include <app/MessageDef/AttributePathIBs.h>
+#include <app/MessageDef/DataVersionFilterIBs.h>
+#include <app/MessageDef/EventFilterIBs.h>
 #include <app/MessageDef/EventPathIBs.h>
 #include <app/ObjectList.h>
 #include <lib/core/CHIPCore.h>
diff --git a/src/app/clusters/ias-zone-client/ias-zone-client.h b/src/app/clusters/ias-zone-client/ias-zone-client.h
index 2e52779..6262d80 100644
--- a/src/app/clusters/ias-zone-client/ias-zone-client.h
+++ b/src/app/clusters/ias-zone-client/ias-zone-client.h
@@ -40,6 +40,7 @@
 
 #pragma once
 
+#include <app/util/af-types.h>
 #include <app/util/basic-types.h>
 
 typedef struct
diff --git a/src/app/util/MatterCallbacks.h b/src/app/util/MatterCallbacks.h
index c18ddae..6a0b693 100644
--- a/src/app/util/MatterCallbacks.h
+++ b/src/app/util/MatterCallbacks.h
@@ -19,6 +19,10 @@
 
 #pragma once
 
+#include <access/SubjectDescriptor.h>
+#include <app/ConcreteAttributePath.h>
+#include <app/ConcreteCommandPath.h>
+
 void MatterPreAttributeReadCallback(const chip::app::ConcreteAttributePath & attributePath);
 void MatterPostAttributeReadCallback(const chip::app::ConcreteAttributePath & attributePath);
 void MatterPreAttributeWriteCallback(const chip::app::ConcreteAttributePath & attributePath);
diff --git a/src/app/util/time-util.h b/src/app/util/time-util.h
index 804a7f4..abea896 100644
--- a/src/app/util/time-util.h
+++ b/src/app/util/time-util.h
@@ -40,6 +40,10 @@
 
 #pragma once
 
+#include <inttypes.h>
+
+#include <app/util/af-types.h>
+
 #define SECONDS_IN_MINUTE 60
 #define SECONDS_IN_HOUR 3600
 #define SECONDS_IN_DAY (SECONDS_IN_MINUTE * 60 * 24)
diff --git a/src/credentials/tests/CHIPAttCert_test_vectors.h b/src/credentials/tests/CHIPAttCert_test_vectors.h
index caa2399..bc603ff 100644
--- a/src/credentials/tests/CHIPAttCert_test_vectors.h
+++ b/src/credentials/tests/CHIPAttCert_test_vectors.h
@@ -18,6 +18,8 @@
 
 #pragma once
 
+#include <lib/support/Span.h>
+
 namespace chip {
 namespace TestCerts {
 
diff --git a/src/include/platform/GeneralFaults.h b/src/include/platform/GeneralFaults.h
index 182a4e3..fc5f7d3 100644
--- a/src/include/platform/GeneralFaults.h
+++ b/src/include/platform/GeneralFaults.h
@@ -23,6 +23,7 @@
 #pragma once
 
 #include <lib/core/CHIPError.h>
+#include <lib/support/CodeUtils.h>
 
 namespace chip {
 namespace DeviceLayer {
diff --git a/src/include/platform/internal/EventLogging.h b/src/include/platform/internal/EventLogging.h
index 1a8dd07..c250c94 100644
--- a/src/include/platform/internal/EventLogging.h
+++ b/src/include/platform/internal/EventLogging.h
@@ -24,6 +24,8 @@
 
 #pragma once
 
+#include <lib/core/CHIPError.h>
+
 namespace chip {
 namespace DeviceLayer {
 namespace Internal {
diff --git a/src/lib/asn1/gen_asn1oid.py b/src/lib/asn1/gen_asn1oid.py
index a2e71c1..e4c9943 100755
--- a/src/lib/asn1/gen_asn1oid.py
+++ b/src/lib/asn1/gen_asn1oid.py
@@ -237,6 +237,7 @@
 #pragma once
 
 #include <cstdint>
+#include <cstddef>
 
 namespace chip {
 namespace ASN1 {
diff --git a/src/lib/support/LifetimePersistedCounter.h b/src/lib/support/LifetimePersistedCounter.h
index 7394615..68bae74 100644
--- a/src/lib/support/LifetimePersistedCounter.h
+++ b/src/lib/support/LifetimePersistedCounter.h
@@ -27,6 +27,7 @@
 #pragma once
 
 #include <lib/support/CHIPCounter.h>
+#include <lib/support/CodeUtils.h>
 #include <platform/PersistedStorage.h>
 
 namespace chip {
diff --git a/src/protocols/secure_channel/MessageCounterManager.cpp b/src/protocols/secure_channel/MessageCounterManager.cpp
index 6903f5b..26a2456 100644
--- a/src/protocols/secure_channel/MessageCounterManager.cpp
+++ b/src/protocols/secure_channel/MessageCounterManager.cpp
@@ -21,6 +21,8 @@
  *
  */
 
+#include <protocols/secure_channel/MessageCounterManager.h>
+
 #include <lib/core/CHIPCore.h>
 #include <lib/core/CHIPEncoding.h>
 #include <lib/core/CHIPKeyIds.h>
@@ -32,7 +34,6 @@
 #include <messaging/Flags.h>
 #include <protocols/Protocols.h>
 #include <protocols/secure_channel/Constants.h>
-#include <protocols/secure_channel/MessageCounterManager.h>
 
 namespace chip {
 namespace secure_channel {
diff --git a/src/protocols/secure_channel/MessageCounterManager.h b/src/protocols/secure_channel/MessageCounterManager.h
index 2984189..80e23f2 100644
--- a/src/protocols/secure_channel/MessageCounterManager.h
+++ b/src/protocols/secure_channel/MessageCounterManager.h
@@ -22,6 +22,8 @@
 
 #pragma once
 
+#include <messaging/ExchangeDelegate.h>
+#include <messaging/ExchangeMgr.h>
 #include <protocols/Protocols.h>
 #include <system/SystemPacketBuffer.h>
 #include <transport/MessageCounterManagerInterface.h>
@@ -29,8 +31,6 @@
 namespace chip {
 namespace secure_channel {
 
-class ExchangeManager;
-
 class MessageCounterManager : public Messaging::UnsolicitedMessageHandler,
                               public Messaging::ExchangeDelegate,
                               public Transport::MessageCounterManagerInterface
diff --git a/src/protocols/secure_channel/SessionEstablishmentDelegate.h b/src/protocols/secure_channel/SessionEstablishmentDelegate.h
index 1275387..f14566d 100644
--- a/src/protocols/secure_channel/SessionEstablishmentDelegate.h
+++ b/src/protocols/secure_channel/SessionEstablishmentDelegate.h
@@ -26,6 +26,7 @@
 #pragma once
 
 #include <system/SystemPacketBuffer.h>
+#include <transport/SessionHandle.h>
 #include <transport/raw/MessageHeader.h>
 #include <transport/raw/PeerAddress.h>
 
diff --git a/src/protocols/secure_channel/StatusReport.h b/src/protocols/secure_channel/StatusReport.h
index c0704d5..cd26b79 100644
--- a/src/protocols/secure_channel/StatusReport.h
+++ b/src/protocols/secure_channel/StatusReport.h
@@ -20,6 +20,7 @@
 
 #include <lib/support/BufferWriter.h>
 #include <protocols/Protocols.h>
+#include <protocols/secure_channel/Constants.h>
 #include <system/SystemPacketBuffer.h>
 
 namespace chip {
diff --git a/src/transport/SessionDelegate.h b/src/transport/SessionDelegate.h
index 19f0960..5eedd6a 100644
--- a/src/transport/SessionDelegate.h
+++ b/src/transport/SessionDelegate.h
@@ -16,7 +16,9 @@
 
 #pragma once
 
-#include <transport/SessionHandle.h>
+#include <inttypes.h>
+
+#include <lib/support/DLLUtil.h>
 
 namespace chip {
 
diff --git a/src/transport/SessionMessageDelegate.h b/src/transport/SessionMessageDelegate.h
index dee2951..e89ec2b 100644
--- a/src/transport/SessionMessageDelegate.h
+++ b/src/transport/SessionMessageDelegate.h
@@ -17,6 +17,7 @@
 #pragma once
 
 #include <transport/SessionHandle.h>
+#include <transport/raw/MessageHeader.h>
 
 namespace chip {