Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove RawEndPoint. #9614

Merged
merged 1 commit into from
Sep 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion config/mbed/chip-gn/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ chip_project_config_include = ""
chip_system_project_config_include = ""
chip_device_project_config_include = ""

chip_inet_config_enable_raw_endpoint = false
chip_inet_config_enable_udp_endpoint = true
chip_inet_config_enable_tcp_endpoint = true
chip_inet_config_enable_dns_resolver = true
Expand Down
1 change: 0 additions & 1 deletion config/nrfconnect/chip-module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ chip_gn_arg_bool ("chip_inet_config_enable_ipv4" CONFIG_NET_IPV4)
chip_gn_arg_bool ("chip_enable_nfc" CONFIG_CHIP_NFC_COMMISSIONING)
chip_gn_arg_bool ("chip_build_tests" CONFIG_CHIP_BUILD_TESTS)
chip_gn_arg_bool ("chip_monolithic_tests" CONFIG_CHIP_BUILD_TESTS)
chip_gn_arg_bool ("chip_inet_config_enable_raw_endpoint" CONFIG_CHIP_BUILD_TESTS)
chip_gn_arg_bool ("chip_inet_config_enable_tcp_endpoint" CONFIG_CHIP_BUILD_TESTS)
chip_gn_arg_bool ("chip_inet_config_enable_dns_resolver" CONFIG_CHIP_BUILD_TESTS)
chip_gn_arg_bool ("chip_build_libshell" CONFIG_CHIP_LIB_SHELL)
Expand Down
1 change: 0 additions & 1 deletion config/standalone/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@
# Options from standalone-chip.mk that differ from configure defaults. These
# options are used from examples/.
chip_build_tests = false
chip_inet_config_enable_raw_endpoint = false
chip_inet_config_enable_dns_resolver = false
1 change: 0 additions & 1 deletion config/telink/chip-module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ chip_gn_arg_bool ("is_debug" CONFIG_DEBUG)
chip_gn_arg_bool ("chip_enable_openthread" CONFIG_NET_L2_OPENTHREAD)
chip_gn_arg_bool ("chip_inet_config_enable_ipv4" CONFIG_NET_IPV4)
chip_gn_arg_bool ("chip_build_tests" CONFIG_CHIP_BUILD_TESTS)
chip_gn_arg_bool ("chip_inet_config_enable_raw_endpoint" CONFIG_CHIP_BUILD_TESTS)
chip_gn_arg_bool ("chip_inet_config_enable_tcp_endpoint" CONFIG_CHIP_BUILD_TESTS)
chip_gn_arg_bool ("chip_inet_config_enable_dns_resolver" CONFIG_CHIP_BUILD_TESTS)
chip_gn_arg_bool ("chip_build_libshell" CONFIG_CHIP_LIB_SHELL)
Expand Down
1 change: 0 additions & 1 deletion examples/platform/k32w/app/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@ chip_inet_project_config_include = "<CHIPProjectConfig.h>"
chip_system_project_config_include = "<CHIPProjectConfig.h>"

chip_system_config_provide_statistics = false
chip_inet_config_enable_raw_endpoint = false
chip_with_nlfaultinjection = true
1 change: 0 additions & 1 deletion examples/platform/k32w/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,4 @@ chip_inet_project_config_include = "<CHIPProjectConfig.h>"
chip_system_project_config_include = "<CHIPProjectConfig.h>"

