Remove some dead Inet code (#10211)

#### Problem

`src/inet` has some unused code inherited from Weave, which complicates
maintenance. (Specifically, this is on the path to #7715 _Virtualize
System and Inet interfaces_.)

#### Change overview

- Remove some unused code from `Inet::EndPointBasis`
- Remove some unused `#include`s
- Remove unused `INET_CONFIG_WILL_OVERRIDE_PLATFORM_XTOR_FUNCS`
- Remove `src/inet/InetUtils.cpp`
- Remove `src/system/SystemLayerPrivate.h`
- Convert LwIPEndPointType to `enum class`

#### Testing

CI; no functional changes.
diff --git a/src/inet/BUILD.gn b/src/inet/BUILD.gn
index f432dc4..ce0bbf5 100644
--- a/src/inet/BUILD.gn
+++ b/src/inet/BUILD.gn
@@ -90,7 +90,6 @@
     "InetLayer.h",
     "InetLayerBasis.h",
     "InetLayerEvents.h",
-    "InetUtils.cpp",
     "arpa-inet-compatibility.h",
   ]
 
diff --git a/src/inet/EndPointBasis.cpp b/src/inet/EndPointBasis.cpp
index 68bbb72..63b233b 100644
--- a/src/inet/EndPointBasis.cpp
+++ b/src/inet/EndPointBasis.cpp
@@ -35,18 +35,18 @@
     InitInetLayerBasis(aInetLayer, aAppState);
 
 #if CHIP_SYSTEM_CONFIG_USE_LWIP
-    mLwIPEndPointType = kLwIPEndPointType_Unknown;
+    mLwIPEndPointType = LwIPEndPointType::Unknown;
 #endif // CHIP_SYSTEM_CONFIG_USE_LWIP
 
 #if CHIP_SYSTEM_CONFIG_USE_SOCKETS
-    mSocket = INET_INVALID_SOCKET_FD;
+    mSocket = kInvalidSocketFd;
 #endif // CHIP_SYSTEM_CONFIG_USE_SOCKETS
 }
 
 #if CHIP_SYSTEM_CONFIG_USE_LWIP
-void EndPointBasis::DeferredFree(chip::System::Object::ReleaseDeferralErrorTactic aTactic)
+void EndPointBasis::DeferredFree(System::Object::ReleaseDeferralErrorTactic aTactic)
 {
-    if (!CHIP_SYSTEM_CONFIG_USE_SOCKETS || IsLWIPEndPoint())
+    if (!CHIP_SYSTEM_CONFIG_USE_SOCKETS || (mVoid != nullptr))
     {
         DeferredRelease(static_cast<System::LayerLwIP *>(Layer().SystemLayer()), aTactic);
     }
diff --git a/src/inet/EndPointBasis.h b/src/inet/EndPointBasis.h
index 31ed82c..f34db99 100644
--- a/src/inet/EndPointBasis.h
+++ b/src/inet/EndPointBasis.h
@@ -26,11 +26,8 @@
 
 #include <inet/InetConfig.h>
 
-#include "inet/IANAConstants.h"
-#include "inet/InetLayerBasis.h"
-#include <inet/InetError.h>
-#include <inet/InetInterface.h>
-#include <inet/InetLayerEvents.h>
+#include <inet/IPAddress.h>
+#include <inet/InetLayerBasis.h>
 
 #include <lib/support/DLLUtil.h>
 
@@ -42,58 +39,29 @@
 #include <Network/Network.h>
 #endif // CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK
 
-//--- Declaration of LWIP protocol control buffer structure names
 #if CHIP_SYSTEM_CONFIG_USE_LWIP
-#if INET_CONFIG_ENABLE_UDP_ENDPOINT
 struct udp_pcb;
-#endif // INET_CONFIG_ENABLE_UDP_ENDPOINT
-#if INET_CONFIG_ENABLE_TCP_ENDPOINT
 struct tcp_pcb;
-#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT
 #endif // CHIP_SYSTEM_CONFIG_USE_LWIP
 
 namespace chip {
 namespace Inet {
 
 /**
- * @class EndPointBasis
- *
- * @brief Basis of internet transport endpoint classes
+ * Basis of internet transport endpoint classes.
  */
 class DLL_EXPORT EndPointBasis : public InetLayerBasis
 {
-public:
-    /** Common state codes */
-    enum
-    {
-        kBasisState_Closed = 0 /**< Encapsulated descriptor is not valid. */
-    };
-
-#if CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK
-    /** Test whether endpoint is a Network.framework endpoint */
-    bool IsNetworkFrameworkEndPoint(void) const;
-#endif
-
-#if CHIP_SYSTEM_CONFIG_USE_SOCKETS
-    /** Test whether endpoint is a POSIX socket */
-    bool IsSocketsEndPoint() const;
-#endif
-
-#if CHIP_SYSTEM_CONFIG_USE_LWIP
-    /** Test whether endpoint is a LwIP protocol control buffer */
-    bool IsLWIPEndPoint(void) const;
-#endif
-
-    /** Test whether endpoint has a valid descriptor. */
-    bool IsOpenEndPoint() const;
-
 protected:
+    void InitEndPointBasis(InetLayer & aInetLayer, void * aAppState = nullptr);
+
 #if CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK
     nw_parameters_t mParameters;
     IPAddressType mAddrType; /**< Protocol family, i.e. IPv4 or IPv6. */
 #endif
 
 #if CHIP_SYSTEM_CONFIG_USE_SOCKETS
+    static constexpr int kInvalidSocketFd = -1;
     int mSocket;                     /**< Encapsulated socket descriptor. */
     IPAddressType mAddrType;         /**< Protocol family, i.e. IPv4 or IPv6. */
     System::SocketWatchToken mWatch; /**< Socket event watcher */
@@ -112,63 +80,18 @@
 #endif                  // INET_CONFIG_ENABLE_TCP_ENDPOINT
     };
 
-    enum
+    enum class LwIPEndPointType : uint8_t
     {
-        kLwIPEndPointType_Unknown = 0,
+        Unknown = 0,
+        Raw     = 1,
+        UDP     = 2,
+        UCP     = 3,
+        TCP     = 4
+    } mLwIPEndPointType;
 
-        kLwIPEndPointType_Raw = 1,
-        kLwIPEndPointType_UDP = 2,
-        kLwIPEndPointType_UCP = 3,
-        kLwIPEndPointType_TCP = 4
-    };
-
-    uint8_t mLwIPEndPointType;
-
-    void DeferredFree(chip::System::Object::ReleaseDeferralErrorTactic aTactic);
+    void DeferredFree(System::Object::ReleaseDeferralErrorTactic aTactic);
 #endif // CHIP_SYSTEM_CONFIG_USE_LWIP
-
-    void InitEndPointBasis(InetLayer & aInetLayer, void * aAppState = nullptr);
 };
 
-#if CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK
-inline bool EndPointBasis::IsNetworkFrameworkEndPoint(void) const
-{
-    return mParameters != NULL;
-}
-#endif // CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK
-
-#if CHIP_SYSTEM_CONFIG_USE_SOCKETS
-inline bool EndPointBasis::IsSocketsEndPoint() const
-{
-    return mSocket != INET_INVALID_SOCKET_FD;
-}
-#endif // CHIP_SYSTEM_CONFIG_USE_SOCKETS
-
-#if CHIP_SYSTEM_CONFIG_USE_LWIP
-inline bool EndPointBasis::IsLWIPEndPoint(void) const
-{
-    return mVoid != NULL;
-}
-#endif // CHIP_SYSTEM_CONFIG_USE_LWIP
-
-inline bool EndPointBasis::IsOpenEndPoint() const
-{
-    bool lResult = false;
-
-#if CHIP_SYSTEM_CONFIG_USE_LWIP
-    lResult = (lResult || IsLWIPEndPoint());
-#endif // CHIP_SYSTEM_CONFIG_USE_LWIP
-
-#if CHIP_SYSTEM_CONFIG_USE_SOCKETS
-    lResult = (lResult || IsSocketsEndPoint());
-#endif // CHIP_SYSTEM_CONFIG_USE_SOCKETS
-
-#if CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK
-    lResult = (lResult || IsNetworkFrameworkEndPoint());
-#endif // CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK
-
-    return lResult;
-}
-
 } // namespace Inet
 } // namespace chip
