diff --git a/examples/common_components/protocol_examples_common/CMakeLists.txt b/examples/common_components/protocol_examples_common/CMakeLists.txt index 7c4ebe34d..5c19957ba 100644 --- a/examples/common_components/protocol_examples_common/CMakeLists.txt +++ b/examples/common_components/protocol_examples_common/CMakeLists.txt @@ -1,4 +1,4 @@ -idf_component_register(SRCS "connect.c" "stdin_out.c" +idf_component_register(SRCS "connect.c" "stdin_out.c" "addr_from_stdin.c" INCLUDE_DIRS "include" PRIV_REQUIRES esp_netif ) diff --git a/examples/protocols/sockets/socket_addr_from_stdin/addr_from_stdin.c b/examples/common_components/protocol_examples_common/addr_from_stdin.c similarity index 100% rename from examples/protocols/sockets/socket_addr_from_stdin/addr_from_stdin.c rename to examples/common_components/protocol_examples_common/addr_from_stdin.c diff --git a/examples/protocols/sockets/socket_addr_from_stdin/include/addr_from_stdin.h b/examples/common_components/protocol_examples_common/include/addr_from_stdin.h similarity index 51% rename from examples/protocols/sockets/socket_addr_from_stdin/include/addr_from_stdin.h rename to examples/common_components/protocol_examples_common/include/addr_from_stdin.h index 3d2e6182e..ab5043aed 100644 --- a/examples/protocols/sockets/socket_addr_from_stdin/include/addr_from_stdin.h +++ b/examples/common_components/protocol_examples_common/include/addr_from_stdin.h @@ -1,3 +1,21 @@ +/* Common utilities for socket address input interface: + The API get_addr_from_stdin() is mainly used by socket client examples which read IP address from stdin (if configured). + This option is typically used in the CI, but could be enabled in the project configuration. + In that case this component is used to receive a string that is evaluated and processed to output + socket structures to open a connectio + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. + */ + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + #include "lwip/sys.h" #include #include @@ -19,4 +37,8 @@ esp_err_t get_addr_from_stdin(int port, int sock_type, int *ip_protocol, int *addr_family, - struct sockaddr_in6 *dest_addr); \ No newline at end of file + struct sockaddr_in6 *dest_addr); + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/examples/protocols/sockets/socket_addr_from_stdin/CMakeLists.txt b/examples/protocols/sockets/socket_addr_from_stdin/CMakeLists.txt deleted file mode 100644 index 22e024f00..000000000 --- a/examples/protocols/sockets/socket_addr_from_stdin/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -idf_component_register(SRCS "addr_from_stdin.c" - INCLUDE_DIRS "include" - PRIV_REQUIRES protocol_examples_common) \ No newline at end of file diff --git a/examples/protocols/sockets/socket_addr_from_stdin/README.md b/examples/protocols/sockets/socket_addr_from_stdin/README.md deleted file mode 100644 index 9a837b82b..000000000 --- a/examples/protocols/sockets/socket_addr_from_stdin/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Socket address input - -This directory contains a common component for socket client examples which read IP address from stdin (if configured). -This option is typically used in the CI, but could be enabled in the project configuration. -In that case this component is used to receive a string that is evaluated and processed to output -socket structures to open a connection. diff --git a/examples/protocols/sockets/socket_addr_from_stdin/component.mk b/examples/protocols/sockets/socket_addr_from_stdin/component.mk deleted file mode 100644 index 9b8ec9027..000000000 --- a/examples/protocols/sockets/socket_addr_from_stdin/component.mk +++ /dev/null @@ -1,5 +0,0 @@ -# -# Component Makefile -# -COMPONENT_ADD_INCLUDEDIRS := include -COMPONENT_SRCDIRS := . \ No newline at end of file diff --git a/examples/protocols/sockets/tcp_client/CMakeLists.txt b/examples/protocols/sockets/tcp_client/CMakeLists.txt index 735796989..aee70cad5 100644 --- a/examples/protocols/sockets/tcp_client/CMakeLists.txt +++ b/examples/protocols/sockets/tcp_client/CMakeLists.txt @@ -4,8 +4,7 @@ cmake_minimum_required(VERSION 3.5) # (Not part of the boilerplate) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. -set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common - $ENV{IDF_PATH}/examples/protocols/sockets/socket_addr_from_stdin) +set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(tcp_client) diff --git a/examples/protocols/sockets/udp_client/CMakeLists.txt b/examples/protocols/sockets/udp_client/CMakeLists.txt index afe45d068..2049b8193 100644 --- a/examples/protocols/sockets/udp_client/CMakeLists.txt +++ b/examples/protocols/sockets/udp_client/CMakeLists.txt @@ -4,8 +4,7 @@ cmake_minimum_required(VERSION 3.5) # (Not part of the boilerplate) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. -set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common - $ENV{IDF_PATH}/examples/protocols/sockets/socket_addr_from_stdin) +set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(udp_client) diff --git a/tools/ci/check_examples_cmake_make.sh b/tools/ci/check_examples_cmake_make.sh index 30b748367..aa7d54058 100755 --- a/tools/ci/check_examples_cmake_make.sh +++ b/tools/ci/check_examples_cmake_make.sh @@ -5,7 +5,7 @@ echo "- Getting paths of CMakeLists and Makefiles" IFS= -CMAKELISTS=$( find ${IDF_PATH}/examples/ -type f -name CMakeLists.txt | grep -v "/components/" | grep -v "/common_components/" | grep -v "/cxx/experimental/experimental_cpp_component/" | grep -v "/main/" | grep -v "/build_system/cmake/" | grep -v "/mb_example_common/" | grep -v "/socket_addr_from_stdin/" | sort -n) +CMAKELISTS=$( find ${IDF_PATH}/examples/ -type f -name CMakeLists.txt | grep -v "/components/" | grep -v "/common_components/" | grep -v "/cxx/experimental/experimental_cpp_component/" | grep -v "/main/" | grep -v "/build_system/cmake/" | grep -v "/mb_example_common/" | sort -n) MAKEFILES=$( find ${IDF_PATH}/examples/ -type f -name Makefile | grep -v "/build_system/cmake/" | sort -n) echo " [DONE]"