chip_system_config_provide_statistics = false
chip_inet_config_enable_raw_endpoint = false
chip_with_nlfaultinjection = true
8 changes: 0 additions & 8 deletions src/inet/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ buildconfig_header("inet_buildconfig") {
"INET_CONFIG_ENABLE_IPV4=${chip_inet_config_enable_ipv4}",
"INET_CONFIG_ENABLE_DNS_RESOLVER=${chip_inet_config_enable_dns_resolver}",
"INET_CONFIG_ENABLE_ASYNC_DNS_SOCKETS=${chip_inet_config_enable_async_dns_sockets}",
"INET_CONFIG_ENABLE_RAW_ENDPOINT=${chip_inet_config_enable_raw_endpoint}",
"INET_CONFIG_ENABLE_TCP_ENDPOINT=${chip_inet_config_enable_tcp_endpoint}",
"INET_CONFIG_ENABLE_UDP_ENDPOINT=${chip_inet_config_enable_udp_endpoint}",
"HAVE_LWIP_RAW_BIND_NETIF=true",
Expand Down Expand Up @@ -107,13 +106,6 @@ static_library("inet") {
public_deps += [ "${chip_root}/src/lwip" ]
}

if (chip_inet_config_enable_raw_endpoint) {
sources += [
"RawEndPoint.cpp",
"RawEndPoint.h",
]
}

if (chip_inet_config_enable_tcp_endpoint) {
sources += [
"TCPEndPoint.cpp",
Expand Down
6 changes: 0 additions & 6 deletions src/inet/EndPointBasis.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@

//--- Declaration of LWIP protocol control buffer structure names
#if CHIP_SYSTEM_CONFIG_USE_LWIP
#if INET_CONFIG_ENABLE_RAW_ENDPOINT
struct raw_pcb;
#endif // INET_CONFIG_ENABLE_RAW_ENDPOINT
#if INET_CONFIG_ENABLE_UDP_ENDPOINT
struct udp_pcb;
#endif // INET_CONFIG_ENABLE_UDP_ENDPOINT
Expand Down Expand Up @@ -107,9 +104,6 @@ class DLL_EXPORT EndPointBasis : public InetLayerBasis
union
{
const void * mVoid; /**< An untyped protocol control buffer reference */
#if INET_CONFIG_ENABLE_RAW_ENDPOINT
raw_pcb * mRaw; /**< Raw network interface protocol control */
#endif // INET_CONFIG_ENABLE_RAW_ENDPOINT
#if INET_CONFIG_ENABLE_UDP_ENDPOINT
udp_pcb * mUDP; /**< User datagram protocol (UDP) control */
#endif // INET_CONFIG_ENABLE_UDP_ENDPOINT
Expand Down
12 changes: 0 additions & 12 deletions src/inet/IPEndPointBasis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,12 +344,6 @@ CHIP_ERROR IPEndPointBasis::SetMulticastLoopback(IPVersion aIPVersion, bool aLoo
switch (mLwIPEndPointType)
{

#if INET_CONFIG_ENABLE_RAW_ENDPOINT
case kLwIPEndPointType_Raw:
raw_set_flags(mRaw, RAW_FLAGS_MULTICAST_LOOP);
break;
#endif // INET_CONFIG_ENABLE_RAW_ENDPOINT

#if INET_CONFIG_ENABLE_UDP_ENDPOINT
case kLwIPEndPointType_UDP:
udp_set_flags(mUDP, UDP_FLAGS_MULTICAST_LOOP);
Expand All @@ -366,12 +360,6 @@ CHIP_ERROR IPEndPointBasis::SetMulticastLoopback(IPVersion aIPVersion, bool aLoo
switch (mLwIPEndPointType)
{

#if INET_CONFIG_ENABLE_RAW_ENDPOINT
case kLwIPEndPointType_Raw:
raw_clear_flags(mRaw, RAW_FLAGS_MULTICAST_LOOP);
break;
#endif // INET_CONFIG_ENABLE_RAW_ENDPOINT

#if INET_CONFIG_ENABLE_UDP_ENDPOINT
case kLwIPEndPointType_UDP:
udp_clear_flags(mUDP, UDP_FLAGS_MULTICAST_LOOP);
Expand Down
4 changes: 0 additions & 4 deletions src/inet/Inet.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@
#include <inet/DNSResolver.h>
#endif // INET_CONFIG_ENABLE_DNS_RESOLVER

#if INET_CONFIG_ENABLE_RAW_ENDPOINT
#include <inet/RawEndPoint.h>
#endif // INET_CONFIG_ENABLE_RAW_ENDPOINT

#if INET_CONFIG_ENABLE_TCP_ENDPOINT
#include <inet/TCPEndPoint.h>
#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT
Expand Down
27 changes: 0 additions & 27 deletions src/inet/InetConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,21 +153,6 @@
#define INET_CONFIG_MAX_DROPPABLE_EVENTS 0
#endif // INET_CONFIG_MAX_DROPPABLE_EVENTS

/**
* @def INET_CONFIG_NUM_RAW_ENDPOINTS
*
* @brief
* This is the total number of "raw" (direct-IP, non-TCP/-UDP) end
* point context structures.
*
* Up to this many outstanding "raw" communication flows may be in
* use.
*
*/
#ifndef INET_CONFIG_NUM_RAW_ENDPOINTS
#define INET_CONFIG_NUM_RAW_ENDPOINTS 8
#endif // INET_CONFIG_NUM_RAW_ENDPOINTS

/**
* @def INET_CONFIG_NUM_TCP_ENDPOINTS
*
Expand Down Expand Up @@ -246,18 +231,6 @@
#define INET_CONFIG_ENABLE_DNS_RESOLVER 0
#endif // INET_CONFIG_ENABLE_DNS_RESOLVER

/**
* @def INET_CONFIG_ENABLE_RAW_ENDPOINT
*
* @brief
* Defines whether (1) or not (0) to enable the ability
* to instantiate a Raw endpoint.
*
*/
#ifndef INET_CONFIG_ENABLE_RAW_ENDPOINT
#define INET_CONFIG_ENABLE_RAW_ENDPOINT 0
#endif // INET_CONFIG_ENABLE_RAW_ENDPOINT

/**
* @def INET_CONFIG_ENABLE_TCP_ENDPOINT
*
Expand Down
66 changes: 0 additions & 66 deletions src/inet/InetLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,6 @@ void InetLayer::UpdateSnapshot(chip::System::Stats::Snapshot & aSnapshot)
UDPEndPoint::sPool.GetStatistics(aSnapshot.mResourcesInUse[chip::System::Stats::kInetLayer_NumUDPEps],
aSnapshot.mHighWatermarks[chip::System::Stats::kInetLayer_NumUDPEps]);
#endif // INET_CONFIG_ENABLE_UDP_ENDPOINT
#if INET_CONFIG_ENABLE_RAW_ENDPOINT
RawEndPoint::sPool.GetStatistics(aSnapshot.mResourcesInUse[chip::System::Stats::kInetLayer_NumRawEps],
aSnapshot.mHighWatermarks[chip::System::Stats::kInetLayer_NumRawEps]);
#endif // INET_CONFIG_ENABLE_RAW_ENDPOINT
}

/**
Expand Down Expand Up @@ -332,17 +328,6 @@ CHIP_ERROR InetLayer::Shutdown()
#endif // CHIP_SYSTEM_CONFIG_USE_SOCKETS && INET_CONFIG_ENABLE_ASYNC_DNS_SOCKETS
#endif // INET_CONFIG_ENABLE_DNS_RESOLVER

#if INET_CONFIG_ENABLE_RAW_ENDPOINT
// Close all raw endpoints owned by this Inet layer instance.
RawEndPoint::sPool.ForEachActiveObject([&](RawEndPoint * lEndPoint) {
if ((lEndPoint != nullptr) && lEndPoint->IsCreatedByInetLayer(*this))
{
lEndPoint->Close();
}
return true;
});
#endif // INET_CONFIG_ENABLE_RAW_ENDPOINT

#if INET_CONFIG_ENABLE_TCP_ENDPOINT
// Abort all TCP endpoints owned by this instance.
TCPEndPoint::sPool.ForEachActiveObject([&](TCPEndPoint * lEndPoint) {
Expand Down Expand Up @@ -502,50 +487,6 @@ CHIP_ERROR InetLayer::GetLinkLocalAddr(InterfaceId link, IPAddress * llAddr)
return CHIP_NO_ERROR;
}

#if INET_CONFIG_ENABLE_RAW_ENDPOINT
/**
* Creates a new RawEndPoint object for a specific IP version and protocol.
*
* @note
* This function gets a free RawEndPoint object from a pre-allocated pool
* and also calls the explicit initializer on the new object.
*
* @param[in] ipVer IPv4 or IPv6.
*
* @param[in] ipProto A protocol within the IP family (e.g., ICMPv4 or ICMPv6).
*
* @param[in,out] retEndPoint A pointer to a pointer of the RawEndPoint object that is
* a return parameter upon completion of the object creation.
* *retEndPoint is NULL if creation fails.
*
* @retval #CHIP_ERROR_INCORRECT_STATE If the InetLayer object is not initialized.
* @retval #CHIP_ERROR_ENDPOINT_POOL_FULL If the InetLayer RawEndPoint pool is full and no new
* endpoints can be created.
* @retval #CHIP_NO_ERROR On success.
*
*/
CHIP_ERROR InetLayer::NewRawEndPoint(IPVersion ipVer, IPProtocol ipProto, RawEndPoint ** retEndPoint)
{
assertChipStackLockedByCurrentThread();

*retEndPoint = nullptr;

VerifyOrReturnError(State == kState_Initialized, CHIP_ERROR_INCORRECT_STATE);

*retEndPoint = RawEndPoint::sPool.TryCreate();
if (*retEndPoint == nullptr)
{
ChipLogError(Inet, "%s endpoint pool FULL", "Raw");
return CHIP_ERROR_ENDPOINT_POOL_FULL;
}

(*retEndPoint)->Inet::RawEndPoint::Init(this, ipVer, ipProto);
SYSTEM_STATS_INCREMENT(chip::System::Stats::kInetLayer_NumRawEps);

return CHIP_NO_ERROR;
}
#endif // INET_CONFIG_ENABLE_RAW_ENDPOINT

#if INET_CONFIG_ENABLE_TCP_ENDPOINT
/**
* Creates a new TCPEndPoint object.
Expand Down Expand Up @@ -1035,13 +976,6 @@ CHIP_ERROR InetLayer::HandleInetLayerEvent(chip::System::Object & aTarget, chip:
break;
#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT

#if INET_CONFIG_ENABLE_RAW_ENDPOINT
case kInetEvent_RawDataReceived:
static_cast<RawEndPoint &>(aTarget).HandleDataReceived(
System::PacketBufferHandle::Adopt(reinterpret_cast<chip::System::PacketBuffer *>(aArgument)));
break;
#endif // INET_CONFIG_ENABLE_RAW_ENDPOINT

#if INET_CONFIG_ENABLE_UDP_ENDPOINT
case kInetEvent_UDPDataReceived:
static_cast<UDPEndPoint &>(aTarget).HandleDataReceived(
Expand Down
15 changes: 0 additions & 15 deletions src/inet/InetLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@
#include <inet/DNSResolver.h>
#endif // INET_CONFIG_ENABLE_DNS_RESOLVER

#if INET_CONFIG_ENABLE_RAW_ENDPOINT
#include <inet/RawEndPoint.h>
#endif // INET_CONFIG_ENABLE_RAW_ENDPOINT

#if INET_CONFIG_ENABLE_TCP_ENDPOINT
#include <inet/TCPEndPoint.h>
#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT
Expand Down Expand Up @@ -149,10 +145,6 @@ class DLL_EXPORT InetLayer
friend class DNSResolver;
#endif // INET_CONFIG_ENABLE_DNS_RESOLVER

#if INET_CONFIG_ENABLE_RAW_ENDPOINT
friend class RawEndPoint;
#endif // INET_CONFIG_ENABLE_RAW_ENDPOINT

#if INET_CONFIG_ENABLE_TCP_ENDPOINT
friend class TCPEndPoint;
#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT
Expand Down Expand Up @@ -189,10 +181,6 @@ class DLL_EXPORT InetLayer

// End Points

#if INET_CONFIG_ENABLE_RAW_ENDPOINT
CHIP_ERROR NewRawEndPoint(IPVersion ipVer, IPProtocol ipProto, RawEndPoint ** retEndPoint);
#endif // INET_CONFIG_ENABLE_RAW_ENDPOINT

#if INET_CONFIG_ENABLE_TCP_ENDPOINT
CHIP_ERROR NewTCPEndPoint(TCPEndPoint ** retEndPoint);
#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT
Expand Down Expand Up @@ -253,9 +241,6 @@ class DLL_EXPORT InetLayer
#if INET_CONFIG_ENABLE_UDP_ENDPOINT
type == kInetEvent_UDPDataReceived ||
#endif // INET_CONFIG_ENABLE_UDP_ENDPOINT
#if INET_CONFIG_ENABLE_RAW_ENDPOINT
type == kInetEvent_RawDataReceived ||
#endif // INET_CONFIG_ENABLE_RAW_ENDPOINT
false;
}

Expand Down
Loading