diff --git a/src/inet/IPEndPointBasis.cpp b/src/inet/IPEndPointBasis.cpp
index 5851177..e758131 100644
--- a/src/inet/IPEndPointBasis.cpp
+++ b/src/inet/IPEndPointBasis.cpp
@@ -345,7 +345,7 @@
         {
 
 #if INET_CONFIG_ENABLE_UDP_ENDPOINT
-        case kLwIPEndPointType_UDP:
+        case LwIPEndPointType::UDP:
             udp_set_flags(mUDP, UDP_FLAGS_MULTICAST_LOOP);
             break;
 #endif // INET_CONFIG_ENABLE_UDP_ENDPOINT
@@ -361,7 +361,7 @@
         {
 
 #if INET_CONFIG_ENABLE_UDP_ENDPOINT
-        case kLwIPEndPointType_UDP:
+        case LwIPEndPointType::UDP:
             udp_clear_flags(mUDP, UDP_FLAGS_MULTICAST_LOOP);
             break;
 #endif // INET_CONFIG_ENABLE_UDP_ENDPOINT
@@ -907,7 +907,7 @@
 
 CHIP_ERROR IPEndPointBasis::GetSocket(IPAddressType aAddressType, int aType, int aProtocol)
 {
-    if (mSocket == INET_INVALID_SOCKET_FD)
+    if (mSocket == kInvalidSocketFd)
     {
         const int one = 1;
         int family;
diff --git a/src/inet/IPEndPointBasis.h b/src/inet/IPEndPointBasis.h
index e22e2cf..b3d86fb 100644
--- a/src/inet/IPEndPointBasis.h
+++ b/src/inet/IPEndPointBasis.h
@@ -28,6 +28,8 @@
 
 #include <inet/EndPointBasis.h>
 
+#include <inet/InetInterface.h>
+#include <inet/InetLayerEvents.h>
 #include <system/SystemPacketBuffer.h>
 
 #if CHIP_SYSTEM_CONFIG_USE_LWIP
@@ -61,21 +63,13 @@
      *  state after binding to a local interface address, then proceed to the
      *  "listening" state when they have continuations registered for handling
      *  events for reception of ICMP messages.
-     *
-     * @note
-     *  The \c kBasisState_Closed state enumeration is mapped to \c
-     *  kState_Ready for historical binary-compatibility reasons. The
-     *  existing \c kState_Closed exists to identify separately the
-     *  distinction between "not opened yet" and "previously opened
-     *  now closed" that existed previously in the \c kState_Ready and
-     *  \c kState_Closed states.
      */
     enum
     {
-        kState_Ready     = kBasisState_Closed, /**< Endpoint initialized, but not open. */
-        kState_Bound     = 1,                  /**< Endpoint bound, but not listening. */
-        kState_Listening = 2,                  /**< Endpoint receiving datagrams. */
-        kState_Closed    = 3                   /**< Endpoint closed, ready for release. */
+        kState_Ready     = 0, /**< Endpoint initialized, but not open. */
+        kState_Bound     = 1, /**< Endpoint bound, but not listening. */
+        kState_Listening = 2, /**< Endpoint receiving datagrams. */
+        kState_Closed    = 3  /**< Endpoint closed, ready for release. */
     } mState;
 
     /**
diff --git a/src/inet/InetConfig.h b/src/inet/InetConfig.h
index 32f0a13..04533c0 100644
--- a/src/inet/InetConfig.h
+++ b/src/inet/InetConfig.h
@@ -114,19 +114,6 @@
 #endif // INET_CONFIG_WILL_OVERRIDE_LWIP_ERROR_FUNCS
 
 /**
- *  @def INET_CONFIG_WILL_OVERRIDE_PLATFORM_XTOR_FUNCS
- *
- *  @brief
- *    This defines whether (1) or not (0) your platform will override
- *    the platform- and system-specific InetLayer WillInit, DidInit,
- *    WillShutdown, and DidShutdown.
- *
- */
-#ifndef INET_CONFIG_WILL_OVERRIDE_PLATFORM_XTOR_FUNCS
-#define INET_CONFIG_WILL_OVERRIDE_PLATFORM_XTOR_FUNCS       0
-#endif // INET_CONFIG_WILL_OVERRIDE_PLATFORM_XTOR_FUNCS
-
-/**
  *  @def INET_CONFIG_MAX_DROPPABLE_EVENTS
  *
  *  @brief
diff --git a/src/inet/InetLayer.cpp b/src/inet/InetLayer.cpp
index 14357b9..4ffeabf 100644
--- a/src/inet/InetLayer.cpp
+++ b/src/inet/InetLayer.cpp
@@ -221,13 +221,6 @@
  *  LwIP-based adaptations, this will typically be a pointer to the
  *  event queue associated with the InetLayer instance.
  *
- *  Platforms may choose to assert
- *  #INET_CONFIG_WILL_OVERRIDE_PLATFORM_XTOR_FUNCS in their
- *  platform-specific configuration header and enable the
- *  Platform::InetLayer::WillInit and Platform::InetLayer::DidInit
- *  hooks to effect platform-specific customizations or data extensions
- *  to InetLayer.
- *
  *  @param[in]  aSystemLayer  A required instance of the chip System Layer
  *                            already successfully initialized.
  *
@@ -247,8 +240,6 @@
  */
 CHIP_ERROR InetLayer::Init(chip::System::Layer & aSystemLayer, void * aContext)
 {
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
     Inet::RegisterLayerErrorFormatter();
 
     if (State != kState_NotInitialized)
@@ -260,54 +251,35 @@
 
     mPlatformData = nullptr;
 
-    err = Platform::InetLayer::WillInit(this, aContext);
-    SuccessOrExit(err);
-
     mSystemLayer = &aSystemLayer;
     mContext     = aContext;
 
 #if CHIP_SYSTEM_CONFIG_USE_LWIP
-    err = InitQueueLimiter();
-    SuccessOrExit(err);
+    ReturnErrorOnFailure(InitQueueLimiter());
 
     static_cast<System::LayerLwIP *>(mSystemLayer)->AddEventHandlerDelegate(sInetEventHandlerDelegate);
 #endif // CHIP_SYSTEM_CONFIG_USE_LWIP
 
     State = kState_Initialized;
 
-#if INET_CONFIG_ENABLE_DNS_RESOLVER
-#if CHIP_SYSTEM_CONFIG_USE_SOCKETS && INET_CONFIG_ENABLE_ASYNC_DNS_SOCKETS
-    err = mAsyncDNSResolver.Init(this);
-    SuccessOrExit(err);
-#endif // CHIP_SYSTEM_CONFIG_USE_SOCKETS && INET_CONFIG_ENABLE_ASYNC_DNS_SOCKETS
-#endif // INET_CONFIG_ENABLE_DNS_RESOLVER
+#if CHIP_SYSTEM_CONFIG_USE_SOCKETS && INET_CONFIG_ENABLE_DNS_RESOLVER && INET_CONFIG_ENABLE_ASYNC_DNS_SOCKETS
+    ReturnErrorOnFailure(mAsyncDNSResolver.Init(this));
+#endif // CHIP_SYSTEM_CONFIG_USE_SOCKETS && INET_CONFIG_ENABLE_DNS_RESOLVER && INET_CONFIG_ENABLE_ASYNC_DNS_SOCKETS
 
-exit:
-    Platform::InetLayer::DidInit(this, mContext, err);
-    return err;
+    return CHIP_NO_ERROR;
 }
 
 /**
  *  This is the InetLayer explicit deinitializer and should be called
  *  prior to disposing of an instantiated InetLayer instance.
  *
- *  Platforms may choose to assert
- *  #INET_CONFIG_WILL_OVERRIDE_PLATFORM_XTOR_FUNCS in their
- *  platform-specific configuration header and enable the
- *  Platform::InetLayer::WillShutdown and
- *  Platform::InetLayer::DidShutdown hooks to effect clean-up of
- *  platform-specific customizations or data extensions to InetLayer.
- *
  *  @return #CHIP_NO_ERROR on success; otherwise, a specific error indicating
  *          the reason for shutdown failure.
  *
  */
 CHIP_ERROR InetLayer::Shutdown()
 {
-    CHIP_ERROR err;
-
-    err = Platform::InetLayer::WillShutdown(this, mContext);
-    SuccessOrExit(err);
+    CHIP_ERROR err = CHIP_NO_ERROR;
 
     if (State == kState_Initialized)
     {
@@ -353,9 +325,6 @@
 
     State = kState_NotInitialized;
 
-exit:
-    Platform::InetLayer::DidShutdown(this, mContext, err);
-
     return err;
 }
 
@@ -1020,110 +989,5 @@
     DestPort    = 0;
 }
 
-#if !INET_CONFIG_WILL_OVERRIDE_PLATFORM_XTOR_FUNCS
-
-// MARK: InetLayer platform- and system-specific functions for InetLayer
-//       construction and destruction.
-
-namespace Platform {
-namespace InetLayer {
-
-/**
- * This is a platform-specific InetLayer pre-initialization hook. This
- * may be overridden by assserting the preprocessor definition,
- * #INET_CONFIG_WILL_OVERRIDE_PLATFORM_XTOR_FUNCS.
- *
- * @param[in,out] aLayer    A pointer to the InetLayer instance being
- *                          initialized.
- *
- * @param[in,out] aContext  Platform-specific context data passed to
- *                          the layer initialization method, \::Init.
- *
- * @return #CHIP_NO_ERROR on success; otherwise, a specific error indicating
- *         the reason for initialization failure. Returning non-successful
- *         status will abort initialization.
- *
- */
-DLL_EXPORT CHIP_ERROR WillInit(Inet::InetLayer * aLayer, void * aContext)
-{
-    (void) aLayer;
-    (void) aContext;
-
-    return CHIP_NO_ERROR;
-}
-
-/**
- * This is a platform-specific InetLayer post-initialization hook. This
- * may be overridden by assserting the preprocessor definition,
- * #INET_CONFIG_WILL_OVERRIDE_PLATFORM_XTOR_FUNCS.
- *
- * @param[in,out] aLayer    A pointer to the InetLayer instance being
- *                          initialized.
- *
- * @param[in,out] aContext  Platform-specific context data passed to
- *                          the layer initialization method, \::Init.
- *
- * @param[in]     anError   The overall status being returned via the
- *                          InetLayer \::Init method.
- *
- */
-DLL_EXPORT void DidInit(Inet::InetLayer * aLayer, void * aContext, CHIP_ERROR anError)
-{
-    (void) aLayer;
-    (void) aContext;
-    (void) anError;
-}
-
-/**
- * This is a platform-specific InetLayer pre-shutdown hook. This
- * may be overridden by assserting the preprocessor definition,
- * #INET_CONFIG_WILL_OVERRIDE_PLATFORM_XTOR_FUNCS.
- *
- * @param[in,out] aLayer    A pointer to the InetLayer instance being
- *                          shutdown.
- *
- * @param[in,out] aContext  Platform-specific context data passed to
- *                          the layer initialization method, \::Init.
- *
- * @return #CHIP_NO_ERROR on success; otherwise, a specific error indicating
- *         the reason for shutdown failure. Returning non-successful
- *         status will abort shutdown.
- *
- */
-DLL_EXPORT CHIP_ERROR WillShutdown(Inet::InetLayer * aLayer, void * aContext)
-{
-    (void) aLayer;
-    (void) aContext;
-
-    return CHIP_NO_ERROR;
-}
-
-/**
- * This is a platform-specific InetLayer post-shutdown hook. This
- * may be overridden by assserting the preprocessor definition,
- * #INET_CONFIG_WILL_OVERRIDE_PLATFORM_XTOR_FUNCS.
- *
- * @param[in,out] aLayer    A pointer to the InetLayer instance being
- *                          shutdown.
- *
- * @param[in,out] aContext  Platform-specific context data passed to
- *                          the layer initialization method, \::Init.
- *
- * @param[in]     anError   The overall status being returned via the
- *                          InetLayer \::Shutdown method.
- *
- */
-DLL_EXPORT void DidShutdown(Inet::InetLayer * aLayer, void * aContext, CHIP_ERROR anError)
-{
-    (void) aLayer;
-    (void) aContext;
-    (void) anError;
-}
-
-} // namespace InetLayer
-} // namespace Platform
-
-#endif // !INET_CONFIG_WILL_OVERRIDE_PLATFORM_XTOR_FUNCS
-
 } // namespace Inet
 } // namespace chip
diff --git a/src/inet/InetLayer.h b/src/inet/InetLayer.h
index 35f6adf..b557cc0 100644
--- a/src/inet/InetLayer.h
+++ b/src/inet/InetLayer.h
@@ -105,22 +105,8 @@
 namespace chip {
 namespace Inet {
 
-// Forward Declarations
-
 class InetLayer;
 
-namespace Platform {
-namespace InetLayer {
-
-extern CHIP_ERROR WillInit(Inet::InetLayer * aLayer, void * aContext);
-extern void DidInit(Inet::InetLayer * aLayer, void * aContext, CHIP_ERROR anError);
-
-extern CHIP_ERROR WillShutdown(Inet::InetLayer * aLayer, void * aContext);
-extern void DidShutdown(Inet::InetLayer * aLayer, void * aContext, CHIP_ERROR anError);
-
-} // namespace InetLayer
-} // namespace Platform
-
 /**
  *  @class InetLayer
  *
@@ -143,6 +129,9 @@
 {
 #if INET_CONFIG_ENABLE_DNS_RESOLVER
     friend class DNSResolver;
+#if CHIP_SYSTEM_CONFIG_USE_SOCKETS && INET_CONFIG_ENABLE_ASYNC_DNS_SOCKETS
+    friend class AsyncDNSResolverSockets;
+#endif // CHIP_SYSTEM_CONFIG_USE_SOCKETS && INET_CONFIG_ENABLE_ASYNC_DNS_SOCKETS
 #endif // INET_CONFIG_ENABLE_DNS_RESOLVER
 
 #if INET_CONFIG_ENABLE_TCP_ENDPOINT
@@ -153,12 +142,6 @@
     friend class UDPEndPoint;
 #endif // INET_CONFIG_ENABLE_UDP_ENDPOINT
 
-#if CHIP_SYSTEM_CONFIG_USE_SOCKETS
-#if INET_CONFIG_ENABLE_DNS_RESOLVER && INET_CONFIG_ENABLE_ASYNC_DNS_SOCKETS
-    friend class AsyncDNSResolverSockets;
-#endif // INET_CONFIG_ENABLE_DNS_RESOLVER && INET_CONFIG_ENABLE_ASYNC_DNS_SOCKETS
-#endif // CHIP_SYSTEM_CONFIG_USE_SOCKETS
-
 public:
     /**
      *  The current state of the InetLayer object.
@@ -285,12 +268,6 @@
 
 #endif // CHIP_SYSTEM_CONFIG_USE_SOCKETS
 
-    friend CHIP_ERROR Platform::InetLayer::WillInit(Inet::InetLayer * aLayer, void * aContext);
-    friend void Platform::InetLayer::DidInit(Inet::InetLayer * aLayer, void * aContext, CHIP_ERROR anError);
-
-    friend CHIP_ERROR Platform::InetLayer::WillShutdown(Inet::InetLayer * aLayer, void * aContext);
-    friend void Platform::InetLayer::DidShutdown(Inet::InetLayer * aLayer, void * aContext, CHIP_ERROR anError);
-
     bool IsIdleTimerRunning();
 };
 
@@ -316,11 +293,5 @@
     void Clear();
 };
 
-extern CHIP_ERROR ParseHostAndPort(const char * aString, uint16_t aStringLen, const char *& aHost, uint16_t & aHostLen,
-                                   uint16_t & aPort);
-
-extern CHIP_ERROR ParseHostPortAndInterface(const char * aString, uint16_t aStringLen, const char *& aHost, uint16_t & aHostLen,
-                                            uint16_t & aPort, const char *& aInterface, uint16_t & aInterfaceLen);
-
 } // namespace Inet
 } // namespace chip
diff --git a/src/inet/InetLayerBasis.h b/src/inet/InetLayerBasis.h
index cfde74e..4645a8a 100644
--- a/src/inet/InetLayerBasis.h
+++ b/src/inet/InetLayerBasis.h
@@ -17,94 +17,48 @@
  */
 
 /**
- *    @file
- *      This file contains the basis class for reference counting
- *      objects by the Inet layer as well as a class for representing
- *      the pending or resulting I/O events on a socket.
+ *    This file contains the basis class for reference counting objects by the Inet layer.
  */
 
 #pragma once
 
-#include <inet/InetConfig.h>
-
-#include <lib/support/BitFlags.h>
-#include <lib/support/DLLUtil.h>
 #include <system/SystemObject.h>
 
-#include <stdint.h>
-#include <type_traits>
-#if CHIP_SYSTEM_CONFIG_USE_SOCKETS
-#include <sys/select.h>
-#endif
-
 namespace chip {
 namespace Inet {
 
-//--- Forward declaration of InetLayer singleton class
 class InetLayer;
 
 /**
- *  @class InetLayerBasis
- *
- *  @brief
- *    This is the basis class of reference-counted objects managed by an
- *    InetLayer object.
- *
+ *  This is the basis class of reference-counted objects managed by an InetLayer object.
  */
 class InetLayerBasis : public chip::System::Object
 {
 public:
-    InetLayer & Layer() const;
-    bool IsCreatedByInetLayer(const InetLayer & aInetLayer) const;
+    /**
+     *  Returns a reference to the Inet layer object that owns this basis object.
+     */
+    InetLayer & Layer() const { return *mInetLayer; }
+
+    /**
+     *  Returns \c true if the basis object was obtained by the specified Inet layer instance.
+     *
+     *  @note
+     *      Does not check whether the object is actually obtained by the system layer instance associated with the Inet layer
+     *      instance. It merely tests whether \c aInetLayer is the Inet layer instance that was provided to \c InitInetLayerBasis.
+     */
+    bool IsCreatedByInetLayer(const InetLayer & aInetLayer) const { return mInetLayer == &aInetLayer; }
 
 protected:
-    void InitInetLayerBasis(InetLayer & aInetLayer, void * aAppState = nullptr);
+    void InitInetLayerBasis(InetLayer & aInetLayer, void * aAppState = nullptr)
+    {
+        AppState   = aAppState;
+        mInetLayer = &aInetLayer;
+    }
 
 private:
     InetLayer * mInetLayer; /**< Pointer to the InetLayer object that owns this object. */
 };
 
-/**
- *  Returns a reference to the Inet layer object that owns this basis object.
- */
-inline InetLayer & InetLayerBasis::Layer() const
-{
-    return *mInetLayer;
-}
-
-/**
- *  Returns \c true if the basis object was obtained by the specified INET layer instance.
- *
- *  @param[in]  aInetLayer    An instance of the INET layer.
- *
- *  @return     \c true if owned by \c aInetLayer, otherwise \c false.
- *
- *  @note
- *      Does not check whether the object is actually obtained by the system layer instance associated with the INET layer
- *      instance. It merely tests whether \c aInetLayer is the INET layer instance that was provided to \c InitInetLayerBasis.
- */
-inline bool InetLayerBasis::IsCreatedByInetLayer(const InetLayer & aInetLayer) const
-{
-    return mInetLayer == &aInetLayer;
-}
-
-inline void InetLayerBasis::InitInetLayerBasis(InetLayer & aInetLayer, void * aAppState)
-{
-    AppState   = aAppState;
-    mInetLayer = &aInetLayer;
-}
-
-#if CHIP_SYSTEM_CONFIG_USE_SOCKETS
-
-/**
- *  @def INET_INVALID_SOCKET_FD
- *
- *  @brief
- *    This is the invalid socket file descriptor identifier.
- */
-#define INET_INVALID_SOCKET_FD (-1)
-
-#endif // CHIP_SYSTEM_CONFIG_USE_SOCKETS
-
 } // namespace Inet
 } // namespace chip
diff --git a/src/inet/InetUtils.cpp b/src/inet/InetUtils.cpp
deleted file mode 100644
index 19d5500..0000000
--- a/src/inet/InetUtils.cpp
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 Project CHIP Authors
- *    Copyright (c) 2013-2017 Nest Labs, Inc.
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-
-/**
- *    @file
- *      This file implements methods for parsing host names or IP
- *      addresses and an optional port number and/or an optional
- *      interface name from a human-readable string.
- *
- */
-
-#include <string.h>
-#include <type_traits>
-
-#include <lib/support/DLLUtil.h>
-
-#include <inet/InetLayer.h>
-
-namespace chip {
-namespace Inet {
-
-/**
- *  Parse a human-readable string containing a host or IP address and
- *  an optional port number (separated by a ':'), supporting the
- *  following formats:
- *
- *    * <host-name>
- *    * <host-name>:\<port\>
- *    * <ip-4-addr>
- *    * <ip-4-addr>:\<port\>
- *    * <ip-6-addr>
- *    * [<ip-6-addr>]:\<port\>
- *
- *  @param[in]  aString     The human-reable string to parse.
- *
- *  @param[in]  aStringLen  The length, in characters, of aString.
- *
- *  @param[out] aHost       A pointer to the host name portion of the parsed
- *                          string.
- *
- *  @param[out] aHostLen    The length, in characters, of aHost.
- *
- *  @param[out] aPort       The port number, if present and successfully
- *                          parsed; otherwise, 0.
- *
- *  @return  #INET_ERROR_INVALID_HOST_NAME   If the input to be parsed is of
- *                                           zero-length or otherwise
- *                                           malformed.
- *  @return  #INET_ERROR_HOST_NAME_TOO_LONG  If the host name exceeds 253
- *                                           characters.
- *  @return  #CHIP_NO_ERROR                  On success.
- *
- */
-DLL_EXPORT CHIP_ERROR ParseHostAndPort(const char * aString, uint16_t aStringLen, const char *& aHost, uint16_t & aHostLen,
-                                       uint16_t & aPort)
-{
-    const char * end = aString + aStringLen;
-    const char * p;
-
-    if (aStringLen == 0)
-        return INET_ERROR_INVALID_HOST_NAME;
-
-    // If the string starts with a [ then it is a backeted
-    // host/address, possibly with a port number following it.
-
-    if (*aString == '[')
-    {
-        // Search for the end bracket.
-        p = static_cast<const char *>(memchr(aString, ']', aStringLen));
-        if (p == nullptr)
-            return INET_ERROR_INVALID_HOST_NAME;
-
-        // Return the IPv6 address.
-        aHost = aString + 1;
-        // Cast is safe because we know p != aString, so p >= aHost, and at the
-        // same time p - aString < aStringLen, which is uint16_t.
-        static_assert(std::is_same<decltype(aStringLen), uint16_t>::value, "String length might be too big");
-        aHostLen = static_cast<uint16_t>(p - aHost);
-
-        // Skip the end bracket.
-        p++;
-    }
-
-    // Otherwise, not a bracketed IPv6 address...
-    else
-    {
-        // Search for a colon.
-        p = static_cast<const char *>(memchr(aString, ':', aStringLen));
-
-        // If the string contains no colons, then it is a host name or
-        // IPv4 address without a port.
-        //
-        // If the string contains MULTIPLE colons, then it is an IPv6
-        // address without a port.
-        //
-        // Note: The cast is safe because p points into the string of p is not
-        // null, so end - p - 1 can't be negative.
-        if (p == nullptr || memchr(p + 1, ':', static_cast<size_t>(end - p - 1)) != nullptr)
-            p = end;
-
-        // Return the host/address portion.
-        aHost = aString;
-        // Cast is safe because we know p - aString < aStringLen, which is
-        // uint16_t.
-        static_assert(std::is_same<decltype(aStringLen), uint16_t>::value, "String length might be too big");
-        aHostLen = static_cast<uint16_t>(p - aString);
-    }
-
-    // Enforce the DNS limit on the maximum length of a host name.
-    if (aHostLen > 253)
-        return INET_ERROR_HOST_NAME_TOO_LONG;
-
-    // If there are more characters after the host name...
-    if (p < end)
-    {
-        // Verify the presence of a colon.
-        if (*p++ != ':')
-            return INET_ERROR_INVALID_HOST_NAME;
-
-        // Verify that the port number portion is not too long.
-        if ((end - p) > 5)
-            return INET_ERROR_INVALID_HOST_NAME;
-
-        // Parse the port number.
-        aPort = 0;
-        for (; p < end; p++)
-            if (*p >= '0' && *p <= '9')
-                aPort = static_cast<uint16_t>((aPort * 10) + (*p - '0'));
-            else
-                return INET_ERROR_INVALID_HOST_NAME;
-    }
-
-    // Otherwise, tell the caller there was no port number.
-    else
-        aPort = 0;
-
-    return CHIP_NO_ERROR;
-}
-
-/**
- *  Parse a human-readable string containing a host or IP address, an
- *  optional port number (separated by a ':'), and an optional
- *  interface name (separated by a '%'), supporting the following
- *  formats:
- *
- *    * <host-name>
- *    * <host-name>%\<interface\>
- *    * <host-name>:\<port\>
- *    * <host-name>:\<port\>%\<interface\>
- *    * <ip-4-addr>
- *    * <ip-4-addr>%\<interface\>
- *    * <ip-4-addr>:\<port\>
- *    * <ip-4-addr>:\<port\>%\<interface\>
- *    * <ip-6-addr>
- *    * <ip-6-addr>%\<interface\>
- *    * [<ip-6-addr>]:\<port\>
- *    * [<ip-6-addr>]:\<port\>%\<interface\>
- *
- *  @param[in]  aString        The human-reable string to parse.
- *
- *  @param[in]  aStringLen     The length, in characters, of aString.
- *
- *  @param[out] aHost          A pointer to the host name portion of the parsed
- *                             string.
- *
- *  @param[out] aHostLen       The length, in characters, of aHost.
- *
- *  @param[out] aPort          The port number, if present and successfully
- *                             parsed; otherwise, 0.
- *
- *  @param[out] aInterface     A pointer to the interface portion of the parsed
- *                             string.
- *
- *  @param[out] aInterfaceLen  The length, in characters, of aInterface.
- *
- *  @return  #INET_ERROR_INVALID_HOST_NAME   If the input to be parsed is of
- *                                           zero-length or otherwise
- *                                           malformed.
- *  @return  #INET_ERROR_HOST_NAME_TOO_LONG  If the host name exceeds 253
- *                                           characters.
- *  @return  #CHIP_NO_ERROR                  On success.
- *
- */
-DLL_EXPORT CHIP_ERROR ParseHostPortAndInterface(const char * aString, uint16_t aStringLen, const char *& aHost, uint16_t & aHostLen,
-                                                uint16_t & aPort, const char *& aInterface, uint16_t & aInterfaceLen)
-{
-    const char * end = aString + aStringLen;
-
-    aInterface    = nullptr;
-    aInterfaceLen = 0;
-
-    for (uint16_t i = 1; i < aStringLen; i++)
-    {
-        char ch = *(end - i);
-        if (ch == '%')
-        {
-            aInterface    = end - i + 1;
-            aInterfaceLen = static_cast<uint16_t>(i - 1);
-            aStringLen    = static_cast<uint16_t>(aStringLen - i);
-            break;
-        }
-        if (ch == ':' || ch == ']')
-            break;
-    }
-
-    return ParseHostAndPort(aString, aStringLen, aHost, aHostLen, aPort);
-}
-
-} // namespace Inet
-} // namespace chip
diff --git a/src/inet/TCPEndPoint.cpp b/src/inet/TCPEndPoint.cpp
index 9ed434d..2030d69 100644
--- a/src/inet/TCPEndPoint.cpp
+++ b/src/inet/TCPEndPoint.cpp
@@ -287,7 +287,7 @@
 
     // Start listening for incoming connections.
     mTCP              = tcp_listen(mTCP);
-    mLwIPEndPointType = kLwIPEndPointType_TCP;
+    mLwIPEndPointType = LwIPEndPointType::TCP;
 
     tcp_arg(mTCP, this);
 
@@ -1627,7 +1627,7 @@
                 // Discard the reference to the PCB to ensure there is no further interaction with it
                 // after this point.
                 mTCP              = NULL;
-                mLwIPEndPointType = kLwIPEndPointType_Unknown;
+                mLwIPEndPointType = LwIPEndPointType::Unknown;
             }
         }
 
@@ -1639,7 +1639,7 @@
             // Discard the reference to the PCB to ensure there is no further interaction with it
             // after this point.
             mTCP              = NULL;
-            mLwIPEndPointType = kLwIPEndPointType_Unknown;
+            mLwIPEndPointType = LwIPEndPointType::Unknown;
         }
     }
 
