Matter SDK Coverage Report
Current view: top level - inet - TCPEndPointImplSockets.h (source / functions) Coverage Total Hit
Test: SHA:4d2388ac7eed75b2fe5e05e20de377999c632502 Lines: 100.0 % 3 3
Test Date: 2025-07-26 07:12:52 Functions: 100.0 % 1 1

            Line data    Source code
       1              : /*
       2              :  *
       3              :  *    Copyright (c) 2020-2021 Project CHIP Authors
       4              :  *    Copyright (c) 2013-2017 Nest Labs, Inc.
       5              :  *
       6              :  *    Licensed under the Apache License, Version 2.0 (the "License");
       7              :  *    you may not use this file except in compliance with the License.
       8              :  *    You may obtain a copy of the License at
       9              :  *
      10              :  *        http://www.apache.org/licenses/LICENSE-2.0
      11              :  *
      12              :  *    Unless required by applicable law or agreed to in writing, software
      13              :  *    distributed under the License is distributed on an "AS IS" BASIS,
      14              :  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      15              :  *    See the License for the specific language governing permissions and
      16              :  *    limitations under the License.
      17              :  */
      18              : 
      19              : /**
      20              :  * This file declares an implementation of Inet::TCPEndPoint using sockets.
      21              :  */
      22              : 
      23              : #pragma once
      24              : 
      25              : #include <inet/EndPointStateSockets.h>
      26              : #include <inet/TCPEndPoint.h>
      27              : 
      28              : namespace chip {
      29              : namespace Inet {
      30              : 
      31              : class TCPEndPointImplSockets : public TCPEndPoint, public EndPointStateSockets
      32              : {
      33              : public:
      34           39 :     TCPEndPointImplSockets(EndPointManager<TCPEndPoint> & endPointManager) :
      35              :         TCPEndPoint(endPointManager)
      36              : #if INET_CONFIG_OVERRIDE_SYSTEM_TCP_USER_TIMEOUT
      37              :         ,
      38           39 :         mBytesWrittenSinceLastProbe(0), mLastTCPKernelSendQueueLen(0)
      39              : #endif // INET_CONFIG_OVERRIDE_SYSTEM_TCP_USER_TIMEOUT
      40           39 :     {}
      41              : 
      42              :     // TCPEndPoint overrides.
      43              :     CHIP_ERROR GetPeerInfo(IPAddress * retAddr, uint16_t * retPort) const override;
      44              :     CHIP_ERROR GetLocalInfo(IPAddress * retAddr, uint16_t * retPort) const override;
      45              :     CHIP_ERROR GetInterfaceId(InterfaceId * retInterface) override;
      46              :     CHIP_ERROR EnableNoDelay() override;
      47              :     CHIP_ERROR EnableKeepAlive(uint16_t interval, uint16_t timeoutCount) override;
      48              :     CHIP_ERROR DisableKeepAlive() override;
      49              :     CHIP_ERROR AckReceive(size_t len) override;
      50              : #if INET_CONFIG_OVERRIDE_SYSTEM_TCP_USER_TIMEOUT
      51              :     void TCPUserTimeoutHandler() override;
      52              : #endif // INET_CONFIG_OVERRIDE_SYSTEM_TCP_USER_TIMEOUT
      53              : 
      54              : private:
      55              :     // TCPEndPoint overrides.
      56              :     CHIP_ERROR BindImpl(IPAddressType addrType, const IPAddress & addr, uint16_t port, bool reuseAddr) override;
      57              :     CHIP_ERROR ListenImpl(uint16_t backlog) override;
      58              :     CHIP_ERROR ConnectImpl(const IPAddress & addr, uint16_t port, InterfaceId intfId) override;
      59              :     CHIP_ERROR SendQueuedImpl(bool queueWasEmpty) override;
      60              :     CHIP_ERROR SetUserTimeoutImpl(uint32_t userTimeoutMillis) override;
      61              :     CHIP_ERROR DriveSendingImpl() override;
      62              :     void HandleConnectCompleteImpl() override;
      63              :     void DoCloseImpl(CHIP_ERROR err, State oldState) override;
      64              : 
      65              :     CHIP_ERROR GetSocketInfo(int getname(int, sockaddr *, socklen_t *), IPAddress * retAddr, uint16_t * retPort) const;
      66              :     CHIP_ERROR GetSocket(IPAddressType addrType);
      67              :     void HandlePendingIO(System::SocketEvents events);
      68              :     void ReceiveData();
      69              :     void HandleIncomingConnection();
      70              :     CHIP_ERROR BindSrcAddrFromIntf(IPAddressType addrType, InterfaceId intfId);
      71              :     static void HandlePendingIO(System::SocketEvents events, intptr_t data);
      72              : 
      73              : #if INET_CONFIG_OVERRIDE_SYSTEM_TCP_USER_TIMEOUT
      74              :     /// This counts the number of bytes written on the TCP socket since thelast probe into the TCP outqueue was made.
      75              :     size_t mBytesWrittenSinceLastProbe;
      76              : 
      77              :     /// This is the measured size(in bytes) of the kernel TCP send queue at the end of the last user timeout window.
      78              :     uint32_t mLastTCPKernelSendQueueLen;
      79              : 
      80              :     CHIP_ERROR CheckConnectionProgress(bool & IsProgressing);
      81              : #endif // INET_CONFIG_OVERRIDE_SYSTEM_TCP_USER_TIMEOUT
      82              : };
      83              : 
      84              : using TCPEndPointImpl = TCPEndPointImplSockets;
      85              : 
      86              : } // namespace Inet
      87              : } // namespace chip
        

Generated by: LCOV version 2.0-1