From cba50470be51223b199c22c593a7995f26feff70 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Wed, 18 Dec 2024 11:20:10 +0100 Subject: [PATCH] feat(asio): Drop esp/asio patches in favor of sock-utils --- .gitmodules | 2 +- components/asio/CMakeLists.txt | 6 +++--- components/asio/asio | 2 +- .../ssl_client_server/main/idf_component.yml | 1 + .../asio/port/include/asio/detail/config.hpp | 11 +++++++++++ .../ssl/detail/openssl_types.hpp} | 0 components/asio/port/include/esp_asio_config.h | 12 ------------ .../asio/port/mbedtls/src/mbedtls_context.cpp | 2 +- .../asio/port/mbedtls/src/mbedtls_engine.cpp | 2 +- components/asio/port/src/asio_stub.cpp | 14 ++++++++++++++ 10 files changed, 33 insertions(+), 19 deletions(-) create mode 100644 components/asio/port/include/asio/detail/config.hpp rename components/asio/port/include/{openssl_stub.hpp => asio/ssl/detail/openssl_types.hpp} (100%) delete mode 100644 components/asio/port/include/esp_asio_config.h create mode 100644 components/asio/port/src/asio_stub.cpp diff --git a/.gitmodules b/.gitmodules index 60b3730713..391f572334 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "components/asio/asio"] path = components/asio/asio - url = https://github.com/espressif/asio + url = https://github.com/chriskohlhoff/asio [submodule "components/mosquitto/mosquitto"] path = components/mosquitto/mosquitto url = https://github.com/eclipse/mosquitto diff --git a/components/asio/CMakeLists.txt b/components/asio/CMakeLists.txt index 3ec69bac48..bc62652c8a 100644 --- a/components/asio/CMakeLists.txt +++ b/components/asio/CMakeLists.txt @@ -6,8 +6,8 @@ if(NOT CONFIG_LWIP_IPV6 AND NOT CMAKE_BUILD_EARLY_EXPANSION) return() endif() -set(asio_sources "asio/asio/src/asio.cpp") -set(asio_requires lwip) +set(asio_sources "asio/asio/src/asio.cpp" "port/src/asio_stub.cpp") +set(asio_requires lwip sock_utils) if(CONFIG_ASIO_SSL_SUPPORT) list(APPEND asio_sources @@ -18,7 +18,7 @@ if(CONFIG_ASIO_SSL_SUPPORT) endif() idf_component_register(SRCS ${asio_sources} - INCLUDE_DIRS "asio/asio/include" "port/include" + INCLUDE_DIRS "port/include" "asio/asio/include" PRIV_INCLUDE_DIRS ${asio_priv_includes} PRIV_REQUIRES ${asio_requires}) diff --git a/components/asio/asio b/components/asio/asio index a2e0f70d61..7609450f71 160000 --- a/components/asio/asio +++ b/components/asio/asio @@ -1 +1 @@ -Subproject commit a2e0f70d612309f4623bd43d8a26629bd716bb2c +Subproject commit 7609450f71434bdc9fbd9491a9505b423c2a8496 diff --git a/components/asio/examples/ssl_client_server/main/idf_component.yml b/components/asio/examples/ssl_client_server/main/idf_component.yml index 87c1515f98..0872893d32 100644 --- a/components/asio/examples/ssl_client_server/main/idf_component.yml +++ b/components/asio/examples/ssl_client_server/main/idf_component.yml @@ -6,3 +6,4 @@ dependencies: override_path: "../../../" protocol_examples_common: path: ${IDF_PATH}/examples/common_components/protocol_examples_common + espressif/sock_utils: "*" diff --git a/components/asio/port/include/asio/detail/config.hpp b/components/asio/port/include/asio/detail/config.hpp new file mode 100644 index 0000000000..9c58409c6b --- /dev/null +++ b/components/asio/port/include/asio/detail/config.hpp @@ -0,0 +1,11 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#include "sys/socket.h" +#include "socketpair.h" + +#include_next "asio/detail/config.hpp" diff --git a/components/asio/port/include/openssl_stub.hpp b/components/asio/port/include/asio/ssl/detail/openssl_types.hpp similarity index 100% rename from components/asio/port/include/openssl_stub.hpp rename to components/asio/port/include/asio/ssl/detail/openssl_types.hpp diff --git a/components/asio/port/include/esp_asio_config.h b/components/asio/port/include/esp_asio_config.h deleted file mode 100644 index 2ad9c79c76..0000000000 --- a/components/asio/port/include/esp_asio_config.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2018-2023 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef _ESP_ASIO_CONFIG_H_ -#define _ESP_ASIO_CONFIG_H_ - -#define ASIO_SSL_DETAIL_OPENSSL_TYPES_HPP -#include "openssl_stub.hpp" - -#endif // _ESP_ASIO_CONFIG_H_ diff --git a/components/asio/port/mbedtls/src/mbedtls_context.cpp b/components/asio/port/mbedtls/src/mbedtls_context.cpp index bf9220ad59..4b3e2f4189 100644 --- a/components/asio/port/mbedtls/src/mbedtls_context.cpp +++ b/components/asio/port/mbedtls/src/mbedtls_context.cpp @@ -8,7 +8,7 @@ // #include "asio/detail/config.hpp" -#include "openssl_stub.hpp" +#include "asio/ssl/detail/openssl_types.hpp" #include #include "asio/detail/throw_error.hpp" #include "asio/error.hpp" diff --git a/components/asio/port/mbedtls/src/mbedtls_engine.cpp b/components/asio/port/mbedtls/src/mbedtls_engine.cpp index 1d97b3a738..1c03a32841 100644 --- a/components/asio/port/mbedtls/src/mbedtls_engine.cpp +++ b/components/asio/port/mbedtls/src/mbedtls_engine.cpp @@ -7,7 +7,7 @@ // #include "asio/detail/config.hpp" -#include "openssl_stub.hpp" +#include "asio/ssl/detail/openssl_types.hpp" #include "asio/detail/throw_error.hpp" #include "asio/error.hpp" #include "asio/ssl/detail/engine.hpp" diff --git a/components/asio/port/src/asio_stub.cpp b/components/asio/port/src/asio_stub.cpp new file mode 100644 index 0000000000..a65cfac12d --- /dev/null +++ b/components/asio/port/src/asio_stub.cpp @@ -0,0 +1,14 @@ +// +// SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD +// +// SPDX-License-Identifier: Apache-2.0 +// +#include +#include + +extern "C" int pause (void) +{ + while (true) { + ::sleep(UINT_MAX); + } +}