@@ -1651,7 +1651,7 @@
 #if CHIP_SYSTEM_CONFIG_USE_SOCKETS
 
     // If the socket hasn't been closed already...
-    if (mSocket != INET_INVALID_SOCKET_FD)
+    if (mSocket != kInvalidSocketFd)
     {
         // If entering the Closed state
         // OR if entering the Closing state, and there's no unsent data in the send queue
@@ -1670,7 +1670,7 @@
 
             static_cast<System::LayerSockets *>(Layer().SystemLayer())->StopWatchingSocket(&mWatch);
             close(mSocket);
-            mSocket = INET_INVALID_SOCKET_FD;
+            mSocket = kInvalidSocketFd;
         }
     }
 
@@ -1961,7 +1961,7 @@
         }
         else
         {
-            mLwIPEndPointType = kLwIPEndPointType_TCP;
+            mLwIPEndPointType = LwIPEndPointType::TCP;
         }
     }
     else
@@ -2001,7 +2001,7 @@
         }
         else
         {
-            mLwIPEndPointType = kLwIPEndPointType_TCP;
+            mLwIPEndPointType = LwIPEndPointType::TCP;
         }
     }
     else
@@ -2251,7 +2251,7 @@
             // Put the new end point into the Connected state.
             conEP->State             = kState_Connected;
             conEP->mTCP              = tpcb;
