@@ -88,11 +88,14 @@ static const uint32_t kExpectedTxSizeDefault = kExpectedRxSizeDefault;
88
88
89
89
static const uint32_t kOptFlagsDefault = (kOptFlagUseIPv6 | kOptFlagUseUDPIP );
90
90
91
+ #if INET_CONFIG_ENABLE_TCP_ENDPOINT
91
92
static TCPEndPoint * sTCPIPEndPoint = nullptr ; // Used for connect/send/receive
92
93
static TCPEndPoint * sTCPIPListenEndPoint = nullptr ; // Used for accept/listen
93
- static UDPEndPoint * sUDPIPEndPoint = nullptr ;
94
+ static const uint16_t kTCPPort = kUDPPort ;
95
+ #endif // INET_CONFIG_ENABLE_TCP_ENDPOINT
96
+
97
+ static UDPEndPoint * sUDPIPEndPoint = nullptr ;
94
98
95
- static const uint16_t kTCPPort = kUDPPort ;
96
99
// clang-format off
97
100
static TestState sTestState =
98
101
{
@@ -184,6 +187,7 @@ static OptionSet * sToolOptionSets[] =
184
187
namespace chip {
185
188
namespace Inet {
186
189
190
+ #if INET_CONFIG_ENABLE_TCP_ENDPOINT
187
191
class TCPTest
188
192
{
189
193
public:
@@ -193,6 +197,7 @@ class TCPTest
193
197
return endPoint->mState == TCPEndPoint::State::kConnected || endPoint->mState == TCPEndPoint::State::kReceiveShutdown ;
194
198
}
195
199
};
200
+ #endif // INET_CONFIG_ENABLE_TCP_ENDPOINT
196
201
197
202
} // namespace Inet
198
203
} // namespace chip
@@ -502,6 +507,7 @@ static bool HandleDataReceived(const PacketBufferHandle & aBuffer, bool aCheckBu
502
507
503
508
// TCP Endpoint Callbacks
504
509
510
+ #if INET_CONFIG_ENABLE_TCP_ENDPOINT
505
511
void HandleTCPConnectionComplete (TCPEndPoint * aEndPoint, CHIP_ERROR aError)
506
512
{
507
513
CHIP_ERROR lStatus;
@@ -636,6 +642,7 @@ static void HandleTCPConnectionReceived(TCPEndPoint * aListenEndPoint, TCPEndPoi
636
642
637
643
sTCPIPEndPoint = aConnectEndPoint;
638
644
}
645
+ #endif // INET_CONFIG_ENABLE_TCP_ENDPOINT
639
646
640
647
// UDP Endpoint Callbacks
641
648
@@ -673,11 +680,13 @@ static bool IsTransportReadyForSend()
673
680
return (sUDPIPEndPoint != nullptr );
674
681
}
675
682
683
+ #if INET_CONFIG_ENABLE_TCP_ENDPOINT
676
684
if ((gOptFlags & kOptFlagUseTCPIP ) == kOptFlagUseTCPIP )
677
685
{
678
686
return (sTCPIPEndPoint != nullptr ) && (sTCPIPEndPoint ->PendingSendLength () == 0 ) &&
679
687
TCPTest::StateIsConnectedOrReceiveShutdown (sTCPIPEndPoint );
680
688
}
689
+ #endif // INET_CONFIG_ENABLE_TCP_ENDPOINT
681
690
682
691
return false ;
683
692
}
@@ -686,6 +695,7 @@ static CHIP_ERROR PrepareTransportForSend()
686
695
{
687
696
CHIP_ERROR lStatus = CHIP_NO_ERROR;
688
697
698
+ #if INET_CONFIG_ENABLE_TCP_ENDPOINT
689
699
if (gOptFlags & kOptFlagUseTCPIP )
690
700
{
691
701
if (sTCPIPEndPoint == nullptr )
@@ -702,6 +712,7 @@ static CHIP_ERROR PrepareTransportForSend()
702
712
INET_FAIL_ERROR (lStatus, " TCPEndPoint::Connect failed" );
703
713
}
704
714
}
715
+ #endif // INET_CONFIG_ENABLE_TCP_ENDPOINT
705
716
706
717
return (lStatus);
707
718
}
@@ -722,6 +733,7 @@ static CHIP_ERROR DriveSendForDestination(const IPAddress & aAddress, uint16_t a
722
733
723
734
ReturnErrorOnFailure (sUDPIPEndPoint ->SendTo (aAddress, kUDPPort , std::move (lBuffer)));
724
735
}
736
+ #if INET_CONFIG_ENABLE_TCP_ENDPOINT
725
737
else if ((gOptFlags & kOptFlagUseTCPIP ) == kOptFlagUseTCPIP )
726
738
{
727
739
const uint32_t lFirstValue = sTestState .mStats .mTransmit .mActual ;
@@ -737,6 +749,7 @@ static CHIP_ERROR DriveSendForDestination(const IPAddress & aAddress, uint16_t a
737
749
738
750
ReturnErrorOnFailure (sTCPIPEndPoint ->Send (std::move (lBuffer)));
739
751
}
752
+ #endif // INET_CONFIG_ENABLE_TCP_ENDPOINT
740
753
741
754
return CHIP_NO_ERROR;
742
755
}
@@ -838,6 +851,7 @@ static void StartTest()
838
851
lStatus = sUDPIPEndPoint ->Listen (HandleUDPMessageReceived, HandleUDPReceiveError);
839
852
INET_FAIL_ERROR (lStatus, " UDPEndPoint::Listen failed" );
840
853
}
854
+ #if INET_CONFIG_ENABLE_TCP_ENDPOINT
841
855
else if (gOptFlags & kOptFlagUseTCPIP )
842
856
{
843
857
const uint16_t lConnectionBacklogMax = 1 ;
@@ -855,6 +869,7 @@ static void StartTest()
855
869
lStatus = sTCPIPListenEndPoint ->Listen (lConnectionBacklogMax);
856
870
INET_FAIL_ERROR (lStatus, " TCPEndPoint::Listen failed" );
857
871
}
872
+ #endif // INET_CONFIG_ENABLE_TCP_ENDPOINT
858
873
}
859
874
860
875
if (Common::IsReceiver ())
@@ -870,6 +885,7 @@ static void CleanupTest()
870
885
871
886
// Release the resources associated with the allocated end points.
872
887
888
+ #if INET_CONFIG_ENABLE_TCP_ENDPOINT
873
889
if (sTCPIPEndPoint != nullptr )
874
890
{
875
891
sTCPIPEndPoint ->Close ();
@@ -881,6 +897,7 @@ static void CleanupTest()
881
897
sTCPIPListenEndPoint ->Shutdown ();
882
898
sTCPIPListenEndPoint ->Free ();
883
899
}
900
+ #endif // INET_CONFIG_ENABLE_TCP_ENDPOINT
884
901
885
902
if (sUDPIPEndPoint != nullptr )
886
903
{
0 commit comments