-            conEP->mLwIPEndPointType = kLwIPEndPointType_TCP;
+            conEP->mLwIPEndPointType = LwIPEndPointType::TCP;
             conEP->Retain();
 
             // Setup LwIP callback functions for the new PCB.
@@ -2344,7 +2344,7 @@
         // of this is that the mTCP field is shared state between the two threads and thus must only be
         // accessed with the LwIP lock held.
         ep->mTCP              = NULL;
-        ep->mLwIPEndPointType = kLwIPEndPointType_Unknown;
+        ep->mLwIPEndPointType = LwIPEndPointType::Unknown;
 
         // Post callback to HandleError.
         CHIP_ERROR err = chip::System::MapErrorLwIP(lwipErr);
@@ -2412,7 +2412,7 @@
 
 CHIP_ERROR TCPEndPoint::GetSocket(IPAddressType addrType)
 {
-    if (mSocket == INET_INVALID_SOCKET_FD)
+    if (mSocket == kInvalidSocketFd)
     {
         int family;
         if (addrType == kIPAddressType_IPv6)
diff --git a/src/inet/TCPEndPoint.h b/src/inet/TCPEndPoint.h
index 8aa7d1a..698e2dd 100644
--- a/src/inet/TCPEndPoint.h
+++ b/src/inet/TCPEndPoint.h
@@ -29,6 +29,7 @@
 
 #include <inet/EndPointBasis.h>
 #include <inet/IPAddress.h>
+#include <inet/InetInterface.h>
 
 #include <system/SystemPacketBuffer.h>
 
@@ -72,23 +73,18 @@
      *  Objects are initialized in the "ready" state, proceed to subsequent
      *  states corresponding to a simplification of the states of the TCP
      *  transport state machine.
-     *
-     * @note
-     *  The \c kBasisState_Closed state enumeration is mapped to \c kState_Ready for historical binary-compatibility reasons. The
-     *  existing \c kState_Closed exists to identify separately the distinction between "not opened yet" and "previously opened now
-     *  closed" that existed previously in the \c kState_Ready and \c kState_Closed states.
      */
     enum
     {
-        kState_Ready           = kBasisState_Closed, /**< Endpoint initialized, but not bound. */
-        kState_Bound           = 1,                  /**< Endpoint bound, but not listening. */
-        kState_Listening       = 2,                  /**< Endpoint receiving connections. */
-        kState_Connecting      = 3,                  /**< Endpoint attempting to connect. */
-        kState_Connected       = 4,                  /**< Endpoint connected, ready for tx/rx. */
-        kState_SendShutdown    = 5,                  /**< Endpoint initiated its half-close. */
-        kState_ReceiveShutdown = 6,                  /**< Endpoint responded to half-close. */
-        kState_Closing         = 7,                  /**< Endpoint closing bidirectionally. */
-        kState_Closed          = 8                   /**< Endpoint closed, ready for release. */
+        kState_Ready           = 0, /**< Endpoint initialized, but not bound. */
+        kState_Bound           = 1, /**< Endpoint bound, but not listening. */
+        kState_Listening       = 2, /**< Endpoint receiving connections. */
+        kState_Connecting      = 3, /**< Endpoint attempting to connect. */
+        kState_Connected       = 4, /**< Endpoint connected, ready for tx/rx. */
+        kState_SendShutdown    = 5, /**< Endpoint initiated its half-close. */
+        kState_ReceiveShutdown = 6, /**< Endpoint responded to half-close. */
+        kState_Closing         = 7, /**< Endpoint closing bidirectionally. */
+        kState_Closed          = 8  /**< Endpoint closed, ready for release. */
     } State;
 
     TCPEndPoint() = default;
diff --git a/src/inet/UDPEndPoint.cpp b/src/inet/UDPEndPoint.cpp
index 60bd3f8..340d810 100644
--- a/src/inet/UDPEndPoint.cpp
+++ b/src/inet/UDPEndPoint.cpp
@@ -382,7 +382,7 @@
         {
             udp_remove(mUDP);
             mUDP              = NULL;
-            mLwIPEndPointType = kLwIPEndPointType_Unknown;
+            mLwIPEndPointType = LwIPEndPointType::Unknown;
         }
 
         // Unlock LwIP stack
@@ -392,11 +392,11 @@
 
 #if CHIP_SYSTEM_CONFIG_USE_SOCKETS
 
-        if (mSocket != INET_INVALID_SOCKET_FD)
+        if (mSocket != kInvalidSocketFd)
         {
             static_cast<System::LayerSockets *>(Layer().SystemLayer())->StopWatchingSocket(&mWatch);
             close(mSocket);
-            mSocket = INET_INVALID_SOCKET_FD;
+            mSocket = kInvalidSocketFd;
         }
 
 #if CHIP_SYSTEM_CONFIG_USE_DISPATCH
diff --git a/src/inet/tests/TestInetEndPoint.cpp b/src/inet/tests/TestInetEndPoint.cpp
index 2f7941e..d5b809a 100644
--- a/src/inet/tests/TestInetEndPoint.cpp
+++ b/src/inet/tests/TestInetEndPoint.cpp
@@ -181,31 +181,6 @@
 }
 #endif // INET_CONFIG_ENABLE_DNS_RESOLVER
 
-// Test Inet ParseHostPortAndInterface
-static void TestParseHost(nlTestSuite * inSuite, void * inContext)
-{
-    char correctHostNames[7][30] = {
-        "10.0.0.1", "10.0.0.1:3000", "www.google.com", "www.google.com:3000", "[fd00:0:1:1::1]:3000", "[fd00:0:1:1::1]:300%wpan0",
-        "%wpan0"
-    };
-    char invalidHostNames[4][30] = { "[fd00::1]5", "[fd00:0:1:1::1:3000", "10.0.0.1:1234567", "10.0.0.1:er31" };
-    const char * host;
-    const char * intf;
-    uint16_t port, hostlen, intflen;
-    CHIP_ERROR err;
-
-    for (char * correctHostName : correctHostNames)
-    {
-        err = ParseHostPortAndInterface(correctHostName, uint16_t(strlen(correctHostName)), host, hostlen, port, intf, intflen);
-        NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
-    }
-    for (char * invalidHostName : invalidHostNames)
-    {
-        err = ParseHostPortAndInterface(invalidHostName, uint16_t(strlen(invalidHostName)), host, hostlen, port, intf, intflen);
-        NL_TEST_ASSERT(inSuite, err == INET_ERROR_INVALID_HOST_NAME);
-    }
-}
-
 static void TestInetError(nlTestSuite * inSuite, void * inContext)
 {
     CHIP_ERROR err = CHIP_NO_ERROR;
@@ -469,7 +444,6 @@
 #if INET_CONFIG_ENABLE_DNS_RESOLVER
                                  NL_TEST_DEF("InetEndPoint::ResolveHostAddress", TestResolveHostAddress),
 #endif // INET_CONFIG_ENABLE_DNS_RESOLVER
-                                 NL_TEST_DEF("InetEndPoint::TestParseHost", TestParseHost),
                                  NL_TEST_DEF("InetEndPoint::TestInetError", TestInetError),
                                  NL_TEST_DEF("InetEndPoint::TestInetInterface", TestInetInterface),
                                  NL_TEST_DEF("InetEndPoint::TestInetEndPoint", TestInetEndPointInternal),
diff --git a/src/system/BUILD.gn b/src/system/BUILD.gn
index b06a9ee..8398993 100644
--- a/src/system/BUILD.gn
+++ b/src/system/BUILD.gn
@@ -135,7 +135,6 @@
     "SystemLayerImpl${chip_system_config_event_loop}.cpp",
     "SystemLayerImpl${chip_system_config_event_loop}.h",
     "SystemLayerImpl.h",
-    "SystemLayerPrivate.h",
     "SystemMutex.cpp",
     "SystemMutex.h",
     "SystemObject.cpp",
diff --git a/src/system/SystemClock.cpp b/src/system/SystemClock.cpp
index 5d8cc3f..2ea3942 100644
--- a/src/system/SystemClock.cpp
+++ b/src/system/SystemClock.cpp
@@ -24,9 +24,6 @@
 
 #include <system/SystemClock.h>
 
-// common private
-#include "SystemLayerPrivate.h"
-
 #include <lib/support/CodeUtils.h>
 #include <lib/support/TimeUtils.h>
 #include <system/SystemError.h>
diff --git a/src/system/SystemError.cpp b/src/system/SystemError.cpp
index 6b79bc1..356c697 100644
--- a/src/system/SystemError.cpp
+++ b/src/system/SystemError.cpp
@@ -27,9 +27,6 @@
 // Include module header
 #include <system/SystemError.h>
 
-// Include common private header
-#include "SystemLayerPrivate.h"
-
 #include <lib/support/DLLUtil.h>
 #include <lib/support/ErrorStr.h>
 
diff --git a/src/system/SystemEvent.h b/src/system/SystemEvent.h
index 9586521..fbc66e1 100644
--- a/src/system/SystemEvent.h
+++ b/src/system/SystemEvent.h
@@ -54,9 +54,5 @@
  */
 typedef CHIP_SYSTEM_CONFIG_EVENT_OBJECT_TYPE Event;
 
-#if CHIP_SYSTEM_CONFIG_USE_LWIP
-
-#endif // CHIP_SYSTEM_CONFIG_USE_LWIP
-
 } // namespace System
 } // namespace chip
diff --git a/src/system/SystemFaultInjection.cpp b/src/system/SystemFaultInjection.cpp
index b79653f..8383dfd 100644
--- a/src/system/SystemFaultInjection.cpp
+++ b/src/system/SystemFaultInjection.cpp
@@ -26,8 +26,6 @@
 /* module header, also carries config, comes first */
 #include <system/SystemFaultInjection.h>
 
-#include "SystemLayerPrivate.h"
-
 #include <nlassert.h>
 #include <string.h>
 
diff --git a/src/system/SystemLayerPrivate.h b/src/system/SystemLayerPrivate.h
deleted file mode 100644
index 1358036..0000000
--- a/src/system/SystemLayerPrivate.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 Project CHIP Authors
- *    Copyright (c) 2017 Nest Labs, Inc.
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-
-/**
- *    @file
- *      This header file includes common private definitions for the CHIP system layer.
- */
-#pragma once
-
-#include <system/SystemConfig.h>
-
-//
-// Common definitions for the LwIP configuration
-//
-#if CHIP_SYSTEM_CONFIG_USE_LWIP
-
-#include <lwip/init.h>
-#include <lwip/stats.h>
-
-// To use LwIP 1.x, some additional definitions are required here.
-#if LWIP_VERSION_MAJOR < 2
-
-// Compatibility adaptations for statistical data in LwIP 1.x
-#ifndef MEMP_STATS_GET
-#define MEMP_STATS_GET(FIELD, INDEX) (lwip_stats.memp[INDEX].FIELD)
-#endif // !defined(MEMP_STATS_GET)
-#endif // LWIP_VERSION_MAJOR
-
-#endif // CHIP_SYSTEM_CONFIG_USE_LWIP
diff --git a/src/system/SystemMutex.cpp b/src/system/SystemMutex.cpp
index abd0671..878a1dd 100644
--- a/src/system/SystemMutex.cpp
+++ b/src/system/SystemMutex.cpp
@@ -25,9 +25,6 @@
 // Include module header
 #include <system/SystemMutex.h>
 
-// Include common private header
-#include "SystemLayerPrivate.h"
-
 #if !CHIP_SYSTEM_CONFIG_NO_LOCKING
 
 // Include system headers
diff --git a/src/system/SystemObject.cpp b/src/system/SystemObject.cpp
index 342cbe6..fc1ebf9 100644
--- a/src/system/SystemObject.cpp
+++ b/src/system/SystemObject.cpp
@@ -25,9 +25,6 @@
 // Include module header
 #include <system/SystemObject.h>
 
-// Include common private header
-#include "SystemLayerPrivate.h"
-
 // Include local headers
 #include <lib/support/CodeUtils.h>
 #include <system/SystemLayer.h>
diff --git a/src/system/SystemObject.h b/src/system/SystemObject.h
index 4a38fa0..6dfcb55 100644
--- a/src/system/SystemObject.h
+++ b/src/system/SystemObject.h
@@ -102,8 +102,6 @@
     void Release();
     Layer & SystemLayer() const;
 
-protected:
-#if CHIP_SYSTEM_CONFIG_USE_LWIP
     /**< What to do when DeferredRelease fails to post a kEvent_ReleaseObj. */
     enum ReleaseDeferralErrorTactic
     {
@@ -112,6 +110,8 @@
         kReleaseDeferralErrorTactic_Die,     /**< Die with message. */
     };
 
+protected:
+#if CHIP_SYSTEM_CONFIG_USE_LWIP
     void DeferredRelease(LayerLwIP * aSystemLayer, ReleaseDeferralErrorTactic aTactic);
 #endif // CHIP_SYSTEM_CONFIG_USE_LWIP
 
diff --git a/src/system/SystemPacketBuffer.cpp b/src/system/SystemPacketBuffer.cpp
index 6d5c57b..a036190 100644
--- a/src/system/SystemPacketBuffer.cpp
+++ b/src/system/SystemPacketBuffer.cpp
@@ -31,9 +31,6 @@
 // Include module header
 #include <system/SystemPacketBuffer.h>
 
-// Include common private header
-#include "SystemLayerPrivate.h"
-
 // Include local headers
 #include <lib/support/CodeUtils.h>
 #include <lib/support/SafeInt.h>
diff --git a/src/system/SystemStats.cpp b/src/system/SystemStats.cpp
index de4c17a..2016971 100644
--- a/src/system/SystemStats.cpp
+++ b/src/system/SystemStats.cpp
@@ -22,9 +22,6 @@
  *  on the state of CHIP, Inet and System resources
  */
 
-// Include common private header
-#include "SystemLayerPrivate.h"
-
 // Include local headers
 #include <system/SystemTimer.h>
 
@@ -113,6 +110,14 @@
 }
 
 #if CHIP_SYSTEM_CONFIG_USE_LWIP && LWIP_STATS && MEMP_STATS
+
+// To use LwIP 1.x, some additional definitions are required here.
+#if LWIP_VERSION_MAJOR < 2
+#ifndef MEMP_STATS_GET
+#define MEMP_STATS_GET(FIELD, INDEX) (lwip_stats.memp[INDEX].FIELD)
+#endif // !defined(MEMP_STATS_GET)
+#endif // LWIP_VERSION_MAJOR
+
 void UpdateLwipPbufCounts(void)
 {
 #if LWIP_PBUF_FROM_CUSTOM_POOLS
diff --git a/src/system/SystemStats.h b/src/system/SystemStats.h
index cb5be8c..f80cf93 100644
--- a/src/system/SystemStats.h
+++ b/src/system/SystemStats.h
@@ -37,9 +37,11 @@
 #include <lib/support/DLLUtil.h>
 
 #if CHIP_SYSTEM_CONFIG_USE_LWIP
+#include <lwip/init.h>
 #include <lwip/mem.h>
 #include <lwip/opt.h>
 #include <lwip/pbuf.h>
+#include <lwip/stats.h>
 #endif // CHIP_SYSTEM_CONFIG_USE_LWIP
 
 #include <stdint.h>
diff --git a/src/system/SystemTimer.cpp b/src/system/SystemTimer.cpp
index 3e136eb..d776a8b 100644
--- a/src/system/SystemTimer.cpp
+++ b/src/system/SystemTimer.cpp
@@ -26,9 +26,6 @@
 // Include module header
 #include <system/SystemTimer.h>
 
-// Include common private header
-#include "SystemLayerPrivate.h"
-
 // Include local headers
 #include <string.h>