diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index 4708d7490b..1da167032a 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -35,7 +35,7 @@ jobs: working-directory: test_app run: | . ${IDF_PATH}/export.sh - idf.py clang-check --include-paths $GITHUB_WORKSPACE --exclude-paths $PWD --run-clang-tidy-py run-clang-tidy + idf.py clang-check --include-paths $GITHUB_WORKSPACE --exclude-paths $PWD --run-clang-tidy-py run-clang-tidy --run-clang-tidy-options "-checks=-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling" cp warnings.txt ../ - name: Convert clang-tidy results into SARIF output run: | diff --git a/.github/workflows/mosq__build.yml b/.github/workflows/mosq__build.yml index 476d174d6d..abf9dbb4bc 100644 --- a/.github/workflows/mosq__build.yml +++ b/.github/workflows/mosq__build.yml @@ -64,6 +64,7 @@ jobs: - name: Run Test working-directory: ${{ env.TEST_DIR }} run: | + python -m pip install pytest-embedded-serial-esp pytest-embedded-idf pytest-rerunfailures pytest-timeout pytest-ignore-test-results unzip ci/artifacts.zip -d ci for dir in `ls -d ci/build_*`; do rm -rf build sdkconfig.defaults diff --git a/.github/workflows/publish-docs-component.yml b/.github/workflows/publish-docs-component.yml index 1cdb90d276..bd5e585882 100644 --- a/.github/workflows/publish-docs-component.yml +++ b/.github/workflows/publish-docs-component.yml @@ -98,7 +98,8 @@ jobs: components/console_cmd_ping; components/console_cmd_ifconfig; components/console_cmd_wifi; - components/esp_wifi_remote; components/mbedtls_cxx; + components/mosquitto; + components/sock_utils; namespace: "espressif" api_token: ${{ secrets.IDF_COMPONENT_API_TOKEN }} diff --git a/.github/workflows/sockutls_build.yml b/.github/workflows/sockutls_build.yml new file mode 100644 index 0000000000..1244c1e160 --- /dev/null +++ b/.github/workflows/sockutls_build.yml @@ -0,0 +1,95 @@ +name: "sock_utils: build-tests" + +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened, labeled] + +jobs: + build_sock_utils: + if: contains(github.event.pull_request.labels.*.name, 'sock_utils') || github.event_name == 'push' + name: Socket helpers build + strategy: + matrix: + idf_ver: ["latest", "release-v5.3"] + runs-on: ubuntu-22.04 + container: espressif/idf:${{ matrix.idf_ver }} + env: + TEST_DIR: components/sock_utils/examples/simple + TARGET_TEST_DIR: build_esp32_default + steps: + - name: Checkout esp-protocols + uses: actions/checkout@v4 + with: + submodules: recursive + - name: Build with IDF-${{ matrix.idf_ver }} + shell: bash + run: | + . ${IDF_PATH}/export.sh + pip install idf-component-manager idf-build-apps --upgrade + python ci/build_apps.py ${TEST_DIR} + cd ${TEST_DIR} + ${GITHUB_WORKSPACE}/ci/clean_build_artifacts.sh `pwd`/${TARGET_TEST_DIR} + zip -qur artifacts.zip ${TARGET_TEST_DIR} + - uses: actions/upload-artifact@v4 + with: + name: sock_utils_target_esp32_${{ matrix.idf_ver }} + path: ${{ env.TEST_DIR }}/artifacts.zip + if-no-files-found: error + host_test_sock_utils: + if: contains(github.event.pull_request.labels.*.name, 'sock_utils') || github.event_name == 'push' + name: Socket helpers host test + strategy: + matrix: + idf_ver: ["latest", "release-v5.3"] + runs-on: ubuntu-22.04 + container: espressif/idf:${{ matrix.idf_ver }} + env: + TEST_DIR: components/sock_utils/test/host + steps: + - name: Checkout esp-protocols + uses: actions/checkout@v4 + with: + submodules: recursive + - name: Build with IDF-${{ matrix.idf_ver }} + shell: bash + run: | + . ${IDF_PATH}/export.sh + pip install idf-component-manager idf-build-apps --upgrade + cd ${TEST_DIR} + idf.py build + ./build/sock_utils_host_test.elf + + test_sock_utils: + # Skip running on forks since it won't have access to secrets + if: | + github.repository == 'espressif/esp-protocols' && + ( contains(github.event.pull_request.labels.*.name, 'sock_utils') || github.event_name == 'push' ) + name: Socket helpers target test + needs: build_sock_utils + strategy: + matrix: + idf_ver: ["latest", "release-v5.3"] + runs-on: + - self-hosted + - ESP32-ETHERNET-KIT + env: + TEST_DIR: components/sock_utils/examples/simple + TARGET_TEST_DIR: build_esp32_default + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: sock_utils_target_esp32_${{ matrix.idf_ver }} + path: ${{ env.TEST_DIR }}/ci/ + - name: Run Test + working-directory: ${{ env.TEST_DIR }} + run: | + unzip ci/artifacts.zip -d ci + for dir in `ls -d ci/build_*`; do + rm -rf build sdkconfig.defaults + mv $dir build + python -m pytest --log-cli-level DEBUG --junit-xml=./results_esp32_${{ matrix.idf_ver }}_${dir#"ci/build_"}.xml --target=esp32 + done diff --git a/.github/workflows/wifi_remote__build.yml b/.github/workflows/wifi_remote__build.yml deleted file mode 100644 index 612dc30b95..0000000000 --- a/.github/workflows/wifi_remote__build.yml +++ /dev/null @@ -1,112 +0,0 @@ -name: "esp_wifi_remote: build-tests" - -on: - push: - branches: - - master - pull_request: - types: [opened, synchronize, reopened, labeled] - -jobs: - wifi_remote_api_compat: - if: contains(github.event.pull_request.labels.*.name, 'wifi_remote') || github.event_name == 'push' - name: Check API compatibility of WiFi Remote - strategy: - matrix: - idf_ver: ["latest", "release-v5.3"] - runs-on: ubuntu-20.04 - container: espressif/idf:${{ matrix.idf_ver }} - steps: - - name: Checkout esp-protocols - uses: actions/checkout@v3 - - name: Check that headers are the same as generated - shell: bash - run: | - . ${IDF_PATH}/export.sh - pip install idf-component-manager idf-build-apps --upgrade - cp -r ./components/esp_wifi_remote ./components/esp_wifi_remote_base - cd ./components/esp_wifi_remote/scripts - python generate_and_check.py --base-dir ../../esp_wifi_remote_base - - build_wifi_remote: - if: contains(github.event.pull_request.labels.*.name, 'wifi_remote') || github.event_name == 'push' - name: Build WiFi Remote Test - strategy: - matrix: - idf_ver: ["latest", "release-v5.3"] - test: [ { app: smoke_test, path: "test/smoke_test" }] - runs-on: ubuntu-20.04 - container: espressif/idf:${{ matrix.idf_ver }} - steps: - - name: Checkout esp-protocols - uses: actions/checkout@v3 - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ matrix.idf_ver }} - - name: Build ${{ matrix.test.app }} with IDF-${{ matrix.idf_ver }} - shell: bash - run: | - . ${IDF_PATH}/export.sh - pip install idf-component-manager idf-build-apps --upgrade - python ./components/esp_wifi_remote/scripts/generate_slave_configs.py ./components/esp_wifi_remote/${{matrix.test.path}} - python ./ci/build_apps.py ./components/esp_wifi_remote/${{matrix.test.path}} -vv --preserve-all - - build_wifi_remote_example: - if: contains(github.event.pull_request.labels.*.name, 'wifi_remote') || github.event_name == 'push' - name: Build WiFi Remote Example - strategy: - matrix: - idf_ver: ["latest"] - example: [ { app: host, path: "examples/mqtt" }, { app: slave, path: "examples/server" }] - include: - - idf_ver: "latest" - example: { app: slave, path: "examples/server" } - warning: "Warning: The smallest app partition is nearly full" - - runs-on: ubuntu-20.04 - container: espressif/idf:${{ matrix.idf_ver }} - steps: - - name: Checkout esp-protocols - uses: actions/checkout@v3 - - name: Build ${{ matrix.example.app }} with IDF-${{ matrix.idf_ver }} - env: - EXPECTED_WARNING: ${{ matrix.warning }} - shell: bash - run: | - . ${IDF_PATH}/export.sh - pip install idf-component-manager idf-build-apps --upgrade - python ./ci/build_apps.py ./components/esp_wifi_remote/${{matrix.example.path}} -vv --preserve-all - - build_idf_examples_with_wifi_remote: - if: contains(github.event.pull_request.labels.*.name, 'wifi_remote') || github.event_name == 'push' - name: Build IDF examples with WiFi Remote - strategy: - matrix: - idf_ver: ["latest", "release-v5.3"] - idf_target: ["esp32p4", "esp32h2", "esp32s3"] - test: [ { app: idf_mqtt_example, path: "examples/protocols/mqtt/tcp" }] - runs-on: ubuntu-20.04 - container: espressif/idf:${{ matrix.idf_ver }} - steps: - - name: Checkout esp-protocols - uses: actions/checkout@v3 - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ matrix.idf_ver }} - - name: Build ${{ matrix.test.app }} with IDF-${{ matrix.idf_ver }} for ${{ matrix.idf_target }} - shell: bash - run: | - . ${IDF_PATH}/export.sh - pip install idf-component-manager idf-build-apps --upgrade - export OVERRIDE_PATH=`pwd`/components/esp_wifi_remote - echo ${OVERRIDE_PATH} - sed -i '/espressif\/esp_wifi_remote:/a \ \ \ \ override_path: "${OVERRIDE_PATH}"' ${IDF_PATH}/${{matrix.test.path}}/main/idf_component.yml - cat ${IDF_PATH}/${{matrix.test.path}}/main/idf_component.yml - export PEDANTIC_FLAGS="-DIDF_CI_BUILD -Werror -Werror=deprecated-declarations -Werror=unused-variable -Werror=unused-but-set-variable -Werror=unused-function" - export EXTRA_CFLAGS="${PEDANTIC_FLAGS} -Wstrict-prototypes" - export EXTRA_CXXFLAGS="${PEDANTIC_FLAGS}" - cd ${IDF_PATH}/${{matrix.test.path}} - idf-build-apps find --config sdkconfig.ci* -vv --target ${{ matrix.idf_target }} - idf-build-apps build --config sdkconfig.ci* -vv --target ${{ matrix.idf_target }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8b985ab995..2b7af80bff 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -61,8 +61,8 @@ repos: - repo: local hooks: - id: commit message scopes - name: "commit message must be scoped with: mdns, modem, websocket, asio, mqtt_cxx, console, common, eppp, wifi_remote, tls_cxx" - entry: '\A(?!(feat|fix|ci|bump|test|docs)\((mdns|modem|common|console|websocket|asio|mqtt_cxx|examples|eppp|wifi_remote|tls_cxx|mosq)\)\:)' + name: "commit message must be scoped with: mdns, modem, websocket, asio, mqtt_cxx, console, common, eppp, tls_cxx, mosq, sockutls" + entry: '\A(?!(feat|fix|ci|bump|test|docs|chore)\((mdns|modem|common|console|websocket|asio|mqtt_cxx|examples|eppp|tls_cxx|mosq|sockutls)\)\:)' language: pygrep args: [--multiline] stages: [commit-msg] diff --git a/README.md b/README.md index 920ca34905..3962546f0b 100644 --- a/README.md +++ b/README.md @@ -54,10 +54,15 @@ Please refer to instructions in [ESP-IDF](https://github.com/espressif/esp-idf) * Brief introduction [README](components/eppp_link/README.md) -### esp_wifi_remote - -* Brief introduction [README](components/esp_wifi_remote/README.md) - ### mbedtls_cxx * Brief introduction [README](components/mbedtls_cxx/README.md) + +### mosquitto + +* Brief introduction [README](components/mosquitto/README.md) +* API documentation [api.md](components/mosquitto/api.md) + +### Socket helpers (sock-utils) + +* Brief introduction [README](components/sock_utils/README.md) diff --git a/ci/check_copyright_config.yaml b/ci/check_copyright_config.yaml index 43f2ad7018..ce5eadf079 100644 --- a/ci/check_copyright_config.yaml +++ b/ci/check_copyright_config.yaml @@ -53,6 +53,7 @@ mosquitto_component: allowed_licenses: - EPL-2.0 - Apache-2.0 + - BSD-3-Clause slim_modem_examples: include: diff --git a/ci/ignore_astyle.txt b/ci/ignore_astyle.txt index e8c2695723..e69de29bb2 100644 --- a/ci/ignore_astyle.txt +++ b/ci/ignore_astyle.txt @@ -1,2 +0,0 @@ -# The below file is generated from esp_wifi_types_native.h in IDF, which doesn't follow atyle -components/esp_wifi_remote/include/esp_wifi_types_native.h diff --git a/components/esp_modem/.cz.yaml b/components/esp_modem/.cz.yaml index 81bcd34edb..3073f85ac1 100644 --- a/components/esp_modem/.cz.yaml +++ b/components/esp_modem/.cz.yaml @@ -3,6 +3,6 @@ commitizen: bump_message: 'bump(modem): $current_version -> $new_version' pre_bump_hooks: python ../../ci/changelog.py esp_modem tag_format: modem-v$version - version: 1.1.0 + version: 1.2.0 version_files: - idf_component.yml diff --git a/components/esp_modem/CHANGELOG.md b/components/esp_modem/CHANGELOG.md index 7a6fc18858..6546e7b102 100644 --- a/components/esp_modem/CHANGELOG.md +++ b/components/esp_modem/CHANGELOG.md @@ -1,5 +1,38 @@ # Changelog +## [1.2.0](https://github.com/espressif/esp-protocols/commits/modem-v1.2.0) + +### Features + +- Add support for guessing mode ([52598e5f](https://github.com/espressif/esp-protocols/commit/52598e5f)) +- Delete CMUX internal implementation even if terminal exit fails ([0e0cbd6b](https://github.com/espressif/esp-protocols/commit/0e0cbd6b)) +- Add support for handling URC ([1b6a3b3b](https://github.com/espressif/esp-protocols/commit/1b6a3b3b), [#180](https://github.com/espressif/esp-protocols/issues/180)) +- add ability to change ESP_MODEM_C_API_STR_MAX from Kconfig ([17909892](https://github.com/espressif/esp-protocols/commit/17909892)) +- Added target test config with CHAP authentication ([f8ae7def](https://github.com/espressif/esp-protocols/commit/f8ae7def)) +- example add esp32p4 usb support ([adafeae5](https://github.com/espressif/esp-protocols/commit/adafeae5)) +- Publish mbedtls component ([0140455f](https://github.com/espressif/esp-protocols/commit/0140455f)) +- host test support of the latest ESP-IDF release ([3f74b4e8](https://github.com/espressif/esp-protocols/commit/3f74b4e8)) + +### Bug Fixes + +- Fix console example to use urc/detect features ([1a9eaf3e](https://github.com/espressif/esp-protocols/commit/1a9eaf3e)) +- Update target test builds to use external Catch2 ([554f022c](https://github.com/espressif/esp-protocols/commit/554f022c)) +- Fix arguments names when spawn esp_modem_xxx declarations ([b6792c52](https://github.com/espressif/esp-protocols/commit/b6792c52)) +- Remove catch dependency ([c3480768](https://github.com/espressif/esp-protocols/commit/c3480768)) +- Examples: use local configs for MQTT topic/data ([f5c13b92](https://github.com/espressif/esp-protocols/commit/f5c13b92)) +- Fixed clang-tidy warnings ([70fa3af7](https://github.com/espressif/esp-protocols/commit/70fa3af7)) +- Fix CI build per IDFv5.3 ([d0c17ef0](https://github.com/espressif/esp-protocols/commit/d0c17ef0)) +- Fixed UART task to check for buffered data periodically ([4bdd90cc](https://github.com/espressif/esp-protocols/commit/4bdd90cc), [#536](https://github.com/espressif/esp-protocols/issues/536)) +- Cleanup unused configs from PPPoS example ([08a62ccc](https://github.com/espressif/esp-protocols/commit/08a62ccc)) +- Update CMUX example with SIM7070_gnss cleaned-up ([56fe5327](https://github.com/espressif/esp-protocols/commit/56fe5327)) +- Update console example with SIM7070_gnss format comments ([5baaf542](https://github.com/espressif/esp-protocols/commit/5baaf542)) +- Fix remaining print format warnings ([3b80181d](https://github.com/espressif/esp-protocols/commit/3b80181d)) + +### Updated + +- docs(modem): Fix esp_modem_at_raw() description (C-API) ([492a6a00](https://github.com/espressif/esp-protocols/commit/492a6a00)) +- ci(common): updated github actions(checkout, upload, download) v3 to 4, Ubuntu 20.04 to v22.04 ([a23a0027](https://github.com/espressif/esp-protocols/commit/a23a0027)) + ## [1.1.0](https://github.com/espressif/esp-protocols/commits/modem-v1.1.0) ### Features diff --git a/components/esp_modem/examples/modem_console/main/modem_console_main.cpp b/components/esp_modem/examples/modem_console/main/modem_console_main.cpp index ac4b8f604c..42dd6a76e4 100644 --- a/components/esp_modem/examples/modem_console/main/modem_console_main.cpp +++ b/components/esp_modem/examples/modem_console/main/modem_console_main.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Unlicense OR CC0-1.0 */ @@ -89,7 +89,7 @@ void wakeup_modem(void) vTaskDelay(pdMS_TO_TICKS(2000)); } -#ifdef CONFIG_EXAMPLE_MODEM_DEVICE_SHINY +#ifdef CONFIG_ESP_MODEM_URC_HANDLER command_result handle_urc(uint8_t *data, size_t len) { ESP_LOG_BUFFER_HEXDUMP("on_read", data, len, ESP_LOG_INFO); @@ -238,7 +238,9 @@ extern "C" void app_main(void) if (c->get_count_of(&SetModeArgs::mode)) { auto mode = c->get_string_of(&SetModeArgs::mode); modem_mode dev_mode; - if (mode == "UNDEF") { + if (mode == "AUTO") { + dev_mode = esp_modem::modem_mode::AUTODETECT; + } else if (mode == "UNDEF") { dev_mode = esp_modem::modem_mode::UNDEF; } else if (mode == "CMUX1") { dev_mode = esp_modem::modem_mode::CMUX_MANUAL_MODE; @@ -370,15 +372,15 @@ extern "C" void app_main(void) ESP_LOGI(TAG, "Resetting the module..."); CHECK_ERR(dce->reset(), ESP_LOGI(TAG, "OK")); }); -#ifdef CONFIG_EXAMPLE_MODEM_DEVICE_SHINY +#ifdef CONFIG_ESP_MODEM_URC_HANDLER const ConsoleCommand HandleURC("urc", "toggle urc handling", no_args, [&](ConsoleCommand * c) { static int cnt = 0; if (++cnt % 2) { ESP_LOGI(TAG, "Adding URC handler"); - dce->set_on_read(handle_urc); + dce->set_urc(handle_urc); } else { ESP_LOGI(TAG, "URC removed"); - dce->set_on_read(nullptr); + dce->set_urc(nullptr); } return 0; }); diff --git a/components/esp_modem/idf_component.yml b/components/esp_modem/idf_component.yml index 0f78f85ac4..6596ab7ac6 100644 --- a/components/esp_modem/idf_component.yml +++ b/components/esp_modem/idf_component.yml @@ -1,4 +1,4 @@ -version: "1.1.0" +version: "1.2.0" description: Library for communicating with cellular modems in command and data modes url: https://github.com/espressif/esp-protocols/tree/master/components/esp_modem issues: https://github.com/espressif/esp-protocols/issues diff --git a/components/esp_modem/include/cxx_include/esp_modem_dce.hpp b/components/esp_modem/include/cxx_include/esp_modem_dce.hpp index 3db3fd86dd..045783c2dd 100644 --- a/components/esp_modem/include/cxx_include/esp_modem_dce.hpp +++ b/components/esp_modem/include/cxx_include/esp_modem_dce.hpp @@ -30,9 +30,11 @@ class DCE_Mode { ~DCE_Mode() = default; bool set(DTE *dte, ModuleIf *module, Netif &netif, modem_mode m); modem_mode get(); + modem_mode guess(DTE *dte, bool with_cmux = false); private: bool set_unsafe(DTE *dte, ModuleIf *module, Netif &netif, modem_mode m); + modem_mode guess_unsafe(DTE *dte, bool with_cmux); modem_mode mode; }; @@ -79,6 +81,11 @@ class DCE_T { return dte->command(command, std::move(got_line), time_ms); } + modem_mode guess_mode(bool with_cmux = false) + { + return mode.guess(dte.get(), with_cmux); + } + bool set_mode(modem_mode m) { return mode.set(dte.get(), device.get(), netif, m); diff --git a/components/esp_modem/include/cxx_include/esp_modem_dte.hpp b/components/esp_modem/include/cxx_include/esp_modem_dte.hpp index 787e9810ff..f576e75f1e 100644 --- a/components/esp_modem/include/cxx_include/esp_modem_dte.hpp +++ b/components/esp_modem/include/cxx_include/esp_modem_dte.hpp @@ -65,6 +65,18 @@ class DTE : public CommandableIf { int write(DTE_Command command); + /** + * @brief send data to the selected terminal, by default (without term_id argument) + * this API works the same as write: sends data to the secondary terminal, which is + * typically used as data terminal (for networking). + * + * @param data Data pointer to write + * @param len Data len to write + * @param term_id Terminal id: Primary if id==0, Secondary if id==1 + * @return number of bytes written + */ + int send(uint8_t *data, size_t len, int term_id = 1); + /** * @brief Reading from the underlying terminal * @param d Returning the data pointer of the received payload diff --git a/components/esp_modem/include/cxx_include/esp_modem_types.hpp b/components/esp_modem/include/cxx_include/esp_modem_types.hpp index 944427156d..1387ee33ba 100644 --- a/components/esp_modem/include/cxx_include/esp_modem_types.hpp +++ b/components/esp_modem/include/cxx_include/esp_modem_types.hpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -37,6 +37,17 @@ enum class modem_mode { CMUX_MANUAL_DATA, /*!< Sets the primary terminal to DATA mode in manual CMUX */ CMUX_MANUAL_COMMAND, /*!< Sets the primary terminal to COMMAND mode in manual CMUX */ CMUX_MANUAL_SWAP, /*!< Swaps virtual terminals in manual CMUX mode (primary <-> secondary) */ + RESUME_DATA_MODE, /*!< This is used when the device is already in DATA mode and we need the modem lib to + * enter the mode without switching. On success, we would end up in DATA-mode, UNDEF otherwise */ + RESUME_COMMAND_MODE, /*!< This is used when the device is already in COMMAND mode and we want to resume it + * On success, we would end up in DATA-mode, UNDEF otherwise */ + RESUME_CMUX_MANUAL_MODE, /*!< This is used when the device is already in CMUX mode and we need the modem lib to + * enter it without switching. On success, we would end up in CMUX_MANUAL-mode, UNDEF otherwise */ + RESUME_CMUX_MANUAL_DATA, /*!< This is used when the device is already in CMUX-DATA mode and we need the modem lib to + * enter it without switching. On success, we would end up in CMUX_MANUAL-DATA mode, UNDEF otherwise */ + AUTODETECT, /*!< Auto-detection command: It tries to send a few packets in order to recognize which mode the + * the device currently is and update the modem library mode. On success the modem is updated, + * otherwise it's set to UNDEF */ }; /** diff --git a/components/esp_modem/src/esp_modem_dce.cpp b/components/esp_modem/src/esp_modem_dce.cpp index 55c51f0cdc..f178eea7d5 100644 --- a/components/esp_modem/src/esp_modem_dce.cpp +++ b/components/esp_modem/src/esp_modem_dce.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -103,6 +103,51 @@ bool DCE_Mode::set_unsafe(DTE *dte, ModuleIf *device, Netif &netif, modem_mode m return true; case modem_mode::DUAL_MODE: // Only DTE can be in Dual mode break; + case modem_mode::AUTODETECT: { + auto guessed = guess_unsafe(dte, true); + if (guessed == modem_mode::UNDEF) { + return false; + } + // prepare the undefined mode before to allow all possible transitions + if (!dte->set_mode(modem_mode::UNDEF)) { + return false; + } + mode = modem_mode::UNDEF; + ESP_LOGD("DCE mode", "Detected mode: %d", static_cast(guessed)); + if (guessed == modem_mode::DATA_MODE) { + return set_unsafe(dte, device, netif, esp_modem::modem_mode::RESUME_DATA_MODE); + } else if (guessed == esp_modem::modem_mode::COMMAND_MODE) { + return set_unsafe(dte, device, netif, esp_modem::modem_mode::RESUME_COMMAND_MODE); + } else if (guessed == esp_modem::modem_mode::CMUX_MODE) { + if (!set_unsafe(dte, device, netif, esp_modem::modem_mode::RESUME_CMUX_MANUAL_MODE)) { + return false; + } + // now we guess the mode for each terminal + guessed = guess_unsafe(dte, false); + ESP_LOGD("DCE mode", "Detected mode on primary term: %d", static_cast(guessed)); + // now we need to access the second terminal, so we could simply send a SWAP command + // (switching to data mode does the swapping internally, so we only swap if we're in CMD mode) + if (guessed == modem_mode::DATA_MODE) { + // switch to DATA on the primary terminal and swap terminals + if (!set_unsafe(dte, device, netif, esp_modem::modem_mode::RESUME_CMUX_MANUAL_DATA)) { + return false; + } + } else { + // swap terminals + if (!set_unsafe(dte, device, netif, esp_modem::modem_mode::CMUX_MANUAL_SWAP)) { + return false; + } + } + guessed = guess_unsafe(dte, false); + ESP_LOGD("DCE mode", "Detected mode on secondary term: %d", static_cast(guessed)); + if (guessed == modem_mode::DATA_MODE) { + if (!set_unsafe(dte, device, netif, esp_modem::modem_mode::RESUME_CMUX_MANUAL_DATA)) { + return false; + } + } + } + return true; + } case modem_mode::COMMAND_MODE: if (mode == modem_mode::COMMAND_MODE || mode >= modem_mode::CMUX_MANUAL_MODE) { return false; @@ -122,6 +167,32 @@ bool DCE_Mode::set_unsafe(DTE *dte, ModuleIf *device, Netif &netif, modem_mode m } mode = m; return true; + case modem_mode::RESUME_DATA_MODE: + if (!dte->set_mode(modem_mode::DATA_MODE)) { + return false; + } + netif.start(); + mode = modem_mode::DATA_MODE; + return true; + case modem_mode::RESUME_COMMAND_MODE: + if (!dte->set_mode(modem_mode::COMMAND_MODE)) { + return false; + } + mode = modem_mode::COMMAND_MODE; + return true; + case modem_mode::RESUME_CMUX_MANUAL_MODE: + if (!dte->set_mode(modem_mode::CMUX_MANUAL_MODE)) { + return false; + } + mode = modem_mode::CMUX_MANUAL_MODE; + return true; + case modem_mode::RESUME_CMUX_MANUAL_DATA: + if (!dte->set_mode(modem_mode::CMUX_MANUAL_SWAP)) { + return false; + } + netif.start(); + mode = modem_mode::CMUX_MANUAL_MODE; + return true; case modem_mode::DATA_MODE: if (mode == modem_mode::DATA_MODE || mode == modem_mode::CMUX_MODE || mode >= modem_mode::CMUX_MANUAL_MODE) { return false; @@ -191,4 +262,114 @@ modem_mode DCE_Mode::get() return mode; } +modem_mode DCE_Mode::guess(DTE *dte, bool with_cmux) +{ + Scoped lock(*dte); + return guess_unsafe(dte, with_cmux); +} + +/** + * This namespace contains probe packets and expected replies on 3 different protocols, + * the modem device could use (as well as timeouts and mode ids for synchronisation) + */ +namespace probe { + +namespace ppp { +// Test that we're in the PPP mode by sending an LCP protocol echo request and expecting LCP echo reply +constexpr std::array lcp_echo_request = {0x7e, 0xff, 0x03, 0xc0, 0x21, 0x09, 0x01, 0x00, 0x08, 0x99, 0xd1, 0x35, 0xc1, 0x8e, 0x2c, 0x7e }; +constexpr std::array lcp_echo_reply_head = {0x7e, 0xff, 0x7d, 0x23, 0xc0}; +const size_t mode = 1 << 0; +const int timeout = 200; +} + +namespace cmd { +// For command mode, we just send a simple AT command +const char at[] = "\r\nAT\r\n"; +const size_t max_at_reply = 16; // account for some whitespaces and/or CMUX encapsulation +const char reply[] = { 'O', 'K' }; +const int mode = 1 << 1; +const int timeout = 500; +} + +namespace cmux { +// For CMUX mode, we send an SABM on control terminal (0) +const uint8_t sabm0_reqest[] = {0xf9, 0x03, 0x3f, 0x01, 0x1c, 0xf9}; +const uint8_t sabm0_reply[] = {0xf9, 0x03, 0x73, 0x01}; +const int mode = 1 << 0; +const int timeout = 200; +} +}; + +modem_mode DCE_Mode::guess_unsafe(DTE *dte, bool with_cmux) +{ + // placeholder for reply and its size, since it could come in pieces, and we have to cache + // this is captured by the lambda by reference. + // must make sure the lambda is cleared before exiting this function (done by dte->on_read(nullptr)) + uint8_t reply[std::max(probe::cmd::max_at_reply, std::max(sizeof(probe::ppp::lcp_echo_request), sizeof(probe::cmux::sabm0_reply)))]; + size_t reply_pos = 0; + auto signal = std::make_shared(); + std::weak_ptr weak_signal = signal; + dte->on_read([weak_signal, with_cmux, &reply, &reply_pos](uint8_t *data, size_t len) { + // storing the response in the `reply` array and de-fragmenting + if (reply_pos >= sizeof(reply)) { + return command_result::TIMEOUT; + } + auto reply_size = std::min((size_t)sizeof(reply) - reply_pos, len); + ::memcpy(reply + reply_pos, data, reply_size); + reply_pos += reply_size; + ESP_LOG_BUFFER_HEXDUMP("esp-modem: guess mode data:", reply, reply_pos, ESP_LOG_DEBUG); + + // Check whether the response resembles the "golden" reply (for these 3 protocols) + if (reply_pos >= sizeof(probe::ppp::lcp_echo_reply_head)) { + // check for initial 2 bytes + auto *ptr = static_cast(memmem(reply, reply_pos, probe::ppp::lcp_echo_reply_head.data(), 2)); + // and check the other two bytes for protocol ID: LCP + if (ptr && ptr[3] == probe::ppp::lcp_echo_reply_head[3] && ptr[4] == probe::ppp::lcp_echo_reply_head[4]) { + if (auto signal = weak_signal.lock()) { + signal->set(probe::ppp::mode); + } + } + } + if (reply_pos >= 4 && memmem(reply, reply_pos, probe::cmd::reply, sizeof(probe::cmd::reply))) { + if (reply[0] != 0xf9) { // double check that the reply is not wrapped in CMUX headers + if (auto signal = weak_signal.lock()) { + signal->set(probe::cmd::mode); + } + } + } + if (with_cmux && reply_pos >= sizeof(probe::cmux::sabm0_reply)) { + // checking the initial 3 bytes + auto *ptr = static_cast(memmem(reply, reply_pos, probe::cmux::sabm0_reply, 3)); + // and checking that DLCI is 0 (control frame) + if (ptr && (ptr[3] >> 2) == 0) { + if (auto signal = weak_signal.lock()) { + signal->set(probe::cmux::mode); + } + } + } + return command_result::TIMEOUT; + }); + auto guessed = modem_mode::UNDEF; + // Check the PPP mode fist by sending LCP echo request + dte->send((uint8_t *)probe::ppp::lcp_echo_request.data(), sizeof(probe::ppp::lcp_echo_request), 0); + if (signal->wait(probe::ppp::mode, probe::ppp::timeout)) { + guessed = modem_mode::DATA_MODE; + } else { // LCP echo timeout + // now check for AT mode + reply_pos = 0; + dte->send((uint8_t *)probe::cmd::at, sizeof(probe::cmd::at), 0); + if (signal->wait(probe::cmd::mode, probe::cmd::timeout)) { + guessed = modem_mode::COMMAND_MODE; + } else if (with_cmux) { // no AT reply, check for CMUX mode (if requested) + reply_pos = 0; + dte->send((uint8_t *) probe::cmux::sabm0_reqest, sizeof(probe::cmux::sabm0_reqest), 0); + if (signal->wait(probe::cmux::mode, probe::cmux::timeout)) { + guessed = modem_mode::CMUX_MODE; + } + } + } + dte->on_read(nullptr); + return guessed; +} + } // esp_modem diff --git a/components/esp_modem/src/esp_modem_dte.cpp b/components/esp_modem/src/esp_modem_dte.cpp index 677708fa4e..8345c6fe8b 100644 --- a/components/esp_modem/src/esp_modem_dte.cpp +++ b/components/esp_modem/src/esp_modem_dte.cpp @@ -223,13 +223,13 @@ bool DTE::set_mode(modem_mode m) } } // transitions (COMMAND|DUAL|CMUX|UNDEF) -> DATA - if (m == modem_mode::DATA_MODE) { + if (m == modem_mode::DATA_MODE || m == modem_mode::RESUME_DATA_MODE) { if (mode == modem_mode::CMUX_MODE || mode == modem_mode::CMUX_MANUAL_MODE || mode == modem_mode::DUAL_MODE) { // mode stays the same, but need to swap terminals (as command has been switched) secondary_term.swap(primary_term); set_command_callbacks(); } else { - mode = m; + mode = modem_mode::DATA_MODE; } return true; } @@ -316,6 +316,12 @@ int DTE::write(uint8_t *data, size_t len) return secondary_term->write(data, len); } +int DTE::send(uint8_t *data, size_t len, int term_id) +{ + Terminal *term = term_id == 0 ? primary_term.get() : secondary_term.get(); + return term->write(data, len); +} + int DTE::write(DTE_Command command) { return primary_term->write(command.data, command.len); diff --git a/components/esp_modem/src/esp_modem_netif.cpp b/components/esp_modem/src/esp_modem_netif.cpp index d808db0748..fbb75c37c5 100644 --- a/components/esp_modem/src/esp_modem_netif.cpp +++ b/components/esp_modem/src/esp_modem_netif.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -87,8 +87,10 @@ void Netif::start() receive(data, len); return true; }); - signal.set(PPP_STARTED); - esp_netif_action_start(driver.base.netif, nullptr, 0, nullptr); + if (!signal.is_any(PPP_STARTED)) { + signal.set(PPP_STARTED); + esp_netif_action_start(driver.base.netif, nullptr, 0, nullptr); + } } void Netif::stop() diff --git a/components/esp_websocket_client/.cz.yaml b/components/esp_websocket_client/.cz.yaml index 4363640eae..9d5acf605c 100644 --- a/components/esp_websocket_client/.cz.yaml +++ b/components/esp_websocket_client/.cz.yaml @@ -3,6 +3,6 @@ commitizen: bump_message: 'bump(websocket): $current_version -> $new_version' pre_bump_hooks: python ../../ci/changelog.py esp_websocket_client tag_format: websocket-v$version - version: 1.2.3 + version: 1.3.0 version_files: - idf_component.yml diff --git a/components/esp_websocket_client/CHANGELOG.md b/components/esp_websocket_client/CHANGELOG.md index fd54a3e52d..f36b2f5483 100644 --- a/components/esp_websocket_client/CHANGELOG.md +++ b/components/esp_websocket_client/CHANGELOG.md @@ -1,5 +1,27 @@ # Changelog +## [1.3.0](https://github.com/espressif/esp-protocols/commits/websocket-v1.3.0) + +### Features + +- add events for begin/end thread ([d7fa24bc](https://github.com/espressif/esp-protocols/commit/d7fa24bc)) +- Make example to use certificate bundle ([aecf6f80](https://github.com/espressif/esp-protocols/commit/aecf6f80)) +- propagate esp_tls stack error and cert verify flags ([234f579b](https://github.com/espressif/esp-protocols/commit/234f579b)) +- Add option to set and use cert_common_name in Websocket client ([3a6720de](https://github.com/espressif/esp-protocols/commit/3a6720de)) +- adding support for `if_name` when using WSS transport ([333a6893](https://github.com/espressif/esp-protocols/commit/333a6893)) +- allow updating reconnect timeout for retry backoffs ([bd9f0627](https://github.com/espressif/esp-protocols/commit/bd9f0627)) +- allow using external tcp transport handle ([83ea2876](https://github.com/espressif/esp-protocols/commit/83ea2876)) +- adding support for `keep_alive_enable` when using WSS transport ([c728eae5](https://github.com/espressif/esp-protocols/commit/c728eae5)) + +### Bug Fixes + +- Prevent crash on network disconnect during send ([a453ca1f](https://github.com/espressif/esp-protocols/commit/a453ca1f)) +- use proper interface to delete semaphore ([991ac40d](https://github.com/espressif/esp-protocols/commit/991ac40d)) +- Move client to different state when disconnecting ([0d8f2a6d](https://github.com/espressif/esp-protocols/commit/0d8f2a6d)) +- fix of websocket host example ([5ccc018a](https://github.com/espressif/esp-protocols/commit/5ccc018a)) +- don't get transport from the list if external transport is used ([9d4d5d2d](https://github.com/espressif/esp-protocols/commit/9d4d5d2d)) +- Fix locking issues of `esp_websocket_client_send_with_exact_opcode` API ([6393fcd7](https://github.com/espressif/esp-protocols/commit/6393fcd7)) + ## [1.2.3](https://github.com/espressif/esp-protocols/commits/websocket-v1.2.3) ### Features diff --git a/components/esp_websocket_client/esp_websocket_client.c b/components/esp_websocket_client/esp_websocket_client.c index 953a7b1d29..f943a86895 100644 --- a/components/esp_websocket_client/esp_websocket_client.c +++ b/components/esp_websocket_client/esp_websocket_client.c @@ -229,13 +229,15 @@ static esp_err_t esp_websocket_client_abort_connection(esp_websocket_client_hand ESP_WS_CLIENT_STATE_CHECK(TAG, client, return ESP_FAIL); esp_transport_close(client->transport); - if (client->config->auto_reconnect) { + if (!client->config->auto_reconnect) { + client->run = false; + client->state = WEBSOCKET_STATE_UNKNOW; + } else { client->reconnect_tick_ms = _tick_get_ms(); ESP_LOGI(TAG, "Reconnect after %d ms", client->wait_timeout_ms); + client->error_handle.error_type = error_type; + client->state = WEBSOCKET_STATE_WAIT_TIMEOUT; } - - client->error_handle.error_type = error_type; - client->state = WEBSOCKET_STATE_WAIT_TIMEOUT; esp_websocket_client_dispatch_event(client, WEBSOCKET_EVENT_DISCONNECTED, NULL, 0); return ESP_OK; } @@ -434,7 +436,7 @@ static void destroy_and_free_resources(esp_websocket_client_handle_t client) if (client->transport_list) { esp_transport_list_destroy(client->transport_list); } - vQueueDelete(client->lock); + vSemaphoreDelete(client->lock); free(client->tx_buffer); free(client->rx_buffer); free(client->errormsg_buffer); @@ -1051,10 +1053,6 @@ static void esp_websocket_client_task(void *pv) break; case WEBSOCKET_STATE_WAIT_TIMEOUT: - if (!client->config->auto_reconnect) { - client->run = false; - break; - } if (_tick_get_ms() - client->reconnect_tick_ms > client->wait_timeout_ms) { client->state = WEBSOCKET_STATE_INIT; client->reconnect_tick_ms = _tick_get_ms(); @@ -1085,7 +1083,9 @@ static void esp_websocket_client_task(void *pv) } else { esp_websocket_client_error(client, "esp_transport_poll_read() returned %d, errno=%d", read_select, errno); } + xSemaphoreTakeRecursive(client->lock, lock_timeout); esp_websocket_client_abort_connection(client, WEBSOCKET_ERROR_TYPE_TCP_TRANSPORT); + xSemaphoreGiveRecursive(client->lock); } } else if (WEBSOCKET_STATE_WAIT_TIMEOUT == client->state) { // waiting for reconnecting... diff --git a/components/esp_websocket_client/examples/target/main/websocket_example.c b/components/esp_websocket_client/examples/target/main/websocket_example.c index 18f6545f07..d141ccbb9a 100644 --- a/components/esp_websocket_client/examples/target/main/websocket_example.c +++ b/components/esp_websocket_client/examples/target/main/websocket_example.c @@ -222,6 +222,7 @@ static void websocket_app_start(void) char *long_data = malloc(size); memset(long_data, 'a', size); esp_websocket_client_send_text(client, long_data, size, portMAX_DELAY); + free(long_data); xSemaphoreTake(shutdown_sema, portMAX_DELAY); esp_websocket_client_close(client, portMAX_DELAY); diff --git a/components/esp_websocket_client/idf_component.yml b/components/esp_websocket_client/idf_component.yml index 54dcc96f90..9ba85c058f 100644 --- a/components/esp_websocket_client/idf_component.yml +++ b/components/esp_websocket_client/idf_component.yml @@ -1,4 +1,4 @@ -version: "1.2.3" +version: "1.3.0" description: WebSocket protocol client for ESP-IDF url: https://github.com/espressif/esp-protocols/tree/master/components/esp_websocket_client dependencies: diff --git a/components/esp_wifi_remote/.cz.yaml b/components/esp_wifi_remote/.cz.yaml deleted file mode 100644 index 34ea1f0485..0000000000 --- a/components/esp_wifi_remote/.cz.yaml +++ /dev/null @@ -1,8 +0,0 @@ ---- -commitizen: - bump_message: 'bump(wifi_remote): $current_version -> $new_version' - pre_bump_hooks: python ../../ci/changelog.py esp_wifi_remote - tag_format: wifi_remote-v$version - version: 0.4.0 - version_files: - - idf_component.yml diff --git a/components/esp_wifi_remote/CHANGELOG.md b/components/esp_wifi_remote/CHANGELOG.md deleted file mode 100644 index 59f72b9374..0000000000 --- a/components/esp_wifi_remote/CHANGELOG.md +++ /dev/null @@ -1,66 +0,0 @@ -# Changelog - -## [0.4.0](https://github.com/espressif/esp-protocols/commits/wifi_remote-v0.4.0) - -### Features - -- Make esp_hosted default RPC library ([1b62adbd](https://github.com/espressif/esp-protocols/commit/1b62adbd)) -- Add build test for current IDF examples ([50c113e4](https://github.com/espressif/esp-protocols/commit/50c113e4)) -- Support for IDF v5.3 in a separate directory ([bde97203](https://github.com/espressif/esp-protocols/commit/bde97203)) -- Support for IDF v5.4 via a separate dir ([e9ac41e1](https://github.com/espressif/esp-protocols/commit/e9ac41e1)) -- Add slave selection and peview targets ([345c4577](https://github.com/espressif/esp-protocols/commit/345c4577)) - -### Bug Fixes - -- Fix CMake to use inherent IDF build vars ([c454ec09](https://github.com/espressif/esp-protocols/commit/c454ec09)) -- Update per v5.4 espressif/esp-idf@97e42349 ([ff5dac70](https://github.com/espressif/esp-protocols/commit/ff5dac70)) -- Fix CI builds to generate configs per slave selection ([8795d164](https://github.com/espressif/esp-protocols/commit/8795d164)) -- Depend on esp_hosted only on targets with no WiFi ([7ca5ed1d](https://github.com/espressif/esp-protocols/commit/7ca5ed1d)) -- Update per espressif/esp-idf@27f61966 ([2e53b81f](https://github.com/espressif/esp-protocols/commit/2e53b81f)) -- Fix checking API compat against reference dir ([1a57a878](https://github.com/espressif/esp-protocols/commit/1a57a878)) - -## [0.3.0](https://github.com/espressif/esp-protocols/commits/wifi_remote-v0.3.0) - -### Features - -- add esp_wifi_internal_tx_by_ref ([ba35d14e](https://github.com/espressif/esp-protocols/commit/ba35d14e)) -- Make wifi_remote depend on esp_hosted ([ac9972aa](https://github.com/espressif/esp-protocols/commit/ac9972aa)) - -## [0.2.3](https://github.com/espressif/esp-protocols/commits/wifi_remote-v0.2.3) - -### Bug Fixes - -- Fix server event/command race condtion using eventfd ([732b1d5](https://github.com/espressif/esp-protocols/commit/732b1d5)) -- Lock server before marshalling events ([9e13870](https://github.com/espressif/esp-protocols/commit/9e13870)) - -## [0.2.2](https://github.com/espressif/esp-protocols/commits/wifi_remote-v0.2.2) - -### Bug Fixes - -- Added more netif options for eppp connection ([24ce867](https://github.com/espressif/esp-protocols/commit/24ce867)) -- Do not restrict EPPP config to RSA keys only ([f05c765](https://github.com/espressif/esp-protocols/commit/f05c765), [#570](https://github.com/espressif/esp-protocols/issues/570)) - -## [0.2.1](https://github.com/espressif/esp-protocols/commits/wifi_remote-v0.2.1) - -### Bug Fixes - -- Added misc wifi API in eppp impl ([93256d1](https://github.com/espressif/esp-protocols/commit/93256d1)) -- Updated eppp dependency not to use fixed version ([3a48c06](https://github.com/espressif/esp-protocols/commit/3a48c06)) - -## [0.2.0](https://github.com/espressif/esp-protocols/commits/wifi_remote-v0.2.0) - -### Features - -- Add support for simple eppp based RPC ([fd168d8](https://github.com/espressif/esp-protocols/commit/fd168d8)) - -### Bug Fixes - -- Make services restartable, code cleanup ([6c82ce2](https://github.com/espressif/esp-protocols/commit/6c82ce2)) -- Add examples to CI ([d2b7c55](https://github.com/espressif/esp-protocols/commit/d2b7c55)) - -## [0.1.12](https://github.com/espressif/esp-protocols/commits/wifi_remote-v0.1.12) - -### Features - -- Added generation step for wifi_remote based on IDF ([dfb00358](https://github.com/espressif/esp-protocols/commit/dfb00358)) -- Move to esp-protocols ([edc3c2d](https://github.com/espressif/esp-protocols/commit/edc3c2d)) diff --git a/components/esp_wifi_remote/CMakeLists.txt b/components/esp_wifi_remote/CMakeLists.txt deleted file mode 100644 index c99baa128d..0000000000 --- a/components/esp_wifi_remote/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -set(IDF_VER_DIR "idf_v${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}") - -if(NOT CONFIG_ESP_WIFI_ENABLED) - set(src_wifi_is_remote esp_wifi_remote.c ${IDF_VER_DIR}/esp_wifi_with_remote.c esp_wifi_remote_net.c) -endif() - -if(CONFIG_ESP_WIFI_REMOTE_LIBRARY_EPPP) - set(src_wifi_remote_eppp eppp/wifi_remote_rpc_client.cpp eppp/wifi_remote_rpc_server.cpp eppp/eppp_init.c) -else() - set(src_wifi_remote_weak ${IDF_VER_DIR}/esp_wifi_remote_weak.c) -endif() - -idf_component_register(INCLUDE_DIRS include ${IDF_VER_DIR}/include - SRCS ${src_wifi_remote_weak} - ${src_wifi_remote_eppp} - ${src_wifi_is_remote} - PRIV_INCLUDE_DIRS eppp - REQUIRES esp_event esp_netif - PRIV_REQUIRES esp_wifi esp-tls vfs) - -idf_component_get_property(wifi esp_wifi COMPONENT_LIB) -target_link_libraries(${wifi} PUBLIC ${COMPONENT_LIB}) diff --git a/components/esp_wifi_remote/Kconfig b/components/esp_wifi_remote/Kconfig deleted file mode 100644 index 45b4bc5d47..0000000000 --- a/components/esp_wifi_remote/Kconfig +++ /dev/null @@ -1,14 +0,0 @@ -menu "Wi-Fi Remote" - config ESP_WIFI_REMOTE_ENABLED - bool - default y - - orsource "./idf_v$ESP_IDF_VERSION/Kconfig.slave_select.in" - orsource "./idf_v$ESP_IDF_VERSION/Kconfig.soc_wifi_caps.in" - orsource "./Kconfig.rpc.in" - - menu "Wi-Fi configuration" - orsource "./idf_v$ESP_IDF_VERSION/Kconfig.wifi.in" - endmenu - -endmenu # Wi-Fi Remote diff --git a/components/esp_wifi_remote/Kconfig.rpc.in b/components/esp_wifi_remote/Kconfig.rpc.in deleted file mode 100644 index cd6ac8bb17..0000000000 --- a/components/esp_wifi_remote/Kconfig.rpc.in +++ /dev/null @@ -1,74 +0,0 @@ -choice ESP_WIFI_REMOTE_LIBRARY - prompt "Choose WiFi-remote implementation" - default ESP_WIFI_REMOTE_LIBRARY_HOSTED - help - Select type of WiFi Remote implementation - - ESP-HOSTED is the default and most versatile option. - It's also possible to use EPPP, which uses PPPoS link between micros and NAPT, so it's slower - and less universal. - - config ESP_WIFI_REMOTE_LIBRARY_HOSTED - bool "ESP-HOSTED" - config ESP_WIFI_REMOTE_LIBRARY_EPPP - bool "EPPP" -endchoice - - if ESP_WIFI_REMOTE_LIBRARY_EPPP - - config ESP_WIFI_REMOTE_EPPP_UART_TX_PIN - int "TXD Pin Number" - default 10 - range 0 31 - help - Pin number of UART TX. - - config ESP_WIFI_REMOTE_EPPP_UART_RX_PIN - int "RXD Pin Number" - default 11 - range 0 31 - help - Pin number of UART RX. - - config ESP_WIFI_REMOTE_EPPP_NETIF_PRIORITY - int "Routing priority of eppp netif" - default 100 - range 0 256 - help - Set the priority of the wifi-remote netif. - The bigger the number the higher the priority. - The interface which is up and with the highest priority will act as a default GW. - - config ESP_WIFI_REMOTE_EPPP_NETIF_DESCRIPTION - string "eppp network interface description" - default "example_netif_sta" - help - Textual description of the wifi remote network interface. - By default it is set to "example_netif_sta" to be used in IDF protocol example - as default wifi station substitution. - - config ESP_WIFI_REMOTE_EPPP_SERVER_CA - string "Servers CA certificate" - default "--- Please copy content of the CA certificate ---" - - config ESP_WIFI_REMOTE_EPPP_CLIENT_CRT - string "Client certificate" - default "--- Please copy content of the Client certificate ---" - - config ESP_WIFI_REMOTE_EPPP_CLIENT_KEY - string "Client key" - default "--- Please copy content of the Client key ---" - - config ESP_WIFI_REMOTE_EPPP_CLIENT_CA - string "Clients CA certificate" - default "--- Please copy content of the CA certificate ---" - - config ESP_WIFI_REMOTE_EPPP_SERVER_CRT - string "Server certificate" - default "--- Please copy content of the Client certificate ---" - - config ESP_WIFI_REMOTE_EPPP_SERVER_KEY - string "Server key" - default "--- Please copy content of the Client key ---" - - endif diff --git a/components/esp_wifi_remote/README.md b/components/esp_wifi_remote/README.md deleted file mode 100644 index f15c9dbeeb..0000000000 --- a/components/esp_wifi_remote/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# esp_wifi_remote - -[![Component Registry](https://components.espressif.com/components/espressif/esp_wifi_remote/badge.svg)](https://components.espressif.com/components/espressif/esp_wifi_remote) - -The `esp_wifi_remote` component is designed to extend WiFi functionality to ESP chipsets that lack native WiFi support. By simply adding a dependency to this component from your project, you gain access to WiFi capabilities via the WiFi-remote menuconfig and standard `esp_wifi` interface. - -Moreover, `esp_wifi_remote` can be utilized on ESP chipsets that do support native WiFi, providing an additional WiFi interface through the `esp_wifi_remote` API. - -To employ this component, a slave device -- capable of WiFi connectivity -- must be connected to your target device in a specified manner, as defined by the transport layer of [`esp_hosted`](https://github.com/espressif/esp-hosted). - -Functionally, `esp_wifi_remote` wraps the public API of `esp_wifi`, offering a set of function call namespaces prefixed with esp_wifi_remote. These calls are translated into Remote Procedure Calls (RPC) to another target device (referred to as the "slave" device), which then executes the appropriate `esp_wifi` APIs. - -Notably, `esp_wifi_remote` heavily relies on a specific version of the `esp_wifi` component. Consequently, the majority of its headers, sources, and configuration files are pre-generated based on the actual version of `esp_wifi`. - -It's important to highlight that `esp_wifi_remote` does not directly implement the RPC calls; rather, it relies on dependencies for this functionality. Presently, only esp_hosted is supported to provide the RPC functionality required by esp_wifi_remote. - - -## Dependencies on `esp_wifi` - -Public API needs to correspond exactly to the `esp_wifi` API. Some of the internal types depend on the actual wifi target, as well as some default configuration values. Therefore it's easier to maintain consistency between this component and the exact version of `esp_wifi` automatically in CI: - -* We extract function prototypes from `esp_wifi.h` and use them to generate `esp_wifi_remote` function declarations. -* We process the local `esp_wifi_types_native.h` and replace `CONFIG_IDF_TARGET` to `CONFIG_SLAVE_IDF_TARGET` and `CONFIG_SOC_WIFI_...` to `CONFIG_SLAVE_....` -* Similarly we process `esp_wifi`'s Kconfig, so the dependencies are on the slave target and slave SOC capabilities. - -Please check the [README.md](./scripts/README.md) for more details on the generation step and testing consistency. diff --git a/components/esp_wifi_remote/eppp/eppp_init.c b/components/esp_wifi_remote/eppp/eppp_init.c deleted file mode 100644 index 94bf8f585c..0000000000 --- a/components/esp_wifi_remote/eppp/eppp_init.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include "esp_log.h" -#include "esp_wifi.h" -#include "eppp_link.h" - -__attribute__((weak)) esp_netif_t *wifi_remote_eppp_init(eppp_type_t role) -{ - uint32_t our_ip = role == EPPP_SERVER ? EPPP_DEFAULT_SERVER_IP() : EPPP_DEFAULT_CLIENT_IP(); - uint32_t their_ip = role == EPPP_SERVER ? EPPP_DEFAULT_CLIENT_IP() : EPPP_DEFAULT_SERVER_IP(); - eppp_config_t config = EPPP_DEFAULT_CONFIG(our_ip, their_ip); - // We currently support only UART transport - config.transport = EPPP_TRANSPORT_UART; - config.uart.tx_io = CONFIG_ESP_WIFI_REMOTE_EPPP_UART_TX_PIN; - config.uart.rx_io = CONFIG_ESP_WIFI_REMOTE_EPPP_UART_RX_PIN; - config.ppp.netif_description = CONFIG_ESP_WIFI_REMOTE_EPPP_NETIF_DESCRIPTION; - config.ppp.netif_prio = CONFIG_ESP_WIFI_REMOTE_EPPP_NETIF_PRIORITY; - return eppp_open(role, &config, portMAX_DELAY); -} diff --git a/components/esp_wifi_remote/eppp/wifi_remote_rpc_client.cpp b/components/esp_wifi_remote/eppp/wifi_remote_rpc_client.cpp deleted file mode 100644 index 53fd5c9030..0000000000 --- a/components/esp_wifi_remote/eppp/wifi_remote_rpc_client.cpp +++ /dev/null @@ -1,318 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include -#include -#include -#include "esp_log.h" -#include "esp_tls.h" -#include "esp_wifi.h" -#include "esp_check.h" -#include "wifi_remote_rpc_impl.hpp" -#include "eppp_link.h" -#include "freertos/FreeRTOS.h" -#include "freertos/event_groups.h" -#include "wifi_remote_rpc_params.h" - -extern "C" esp_netif_t *wifi_remote_eppp_init(eppp_type_t role); - -namespace eppp_rpc { - -namespace client { -const char *TAG = "rpc_client"; - -const unsigned char ca_crt[] = "-----BEGIN CERTIFICATE-----\n" CONFIG_ESP_WIFI_REMOTE_EPPP_SERVER_CA "\n-----END CERTIFICATE-----"; -const unsigned char crt[] = "-----BEGIN CERTIFICATE-----\n" CONFIG_ESP_WIFI_REMOTE_EPPP_CLIENT_CRT "\n-----END CERTIFICATE-----"; -const unsigned char key[] = "-----BEGIN PRIVATE KEY-----\n" CONFIG_ESP_WIFI_REMOTE_EPPP_CLIENT_KEY "\n-----END PRIVATE KEY-----"; -// TODO: Add option to supply keys and certs via a global symbol (file) - -} - -using namespace client; - -class Sync { - friend class RpcInstance; -public: - void lock() - { - xSemaphoreTake(mutex, portMAX_DELAY); - } - void unlock() - { - xSemaphoreGive(mutex); - } - esp_err_t init() - { - mutex = xSemaphoreCreateMutex(); - events = xEventGroupCreate(); - return mutex == nullptr || events == nullptr ? ESP_ERR_NO_MEM : ESP_OK; - } - esp_err_t wait_for(EventBits_t bits, uint32_t timeout = portMAX_DELAY) - { - return (xEventGroupWaitBits(events, bits, pdTRUE, pdTRUE, timeout) & bits) == bits ? ESP_OK : ESP_FAIL; - } - esp_err_t notify(EventBits_t bits) - { - xEventGroupSetBits(events, bits); - return ESP_OK; - } - ~Sync() - { - if (mutex) { - vSemaphoreDelete(mutex); - } - if (events) { - vEventGroupDelete(events); - } - } - - -private: - SemaphoreHandle_t mutex{nullptr}; - EventGroupHandle_t events{nullptr}; - - const int request = 1; - const int resp_header = 2; - const int resp_payload = 4; - const int restart = 8; -}; - -class RpcInstance { - friend class Sync; -public: - - template - esp_err_t send(api_id id, T *t) - { - pending_resp = id; - ESP_RETURN_ON_ERROR(sync.notify(sync.request), TAG, "failed to notify req"); - ESP_RETURN_ON_ERROR(rpc.send(id, t), TAG, "Failed to send request"); - return ESP_OK; - } - - // overload of the templated method (used for functions with no arguments) - esp_err_t send(api_id id) - { - pending_resp = id; - ESP_RETURN_ON_ERROR(sync.notify(sync.request), TAG, "failed to notify req"); - ESP_RETURN_ON_ERROR(rpc.send(id), TAG, "Failed to send request"); - return ESP_OK; - } - - template - T get_resp(api_id id) - { - sync.wait_for(sync.resp_header); - auto ret = rpc.template get_payload(id, pending_header); - sync.notify(sync.resp_payload); - return ret; - } - esp_err_t init() - { - ESP_RETURN_ON_FALSE(netif = wifi_remote_eppp_init(EPPP_CLIENT), ESP_FAIL, TAG, "Failed to connect to EPPP server"); - ESP_RETURN_ON_ERROR(esp_event_handler_register(IP_EVENT, IP_EVENT_PPP_GOT_IP, got_ip, this), TAG, "Failed to register event"); - ESP_RETURN_ON_ERROR(sync.init(), TAG, "Failed to init sync primitives"); - ESP_RETURN_ON_ERROR(rpc.init(), TAG, "Failed to init RPC engine"); - return xTaskCreate(task, "client", 8192, this, 5, nullptr) == pdTRUE ? ESP_OK : ESP_FAIL; - } - RpcEngine rpc{eppp_rpc::role::CLIENT}; - Sync sync; -private: - api_id pending_resp{api_id::UNDEF}; - RpcHeader pending_header{}; - esp_err_t process_ip_event(RpcHeader &header) - { - auto event = rpc.get_payload(api_id::IP_EVENT, header); - // Now bypass network layers with EPPP interface - ESP_RETURN_ON_ERROR(esp_netif_set_dns_info(netif, ESP_NETIF_DNS_MAIN, &event.dns), TAG, "Failed to set DNS info"); - ESP_RETURN_ON_ERROR(esp_netif_set_default_netif(netif), TAG, "Failed to set default netif to EPPP"); - ip_event_got_ip_t evt = { - .esp_netif = netif, - .ip_info = {}, - .ip_changed = true, - }; - esp_netif_get_ip_info(netif, &evt.ip_info); - ESP_RETURN_ON_ERROR(esp_event_post(IP_EVENT, IP_EVENT_STA_GOT_IP, &evt, sizeof(evt), 0), TAG, "Failed to post IP event"); - ESP_LOGI(TAG, "Main DNS:" IPSTR, IP2STR(&event.dns.ip.u_addr.ip4)); - ESP_LOGI(TAG, "EPPP IP:" IPSTR, IP2STR(&event.ppp_ip.ip)); - ESP_LOGI(TAG, "WIFI IP:" IPSTR, IP2STR(&event.wifi_ip.ip)); - ESP_LOGI(TAG, "WIFI GW:" IPSTR, IP2STR(&event.wifi_ip.gw)); - ESP_LOGI(TAG, "WIFI mask:" IPSTR, IP2STR(&event.wifi_ip.netmask)); - return ESP_OK; - } - esp_err_t process_wifi_event(RpcHeader &header) - { - auto event_id = rpc.get_payload(api_id::WIFI_EVENT, header); - ESP_RETURN_ON_ERROR(esp_event_post(WIFI_EVENT, event_id, nullptr, 0, 0), TAG, "Failed to post WiFi event"); - return ESP_OK; - } - esp_err_t perform() - { - auto header = rpc.get_header(); - if (api_id(header.id) == api_id::ERROR) { // network error - return ESP_FAIL; - } - if (api_id(header.id) == api_id::UNDEF) { // network timeout - return ESP_OK; - } - - if (api_id(header.id) == api_id::IP_EVENT) { - return process_ip_event(header); - } - if (api_id(header.id) == api_id::WIFI_EVENT) { - return process_wifi_event(header); - } - if (sync.wait_for(sync.request, 0) == ESP_OK && api_id(header.id) == pending_resp) { - pending_header = header; - pending_resp = api_id::UNDEF; - sync.notify(sync.resp_header); - sync.wait_for(sync.resp_payload); - return ESP_OK; - } - ESP_LOGE(TAG, "Unexpected header %" PRIi32, static_cast(header.id)); - return ESP_FAIL; - - } - static void task(void *ctx) - { - auto instance = static_cast(ctx); - do { - while (instance->perform() == ESP_OK) {} - } while (instance->restart() == ESP_OK); - vTaskDelete(nullptr); - } - esp_err_t restart() - { - rpc.deinit(); - ESP_RETURN_ON_ERROR(sync.wait_for(sync.restart, pdMS_TO_TICKS(10000)), TAG, "Didn't receive EPPP address in time"); - return rpc.init(); - } - static void got_ip(void *ctx, esp_event_base_t base, int32_t id, void *data) - { - auto instance = static_cast(ctx); - instance->sync.notify(instance->sync.restart); - } - esp_netif_t *netif{nullptr}; -}; - - -namespace client { -constinit RpcInstance instance; -} // namespace client - -RpcInstance *RpcEngine::init_client() -{ - char host[4 * 4 + 1] = {}; // IPv4: 4 x (3 numbers + '.') + \0 - esp_ip4_addr_t ip = { .addr = EPPP_DEFAULT_SERVER_IP() }; - if (esp_ip4addr_ntoa(&ip, host, sizeof(host)) == nullptr) { - return nullptr; - } - - esp_tls_cfg_t cfg = {}; - cfg.cacert_buf = client::ca_crt; - cfg.cacert_bytes = sizeof(client::ca_crt); - cfg.clientcert_buf = client::crt; - cfg.clientcert_bytes = sizeof(client::crt); - cfg.clientkey_buf = client::key; - cfg.clientkey_bytes = sizeof(client::key); - cfg.common_name = "espressif.local"; - - ESP_RETURN_ON_FALSE(tls_ = esp_tls_init(), nullptr, TAG, "Failed to create ESP-TLS instance"); - int retries = 0; - while (esp_tls_conn_new_sync(host, strlen(host), rpc_port, &cfg, tls_) <= 0) { - esp_tls_conn_destroy(tls_); - tls_ = nullptr; - ESP_RETURN_ON_FALSE(retries++ < 3, nullptr, TAG, "Failed to open connection to %s", host); - ESP_LOGW(TAG, "Connection to RPC server failed! Will retry in %d second(s)", retries); - vTaskDelay(pdMS_TO_TICKS(1000 * retries)); - ESP_RETURN_ON_FALSE(tls_ = esp_tls_init(), nullptr, TAG, "Failed to create ESP-TLS instance"); - } - return &client::instance; -} -} // namespace eppp_rpc - -// -// esp_wifi_remote API implementation -// -using namespace eppp_rpc; -using namespace client; - -extern "C" esp_err_t esp_wifi_remote_init(const wifi_init_config_t *config) -{ - // Here we initialize this client's RPC - ESP_RETURN_ON_ERROR(instance.init(), TAG, "Failed to initialize eppp-rpc"); - - std::lock_guard lock(instance.sync); - ESP_RETURN_ON_ERROR(instance.send(api_id::INIT, config), TAG, "Failed to send request"); - return instance.get_resp(api_id::INIT); -} - -extern "C" esp_err_t esp_wifi_remote_set_config(wifi_interface_t interface, wifi_config_t *conf) -{ - esp_wifi_remote_config params = { .interface = interface, .conf = {} }; - memcpy(¶ms.conf, conf, sizeof(wifi_config_t)); - std::lock_guard lock(instance.sync); - ESP_RETURN_ON_ERROR(instance.send(api_id::SET_CONFIG, ¶ms), TAG, "Failed to send request"); - return instance.get_resp(api_id::SET_CONFIG); -} - -extern "C" esp_err_t esp_wifi_remote_start(void) -{ - std::lock_guard lock(instance.sync); - ESP_RETURN_ON_ERROR(instance.send(api_id::START), TAG, "Failed to send request"); - return instance.get_resp(api_id::START); -} - -extern "C" esp_err_t esp_wifi_remote_stop(void) -{ - std::lock_guard lock(instance.sync); - ESP_RETURN_ON_ERROR(instance.send(api_id::STOP), TAG, "Failed to send request"); - return instance.get_resp(api_id::STOP); -} - -extern "C" esp_err_t esp_wifi_remote_connect(void) -{ - std::lock_guard lock(instance.sync); - ESP_RETURN_ON_ERROR(instance.send(api_id::CONNECT), TAG, "Failed to send request"); - return instance.get_resp(api_id::CONNECT); -} - -extern "C" esp_err_t esp_wifi_remote_get_mac(wifi_interface_t ifx, uint8_t mac[6]) -{ - std::lock_guard lock(instance.sync); - ESP_RETURN_ON_ERROR(instance.send(api_id::GET_MAC, &ifx), TAG, "Failed to send request"); - auto ret = instance.get_resp(api_id::GET_MAC); - ESP_LOG_BUFFER_HEXDUMP("MAC", ret.mac, 6, ESP_LOG_DEBUG); - memcpy(mac, ret.mac, 6); - return ret.err; -} - -extern "C" esp_err_t esp_wifi_remote_set_mode(wifi_mode_t mode) -{ - std::lock_guard lock(instance.sync); - ESP_RETURN_ON_ERROR(instance.send(api_id::SET_MODE, &mode), TAG, "Failed to send request"); - return instance.get_resp(api_id::SET_MODE); -} - -extern "C" esp_err_t esp_wifi_remote_deinit(void) -{ - std::lock_guard lock(instance.sync); - ESP_RETURN_ON_ERROR(instance.send(api_id::DEINIT), TAG, "Failed to send request"); - return instance.get_resp(api_id::DEINIT); -} - -extern "C" esp_err_t esp_wifi_remote_disconnect(void) -{ - std::lock_guard lock(instance.sync); - ESP_RETURN_ON_ERROR(instance.send(api_id::DISCONNECT), TAG, "Failed to send request"); - return instance.get_resp(api_id::DISCONNECT); -} - -extern "C" esp_err_t esp_wifi_remote_set_storage(wifi_storage_t storage) -{ - std::lock_guard lock(instance.sync); - ESP_RETURN_ON_ERROR(instance.send(api_id::SET_STORAGE, &storage), TAG, "Failed to send request"); - return instance.get_resp(api_id::SET_STORAGE); -} diff --git a/components/esp_wifi_remote/eppp/wifi_remote_rpc_impl.hpp b/components/esp_wifi_remote/eppp/wifi_remote_rpc_impl.hpp deleted file mode 100644 index 7847533f99..0000000000 --- a/components/esp_wifi_remote/eppp/wifi_remote_rpc_impl.hpp +++ /dev/null @@ -1,179 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -#pragma once -#include -#include - -namespace eppp_rpc { - -static constexpr int rpc_port = 3333; - -/** - * @brief Currently supported RPC commands/events - */ -enum class api_id : uint32_t { - ERROR, - UNDEF, - INIT, - DEINIT, - SET_MODE, - SET_CONFIG, - START, - STOP, - CONNECT, - DISCONNECT, - GET_MAC, - SET_STORAGE, - WIFI_EVENT, - IP_EVENT, -}; - -enum class role { - SERVER, - CLIENT, -}; - -struct RpcHeader { - api_id id; - uint32_t size; -} __attribute((__packed__)); - -/** - * @brief Structure holding the outgoing or incoming parameter - */ -template -struct RpcData { - RpcHeader head; - T value_{}; - explicit RpcData(api_id id) : head{id, sizeof(T)} {} - - uint8_t *value() - { - return (uint8_t *) &value_; - } - - uint8_t *marshall(T *t, size_t &size) - { - size = head.size + sizeof(RpcHeader); - memcpy(value(), t, sizeof(T)); - return (uint8_t *) this; - } -} __attribute((__packed__)); - -/** - * @brief Singleton holding the static data for either the client or server side - */ -class RpcInstance; - -/** - * @brief Engine that implements a simple RPC mechanism - */ -class RpcEngine { -public: - constexpr explicit RpcEngine(role r) : tls_(nullptr), role_(r) {} - - esp_err_t init() - { - if (tls_ != nullptr) { - return ESP_OK; - } - if (role_ == role::CLIENT) { - instance = init_client(); - } - if (role_ == role::SERVER) { - instance = init_server(); - } - return instance == nullptr ? ESP_FAIL : ESP_OK; - } - - void deinit() - { - if (tls_ == nullptr) { - return; - } - if (role_ == role::CLIENT) { - esp_tls_conn_destroy(tls_); - } else if (role_ == role::SERVER) { - esp_tls_server_session_delete(tls_); - } - tls_ = nullptr; - } - - template - esp_err_t send(api_id id, T *t) - { - RpcData req(id); - size_t size; - auto buf = req.marshall(t, size); - ESP_LOGD("rpc", "Sending API id:%d", (int) id); - ESP_LOG_BUFFER_HEXDUMP("rpc", buf, size, ESP_LOG_VERBOSE); - int len = esp_tls_conn_write(tls_, buf, size); - if (len <= 0) { - ESP_LOGE("rpc", "Failed to write data to the connection"); - return ESP_FAIL; - } - return ESP_OK; - } - - esp_err_t send(api_id id) // overload for (void) - { - RpcHeader head = {.id = id, .size = 0}; - int len = esp_tls_conn_write(tls_, &head, sizeof(head)); - if (len <= 0) { - ESP_LOGE("rpc", "Failed to write data to the connection"); - return ESP_FAIL; - } - return ESP_OK; - } - - int get_socket_fd() - { - int sock; - if (esp_tls_get_conn_sockfd(tls_, &sock) != ESP_OK) { - return -1; - } - return sock; - } - - RpcHeader get_header() - { - RpcHeader header{}; - int len = esp_tls_conn_read(tls_, (char *) &header, sizeof(header)); - if (len <= 0) { - if (len < 0 && errno != EAGAIN) { - ESP_LOGE("rpc", "Failed to read header data from the connection %d %s", errno, strerror(errno)); - return {.id = api_id::ERROR, .size = 0}; - } - return {.id = api_id::UNDEF, .size = 0}; - } - return header; - } - - template - T get_payload(api_id id, RpcHeader &head) - { - RpcData resp(id); - if (head.id != id || head.size != resp.head.size) { - ESP_LOGE("rpc", "unexpected header %d %d or sizes %" PRIu32 " %" PRIu32, (int)head.id, (int)id, head.size, resp.head.size); - return {}; - } - int len = esp_tls_conn_read(tls_, (char *) resp.value(), resp.head.size); - if (len <= 0) { - ESP_LOGE("rpc", "Failed to read data from the connection"); - return {}; - } - return resp.value_; - } - -private: - RpcInstance *init_server(); - RpcInstance *init_client(); - esp_tls_t *tls_; - role role_; - RpcInstance *instance{nullptr}; -}; - -}; diff --git a/components/esp_wifi_remote/eppp/wifi_remote_rpc_params.h b/components/esp_wifi_remote/eppp/wifi_remote_rpc_params.h deleted file mode 100644 index 700eae202f..0000000000 --- a/components/esp_wifi_remote/eppp/wifi_remote_rpc_params.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -#pragma once - -struct esp_wifi_remote_config { - wifi_interface_t interface; - wifi_config_t conf; -}; - -struct esp_wifi_remote_mac_t { - esp_err_t err; - uint8_t mac[6]; -}; - -struct esp_wifi_remote_eppp_ip_event { - int32_t id; - esp_netif_ip_info_t wifi_ip; - esp_netif_ip_info_t ppp_ip; - esp_netif_dns_info_t dns; -}; diff --git a/components/esp_wifi_remote/eppp/wifi_remote_rpc_server.cpp b/components/esp_wifi_remote/eppp/wifi_remote_rpc_server.cpp deleted file mode 100644 index 36e7c8bfbc..0000000000 --- a/components/esp_wifi_remote/eppp/wifi_remote_rpc_server.cpp +++ /dev/null @@ -1,383 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include -#include -#include -#include -#include "esp_log.h" -#include "esp_check.h" -#include "esp_tls.h" -#include "esp_wifi.h" -#include "wifi_remote_rpc_impl.hpp" -#include "eppp_link.h" -#include "wifi_remote_rpc_params.h" -#include "lwip/apps/snmp.h" -#include "esp_vfs.h" -#include "esp_vfs_eventfd.h" - -extern "C" esp_netif_t *wifi_remote_eppp_init(eppp_type_t role); - -namespace eppp_rpc { - -namespace server { -const char *TAG = "rpc_server"; - -const unsigned char ca_crt[] = "-----BEGIN CERTIFICATE-----\n" CONFIG_ESP_WIFI_REMOTE_EPPP_CLIENT_CA "\n-----END CERTIFICATE-----"; -const unsigned char crt[] = "-----BEGIN CERTIFICATE-----\n" CONFIG_ESP_WIFI_REMOTE_EPPP_SERVER_CRT "\n-----END CERTIFICATE-----"; -const unsigned char key[] = "-----BEGIN PRIVATE KEY-----\n" CONFIG_ESP_WIFI_REMOTE_EPPP_SERVER_KEY "\n-----END PRIVATE KEY-----"; -// TODO: Add option to supply keys and certs via a global symbol (file) - -} - -using namespace server; - -struct Events { - api_id type; - int32_t id; - esp_wifi_remote_eppp_ip_event *ip_data{nullptr}; - bool clean_ip_data{true}; - esp_err_t create_ip_data() - { - ip_data = new (std::nothrow) esp_wifi_remote_eppp_ip_event; - return ip_data ? ESP_OK : ESP_ERR_NO_MEM; - } - ~Events() - { - if (clean_ip_data) { - delete ip_data; - } - } -}; - -class Sync { - friend class RpcInstance; -public: - esp_err_t put(Events &ev) - { - ESP_RETURN_ON_FALSE(xQueueSend(queue, &ev, pdMS_TO_TICKS(queue_timeout)), ESP_FAIL, TAG, "Failed to queue event %" PRIi32, ev.id); - ev.clean_ip_data = false; // IP data were successfully sent to the queue, will free manually after receiving from it - uint64_t event_queued = 1; - write(fd, &event_queued, sizeof(event_queued)); // trigger the wait loop that - return ESP_OK; - } - Events get() - { - Events ev{}; - if (!xQueueReceive(queue, &ev, 0)) { - ev.type = api_id::ERROR; - } - return ev; - } - esp_err_t init() - { - queue = xQueueCreate(max_items, sizeof(Events)); - esp_vfs_eventfd_config_t config = ESP_VFS_EVENTD_CONFIG_DEFAULT(); - esp_vfs_eventfd_register(&config); - fd = eventfd(0, EFD_SUPPORT_ISR); - return queue == nullptr || fd < 0 ? ESP_ERR_NO_MEM : ESP_OK; - } - ~Sync() - { - if (queue) { - vQueueDelete(queue); - } - if (fd >= 0) { - close(fd); - } - } - int fd{-1}; - // Used to trigger task by either an internal event or rpc command - static const int NONE = 0; - static const int ERROR = 1; - static const int EVENT = 2; - static const int RPC = 4; -private: - QueueHandle_t queue{nullptr}; - const int max_items = 15; - const int queue_timeout = 200; -}; - -class RpcInstance { - friend class Sync; -public: - RpcEngine rpc{role::SERVER}; - int sock{-1}; - - esp_err_t init() - { - ESP_RETURN_ON_FALSE(netif = wifi_remote_eppp_init(EPPP_SERVER), ESP_FAIL, TAG, "Failed to init EPPP connection"); - ESP_RETURN_ON_ERROR(start_server(), TAG, "Failed to start RPC server"); - ESP_RETURN_ON_ERROR(rpc.init(), TAG, "Failed to init RPC engine"); - ESP_RETURN_ON_ERROR(esp_netif_napt_enable(netif), TAG, "Failed to enable NAPT"); - ESP_RETURN_ON_ERROR(sync.init(), TAG, "Failed to init event queue"); - ESP_RETURN_ON_ERROR(esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, handler, this), TAG, "Failed to register event"); - ESP_RETURN_ON_ERROR(esp_event_handler_register(IP_EVENT, ESP_EVENT_ANY_ID, handler, this), TAG, "Failed to register event"); - return xTaskCreate(task, "server", 8192, this, 5, nullptr) == pdTRUE ? ESP_OK : ESP_FAIL; - } - Sync sync; -private: - esp_netif_t *netif{nullptr}; - static void task(void *ctx) - { - auto instance = static_cast(ctx); - while (instance->perform() == ESP_OK) {} - esp_restart(); - } - esp_err_t start_server() - { - struct sockaddr_in dest_addr = {}; - int ret; - int opt = 1; - dest_addr.sin_addr.s_addr = htonl(INADDR_ANY); - dest_addr.sin_family = AF_INET; - dest_addr.sin_port = htons(rpc_port); - int listen_sock = socket(AF_INET, SOCK_STREAM, IPPROTO_IP); - ESP_RETURN_ON_FALSE(listen_sock >= 0, ESP_FAIL, TAG, "Failed to create listening socket"); - setsockopt(listen_sock, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)); - ret = bind(listen_sock, (struct sockaddr *) &dest_addr, sizeof(dest_addr)); - ESP_RETURN_ON_FALSE(ret == 0, ESP_FAIL, TAG, "Failed to bind the listening socket"); - ret = listen(listen_sock, 1); - ESP_RETURN_ON_FALSE(ret == 0, ESP_FAIL, TAG, "Failed to start listening"); - struct sockaddr_storage source_addr {}; - socklen_t addr_len = sizeof(source_addr); - sock = accept(listen_sock, (struct sockaddr *) &source_addr, &addr_len); - ESP_RETURN_ON_FALSE(sock >= 0, ESP_FAIL, TAG, "Failed to accept connections: errno %d", errno); - ESP_LOGI(TAG, "Socket accepted on: %s", inet_ntoa(((struct sockaddr_in *) &source_addr)->sin_addr)); - return ESP_OK; - } - esp_err_t wifi_event(int32_t id) - { - ESP_LOGI(TAG, "Received WIFI event %" PRIi32, id); - Events ev{api_id::WIFI_EVENT, id, nullptr}; - ESP_RETURN_ON_ERROR(sync.put(ev), TAG, "Failed to queue WiFi event"); - return ESP_OK; - } - esp_err_t ip_event(int32_t id, ip_event_got_ip_t *ip_data) - { - ESP_LOGI(TAG, "Received IP event %" PRIi32, id); - Events ev{api_id::IP_EVENT, id, nullptr}; - if (ip_data->esp_netif) { - ESP_RETURN_ON_ERROR(ev.create_ip_data(), TAG, "Failed to allocate event data"); - ev.ip_data->id = id; - ESP_RETURN_ON_ERROR(esp_netif_get_dns_info(ip_data->esp_netif, ESP_NETIF_DNS_MAIN, &ev.ip_data->dns), TAG, "Failed to get DNS info"); - ESP_LOGI(TAG, "Main DNS:" IPSTR, IP2STR(&ev.ip_data->dns.ip.u_addr.ip4)); - memcpy(&ev.ip_data->wifi_ip, &ip_data->ip_info, sizeof(ev.ip_data->wifi_ip)); - ESP_RETURN_ON_ERROR(esp_netif_get_ip_info(netif, &ev.ip_data->ppp_ip), TAG, "Failed to get IP info"); - ESP_LOGI(TAG, "IP address:" IPSTR, IP2STR(&ip_data->ip_info.ip)); - } - ESP_RETURN_ON_ERROR(sync.put(ev), TAG, "Failed to queue IP event"); - return ESP_OK; - } - static void handler(void *ctx, esp_event_base_t base, int32_t id, void *data) - { - auto instance = static_cast(ctx); - if (base == WIFI_EVENT) { - instance->wifi_event(id); - } else if (base == IP_EVENT) { - auto *ip_data = (ip_event_got_ip_t *)data; - instance->ip_event(id, ip_data); - } - } - int select() - { - struct timeval timeout = { .tv_sec = 1, .tv_usec = 0}; - int rpc_sock = rpc.get_socket_fd(); - - ESP_RETURN_ON_FALSE(rpc_sock != -1, Sync::ERROR, TAG, "failed ot get rpc socket"); - fd_set readset; - fd_set errset; - FD_ZERO(&readset); - FD_ZERO(&errset); - FD_SET(rpc_sock, &readset); - FD_SET(sync.fd, &readset); - FD_SET(rpc_sock, &errset); - int ret = ::select(std::max(rpc_sock, 5) + 1, &readset, nullptr, &errset, &timeout); - if (ret == 0) { - ESP_LOGV(TAG, "poll_read: select - Timeout before any socket was ready!"); - return Sync::NONE; - } - if (ret < 0) { - ESP_LOGE(TAG, "select error: %d", errno); - return Sync::ERROR; - } - if (FD_ISSET(rpc_sock, &errset)) { - int sock_errno = 0; - uint32_t optlen = sizeof(sock_errno); - getsockopt(rpc_sock, SOL_SOCKET, SO_ERROR, &sock_errno, &optlen); - ESP_LOGE(TAG, "select failed, socket errno = %d", sock_errno); - return Sync::ERROR; - } - int result = Sync::NONE; - if (FD_ISSET(rpc_sock, &readset)) { - result |= Sync::RPC; - } - if (FD_ISSET(sync.fd, &readset)) { - result |= Sync::EVENT; - } - return result; - } - esp_err_t marshall_events() - { - api_id type; - do { - Events ev = sync.get(); - type = ev.type; - if (ev.type == api_id::WIFI_EVENT) { - ESP_RETURN_ON_ERROR(rpc.send(api_id::WIFI_EVENT, &ev.id), TAG, "Failed to marshall WiFi event"); - } else if (ev.type == api_id::IP_EVENT && ev.ip_data) { - ESP_RETURN_ON_ERROR(rpc.send(api_id::IP_EVENT, ev.ip_data), TAG, "Failed to marshal IP event"); - } - } while (type != api_id::ERROR); - return ESP_OK; - } - esp_err_t perform() - { - auto res = select(); - if (res == Sync::ERROR) { - return ESP_FAIL; - } - if (res & Sync::EVENT) { - uint64_t data; - read(sync.fd, &data, sizeof(data)); - if (marshall_events() != ESP_OK) { - return ESP_FAIL; - } - } - if (res & Sync::RPC) { - if (handle_commands() != ESP_OK) { - return ESP_FAIL; - } - } - return ESP_OK; - } - - esp_err_t handle_commands() - { - auto header = rpc.get_header(); - ESP_LOGI(TAG, "Received header id %d", (int) header.id); - switch (header.id) { - case api_id::SET_MODE: { - auto req = rpc.get_payload(api_id::SET_MODE, header); - auto ret = esp_wifi_set_mode(req); - if (rpc.send(api_id::SET_MODE, &ret) != ESP_OK) { - return ESP_FAIL; - } - break; - } - case api_id::INIT: { - auto req = rpc.get_payload(api_id::INIT, header); - req.osi_funcs = &g_wifi_osi_funcs; - req.wpa_crypto_funcs = g_wifi_default_wpa_crypto_funcs; - auto ret = esp_wifi_init(&req); - if (rpc.send(api_id::INIT, &ret) != ESP_OK) { - return ESP_FAIL; - } - break; - } - case api_id::SET_CONFIG: { - auto req = rpc.get_payload(api_id::SET_CONFIG, header); - auto ret = esp_wifi_set_config(req.interface, &req.conf); - if (rpc.send(api_id::SET_CONFIG, &ret) != ESP_OK) { - return ESP_FAIL; - } - break; - } - case api_id::START: { - if (header.size != 0) { - return ESP_FAIL; - } - - auto ret = esp_wifi_start(); - if (rpc.send(api_id::START, &ret) != ESP_OK) { - return ESP_FAIL; - } - break; - } - case api_id::CONNECT: { - if (header.size != 0) { - return ESP_FAIL; - } - - auto ret = esp_wifi_connect(); - if (rpc.send(api_id::CONNECT, &ret) != ESP_OK) { - return ESP_FAIL; - } - break; - } - case api_id::DISCONNECT: { - if (header.size != 0) { - return ESP_FAIL; - } - - auto ret = esp_wifi_disconnect(); - if (rpc.send(api_id::DISCONNECT, &ret) != ESP_OK) { - return ESP_FAIL; - } - break; - } - case api_id::DEINIT: { - if (header.size != 0) { - return ESP_FAIL; - } - - auto ret = esp_wifi_deinit(); - if (rpc.send(api_id::DEINIT, &ret) != ESP_OK) { - return ESP_FAIL; - } - break; - } - case api_id::SET_STORAGE: { - auto req = rpc.get_payload(api_id::SET_STORAGE, header); - auto ret = esp_wifi_set_storage(req); - if (rpc.send(api_id::SET_STORAGE, &ret) != ESP_OK) { - return ESP_FAIL; - } - break; - } - case api_id::GET_MAC: { - auto req = rpc.get_payload(api_id::GET_MAC, header); - esp_wifi_remote_mac_t resp = {}; - resp.err = esp_wifi_get_mac(req, resp.mac); - if (rpc.send(api_id::GET_MAC, &resp) != ESP_OK) { - return ESP_FAIL; - } - break; - } - default: - return ESP_FAIL; - } - return ESP_OK; - } -}; - - -namespace server { -constinit RpcInstance instance; -} - -RpcInstance *RpcEngine::init_server() -{ - esp_tls_cfg_server_t cfg = {}; - cfg.cacert_buf = server::ca_crt; - cfg.cacert_bytes = sizeof(server::ca_crt); - cfg.servercert_buf = server::crt; - cfg.servercert_bytes = sizeof(server::crt); - cfg.serverkey_buf = server::key; - cfg.serverkey_bytes = sizeof(server::key); - - ESP_RETURN_ON_FALSE(tls_ = esp_tls_init(), nullptr, TAG, "Failed to create ESP-TLS instance"); - ESP_RETURN_ON_FALSE(esp_tls_server_session_create(&cfg, server::instance.sock, tls_) == ESP_OK, nullptr, TAG, "Failed to create TLS session"); - return &server::instance; -} - -} // namespace eppp_rpc - -using namespace eppp_rpc; - -extern "C" esp_err_t server_init(void) -{ - return server::instance.init(); -} diff --git a/components/esp_wifi_remote/esp_wifi_remote.c b/components/esp_wifi_remote/esp_wifi_remote.c deleted file mode 100644 index adf9fe3856..0000000000 --- a/components/esp_wifi_remote/esp_wifi_remote.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "esp_wifi.h" -#include "esp_log.h" -#include "esp_wifi_remote.h" - -#define WEAK __attribute__((weak)) - -WEAK ESP_EVENT_DEFINE_BASE(WIFI_EVENT); - -#if !CONFIG_SOC_WIFI_SUPPORTED -struct wifi_osi_funcs_t { }; -#endif - -WEAK wifi_osi_funcs_t g_wifi_osi_funcs; -WEAK const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs; -WEAK uint64_t g_wifi_feature_caps = -#if CONFIG_ESP_WIFI_ENABLE_WPA3_SAE - CONFIG_FEATURE_WPA3_SAE_BIT | -#endif -#if CONFIG_SPIRAM - CONFIG_FEATURE_CACHE_TX_BUF_BIT | -#endif -#if CONFIG_ESP_WIFI_FTM_INITIATOR_SUPPORT - CONFIG_FEATURE_FTM_INITIATOR_BIT | -#endif -#if CONFIG_ESP_WIFI_FTM_RESPONDER_SUPPORT - CONFIG_FEATURE_FTM_RESPONDER_BIT | -#endif - 0; diff --git a/components/esp_wifi_remote/esp_wifi_remote_net.c b/components/esp_wifi_remote/esp_wifi_remote_net.c deleted file mode 100644 index 6c56b420ff..0000000000 --- a/components/esp_wifi_remote/esp_wifi_remote_net.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include -#include "esp_err.h" -#include "esp_wifi_remote.h" -#include "esp_log.h" - -#define CHANNELS 2 -#define WEAK __attribute__((weak)) - -static esp_remote_channel_tx_fn_t s_tx_cb[CHANNELS]; -static esp_remote_channel_t s_channel[CHANNELS]; -static wifi_rxcb_t s_rx_fn[CHANNELS]; - -WEAK esp_err_t esp_wifi_remote_channel_rx(void *h, void *buffer, void *buff_to_free, size_t len) -{ - assert(h); - if (h == s_channel[0] && s_rx_fn[0]) { - return s_rx_fn[0](buffer, len, buff_to_free); - } - if (h == s_channel[1] && s_rx_fn[1]) { - return s_rx_fn[1](buffer, len, buff_to_free); - } - return ESP_FAIL; -} - -WEAK esp_err_t esp_wifi_remote_channel_set(wifi_interface_t ifx, void *h, esp_remote_channel_tx_fn_t tx_cb) -{ - if (ifx == WIFI_IF_STA) { - s_channel[0] = h; - s_tx_cb[0] = tx_cb; - return ESP_OK; - } - if (ifx == WIFI_IF_AP) { - s_channel[1] = h; - s_tx_cb[1] = tx_cb; - return ESP_OK; - } - return ESP_FAIL; -} - -WEAK esp_err_t esp_wifi_internal_set_sta_ip(void) -{ - // TODO: Pass this information to the slave target - // Note that this function is called from the default event loop, so we shouldn't block here - return ESP_OK; -} - -WEAK esp_err_t esp_wifi_internal_reg_netstack_buf_cb(wifi_netstack_buf_ref_cb_t ref, wifi_netstack_buf_free_cb_t free) -{ - return ESP_OK; -} - -WEAK void esp_wifi_internal_free_rx_buffer(void *buffer) -{ - free(buffer); -} - -WEAK esp_err_t esp_wifi_internal_tx_by_ref(wifi_interface_t ifx, void *buffer, size_t len, void *netstack_buf) -{ - return esp_wifi_internal_tx(ifx, buffer, (uint16_t)len); -} - -WEAK int esp_wifi_internal_tx(wifi_interface_t ifx, void *buffer, uint16_t len) -{ - if (ifx == WIFI_IF_STA && s_tx_cb[0]) { - - /* TODO: If not needed, remove arg3 */ - return s_tx_cb[0](s_channel[0], buffer, len); - } - if (ifx == WIFI_IF_AP && s_tx_cb[1]) { - return s_tx_cb[1](s_channel[1], buffer, len); - } - - return -1; -} - -WEAK esp_err_t esp_wifi_internal_reg_rxcb(wifi_interface_t ifx, wifi_rxcb_t fn) -{ - if (ifx == WIFI_IF_STA) { - ESP_LOGI("esp_wifi_remote", "%s: sta: %p", __func__, fn); - s_rx_fn[0] = fn; - return ESP_OK; - } - if (ifx == WIFI_IF_AP) { - s_rx_fn[1] = fn; - return ESP_OK; - } - - return ESP_FAIL; -} diff --git a/components/esp_wifi_remote/examples/mqtt/CMakeLists.txt b/components/esp_wifi_remote/examples/mqtt/CMakeLists.txt deleted file mode 100644 index 500c42d77f..0000000000 --- a/components/esp_wifi_remote/examples/mqtt/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -# This project serves as a demo to enable using esp-mqtt on ESP platform targets as well as on linux -cmake_minimum_required(VERSION 3.16) - -include($ENV{IDF_PATH}/tools/cmake/project.cmake) -project(esp_mqtt_demo) diff --git a/components/esp_wifi_remote/examples/mqtt/README.md b/components/esp_wifi_remote/examples/mqtt/README.md deleted file mode 100644 index 0c81f4e210..0000000000 --- a/components/esp_wifi_remote/examples/mqtt/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# MQTT application running on WiFi station - -This is a simple mqtt demo, that connects to WiFi AP first. This application has a dependency to `esp_wifi_remote`, so that if it's build and executed on a chipset without WiFI capabilities it redirects all wifi calls the remote target. - -## Overview - -When running this example on a target that doesn't natively support WiFi, please make sure that the remote target (slave application) is connected to your chipset via the configured transport interface. - -Connection to the slave device also depends on RPC library used. It is recommended to use [`esp_hosted`](https://github.com/espressif/esp-hosted). Alternatively you can use [`eppp_link`](https://components.espressif.com/components/espressif/eppp_link). - -Please note, that `esp_hosted` as a component is currently WIP, so the `wifi_remote` defaults to `eppp`, for now. - -## HW connection - -We currently support only `UART` transport, so the connection is very simple. You only need to connect Rx, Tx and GND with the remote target. -You need to configure these fields according to your connection: -* CONFIG_ESP_WIFI_REMOTE_EPPP_UART_TX_PIN -* CONFIG_ESP_WIFI_REMOTE_EPPP_UART_RX_PIN - -## SW configuration - -The RPC mechanism between the host and the slave micro uses TLS with mutual authentication, so you would have to configure certificates and keys for both parties. This application -- host target -- is considered RPC client, so it needs client's certificate and key, as well as the CA certificate to validate the server (slave application). -If self-signed certificates are acceptable, you can use [generate_test_certs](../test_certs/generate_test_certs.sh) script to generate both the CA and the keys itself and convert them to the PEM format that's accepted by the EPPP RPC engine. -You will have to configure these options: -* CONFIG_ESP_WIFI_REMOTE_EPPP_SERVER_CA -* CONFIG_ESP_WIFI_REMOTE_EPPP_CLIENT_CRT -* CONFIG_ESP_WIFI_REMOTE_EPPP_CLIENT_KEY - -## Setting up slave device - -You need to set up the connection and configuration in a similar way on the slave part (connection pins + certificates and keys). Please refer to the [slave_application](../server/README.md) README for more information. diff --git a/components/esp_wifi_remote/examples/mqtt/main/CMakeLists.txt b/components/esp_wifi_remote/examples/mqtt/main/CMakeLists.txt deleted file mode 100644 index d6e9824b85..0000000000 --- a/components/esp_wifi_remote/examples/mqtt/main/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -idf_component_register(SRCS "app_main.c" - INCLUDE_DIRS ".") - -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/components/esp_wifi_remote/examples/mqtt/main/Kconfig.projbuild b/components/esp_wifi_remote/examples/mqtt/main/Kconfig.projbuild deleted file mode 100644 index 7ad4dc25ea..0000000000 --- a/components/esp_wifi_remote/examples/mqtt/main/Kconfig.projbuild +++ /dev/null @@ -1,21 +0,0 @@ -menu "Example Configuration" - - config BROKER_URL - string "Broker URL" - default "mqtt://mqtt.eclipseprojects.io" - help - URL of the broker to connect to - - config ESP_WIFI_SSID - string "WiFi SSID" - default "myssid" - help - SSID (network name) for the example to connect to. - - config ESP_WIFI_PASSWORD - string "WiFi Password" - default "mypassword" - help - WiFi password (WPA or WPA2) for the example to use. - -endmenu diff --git a/components/esp_wifi_remote/examples/mqtt/main/app_main.c b/components/esp_wifi_remote/examples/mqtt/main/app_main.c deleted file mode 100644 index 07b60abdf7..0000000000 --- a/components/esp_wifi_remote/examples/mqtt/main/app_main.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Unlicense OR CC0-1.0 - */ -#include -#include -#include -#include -#include "esp_system.h" -#include "nvs_flash.h" -#include "esp_event.h" -#include "esp_netif.h" -#include "esp_netif.h" -#include "esp_system.h" -#include "freertos/FreeRTOS.h" -#include "freertos/event_groups.h" -#include "esp_system.h" -#include "esp_wifi.h" - -#include "esp_log.h" -#include "mqtt_client.h" - -static const char *TAG = "esp_mqtt_demo"; -static EventGroupHandle_t s_wifi_event_group; -static int s_retry_num = 0; - -#define WIFI_CONNECTED_BIT BIT0 -#define WIFI_FAIL_BIT BIT1 - -#define EXAMPLE_ESP_WIFI_SSID CONFIG_ESP_WIFI_SSID -#define EXAMPLE_ESP_WIFI_PASS CONFIG_ESP_WIFI_PASSWORD -#define EXAMPLE_ESP_MAXIMUM_RETRY 5 - -static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_t event_id, void *event_data) -{ - ESP_LOGD(TAG, "Event dispatched from event loop base=%s, event_id=%d", base, event_id); - esp_mqtt_event_handle_t event = (esp_mqtt_event_handle_t)event_data; - esp_mqtt_client_handle_t client = event->client; - int msg_id; - switch ((esp_mqtt_event_id_t)event_id) { - case MQTT_EVENT_CONNECTED: - ESP_LOGI(TAG, "MQTT_EVENT_CONNECTED"); - msg_id = esp_mqtt_client_publish(client, "/topic/qos1", "data_3", 0, 1, 0); - ESP_LOGI(TAG, "sent publish successful, msg_id=%d", msg_id); - - msg_id = esp_mqtt_client_subscribe(client, "/topic/qos0", 0); - ESP_LOGI(TAG, "sent subscribe successful, msg_id=%d", msg_id); - - msg_id = esp_mqtt_client_subscribe(client, "/topic/qos1", 1); - ESP_LOGI(TAG, "sent subscribe successful, msg_id=%d", msg_id); - - msg_id = esp_mqtt_client_unsubscribe(client, "/topic/qos1"); - ESP_LOGI(TAG, "sent unsubscribe successful, msg_id=%d", msg_id); - break; - case MQTT_EVENT_DISCONNECTED: - ESP_LOGI(TAG, "MQTT_EVENT_DISCONNECTED"); - break; - - case MQTT_EVENT_SUBSCRIBED: - ESP_LOGI(TAG, "MQTT_EVENT_SUBSCRIBED, msg_id=%d", event->msg_id); - msg_id = esp_mqtt_client_publish(client, "/topic/qos0", "data", 0, 0, 0); - ESP_LOGI(TAG, "sent publish successful, msg_id=%d", msg_id); - break; - case MQTT_EVENT_UNSUBSCRIBED: - ESP_LOGI(TAG, "MQTT_EVENT_UNSUBSCRIBED, msg_id=%d", event->msg_id); - break; - case MQTT_EVENT_PUBLISHED: - ESP_LOGI(TAG, "MQTT_EVENT_PUBLISHED, msg_id=%d", event->msg_id); - break; - case MQTT_EVENT_DATA: - ESP_LOGI(TAG, "MQTT_EVENT_DATA"); - printf("TOPIC=%.*s\r\n", event->topic_len, event->topic); - printf("DATA=%.*s\r\n", event->data_len, event->data); - break; - case MQTT_EVENT_ERROR: - ESP_LOGI(TAG, "MQTT_EVENT_ERROR"); - break; - default: - ESP_LOGI(TAG, "Other event id:%d", event->event_id); - break; - } -} - -static void mqtt_app_start(void) -{ - esp_mqtt_client_config_t mqtt_cfg = {}; - mqtt_cfg.broker.address.uri = CONFIG_BROKER_URL; - mqtt_cfg.credentials.client_id = "idf_on_linux_client"; - - esp_mqtt_client_handle_t client = esp_mqtt_client_init(&mqtt_cfg); - /* The last argument may be used to pass data to the event handler, in this example mqtt_event_handler */ - esp_mqtt_client_register_event(client, (esp_mqtt_event_id_t)ESP_EVENT_ANY_ID, mqtt_event_handler, NULL); - esp_mqtt_client_start(client); -} - -static void event_handler(void *arg, esp_event_base_t event_base, - int32_t event_id, void *event_data) -{ - ESP_LOGI(TAG, "EVENT type %s id %d", event_base, (int)event_id); - if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_START) { - esp_wifi_connect(); - } else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED) { - if (s_retry_num < EXAMPLE_ESP_MAXIMUM_RETRY) { - esp_wifi_connect(); - s_retry_num++; - ESP_LOGI(TAG, "retry to connect to the AP"); - } else { - xEventGroupSetBits(s_wifi_event_group, WIFI_FAIL_BIT); - } - ESP_LOGI(TAG, "connect to the AP fail"); - } else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) { - ip_event_got_ip_t *event = (ip_event_got_ip_t *) event_data; - ESP_LOGI(TAG, "got ip:" IPSTR, IP2STR(&event->ip_info.ip)); - s_retry_num = 0; - xEventGroupSetBits(s_wifi_event_group, WIFI_CONNECTED_BIT); - } -} - -static void wifi_init_sta() -{ - s_wifi_event_group = xEventGroupCreate(); - - ESP_ERROR_CHECK(esp_netif_init()); - - ESP_ERROR_CHECK(esp_event_loop_create_default()); - esp_netif_create_default_wifi_sta(); - - wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); - ESP_ERROR_CHECK(esp_wifi_init(&cfg)); - - esp_event_handler_instance_t instance_any_id; - esp_event_handler_instance_t instance_got_ip; - ESP_ERROR_CHECK(esp_event_handler_instance_register(WIFI_EVENT, - ESP_EVENT_ANY_ID, - &event_handler, - NULL, - &instance_any_id)); - ESP_ERROR_CHECK(esp_event_handler_instance_register(IP_EVENT, - IP_EVENT_STA_GOT_IP, - &event_handler, - NULL, - &instance_got_ip)); - - wifi_config_t wifi_config = { - .sta = { - .ssid = EXAMPLE_ESP_WIFI_SSID, - .password = EXAMPLE_ESP_WIFI_PASS, - }, - }; - ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) ); - ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config) ); - ESP_ERROR_CHECK(esp_wifi_start() ); - - ESP_LOGI(TAG, "wifi_init_sta finished."); - - /* Waiting until either the connection is established (WIFI_CONNECTED_BIT) or connection failed for the maximum - * number of re-tries (WIFI_FAIL_BIT). The bits are set by event_handler() (see above) */ - EventBits_t bits = xEventGroupWaitBits(s_wifi_event_group, - WIFI_CONNECTED_BIT | WIFI_FAIL_BIT, - pdFALSE, - pdFALSE, - portMAX_DELAY); - - /* xEventGroupWaitBits() returns the bits before the call returned, hence we can test which event actually - * happened. */ - if (bits & WIFI_CONNECTED_BIT) { - ESP_LOGI(TAG, "connected to ap SSID:%s password:%s", - EXAMPLE_ESP_WIFI_SSID, EXAMPLE_ESP_WIFI_PASS); - } else if (bits & WIFI_FAIL_BIT) { - ESP_LOGI(TAG, "Failed to connect to SSID:%s, password:%s", - EXAMPLE_ESP_WIFI_SSID, EXAMPLE_ESP_WIFI_PASS); - } else { - ESP_LOGE(TAG, "UNEXPECTED EVENT"); - } -} - -void app_main(void) -{ - ESP_LOGI(TAG, "[APP] Startup.."); - ESP_LOGI(TAG, "[APP] Free memory: %d bytes", esp_get_free_heap_size()); - ESP_LOGI(TAG, "[APP] IDF version: %s", esp_get_idf_version()); - - esp_log_level_set("*", ESP_LOG_INFO); - esp_log_level_set("mqtt_client", ESP_LOG_VERBOSE); - esp_log_level_set("esp_mqtt_demo", ESP_LOG_VERBOSE); - esp_log_level_set("transport_base", ESP_LOG_VERBOSE); - esp_log_level_set("esp-tls", ESP_LOG_VERBOSE); - esp_log_level_set("transport", ESP_LOG_VERBOSE); - esp_log_level_set("outbox", ESP_LOG_VERBOSE); - - //Initialize NVS - esp_err_t ret = nvs_flash_init(); - if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) { - ESP_ERROR_CHECK(nvs_flash_erase()); - ret = nvs_flash_init(); - } - ESP_ERROR_CHECK(ret); - - ESP_LOGI(TAG, "ESP_WIFI_MODE_STA"); - wifi_init_sta(); - - mqtt_app_start(); -} diff --git a/components/esp_wifi_remote/examples/mqtt/main/idf_component.yml b/components/esp_wifi_remote/examples/mqtt/main/idf_component.yml deleted file mode 100644 index 88b71aa807..0000000000 --- a/components/esp_wifi_remote/examples/mqtt/main/idf_component.yml +++ /dev/null @@ -1,4 +0,0 @@ -dependencies: - esp_wifi_remote: - version: "*" - override_path: ../../.. diff --git a/components/esp_wifi_remote/examples/mqtt/sdkconfig.ci.p4 b/components/esp_wifi_remote/examples/mqtt/sdkconfig.ci.p4 deleted file mode 100644 index 8ca2fb7ae2..0000000000 --- a/components/esp_wifi_remote/examples/mqtt/sdkconfig.ci.p4 +++ /dev/null @@ -1,5 +0,0 @@ -CONFIG_ESP_WIFI_REMOTE_EPPP_UART_TX_PIN=17 -CONFIG_ESP_WIFI_REMOTE_EPPP_UART_RX_PIN=16 -CONFIG_ESP_WIFI_REMOTE_EPPP_SERVER_CA="MIIDIzCCAgugAwIBAgIULOncUeRLKxgrihIh1kHGGlPV7ecwDQYJKoZIhvcNAQELBQAwITELMAkGA1UEBhMCQ1oxEjAQBgNVBAMMCUVzcHJlc3NpZjAeFw0yNDA0MDMwOTE0MjNaFw0zNDA0MDEwOTE0MjNaMCExCzAJBgNVBAYTAkNaMRIwEAYDVQQDDAlFc3ByZXNzaWYwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCbayaZAuzQWrwRj3oiFP9AZK0ECaDvVlJec4M6yokded1pqNY+bNmA7VsHSQkf3d1rO1G5GwEXoMPli15m7rJodq9iYp1J2LhLhpKDNapm19reyH9A4rAfjSyk/WyvT+3Y5sNHVFdE2t1EetOyzy90CfOHT9JfWG9PiV6b1W65CqgjJVCHMWioppVAGQCoN+mDBf1VhD4am6onei+ijHdALJDfp74mSIOJGulm/IR7504s+yy7068PQ05V/wHkmd9O1Iww5fnJdRh2KvTFZVOB5u9y54MTJb0sGZj+JfxIbcFiIWAykLFVWBk5PO6yj8fNMmk/Ogb2K4wo7AZnJ3qBAgMBAAGjUzBRMB0GA1UdDgQWBBT3j77hJHm/hI34fEn3tocHqB4INzAfBgNVHSMEGDAWgBT3j77hJHm/hI34fEn3tocHqB4INzAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQBstXfBIRvqZp4OBQ2kCJig/CErcfdB4qQOS2LzQmpIOUQ4d/zvZOQD2WIw/x2Rd1/hto/+f57pOZNHsi8vfX2Z7kPOlD9ZG1wTznl1v8wOMP01AFJuVtmJQV0C4lVupb2/Mmu42xqP9pr/uL5pJ2rFb8ujl2xakhSvYVdMONtZL0mh9+hdnUb7Fj7KI3qWxzc7+uXGjCzh6LkOmcMBOB6+0V6xW2NVpUUPtuXytK0t2oyWpDvwFIrl0J6qBNRlH1ON1iz33HOo73IjprMNx3hIo5y/N8+TTxY6KEegbP67hSnJJhQ7tezoOu4OE0xmJp0XmGPMNewYARqL2UvHnZyf" -CONFIG_ESP_WIFI_REMOTE_EPPP_CLIENT_CRT="MIICwjCCAaoCFAWE4aJdYWbMJAaBTMxVpoXMrhzvMA0GCSqGSIb3DQEBCwUAMCExCzAJBgNVBAYTAkNaMRIwEAYDVQQDDAlFc3ByZXNzaWYwHhcNMjQwNDAzMDkxNjE4WhcNMzQwNDAxMDkxNjE4WjAaMRgwFgYDVQQDDA9lc3ByZXNzaWYubG9jYWwwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDcjdBQ3sHbfuWRo2LlqZF37Dfuymz5/fq+szcOLUUWCccxku9qNNEdZAcZHMsINurezpHXa6ZNKGqmbmqZPVrEKzMUIolpnQmcerRt/yKqxCZ/kgsJE3IZyqi1T+xDwaBEhgdB6+wxyrL0/uBlLCbEdZAA7MPcauIKz8ykfIwo7Ht/vcHNxGaFFu+DcNoJI/Pw6hERlC9DHuUftK0/Lap1K2o+6kFQKqhVrvNQmaiqnz3Dr9psPO90AvbRqeODmfpi7rtU4MKOprQhUrMS9s9d5yVdJILp74pt6nzu3EnFiixRD5XD9PtK5NvP1sgDAgbWgTttwM9X7N6mzEe/gVUZAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAJVsbAamDRuZ1J2ogHLo/UmjmcmIATmqO7Ebaoid7+FYme/2NFzofOFtJNaCumdhwxSyf7ER6m2DUO6bDseblqNCTyRDNNXzTHEFQiYh2PThKSDdH0fbEf4IpcbOCnpSEpIg9C/ywEhq/wzYiOlxPhNWxBKHLhEkM7aWBerAhInCRRXymfus2HUf6aTWZ0wigMoUVKwOu16Zh04D2d6qb314cEMgKvANPiTTdgEae7Ot+rP1s2Zp75zUbWuz4uWd4wJDOHWR25mkD3ZELfbrpmEymbOTQ26zOpIUiPNfYZ1t9KwEjkKN+jBTXKu7QhB/u+g5yBHjRL++LEli4YGGGiA=" -CONFIG_ESP_WIFI_REMOTE_EPPP_CLIENT_KEY="MIIEpQIBAAKCAQEA3I3QUN7B237lkaNi5amRd+w37sps+f36vrM3Di1FFgnHMZLvajTRHWQHGRzLCDbq3s6R12umTShqpm5qmT1axCszFCKJaZ0JnHq0bf8iqsQmf5ILCRNyGcqotU/sQ8GgRIYHQevsMcqy9P7gZSwmxHWQAOzD3GriCs/MpHyMKOx7f73BzcRmhRbvg3DaCSPz8OoREZQvQx7lH7StPy2qdStqPupBUCqoVa7zUJmoqp89w6/abDzvdAL20anjg5n6Yu67VODCjqa0IVKzEvbPXeclXSSC6e+Kbep87txJxYosUQ+Vw/T7SuTbz9bIAwIG1oE7bcDPV+zepsxHv4FVGQIDAQABAoIBAQDPzzc224yg+iHoZaArcOhFrGbPMiAYNLxrroTzcKglqbTr+txmn7lhDfy6Jq0O4l/O66fy59Vb4fcLNgJuvKanK2UHVbtPrc1+iQc0lS7e4866aKrJNG9P6emoXNPqy6fsqLRx4o88IxcXTIe2DDHC7lpu5KdvKa4uLblOSqPtcZTHXPD9olVe8ZYF5CttMUTc4SkF4HSkY2jb0j+6kASN4eQ2CqEt+IW4IxI5NiEzrlzZSOdyqIOeyGUZz+QcfILOProWZHYzH3jOHQe4PJSXO57f2dojY1GqRcjnr3guQMpw1s7wmDYO1QekiBYwRERNzjEY7VhgDq8T0rwJPHP5AoGBAPO13QpJVSj1NfQ/H0AgZlsJIIlIwIC2YwuwjA7b36A3JOFolkHjtq4eNntThNRQbTL9OficbxJSHXQcOsQeo7dvwEhJjuVwEajL4/6cjc9b4oyGJxLlTKTshUPmeKPfGWUjRZKGbVWbT3m4BXqGiv4laCZ0LDHiCt4DvEzQ1Bo3AoGBAOetBClbcbUJhxkAme5HHI9A5VcqyOi2CrRh+HjKd/2IJlDA+Vmbl2iEB+9cMRGRubazbrk1yAzgtW29GX8kngr8yxDtIM8M7lPR2NhXx7XbmCKwKosZ7l6hHNdnD12TFyLCjuuJlUA37sWXw8r33623mLFQlNVjnL0onUa1XSMvAoGACw47+cR73YDKMstOQp11pzmRxUiMmworEhOvNtlYmq8FuEgDUPfgiKOMOyn9w5fmbEK6h4GpND6PYX4KWG0/ZgnmwiC8H8Jmuq6NKDa35Ck57MAFM8E9Kdok7YCeBmkPgNwJwuzgNtr1zwK/FODXm1HdGKl6e8TSU2H9/8oVZR8CgYEAoHSWI0awNCCLLufZtMwPna/mpz58s6ARPel0u8QO4st/LgLZMBSxArQfAsqpOW/iXgVcNG5pRXIEdiK4G/TyeM2onup9BKoCDo+SThRNv0h9z9iPPpQRIf0YCp/YZojPR0XU0pERi86xUqzP8C1I//neiUA0NK6vCdutQiGuhgUCgYEAp89EFcM1WvtPRJE+md8N8BUef5MJ+JJ0nb+BW1kkLY50Q1MVmsVXdUowYupWLBgEfMn8fy8Q+xD9EeiISTF9MtT1X4iQSI/pzKW5LLd0OJYnqPMWzyggASzSNWdYBIGNkqsQGmGCtF9+i6V4acfTTbMD9LiB7u5/enQa8N0Qg+s=" diff --git a/components/esp_wifi_remote/examples/mqtt/sdkconfig.defaults b/components/esp_wifi_remote/examples/mqtt/sdkconfig.defaults deleted file mode 100644 index 3ad1ba3383..0000000000 --- a/components/esp_wifi_remote/examples/mqtt/sdkconfig.defaults +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_ESP_WIFI_REMOTE_LIBRARY_EPPP=y -CONFIG_LWIP_PPP_SUPPORT=y -CONFIG_LWIP_PPP_SERVER_SUPPORT=y -CONFIG_LWIP_PPP_VJ_HEADER_COMPRESSION=n diff --git a/components/esp_wifi_remote/examples/server/CMakeLists.txt b/components/esp_wifi_remote/examples/server/CMakeLists.txt deleted file mode 100644 index 144b9e1a21..0000000000 --- a/components/esp_wifi_remote/examples/server/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# The following five lines of boilerplate have to be in your project's -# CMakeLists in this exact order for cmake to work correctly -cmake_minimum_required(VERSION 3.16) - -include($ENV{IDF_PATH}/tools/cmake/project.cmake) -project(pppos_slave) diff --git a/components/esp_wifi_remote/examples/server/README.md b/components/esp_wifi_remote/examples/server/README.md deleted file mode 100644 index f6e63d99b4..0000000000 --- a/components/esp_wifi_remote/examples/server/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# WiFi remote EPPP RPC server - -This is a standalone application serving as the slave device for `esp_wifi_remote` users (with `eppp` RPC). - -## Overview - -You need to configure and connect a slave device to the `esp_wifi_remote` host and run this application. Please fallow carefully these guidelines on HW connection and configuration of the slave device, based on the host device. - -## HW connection - -We currently support only `UART` transport you just need to connect Rx, Tx and GND and configure these fields accordingly: -* CONFIG_ESP_WIFI_REMOTE_EPPP_UART_TX_PIN -* CONFIG_ESP_WIFI_REMOTE_EPPP_UART_RX_PIN - -## SW configuration - -You will have to install server side certificates and keys, as well as the CA which should verify the client side. -Please configure these options: -* CONFIG_ESP_WIFI_REMOTE_EPPP_CLIENT_CA -* CONFIG_ESP_WIFI_REMOTE_EPPP_SERVER_CRT -* CONFIG_ESP_WIFI_REMOTE_EPPP_SERVER_KEY diff --git a/components/esp_wifi_remote/examples/server/main/CMakeLists.txt b/components/esp_wifi_remote/examples/server/main/CMakeLists.txt deleted file mode 100644 index 2ba044442a..0000000000 --- a/components/esp_wifi_remote/examples/server/main/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -idf_component_register(SRCS "station_example_main.c" - INCLUDE_DIRS ".") diff --git a/components/esp_wifi_remote/examples/server/main/idf_component.yml b/components/esp_wifi_remote/examples/server/main/idf_component.yml deleted file mode 100644 index 88b71aa807..0000000000 --- a/components/esp_wifi_remote/examples/server/main/idf_component.yml +++ /dev/null @@ -1,4 +0,0 @@ -dependencies: - esp_wifi_remote: - version: "*" - override_path: ../../.. diff --git a/components/esp_wifi_remote/examples/server/main/station_example_main.c b/components/esp_wifi_remote/examples/server/main/station_example_main.c deleted file mode 100644 index 93516d3ca2..0000000000 --- a/components/esp_wifi_remote/examples/server/main/station_example_main.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Unlicense OR CC0-1.0 - */ - -#include -#include -#include "freertos/FreeRTOS.h" -#include "freertos/event_groups.h" -#include "esp_system.h" -#include "esp_wifi.h" -#include "esp_event.h" -#include "esp_log.h" -#include "nvs_flash.h" -#include "eppp_link.h" -#include "esp_wifi_remote.h" - -esp_err_t server_init(void); - -void app_main(void) -{ - //Initialize NVS - esp_err_t ret = nvs_flash_init(); - if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) { - ESP_ERROR_CHECK(nvs_flash_erase()); - ret = nvs_flash_init(); - } - ESP_ERROR_CHECK(ret); - - ESP_ERROR_CHECK(esp_netif_init()); - ESP_ERROR_CHECK(esp_event_loop_create_default()); - esp_netif_create_default_wifi_sta(); - - server_init(); -} diff --git a/components/esp_wifi_remote/examples/server/sdkconfig.ci.c6 b/components/esp_wifi_remote/examples/server/sdkconfig.ci.c6 deleted file mode 100644 index 58f71a3662..0000000000 --- a/components/esp_wifi_remote/examples/server/sdkconfig.ci.c6 +++ /dev/null @@ -1,6 +0,0 @@ -CONFIG_IDF_TARGET="esp32c6" -CONFIG_ESP_WIFI_REMOTE_EPPP_UART_TX_PIN=22 -CONFIG_ESP_WIFI_REMOTE_EPPP_UART_RX_PIN=23 -CONFIG_ESP_WIFI_REMOTE_EPPP_CLIENT_CA="MIIDIzCCAgugAwIBAgIUTWOEAhITHAm2ixn5i2XlSeL01mowDQYJKoZIhvcNAQELBQAwITELMAkGA1UEBhMCQ1oxEjAQBgNVBAMMCUVzcHJlc3NpZjAeFw0yNDA0MTAxNTEzNTdaFw0yNTA0MTAxNTEzNTdaMCExCzAJBgNVBAYTAkNaMRIwEAYDVQQDDAlFc3ByZXNzaWYwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCSewupiSiyZNfLdVW0/smQB0yJ0Ua0KNU423ZZ7HMSrBPhfHtnQQ6SJqTdfqGCl1lvSsJZN9aT4iaEtyAm6N9trmSbSWVlkn0D8MQuBHwHCT7jRsLnyRYURRPUs11TkQdqvxtsIFqFVFB/8nJqy4IuU6JFTobCbUappQMdHKCyidXJUVHZ5y+KK2kEYFiv26rHlry+D0O/VO5/xl97uFIzP0JVdnGNu5sy9uoRYp+ua0moD3tx12tYe83XIuHKbKHMpIayjPIoaZzhCwomZMh0NETEQ5t7RXYneRGZvXXyIb/O8jPCmbfSqJ6umhPhf757xBXHaC0iG/xlND0dnRIvAgMBAAGjUzBRMB0GA1UdDgQWBBTgqejeFi/5UAgNhNv4aH7UniqmQjAfBgNVHSMEGDAWgBTgqejeFi/5UAgNhNv4aH7UniqmQjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQCQnqIue6KLXkjOXGtO5Bl4TkZpYAPkQuGiM6RgaBhdt3P5J1mF4T6aav8qGXSHShy1E3XkMR5OC3hkhG+FKBVKSaQLsRipuo+CeHp5RfOCNEzNI0RZwKJI92RcdWlhOA+pOTruXSoYuZvj0xnaePEghTrr7PLdgirpzIffLjvgh8BcQAz5QzP0U1XHkAVzbQjUBChiEiXVAlKChk7kKB/wEzwX3cvYKlTc89RB6I3+a+KhYJt3LIAOIDeyVp+Bhmb1JSo3H7zMpJAksG2RMnZCwlHeR6cMbb/OtJYeUKpNUxj0SaeNyHo3y8Q21G8TXcc9suU6sYJi780ArulC3cbQ" -CONFIG_ESP_WIFI_REMOTE_EPPP_SERVER_CRT="MIICvzCCAacCFCanehvaDq0bhjZA/3W/h4b0p1VHMA0GCSqGSIb3DQEBCwUAMCExCzAJBgNVBAYTAkNaMRIwEAYDVQQDDAlFc3ByZXNzaWYwHhcNMjQwNDEwMTUxMzU3WhcNMjUwNDEwMTUxMzU3WjAXMRUwEwYDVQQDDAwxOTIuMTY4LjExLjEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCsyR1FqBhBT3mr9AH/6iYoo1VCHbzB+V/StfCokv6LnMm6t7yiu1GgzqVk1aiHrUJGor5tBfpXywLnfVjFByZSBhhEkI26xQVdK5pZUsU1hMCJ6CWd105CD+0e5tTbGzF0PNH2KzFdg2YUqOSWBsfmgSNtnp3az8XmZN5i4958Sxe1kMN3f6EQwvkxZHGVgXCrUsdsHAEyV5NVfYq7P2nBxz3HJSGkTScFd+PRp3nfVFbBbCQDmqwoPZ7E/gUXjoLIFf7zjIMzCXTsZd/dKgXWWEFHq8SPWmLtAEvPCProT5QUaZ3gJSHup9Wmh+ok9W8wrwMj1sHlfiZWo3tatFmvAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAAeWiWyTTyNbZRHq8X9qbr7oG6SYWOqDR3lPfs8wB8B+1Hez/JCrI/8quNqVAjhoTtebtp/2mcEseQDj5BOx8NBCDAmUOwB+ZKPzUoGiALy5XFGqUXzTv9tBMotC6dAMTIbT2Ql1mPJgtg2+Qv7vg6hsk4rlPMoICqN3lW6zXo2GOuJ56Tj5NkvVxv6MOVN2e3p67c92rRBysAxP6MaV8S9s2+VvnENuxpU5cq8sfzaxFkTn4UD9PoQSYGPNL9kv7Y/h7H5wlKiFY24KowPTHjulaH/DC9Fk4F1gNWjnkFcOgepzhiw/ibLrivMptUFtplFFbxGuwY5PaA26yhliBv8=" -CONFIG_ESP_WIFI_REMOTE_EPPP_SERVER_KEY="MIIEowIBAAKCAQEArMkdRagYQU95q/QB/+omKKNVQh28wflf0rXwqJL+i5zJure8ortRoM6lZNWoh61CRqK+bQX6V8sC531YxQcmUgYYRJCNusUFXSuaWVLFNYTAieglnddOQg/tHubU2xsxdDzR9isxXYNmFKjklgbH5oEjbZ6d2s/F5mTeYuPefEsXtZDDd3+hEML5MWRxlYFwq1LHbBwBMleTVX2Kuz9pwcc9xyUhpE0nBXfj0ad531RWwWwkA5qsKD2exP4FF46CyBX+84yDMwl07GXf3SoF1lhBR6vEj1pi7QBLzwj66E+UFGmd4CUh7qfVpofqJPVvMK8DI9bB5X4mVqN7WrRZrwIDAQABAoIBAHDh833OlAoXIiZ1A9lt4AAstUa8ptUTVscSlmeLoUEU7bZO0659MpccanG2JKR/TQ1YxY/0l9lDiGI0Qgp24VI1KSWiSvX6Qcbc9bnlmXGdiSyPvgOg5j/Cp+fIZse+vFB0a7eoAFhXwBk/PhfF1lOBiuPS/M43b9NVkvSIapJIaS4pvmkBvKSzHEvSArDHcr+1vFuFssZyHTnXmVgB4WiYPX4ACE8S18cnjXIQDfx8zpBbF/itnqeHDC5echnto63UDB7qHZa+DVvakhEtv50rzAuhq3/uspBClucuQUhlAAimd4OeKuwB1UC0K9AamDZRCnsf0O/Bo8/W4SWYAgECgYEA5LpRmcQ9ghW8V6bzwYvK8XGWyeNy94qOpZysFeOjxqe2sUTHVY2Ty1s44RbDd/bm0n3xcxMtLof/6Oz4TX+JseskQWBQlRiwuqc46CcHHjUQ8qokfWtASwWYgb6AzLa4B/D+H91wP/AzRfYNdRB9xhSCr7AOk9Vo5KmEPRLN/VMCgYEAwWM3oDaCkMicoMgngz/9dZ2/1yohfYdrupC0pGPhtBFNKghP+9S+e6cwWKzwQJbbRjGgt1OA3e4UEuTHJjp1tw+BRkNQ/1FI0psJGwmOtveAE7yiHf7Tw7mNDk+j32vpAPWnL7I3222Kv4G8xi2vSbn3IaI2sl7M0RHLJc/JCrUCgYBh4dI16aMg3khhglLiSv6oYKHU9/8lLChreyaxn19hDjjCl9puJE5RQlKPEPzJg+G3xqnjQxucxBqiBXclQyUb/LLhP2R8ybonxpQ11S3YoYEFOAaxnYpAEL75Fxtrf+41h85YuJzm39YxZGDR7iLE99YNdVxnq3ZeFKVAtaFtfQKBgEalPRvc7eOANZ+SnsSWqru9regnLubRgqw70pG/HyONsnepY7amaBN55vJt8rJVqbLBzGlMKuZn45NnWc0ATCJcmqgVTVCH3Cd7lV74Jdd3IKWVIk/82FVGwl25AC9NF2hPVQzaeQdCxA3jkhd/dupi8gGqZXrRoNa7PlAI0POFAoGBAJDlvddpEYcKhT3pncXIorVfYR67TlXVcKZHvL9XljwgDuf1j52ZhAs8UuoWW+NSgOdWVxocAshrLbu5fjSIN92oDAq6YVeXvxis6e8l79xd6A5iFH9Po+dEuQSaOR8XgW56n39oVR2hfaFwqijawIEzDNlYpiXAD3qNyW5e0MKA" diff --git a/components/esp_wifi_remote/examples/server/sdkconfig.defaults b/components/esp_wifi_remote/examples/server/sdkconfig.defaults deleted file mode 100644 index 61654a588b..0000000000 --- a/components/esp_wifi_remote/examples/server/sdkconfig.defaults +++ /dev/null @@ -1,7 +0,0 @@ -CONFIG_ESP_WIFI_REMOTE_LIBRARY_EPPP=y -CONFIG_LWIP_IP_FORWARD=y -CONFIG_LWIP_IPV4_NAPT=y -CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=4096 -CONFIG_LWIP_PPP_SUPPORT=y -CONFIG_LWIP_PPP_SERVER_SUPPORT=y -CONFIG_LWIP_PPP_VJ_HEADER_COMPRESSION=n diff --git a/components/esp_wifi_remote/examples/test_certs/generate_test_certs.sh b/components/esp_wifi_remote/examples/test_certs/generate_test_certs.sh deleted file mode 100755 index 330b3211f8..0000000000 --- a/components/esp_wifi_remote/examples/test_certs/generate_test_certs.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env bash - -function gen_pkey { # Params: [KEY_FILE] - openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 | openssl pkcs8 -topk8 -outform PEM -nocrypt -out $1 -} - -function sign_with_ca { # Params: [KEY_FILE] [CN] [CRT_FILE] - openssl req -out request.csr -key $1 -subj "/CN=$2" -new -sha256 - openssl x509 -req -in request.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out $3 -days 365 -sha256 -} - -function export_config { # Params: [FILE/CONFIG_NAME] - content=`cat $1 | sed '/---/d' | tr -d '\n'` - echo "CONFIG_ESP_WIFI_REMOTE_EPPP_$1=\"${content}\"" -} - -if [ -z "$1" ]; then - echo "Usage $0 [CLIENT_CN]" - exit 1; -fi - -SERVER_CN=$1 -CLIENT_CN="${2-client_cn}" - -echo "Server's CN: $SERVER_CN" -echo "Client's CN: $CLIENT_CN" - -## First create our own CA -gen_pkey ca.key -openssl req -new -x509 -subj "/C=CZ/CN=Espressif" -days 365 -key ca.key -out ca.crt -# will use the same CA for both server and client side -cp ca.crt SERVER_CA -cp ca.crt CLIENT_CA - -# Server side -gen_pkey SERVER_KEY -sign_with_ca SERVER_KEY $SERVER_CN SERVER_CRT - -# Client side -gen_pkey CLIENT_KEY -sign_with_ca CLIENT_KEY $CLIENT_CN CLIENT_CRT - -## Generate config options -echo -e "\n# Client side: need own cert and key and ca-cert for server validation" -for f in SERVER_CA CLIENT_CRT CLIENT_KEY; do - export_config $f -done - -echo -e "\n# Server side: need own cert and key and ca-cert for client validation" -for f in CLIENT_CA SERVER_CRT SERVER_KEY; do - export_config $f -done diff --git a/components/esp_wifi_remote/idf_component.yml b/components/esp_wifi_remote/idf_component.yml deleted file mode 100644 index 3e4f333ec8..0000000000 --- a/components/esp_wifi_remote/idf_component.yml +++ /dev/null @@ -1,12 +0,0 @@ -version: 0.4.0 -url: https://github.com/espressif/esp-protocols/tree/master/components/esp_wifi_remote -description: Utility wrapper for esp_wifi functionality on remote targets -dependencies: - espressif/eppp_link: - version: '>=0.1' - idf: - version: '>=5.3' - espressif/esp_hosted: - version: '>=0.0.6' - rules: - - if: "target in [esp32h2, esp32p4]" diff --git a/components/esp_wifi_remote/idf_v5.3/Kconfig.slave_select.in b/components/esp_wifi_remote/idf_v5.3/Kconfig.slave_select.in deleted file mode 100644 index 1e11562341..0000000000 --- a/components/esp_wifi_remote/idf_v5.3/Kconfig.slave_select.in +++ /dev/null @@ -1,17 +0,0 @@ -# This file is auto-generated - choice SLAVE_IDF_TARGET - prompt "choose slave target" - default SLAVE_IDF_TARGET_ESP32 - config SLAVE_IDF_TARGET_ESP32 - bool "esp32" - config SLAVE_IDF_TARGET_ESP32S2 - bool "esp32s2" - config SLAVE_IDF_TARGET_ESP32C3 - bool "esp32c3" - config SLAVE_IDF_TARGET_ESP32S3 - bool "esp32s3" - config SLAVE_IDF_TARGET_ESP32C2 - bool "esp32c2" - config SLAVE_IDF_TARGET_ESP32C6 - bool "esp32c6" - endchoice diff --git a/components/esp_wifi_remote/idf_v5.3/Kconfig.soc_wifi_caps.in b/components/esp_wifi_remote/idf_v5.3/Kconfig.soc_wifi_caps.in deleted file mode 100644 index 2ee141f076..0000000000 --- a/components/esp_wifi_remote/idf_v5.3/Kconfig.soc_wifi_caps.in +++ /dev/null @@ -1,225 +0,0 @@ -# This file is auto-generated - -if SLAVE_IDF_TARGET_ESP32 - - config SLAVE_SOC_WIFI_SUPPORTED - bool - default y - - config SLAVE_SOC_WIFI_WAPI_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_CSI_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_MESH_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_SUPPORT_VARIABLE_BEACON_WINDOW - bool - default y - - config SLAVE_SOC_WIFI_NAN_SUPPORT - bool - default y - -endif # ESP32 - -if SLAVE_IDF_TARGET_ESP32S2 - - config SLAVE_SOC_WIFI_SUPPORTED - bool - default y - - config SLAVE_SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH - int - default 12 - - config SLAVE_SOC_WIFI_HW_TSF - bool - default y - - config SLAVE_SOC_WIFI_FTM_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_WAPI_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_CSI_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_MESH_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_SUPPORT_VARIABLE_BEACON_WINDOW - bool - default y - - config SLAVE_SOC_WIFI_NAN_SUPPORT - bool - default y - -endif # ESP32S2 - -if SLAVE_IDF_TARGET_ESP32C3 - - config SLAVE_SOC_WIFI_SUPPORTED - bool - default y - - config SLAVE_SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH - int - default 12 - - config SLAVE_SOC_WIFI_HW_TSF - bool - default y - - config SLAVE_SOC_WIFI_FTM_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_GCMP_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_WAPI_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_CSI_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_MESH_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_SUPPORT_VARIABLE_BEACON_WINDOW - bool - default y - - config SLAVE_SOC_WIFI_PHY_NEEDS_USB_WORKAROUND - bool - default y - -endif # ESP32C3 - -if SLAVE_IDF_TARGET_ESP32S3 - - config SLAVE_SOC_WIFI_SUPPORTED - bool - default y - - config SLAVE_SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH - int - default 12 - - config SLAVE_SOC_WIFI_HW_TSF - bool - default y - - config SLAVE_SOC_WIFI_FTM_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_GCMP_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_WAPI_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_CSI_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_MESH_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_SUPPORT_VARIABLE_BEACON_WINDOW - bool - default y - - config SLAVE_SOC_WIFI_PHY_NEEDS_USB_WORKAROUND - bool - default y - -endif # ESP32S3 - -if SLAVE_IDF_TARGET_ESP32C2 - - config SLAVE_SOC_WIFI_SUPPORTED - bool - default y - - config SLAVE_SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH - int - default 12 - - config SLAVE_SOC_WIFI_HW_TSF - bool - default y - - config SLAVE_SOC_WIFI_FTM_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_SUPPORT_VARIABLE_BEACON_WINDOW - bool - default y - - config SLAVE_SOC_WIFI_PHY_NEEDS_USB_WORKAROUND - bool - default y - -endif # ESP32C2 - -if SLAVE_IDF_TARGET_ESP32C6 - - config SLAVE_SOC_WIFI_SUPPORTED - bool - default y - - config SLAVE_SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH - int - default 12 - - config SLAVE_SOC_WIFI_HW_TSF - bool - default y - - config SLAVE_SOC_WIFI_FTM_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_GCMP_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_WAPI_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_CSI_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_MESH_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_HE_SUPPORT - bool - default y - -endif # ESP32C6 diff --git a/components/esp_wifi_remote/idf_v5.3/Kconfig.wifi.in b/components/esp_wifi_remote/idf_v5.3/Kconfig.wifi.in deleted file mode 100644 index ce89c6bade..0000000000 --- a/components/esp_wifi_remote/idf_v5.3/Kconfig.wifi.in +++ /dev/null @@ -1,723 +0,0 @@ -# Wi-Fi configuration -# This file is auto-generated - - config ESP_WIFI_STATIC_RX_BUFFER_NUM - int "Max number of WiFi static RX buffers" - range 2 25 if !SLAVE_SOC_WIFI_HE_SUPPORT - range 2 128 if SLAVE_SOC_WIFI_HE_SUPPORT - default 10 if !SPIRAM_TRY_ALLOCATE_WIFI_LWIP - default 16 if SPIRAM_TRY_ALLOCATE_WIFI_LWIP - help - Set the number of WiFi static RX buffers. Each buffer takes approximately 1.6KB of RAM. - The static rx buffers are allocated when esp_wifi_init is called, they are not freed - until esp_wifi_deinit is called. - - WiFi hardware use these buffers to receive all 802.11 frames. - A higher number may allow higher throughput but increases memory use. If ESP_WIFI_AMPDU_RX_ENABLED - is enabled, this value is recommended to set equal or bigger than ESP_WIFI_RX_BA_WIN in order to - achieve better throughput and compatibility with both stations and APs. - - config ESP_WIFI_DYNAMIC_RX_BUFFER_NUM - int "Max number of WiFi dynamic RX buffers" - range 0 128 if !LWIP_WND_SCALE - range 0 1024 if LWIP_WND_SCALE - default 32 - help - Set the number of WiFi dynamic RX buffers, 0 means unlimited RX buffers will be allocated - (provided sufficient free RAM). The size of each dynamic RX buffer depends on the size of - the received data frame. - - For each received data frame, the WiFi driver makes a copy to an RX buffer and then delivers - it to the high layer TCP/IP stack. The dynamic RX buffer is freed after the higher layer has - successfully received the data frame. - - For some applications, WiFi data frames may be received faster than the application can - process them. In these cases we may run out of memory if RX buffer number is unlimited (0). - - If a dynamic RX buffer limit is set, it should be at least the number of static RX buffers. - - choice ESP_WIFI_TX_BUFFER - prompt "Type of WiFi TX buffers" - default ESP_WIFI_DYNAMIC_TX_BUFFER - help - Select type of WiFi TX buffers: - - If "Static" is selected, WiFi TX buffers are allocated when WiFi is initialized and released - when WiFi is de-initialized. The size of each static TX buffer is fixed to about 1.6KB. - - If "Dynamic" is selected, each WiFi TX buffer is allocated as needed when a data frame is - delivered to the Wifi driver from the TCP/IP stack. The buffer is freed after the data frame - has been sent by the WiFi driver. The size of each dynamic TX buffer depends on the length - of each data frame sent by the TCP/IP layer. - - If PSRAM is enabled, "Static" should be selected to guarantee enough WiFi TX buffers. - If PSRAM is disabled, "Dynamic" should be selected to improve the utilization of RAM. - - config ESP_WIFI_STATIC_TX_BUFFER - bool "Static" - config ESP_WIFI_DYNAMIC_TX_BUFFER - bool "Dynamic" - depends on !SPIRAM_USE_MALLOC - endchoice - - config ESP_WIFI_TX_BUFFER_TYPE - int - default 0 if ESP_WIFI_STATIC_TX_BUFFER - default 1 if ESP_WIFI_DYNAMIC_TX_BUFFER - - config ESP_WIFI_STATIC_TX_BUFFER_NUM - int "Max number of WiFi static TX buffers" - depends on ESP_WIFI_STATIC_TX_BUFFER - range 1 64 - default 16 - help - Set the number of WiFi static TX buffers. Each buffer takes approximately 1.6KB of RAM. - The static RX buffers are allocated when esp_wifi_init() is called, they are not released - until esp_wifi_deinit() is called. - - For each transmitted data frame from the higher layer TCP/IP stack, the WiFi driver makes a - copy of it in a TX buffer. For some applications especially UDP applications, the upper - layer can deliver frames faster than WiFi layer can transmit. In these cases, we may run out - of TX buffers. - - config ESP_WIFI_CACHE_TX_BUFFER_NUM - int "Max number of WiFi cache TX buffers" - depends on SPIRAM - range 16 128 - default 32 - help - Set the number of WiFi cache TX buffer number. - - For each TX packet from uplayer, such as LWIP etc, WiFi driver needs to allocate a static TX - buffer and makes a copy of uplayer packet. If WiFi driver fails to allocate the static TX buffer, - it caches the uplayer packets to a dedicated buffer queue, this option is used to configure the - size of the cached TX queue. - - config ESP_WIFI_DYNAMIC_TX_BUFFER_NUM - int "Max number of WiFi dynamic TX buffers" - depends on ESP_WIFI_DYNAMIC_TX_BUFFER - range 1 128 - default 32 - help - Set the number of WiFi dynamic TX buffers. The size of each dynamic TX buffer is not fixed, - it depends on the size of each transmitted data frame. - - For each transmitted frame from the higher layer TCP/IP stack, the WiFi driver makes a copy - of it in a TX buffer. For some applications, especially UDP applications, the upper layer - can deliver frames faster than WiFi layer can transmit. In these cases, we may run out of TX - buffers. - - choice ESP_WIFI_MGMT_RX_BUFFER - prompt "Type of WiFi RX MGMT buffers" - default ESP_WIFI_STATIC_RX_MGMT_BUFFER - help - Select type of WiFi RX MGMT buffers: - - If "Static" is selected, WiFi RX MGMT buffers are allocated when WiFi is initialized and released - when WiFi is de-initialized. The size of each static RX MGMT buffer is fixed to about 500 Bytes. - - If "Dynamic" is selected, each WiFi RX MGMT buffer is allocated as needed when a MGMT data frame is - received. The MGMT buffer is freed after the MGMT data frame has been processed by the WiFi driver. - - - config ESP_WIFI_STATIC_RX_MGMT_BUFFER - bool "Static" - config ESP_WIFI_DYNAMIC_RX_MGMT_BUFFER - bool "Dynamic" - endchoice - - config ESP_WIFI_DYNAMIC_RX_MGMT_BUF - int - default 0 if ESP_WIFI_STATIC_RX_MGMT_BUFFER - default 1 if ESP_WIFI_DYNAMIC_RX_MGMT_BUFFER - - config ESP_WIFI_RX_MGMT_BUF_NUM_DEF - int "Max number of WiFi RX MGMT buffers" - range 1 10 - default 5 - help - Set the number of WiFi RX_MGMT buffers. - - For Management buffers, the number of dynamic and static management buffers is the same. - In order to prevent memory fragmentation, the management buffer type should be set to static first. - - config ESP_WIFI_CSI_ENABLED - bool "WiFi CSI(Channel State Information)" - depends on SLAVE_SOC_WIFI_CSI_SUPPORT - default n - help - Select this option to enable CSI(Channel State Information) feature. CSI takes about - CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM KB of RAM. If CSI is not used, it is better to disable - this feature in order to save memory. - - config ESP_WIFI_AMPDU_TX_ENABLED - bool "WiFi AMPDU TX" - default y - help - Select this option to enable AMPDU TX feature - - - config ESP_WIFI_TX_BA_WIN - int "WiFi AMPDU TX BA window size" - depends on ESP_WIFI_AMPDU_TX_ENABLED - range 2 32 if !SLAVE_SOC_WIFI_HE_SUPPORT - range 2 64 if SLAVE_SOC_WIFI_HE_SUPPORT - default 6 - help - Set the size of WiFi Block Ack TX window. Generally a bigger value means higher throughput but - more memory. Most of time we should NOT change the default value unless special reason, e.g. - test the maximum UDP TX throughput with iperf etc. For iperf test in shieldbox, the recommended - value is 9~12. - - config ESP_WIFI_AMPDU_RX_ENABLED - bool "WiFi AMPDU RX" - default y - help - Select this option to enable AMPDU RX feature - - config ESP_WIFI_RX_BA_WIN - int "WiFi AMPDU RX BA window size" - depends on ESP_WIFI_AMPDU_RX_ENABLED - range 2 32 if !SLAVE_SOC_WIFI_HE_SUPPORT - range 2 64 if SLAVE_SOC_WIFI_HE_SUPPORT - default 6 if !SPIRAM_TRY_ALLOCATE_WIFI_LWIP - default 16 if SPIRAM_TRY_ALLOCATE_WIFI_LWIP - help - Set the size of WiFi Block Ack RX window. Generally a bigger value means higher throughput and better - compatibility but more memory. Most of time we should NOT change the default value unless special - reason, e.g. test the maximum UDP RX throughput with iperf etc. For iperf test in shieldbox, the - recommended value is 9~12. If PSRAM is used and WiFi memory is preferred to allocate in PSRAM first, - the default and minimum value should be 16 to achieve better throughput and compatibility with both - stations and APs. - - config ESP_WIFI_AMSDU_TX_ENABLED - bool "WiFi AMSDU TX" - depends on SPIRAM - default n - help - Select this option to enable AMSDU TX feature - - config ESP_WIFI_NVS_ENABLED - bool "WiFi NVS flash" - default y - help - Select this option to enable WiFi NVS flash - - choice ESP_WIFI_TASK_CORE_ID - depends on !FREERTOS_UNICORE - prompt "WiFi Task Core ID" - default ESP_WIFI_TASK_PINNED_TO_CORE_0 - help - Pinned WiFi task to core 0 or core 1. - - config ESP_WIFI_TASK_PINNED_TO_CORE_0 - bool "Core 0" - config ESP_WIFI_TASK_PINNED_TO_CORE_1 - bool "Core 1" - endchoice - - config ESP_WIFI_SOFTAP_BEACON_MAX_LEN - int "Max length of WiFi SoftAP Beacon" - range 752 1256 - default 752 - help - ESP-MESH utilizes beacon frames to detect and resolve root node conflicts (see documentation). However - the default length of a beacon frame can simultaneously hold only five root node identifier structures, - meaning that a root node conflict of up to five nodes can be detected at one time. In the occurrence of - more root nodes conflict involving more than five root nodes, the conflict resolution process will - detect five of the root nodes, resolve the conflict, and re-detect more root nodes. This process will - repeat until all root node conflicts are resolved. However this process can generally take a very long - time. - - To counter this situation, the beacon frame length can be increased such that more root nodes can be - detected simultaneously. Each additional root node will require 36 bytes and should be added on top of - the default beacon frame length of - 752 bytes. For example, if you want to detect 10 root nodes simultaneously, you need to set the beacon - frame length as - 932 (752+36*5). - - Setting a longer beacon length also assists with debugging as the conflicting root nodes can be - identified more quickly. - - config ESP_WIFI_MGMT_SBUF_NUM - int "WiFi mgmt short buffer number" - range 6 32 - default 32 - help - Set the number of WiFi management short buffer. - - config ESP_WIFI_IRAM_OPT - bool "WiFi IRAM speed optimization" - default n if (BT_ENABLED && SPIRAM && SLAVE_IDF_TARGET_ESP32) - default y - help - Select this option to place frequently called Wi-Fi library functions in IRAM. - When this option is disabled, more than 10Kbytes of IRAM memory will be saved - but Wi-Fi throughput will be reduced. - - config ESP_WIFI_EXTRA_IRAM_OPT - bool "WiFi EXTRA IRAM speed optimization" - default y if SLAVE_SOC_WIFI_HE_SUPPORT - default n - help - Select this option to place additional frequently called Wi-Fi library functions - in IRAM. When this option is disabled, more than 5Kbytes of IRAM memory will be saved - but Wi-Fi throughput will be reduced. - - config ESP_WIFI_RX_IRAM_OPT - bool "WiFi RX IRAM speed optimization" - default n if (BT_ENABLED && SPIRAM && SLAVE_IDF_TARGET_ESP32) - default y - help - Select this option to place frequently called Wi-Fi library RX functions in IRAM. - When this option is disabled, more than 17Kbytes of IRAM memory will be saved - but Wi-Fi performance will be reduced. - - config ESP_WIFI_ENABLE_WPA3_SAE - bool "Enable WPA3-Personal" - default y - select ESP_WIFI_MBEDTLS_CRYPTO - help - Select this option to allow the device to establish a WPA3-Personal connection with eligible AP's. - PMF (Protected Management Frames) is a prerequisite feature for a WPA3 connection, it needs to be - explicitly configured before attempting connection. Please refer to the Wi-Fi Driver API Guide - for details. - - config ESP_WIFI_ENABLE_SAE_PK - bool "Enable SAE-PK" - default y - depends on ESP_WIFI_ENABLE_WPA3_SAE - help - Select this option to enable SAE-PK - - config ESP_WIFI_SOFTAP_SAE_SUPPORT - bool "Enable WPA3 Personal(SAE) SoftAP" - default y - depends on ESP_WIFI_ENABLE_WPA3_SAE - depends on ESP_WIFI_SOFTAP_SUPPORT - help - Select this option to enable SAE support in softAP mode. - - config ESP_WIFI_ENABLE_WPA3_OWE_STA - bool "Enable OWE STA" - default y - select ESP_WIFI_MBEDTLS_CRYPTO - help - Select this option to allow the device to establish OWE connection with eligible AP's. - PMF (Protected Management Frames) is a prerequisite feature for a WPA3 connection, it needs to be - explicitly configured before attempting connection. Please refer to the Wi-Fi Driver API Guide - for details. - - config ESP_WIFI_SLP_IRAM_OPT - bool "WiFi SLP IRAM speed optimization" - select PM_SLP_DEFAULT_PARAMS_OPT - select PERIPH_CTRL_FUNC_IN_IRAM - default y if SLAVE_SOC_WIFI_HE_SUPPORT - help - Select this option to place called Wi-Fi library TBTT process and receive beacon functions in IRAM. - Some functions can be put in IRAM either by ESP_WIFI_IRAM_OPT and ESP_WIFI_RX_IRAM_OPT, or this one. - If already enabled ESP_WIFI_IRAM_OPT, the other 7.3KB IRAM memory would be taken by this option. - If already enabled ESP_WIFI_RX_IRAM_OPT, the other 1.3KB IRAM memory would be taken by this option. - If neither of them are enabled, the other 7.4KB IRAM memory would be taken by this option. - Wi-Fi power-save mode average current would be reduced if this option is enabled. - - config ESP_WIFI_SLP_DEFAULT_MIN_ACTIVE_TIME - int "Minimum active time" - range 8 60 - default 50 - help - Only for station in WIFI_PS_MIN_MODEM or WIFI_PS_MAX_MODEM. When the station enters the active state, - it will work for at least ESP_WIFI_SLP_DEFAULT_MIN_ACTIVE_TIME. If a data packet is received or sent - during this period, the time will be refreshed. If the time is up, but the station still has packets - to receive or send, the time will also be refreshed. unit: milliseconds. - - config ESP_WIFI_SLP_DEFAULT_MAX_ACTIVE_TIME - int "Maximum keep alive time" - range 10 60 - default 10 - help - Only for station in WIFI_PS_MIN_MODEM or WIFI_PS_MAX_MODEM. If no packet has been - sent within ESP_WIFI_SLP_DEFAULT_MAX_ACTIVE_TIME, a null data packet will be sent - to maintain the connection with the AP. unit: seconds. - - config ESP_WIFI_SLP_DEFAULT_WAIT_BROADCAST_DATA_TIME - int "Minimum wait broadcast data time" - range 10 30 - default 15 - help - Only for station in WIFI_PS_MIN_MODEM or WIFI_PS_MAX_MODEM. When the station knows through the beacon - that AP will send broadcast packet, it will wait for ESP_WIFI_SLP_DEFAULT_WAIT_BROADCAST_DATA_TIME - before entering the sleep process. If a broadcast packet is received with more data bits, the time - will refreshed. unit: milliseconds. - - config ESP_WIFI_FTM_ENABLE - bool "WiFi FTM" - default n - depends on SLAVE_SOC_WIFI_FTM_SUPPORT - help - Enable feature Fine Timing Measurement for calculating WiFi Round-Trip-Time (RTT). - - config ESP_WIFI_FTM_INITIATOR_SUPPORT - bool "FTM Initiator support" - default y - depends on ESP_WIFI_FTM_ENABLE - - config ESP_WIFI_FTM_RESPONDER_SUPPORT - bool "FTM Responder support" - default y - depends on ESP_WIFI_FTM_ENABLE - - config ESP_WIFI_STA_DISCONNECTED_PM_ENABLE - bool "Power Management for station at disconnected" - default y - help - Select this option to enable power_management for station when disconnected. - Chip will do modem-sleep when rf module is not in use any more. - - config ESP_WIFI_GCMP_SUPPORT - bool "WiFi GCMP Support(GCMP128 and GCMP256)" - default n - depends on SLAVE_SOC_WIFI_GCMP_SUPPORT - help - Select this option to enable GCMP support. GCMP support is compulsory for WiFi Suite-B support. - - config ESP_WIFI_GMAC_SUPPORT - bool "WiFi GMAC Support(GMAC128 and GMAC256)" - default y - help - Select this option to enable GMAC support. GMAC support is compulsory for WiFi 192 bit certification. - - config ESP_WIFI_SOFTAP_SUPPORT - bool "WiFi SoftAP Support" - default y - help - WiFi module can be compiled without SoftAP to save code size. - - config ESP_WIFI_ENHANCED_LIGHT_SLEEP - bool "WiFi modem automatically receives the beacon" - default n - depends on ESP_PHY_MAC_BB_PD && SOC_PM_SUPPORT_BEACON_WAKEUP - help - The wifi modem automatically receives the beacon frame during light sleep. - - config ESP_WIFI_SLP_BEACON_LOST_OPT - bool "Wifi sleep optimize when beacon lost" - help - Enable wifi sleep optimization when beacon loss occurs and immediately enter - sleep mode when the WiFi module detects beacon loss. - - config ESP_WIFI_SLP_BEACON_LOST_TIMEOUT - int "Beacon loss timeout" - range 5 100 - default 10 - depends on ESP_WIFI_SLP_BEACON_LOST_OPT - help - Timeout time for close rf phy when beacon loss occurs, Unit: 1024 microsecond. - - config ESP_WIFI_SLP_BEACON_LOST_THRESHOLD - int "Maximum number of consecutive lost beacons allowed" - range 0 8 - default 3 - depends on ESP_WIFI_SLP_BEACON_LOST_OPT - help - Maximum number of consecutive lost beacons allowed, WiFi keeps Rx state when - the number of consecutive beacons lost is greater than the given threshold. - - config ESP_WIFI_SLP_PHY_ON_DELTA_EARLY_TIME - int "Delta early time for RF PHY on" - range 0 100 - default 2 - depends on ESP_WIFI_SLP_BEACON_LOST_OPT && SLAVE_SOC_WIFI_SUPPORT_VARIABLE_BEACON_WINDOW - help - Delta early time for rf phy on, When the beacon is lost, the next rf phy on will - be earlier the time specified by the configuration item, Unit: 32 microsecond. - - config ESP_WIFI_SLP_PHY_OFF_DELTA_TIMEOUT_TIME - int "Delta timeout time for RF PHY off" - range 0 8 - default 2 - depends on ESP_WIFI_SLP_BEACON_LOST_OPT && SLAVE_SOC_WIFI_SUPPORT_VARIABLE_BEACON_WINDOW - help - Delta timeout time for rf phy off, When the beacon is lost, the next rf phy off will - be delayed for the time specified by the configuration item. Unit: 1024 microsecond. - - config ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM - int "Maximum espnow encrypt peers number" - range 0 4 if SLAVE_IDF_TARGET_ESP32C2 - range 0 17 if (!SLAVE_IDF_TARGET_ESP32C2) - default 2 if SLAVE_IDF_TARGET_ESP32C2 - default 7 if (!SLAVE_IDF_TARGET_ESP32C2) - help - Maximum number of encrypted peers supported by espnow. - The number of hardware keys for encryption is fixed. And the espnow and SoftAP share the same - hardware keys. So this configuration will affect the maximum connection number of SoftAP. - Maximum espnow encrypted peers number + maximum number of connections of SoftAP = Max hardware - keys number. When using ESP mesh, this value should be set to a maximum of 6. - - config ESP_WIFI_NAN_ENABLE - bool "WiFi Aware" - default n - depends on SLAVE_SOC_WIFI_NAN_SUPPORT - help - Enable WiFi Aware (NAN) feature. - - config ESP_WIFI_MBEDTLS_CRYPTO - bool "Use MbedTLS crypto APIs" - default y - select MBEDTLS_AES_C - select MBEDTLS_ECP_C - select MBEDTLS_ECDH_C - select MBEDTLS_ECDSA_C - select MBEDTLS_CMAC_C - select MBEDTLS_ECP_DP_SECP256R1_ENABLED - help - Select this option to enable the use of MbedTLS crypto APIs. - The internal crypto support within the supplicant is limited - and may not suffice for all new security features, including WPA3. - - It is recommended to always keep this option enabled. Additionally, - note that MbedTLS can leverage hardware acceleration if available, - resulting in significantly faster cryptographic operations. - - if ESP_WIFI_MBEDTLS_CRYPTO - config ESP_WIFI_MBEDTLS_TLS_CLIENT - bool "Use MbedTLS TLS client for WiFi Enterprise connection" - depends on ESP_WIFI_ENTERPRISE_SUPPORT - default y - select MBEDTLS_TLS_ENABLED - help - Select this option to use MbedTLS TLS client for WPA2 enterprise connection. - Please note that from MbedTLS-3.0 onwards, MbedTLS does not support SSL-3.0 - TLS-v1.0, TLS-v1.1 versions. In case your server is using one of these version, - it is advisable to update your server. - Please disable this option for compatibility with older TLS versions. - - config ESP_WIFI_EAP_TLS1_3 - bool "Enable EAP-TLS v1.3 Support for WiFi Enterprise connection" - default n - select MBEDTLS_SSL_PROTO_TLS1_3 - depends on ESP_WIFI_MBEDTLS_TLS_CLIENT && IDF_EXPERIMENTAL_FEATURES - help - Select this option to support EAP with TLS v1.3. - This configuration still supports compatibility with EAP-TLS v1.2. - Please note that enabling this configuration will cause every application which - uses TLS go for TLS1.3 if server supports that. TLS1.3 is still in development in mbedtls - and there may be interoperability issues with this. Please modify your application to set - max version as TLS1.2 if you want to enable TLS1.3 only for WiFi connection. - - endif - - config ESP_WIFI_WAPI_PSK - bool "Enable WAPI PSK support" - depends on SLAVE_SOC_WIFI_WAPI_SUPPORT - default n - help - Select this option to enable WAPI-PSK - which is a Chinese National Standard Encryption for Wireless LANs (GB 15629.11-2003). - - config ESP_WIFI_SUITE_B_192 - bool "Enable NSA suite B support with 192 bit key" - default n - depends on SLAVE_SOC_WIFI_GCMP_SUPPORT - select ESP_WIFI_GCMP_SUPPORT - select ESP_WIFI_GMAC_SUPPORT - help - Select this option to enable 192 bit NSA suite-B. - This is necessary to support WPA3 192 bit security. - - config ESP_WIFI_11KV_SUPPORT - bool "Enable 802.11k, 802.11v APIs Support" - default n - help - Select this option to enable 802.11k 802.11v APIs(RRM and BTM support). - Only APIs which are helpful for network assisted roaming - are supported for now. - Enable this option with BTM and RRM enabled in sta config - to make device ready for network assisted roaming. - BTM: BSS transition management enables an AP to request a station to transition - to a specific AP, or to indicate to a station a set of preferred APs. - RRM: Radio measurements enable STAs to understand the radio environment, - it enables STAs to observe and gather data on radio link performance - and on the radio environment. Current implementation adds beacon report, - link measurement, neighbor report. - - config ESP_WIFI_SCAN_CACHE - bool "Keep scan results in cache" - depends on ESP_WIFI_11KV_SUPPORT - default n - help - Keep scan results in cache, if not enabled, those - will be flushed immediately. - - config ESP_WIFI_MBO_SUPPORT - bool "Enable Multi Band Operation Certification Support" - default n - select ESP_WIFI_11KV_SUPPORT - select ESP_WIFI_SCAN_CACHE - help - Select this option to enable WiFi Multiband operation certification support. - - config ESP_WIFI_ENABLE_ROAMING_APP - bool "Advanced support for Wi-Fi Roaming (Experimental)" - depends on IDF_EXPERIMENTAL_FEATURES - default n - select ESP_WIFI_SCAN_CACHE - help - Enable Espressif's roaming app to allow for efficient Wi-Fi roaming. - This includes configurable periodic environment scans, maintaining a cache of the - best APs, handling low rssi events etc. - - Risk Warning - Please note that this feature is still experimental and enabling this potentially can - lead to unpredictable scanning, connection and roaming attempts. - We are still working on tuning and optimising this feature to ensure reliable and stable use. - - menu "Configure roaming App" - depends on ESP_WIFI_ENABLE_ROAMING_APP - rsource "wifi_apps/roaming_app/src/Kconfig.roaming" - endmenu - - config ESP_WIFI_DPP_SUPPORT - bool "Enable DPP support" - default n - select ESP_WIFI_MBEDTLS_CRYPTO - help - Select this option to enable WiFi Easy Connect Support. - - config ESP_WIFI_11R_SUPPORT - bool "Enable 802.11R (Fast Transition) Support" - default n - help - Select this option to enable WiFi Fast Transition Support. - - config ESP_WIFI_WPS_SOFTAP_REGISTRAR - bool "Add WPS Registrar support in SoftAP mode" - depends on ESP_WIFI_SOFTAP_SUPPORT - default n - help - Select this option to enable WPS registrar support in softAP mode. - - config ESP_WIFI_ENABLE_WIFI_TX_STATS - bool "Enable Wi-Fi transmission statistics" - depends on SLAVE_SOC_WIFI_HE_SUPPORT - default n - help - Enable Wi-Fi transmission statistics. Total support 4 access category. Each access category - will use 346 bytes memory. - - config ESP_WIFI_ENABLE_WIFI_RX_STATS - bool "Enable Wi-Fi reception statistics" - depends on SLAVE_SOC_WIFI_HE_SUPPORT - default n - help - Enable Wi-Fi reception statistics. Total support 2 access category. Each access category - will use 190 bytes memory. - - config ESP_WIFI_ENABLE_WIFI_RX_MU_STATS - bool "Enable Wi-Fi DL MU-MIMO and DL OFDMA reception statistics" - depends on ESP_WIFI_ENABLE_WIFI_RX_STATS - default n - help - Enable Wi-Fi DL MU-MIMO and DL OFDMA reception statistics. Will use 10932 bytes memory. - - config ESP_WIFI_TX_HETB_QUEUE_NUM - int "WiFi TX HE TB QUEUE number for STA HE TB PPDU transmission" - depends on SLAVE_SOC_WIFI_HE_SUPPORT - range 1 4 - default 3 - help - Set the maximum number of queue that can be aggregated by the STA in the A-MPDU carried in the - HE TB PPDU. - - config ESP_WIFI_ENABLE_DUMP_HESIGB - bool "Enable Wi-Fi dump HE-SIGB which is contained in DL HE MU PPDUs" - depends on SLAVE_SOC_WIFI_HE_SUPPORT_5G - default "n" - help - Enable Wi-Fi dump HE-SIGB which is contained in DL HE MU PPDUs. - - config ESP_WIFI_ENABLE_DUMP_MU_CFO - bool "Enable Wi-Fi dump MU CFO" - depends on SLAVE_SOC_WIFI_HE_SUPPORT_5G - default "n" - help - Enable Wi-Fi dump MU CFO. - - config ESP_WIFI_ENABLE_DUMP_CTRL_NDPA - bool "Enable Wi-Fi dump NDPA frames" - depends on SLAVE_SOC_WIFI_HE_SUPPORT_5G - default "n" - help - Enable Wi-Fi dump NDPA frames. - - config ESP_WIFI_ENABLE_DUMP_CTRL_BFRP - bool "Enable Wi-Fi dump BFRP frames" - depends on SLAVE_SOC_WIFI_HE_SUPPORT_5G - default "n" - help - Enable Wi-Fi dump BFRP frames. - - menu "WPS Configuration Options" - config ESP_WIFI_WPS_STRICT - bool "Strictly validate all WPS attributes" - default n - help - Select this option to enable validate each WPS attribute - rigorously. Disabling this add the workarounds with various APs. - Enabling this may cause inter operability issues with some APs. - - config ESP_WIFI_WPS_PASSPHRASE - bool "Get WPA2 passphrase in WPS config" - default n - help - Select this option to get passphrase during WPS configuration. - This option fakes the virtual display capabilities to get the - configuration in passphrase mode. - Not recommended to be used since WPS credentials should not - be shared to other devices, making it in readable format increases - that risk, also passphrase requires pbkdf2 to convert in psk. - - endmenu # "WPS Configuration Options" - - - config ESP_WIFI_DEBUG_PRINT - bool "Print debug messages from WPA Supplicant" - default n - help - Select this option to print logging information from WPA supplicant, - this includes handshake information and key hex dumps depending - on the project logging level. - - Enabling this could increase the build size ~60kb - depending on the project logging level. - - config ESP_WIFI_TESTING_OPTIONS - bool "Add DPP testing code" - default n - help - Select this to enable unity test for DPP. - - config ESP_WIFI_ENTERPRISE_SUPPORT - bool "Enable enterprise option" - default y - help - Select this to enable/disable enterprise connection support. - - disabling this will reduce binary size. - disabling this will disable the use of any esp_wifi_sta_wpa2_ent_* (as APIs will be meaningless) - - Note that when using bigger certificates on low-power chips without crypto - hardware acceleration, it is recommended to adjust the task watchdog timer (TWDT) - if it is enabled. For precise information on timing requirements, you can check - performance numbers at https://github.com/espressif/mbedtls/wiki/Performance-Numbers. - - config ESP_WIFI_ENT_FREE_DYNAMIC_BUFFER - bool "Free dynamic buffers during WiFi enterprise connection" - depends on ESP_WIFI_ENTERPRISE_SUPPORT - default y if SLAVE_IDF_TARGET_ESP32C2 - default n if !SLAVE_IDF_TARGET_ESP32C2 - help - Select this configuration to free dynamic buffers during WiFi enterprise connection. - This will enable chip to reduce heap consumption during WiFi enterprise connection. - -# Wi-Fi configuration end diff --git a/components/esp_wifi_remote/idf_v5.3/esp_wifi_remote_weak.c b/components/esp_wifi_remote/idf_v5.3/esp_wifi_remote_weak.c deleted file mode 100644 index 326f2aba40..0000000000 --- a/components/esp_wifi_remote/idf_v5.3/esp_wifi_remote_weak.c +++ /dev/null @@ -1,392 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -// This file is auto-generated -#include "esp_wifi_remote.h" -#include "esp_log.h" - -#define WEAK __attribute__((weak)) -#define LOG_UNSUPPORTED_AND_RETURN(ret) ESP_LOGW("esp_wifi_remote_weak", "%s unsupported", __func__); \ - return ret; - -WEAK esp_err_t esp_wifi_remote_init(const wifi_init_config_t *config) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_deinit(void) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_mode(wifi_mode_t mode) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_mode(wifi_mode_t *mode) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_start(void) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_stop(void) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_restore(void) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_connect(void) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_disconnect(void) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_clear_fast_connect(void) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_deauth_sta(uint16_t aid) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_scan_start(const wifi_scan_config_t *config, _Bool block) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_scan_parameters(const wifi_scan_default_params_t *config) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_scan_parameters(wifi_scan_default_params_t *config) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_scan_stop(void) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_scan_get_ap_num(uint16_t *number) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_scan_get_ap_record(wifi_ap_record_t *ap_record) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_clear_ap_list(void) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_sta_get_ap_info(wifi_ap_record_t *ap_info) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_ps(wifi_ps_type_t type) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_ps(wifi_ps_type_t *type) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_channel(uint8_t primary, wifi_second_chan_t second) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_channel(uint8_t *primary, wifi_second_chan_t *second) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_country(const wifi_country_t *country) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_country(wifi_country_t *country) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_mac(wifi_interface_t ifx, const uint8_t mac[6]) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_mac(wifi_interface_t ifx, uint8_t mac[6]) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_promiscuous(_Bool en) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_promiscuous(_Bool *en) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_promiscuous_filter(const wifi_promiscuous_filter_t *filter) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_promiscuous_filter(wifi_promiscuous_filter_t *filter) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_promiscuous_ctrl_filter(const wifi_promiscuous_filter_t *filter) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_promiscuous_ctrl_filter(wifi_promiscuous_filter_t *filter) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_config(wifi_interface_t interface, wifi_config_t *conf) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_config(wifi_interface_t interface, wifi_config_t *conf) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_ap_get_sta_list(wifi_sta_list_t *sta) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_ap_get_sta_aid(const uint8_t mac[6], uint16_t *aid) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_storage(wifi_storage_t storage) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_vendor_ie(_Bool enable, wifi_vendor_ie_type_t type, wifi_vendor_ie_id_t idx, const void *vnd_ie) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_max_tx_power(int8_t power) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_max_tx_power(int8_t *power) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_event_mask(uint32_t mask) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_event_mask(uint32_t *mask) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_80211_tx(wifi_interface_t ifx, const void *buffer, int len, _Bool en_sys_seq) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_csi_rx_cb(wifi_csi_cb_t cb, void *ctx) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_csi_config(const wifi_csi_config_t *config) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_csi_config(wifi_csi_config_t *config) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_csi(_Bool en) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK int64_t esp_wifi_remote_get_tsf_time(wifi_interface_t interface) -{ - LOG_UNSUPPORTED_AND_RETURN(-1); -} - -WEAK esp_err_t esp_wifi_remote_set_inactive_time(wifi_interface_t ifx, uint16_t sec) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_inactive_time(wifi_interface_t ifx, uint16_t *sec) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_statis_dump(uint32_t modules) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_rssi_threshold(int32_t rssi) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_ftm_initiate_session(wifi_ftm_initiator_cfg_t *cfg) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_ftm_end_session(void) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_ftm_resp_set_offset(int16_t offset_cm) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_ftm_get_report(wifi_ftm_report_entry_t *report, uint8_t num_entries) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_config_11b_rate(wifi_interface_t ifx, _Bool disable) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_connectionless_module_set_wake_interval(uint16_t wake_interval) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_force_wakeup_acquire(void) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_force_wakeup_release(void) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_country_code(const char *country, _Bool ieee80211d_enabled) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_country_code(char *country) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_config_80211_tx_rate(wifi_interface_t ifx, wifi_phy_rate_t rate) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_disable_pmf_config(wifi_interface_t ifx) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_sta_get_aid(uint16_t *aid) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_sta_get_negotiated_phymode(wifi_phy_mode_t *phymode) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_dynamic_cs(_Bool enabled) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_sta_get_rssi(int *rssi) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} diff --git a/components/esp_wifi_remote/idf_v5.3/esp_wifi_with_remote.c b/components/esp_wifi_remote/idf_v5.3/esp_wifi_with_remote.c deleted file mode 100644 index ebc4564460..0000000000 --- a/components/esp_wifi_remote/idf_v5.3/esp_wifi_with_remote.c +++ /dev/null @@ -1,388 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -// This file is auto-generated -#include "esp_wifi.h" -#include "esp_wifi_remote.h" - -esp_err_t esp_wifi_init(const wifi_init_config_t *config) -{ - return esp_wifi_remote_init(config); -} - -esp_err_t esp_wifi_deinit(void) -{ - return esp_wifi_remote_deinit(); -} - -esp_err_t esp_wifi_set_mode(wifi_mode_t mode) -{ - return esp_wifi_remote_set_mode(mode); -} - -esp_err_t esp_wifi_get_mode(wifi_mode_t *mode) -{ - return esp_wifi_remote_get_mode(mode); -} - -esp_err_t esp_wifi_start(void) -{ - return esp_wifi_remote_start(); -} - -esp_err_t esp_wifi_stop(void) -{ - return esp_wifi_remote_stop(); -} - -esp_err_t esp_wifi_restore(void) -{ - return esp_wifi_remote_restore(); -} - -esp_err_t esp_wifi_connect(void) -{ - return esp_wifi_remote_connect(); -} - -esp_err_t esp_wifi_disconnect(void) -{ - return esp_wifi_remote_disconnect(); -} - -esp_err_t esp_wifi_clear_fast_connect(void) -{ - return esp_wifi_remote_clear_fast_connect(); -} - -esp_err_t esp_wifi_deauth_sta(uint16_t aid) -{ - return esp_wifi_remote_deauth_sta(aid); -} - -esp_err_t esp_wifi_scan_start(const wifi_scan_config_t *config, _Bool block) -{ - return esp_wifi_remote_scan_start(config, block); -} - -esp_err_t esp_wifi_set_scan_parameters(const wifi_scan_default_params_t *config) -{ - return esp_wifi_remote_set_scan_parameters(config); -} - -esp_err_t esp_wifi_get_scan_parameters(wifi_scan_default_params_t *config) -{ - return esp_wifi_remote_get_scan_parameters(config); -} - -esp_err_t esp_wifi_scan_stop(void) -{ - return esp_wifi_remote_scan_stop(); -} - -esp_err_t esp_wifi_scan_get_ap_num(uint16_t *number) -{ - return esp_wifi_remote_scan_get_ap_num(number); -} - -esp_err_t esp_wifi_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records) -{ - return esp_wifi_remote_scan_get_ap_records(number, ap_records); -} - -esp_err_t esp_wifi_scan_get_ap_record(wifi_ap_record_t *ap_record) -{ - return esp_wifi_remote_scan_get_ap_record(ap_record); -} - -esp_err_t esp_wifi_clear_ap_list(void) -{ - return esp_wifi_remote_clear_ap_list(); -} - -esp_err_t esp_wifi_sta_get_ap_info(wifi_ap_record_t *ap_info) -{ - return esp_wifi_remote_sta_get_ap_info(ap_info); -} - -esp_err_t esp_wifi_set_ps(wifi_ps_type_t type) -{ - return esp_wifi_remote_set_ps(type); -} - -esp_err_t esp_wifi_get_ps(wifi_ps_type_t *type) -{ - return esp_wifi_remote_get_ps(type); -} - -esp_err_t esp_wifi_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap) -{ - return esp_wifi_remote_set_protocol(ifx, protocol_bitmap); -} - -esp_err_t esp_wifi_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap) -{ - return esp_wifi_remote_get_protocol(ifx, protocol_bitmap); -} - -esp_err_t esp_wifi_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw) -{ - return esp_wifi_remote_set_bandwidth(ifx, bw); -} - -esp_err_t esp_wifi_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw) -{ - return esp_wifi_remote_get_bandwidth(ifx, bw); -} - -esp_err_t esp_wifi_set_channel(uint8_t primary, wifi_second_chan_t second) -{ - return esp_wifi_remote_set_channel(primary, second); -} - -esp_err_t esp_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second) -{ - return esp_wifi_remote_get_channel(primary, second); -} - -esp_err_t esp_wifi_set_country(const wifi_country_t *country) -{ - return esp_wifi_remote_set_country(country); -} - -esp_err_t esp_wifi_get_country(wifi_country_t *country) -{ - return esp_wifi_remote_get_country(country); -} - -esp_err_t esp_wifi_set_mac(wifi_interface_t ifx, const uint8_t mac[6]) -{ - return esp_wifi_remote_set_mac(ifx, mac); -} - -esp_err_t esp_wifi_get_mac(wifi_interface_t ifx, uint8_t mac[6]) -{ - return esp_wifi_remote_get_mac(ifx, mac); -} - -esp_err_t esp_wifi_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb) -{ - return esp_wifi_remote_set_promiscuous_rx_cb(cb); -} - -esp_err_t esp_wifi_set_promiscuous(_Bool en) -{ - return esp_wifi_remote_set_promiscuous(en); -} - -esp_err_t esp_wifi_get_promiscuous(_Bool *en) -{ - return esp_wifi_remote_get_promiscuous(en); -} - -esp_err_t esp_wifi_set_promiscuous_filter(const wifi_promiscuous_filter_t *filter) -{ - return esp_wifi_remote_set_promiscuous_filter(filter); -} - -esp_err_t esp_wifi_get_promiscuous_filter(wifi_promiscuous_filter_t *filter) -{ - return esp_wifi_remote_get_promiscuous_filter(filter); -} - -esp_err_t esp_wifi_set_promiscuous_ctrl_filter(const wifi_promiscuous_filter_t *filter) -{ - return esp_wifi_remote_set_promiscuous_ctrl_filter(filter); -} - -esp_err_t esp_wifi_get_promiscuous_ctrl_filter(wifi_promiscuous_filter_t *filter) -{ - return esp_wifi_remote_get_promiscuous_ctrl_filter(filter); -} - -esp_err_t esp_wifi_set_config(wifi_interface_t interface, wifi_config_t *conf) -{ - return esp_wifi_remote_set_config(interface, conf); -} - -esp_err_t esp_wifi_get_config(wifi_interface_t interface, wifi_config_t *conf) -{ - return esp_wifi_remote_get_config(interface, conf); -} - -esp_err_t esp_wifi_ap_get_sta_list(wifi_sta_list_t *sta) -{ - return esp_wifi_remote_ap_get_sta_list(sta); -} - -esp_err_t esp_wifi_ap_get_sta_aid(const uint8_t mac[6], uint16_t *aid) -{ - return esp_wifi_remote_ap_get_sta_aid(mac, aid); -} - -esp_err_t esp_wifi_set_storage(wifi_storage_t storage) -{ - return esp_wifi_remote_set_storage(storage); -} - -esp_err_t esp_wifi_set_vendor_ie(_Bool enable, wifi_vendor_ie_type_t type, wifi_vendor_ie_id_t idx, const void *vnd_ie) -{ - return esp_wifi_remote_set_vendor_ie(enable, type, idx, vnd_ie); -} - -esp_err_t esp_wifi_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx) -{ - return esp_wifi_remote_set_vendor_ie_cb(cb, ctx); -} - -esp_err_t esp_wifi_set_max_tx_power(int8_t power) -{ - return esp_wifi_remote_set_max_tx_power(power); -} - -esp_err_t esp_wifi_get_max_tx_power(int8_t *power) -{ - return esp_wifi_remote_get_max_tx_power(power); -} - -esp_err_t esp_wifi_set_event_mask(uint32_t mask) -{ - return esp_wifi_remote_set_event_mask(mask); -} - -esp_err_t esp_wifi_get_event_mask(uint32_t *mask) -{ - return esp_wifi_remote_get_event_mask(mask); -} - -esp_err_t esp_wifi_80211_tx(wifi_interface_t ifx, const void *buffer, int len, _Bool en_sys_seq) -{ - return esp_wifi_remote_80211_tx(ifx, buffer, len, en_sys_seq); -} - -esp_err_t esp_wifi_set_csi_rx_cb(wifi_csi_cb_t cb, void *ctx) -{ - return esp_wifi_remote_set_csi_rx_cb(cb, ctx); -} - -esp_err_t esp_wifi_set_csi_config(const wifi_csi_config_t *config) -{ - return esp_wifi_remote_set_csi_config(config); -} - -esp_err_t esp_wifi_get_csi_config(wifi_csi_config_t *config) -{ - return esp_wifi_remote_get_csi_config(config); -} - -esp_err_t esp_wifi_set_csi(_Bool en) -{ - return esp_wifi_remote_set_csi(en); -} - -int64_t esp_wifi_get_tsf_time(wifi_interface_t interface) -{ - return esp_wifi_remote_get_tsf_time(interface); -} - -esp_err_t esp_wifi_set_inactive_time(wifi_interface_t ifx, uint16_t sec) -{ - return esp_wifi_remote_set_inactive_time(ifx, sec); -} - -esp_err_t esp_wifi_get_inactive_time(wifi_interface_t ifx, uint16_t *sec) -{ - return esp_wifi_remote_get_inactive_time(ifx, sec); -} - -esp_err_t esp_wifi_statis_dump(uint32_t modules) -{ - return esp_wifi_remote_statis_dump(modules); -} - -esp_err_t esp_wifi_set_rssi_threshold(int32_t rssi) -{ - return esp_wifi_remote_set_rssi_threshold(rssi); -} - -esp_err_t esp_wifi_ftm_initiate_session(wifi_ftm_initiator_cfg_t *cfg) -{ - return esp_wifi_remote_ftm_initiate_session(cfg); -} - -esp_err_t esp_wifi_ftm_end_session(void) -{ - return esp_wifi_remote_ftm_end_session(); -} - -esp_err_t esp_wifi_ftm_resp_set_offset(int16_t offset_cm) -{ - return esp_wifi_remote_ftm_resp_set_offset(offset_cm); -} - -esp_err_t esp_wifi_ftm_get_report(wifi_ftm_report_entry_t *report, uint8_t num_entries) -{ - return esp_wifi_remote_ftm_get_report(report, num_entries); -} - -esp_err_t esp_wifi_config_11b_rate(wifi_interface_t ifx, _Bool disable) -{ - return esp_wifi_remote_config_11b_rate(ifx, disable); -} - -esp_err_t esp_wifi_connectionless_module_set_wake_interval(uint16_t wake_interval) -{ - return esp_wifi_remote_connectionless_module_set_wake_interval(wake_interval); -} - -esp_err_t esp_wifi_force_wakeup_acquire(void) -{ - return esp_wifi_remote_force_wakeup_acquire(); -} - -esp_err_t esp_wifi_force_wakeup_release(void) -{ - return esp_wifi_remote_force_wakeup_release(); -} - -esp_err_t esp_wifi_set_country_code(const char *country, _Bool ieee80211d_enabled) -{ - return esp_wifi_remote_set_country_code(country, ieee80211d_enabled); -} - -esp_err_t esp_wifi_get_country_code(char *country) -{ - return esp_wifi_remote_get_country_code(country); -} - -esp_err_t esp_wifi_config_80211_tx_rate(wifi_interface_t ifx, wifi_phy_rate_t rate) -{ - return esp_wifi_remote_config_80211_tx_rate(ifx, rate); -} - -esp_err_t esp_wifi_disable_pmf_config(wifi_interface_t ifx) -{ - return esp_wifi_remote_disable_pmf_config(ifx); -} - -esp_err_t esp_wifi_sta_get_aid(uint16_t *aid) -{ - return esp_wifi_remote_sta_get_aid(aid); -} - -esp_err_t esp_wifi_sta_get_negotiated_phymode(wifi_phy_mode_t *phymode) -{ - return esp_wifi_remote_sta_get_negotiated_phymode(phymode); -} - -esp_err_t esp_wifi_set_dynamic_cs(_Bool enabled) -{ - return esp_wifi_remote_set_dynamic_cs(enabled); -} - -esp_err_t esp_wifi_sta_get_rssi(int *rssi) -{ - return esp_wifi_remote_sta_get_rssi(rssi); -} diff --git a/components/esp_wifi_remote/idf_v5.3/include/esp_wifi_remote_api.h b/components/esp_wifi_remote/idf_v5.3/include/esp_wifi_remote_api.h deleted file mode 100644 index 0a0a31a16f..0000000000 --- a/components/esp_wifi_remote/idf_v5.3/include/esp_wifi_remote_api.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -// This file is auto-generated -#pragma once -esp_err_t esp_wifi_remote_init(const wifi_init_config_t *config); -esp_err_t esp_wifi_remote_deinit(void); -esp_err_t esp_wifi_remote_set_mode(wifi_mode_t mode); -esp_err_t esp_wifi_remote_get_mode(wifi_mode_t *mode); -esp_err_t esp_wifi_remote_start(void); -esp_err_t esp_wifi_remote_stop(void); -esp_err_t esp_wifi_remote_restore(void); -esp_err_t esp_wifi_remote_connect(void); -esp_err_t esp_wifi_remote_disconnect(void); -esp_err_t esp_wifi_remote_clear_fast_connect(void); -esp_err_t esp_wifi_remote_deauth_sta(uint16_t aid); -esp_err_t esp_wifi_remote_scan_start(const wifi_scan_config_t *config, _Bool block); -esp_err_t esp_wifi_remote_set_scan_parameters(const wifi_scan_default_params_t *config); -esp_err_t esp_wifi_remote_get_scan_parameters(wifi_scan_default_params_t *config); -esp_err_t esp_wifi_remote_scan_stop(void); -esp_err_t esp_wifi_remote_scan_get_ap_num(uint16_t *number); -esp_err_t esp_wifi_remote_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records); -esp_err_t esp_wifi_remote_scan_get_ap_record(wifi_ap_record_t *ap_record); -esp_err_t esp_wifi_remote_clear_ap_list(void); -esp_err_t esp_wifi_remote_sta_get_ap_info(wifi_ap_record_t *ap_info); -esp_err_t esp_wifi_remote_set_ps(wifi_ps_type_t type); -esp_err_t esp_wifi_remote_get_ps(wifi_ps_type_t *type); -esp_err_t esp_wifi_remote_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap); -esp_err_t esp_wifi_remote_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap); -esp_err_t esp_wifi_remote_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw); -esp_err_t esp_wifi_remote_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw); -esp_err_t esp_wifi_remote_set_channel(uint8_t primary, wifi_second_chan_t second); -esp_err_t esp_wifi_remote_get_channel(uint8_t *primary, wifi_second_chan_t *second); -esp_err_t esp_wifi_remote_set_country(const wifi_country_t *country); -esp_err_t esp_wifi_remote_get_country(wifi_country_t *country); -esp_err_t esp_wifi_remote_set_mac(wifi_interface_t ifx, const uint8_t mac[6]); -esp_err_t esp_wifi_remote_get_mac(wifi_interface_t ifx, uint8_t mac[6]); -esp_err_t esp_wifi_remote_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb); -esp_err_t esp_wifi_remote_set_promiscuous(_Bool en); -esp_err_t esp_wifi_remote_get_promiscuous(_Bool *en); -esp_err_t esp_wifi_remote_set_promiscuous_filter(const wifi_promiscuous_filter_t *filter); -esp_err_t esp_wifi_remote_get_promiscuous_filter(wifi_promiscuous_filter_t *filter); -esp_err_t esp_wifi_remote_set_promiscuous_ctrl_filter(const wifi_promiscuous_filter_t *filter); -esp_err_t esp_wifi_remote_get_promiscuous_ctrl_filter(wifi_promiscuous_filter_t *filter); -esp_err_t esp_wifi_remote_set_config(wifi_interface_t interface, wifi_config_t *conf); -esp_err_t esp_wifi_remote_get_config(wifi_interface_t interface, wifi_config_t *conf); -esp_err_t esp_wifi_remote_ap_get_sta_list(wifi_sta_list_t *sta); -esp_err_t esp_wifi_remote_ap_get_sta_aid(const uint8_t mac[6], uint16_t *aid); -esp_err_t esp_wifi_remote_set_storage(wifi_storage_t storage); -esp_err_t esp_wifi_remote_set_vendor_ie(_Bool enable, wifi_vendor_ie_type_t type, wifi_vendor_ie_id_t idx, const void *vnd_ie); -esp_err_t esp_wifi_remote_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx); -esp_err_t esp_wifi_remote_set_max_tx_power(int8_t power); -esp_err_t esp_wifi_remote_get_max_tx_power(int8_t *power); -esp_err_t esp_wifi_remote_set_event_mask(uint32_t mask); -esp_err_t esp_wifi_remote_get_event_mask(uint32_t *mask); -esp_err_t esp_wifi_remote_80211_tx(wifi_interface_t ifx, const void *buffer, int len, _Bool en_sys_seq); -esp_err_t esp_wifi_remote_set_csi_rx_cb(wifi_csi_cb_t cb, void *ctx); -esp_err_t esp_wifi_remote_set_csi_config(const wifi_csi_config_t *config); -esp_err_t esp_wifi_remote_get_csi_config(wifi_csi_config_t *config); -esp_err_t esp_wifi_remote_set_csi(_Bool en); -int64_t esp_wifi_remote_get_tsf_time(wifi_interface_t interface); -esp_err_t esp_wifi_remote_set_inactive_time(wifi_interface_t ifx, uint16_t sec); -esp_err_t esp_wifi_remote_get_inactive_time(wifi_interface_t ifx, uint16_t *sec); -esp_err_t esp_wifi_remote_statis_dump(uint32_t modules); -esp_err_t esp_wifi_remote_set_rssi_threshold(int32_t rssi); -esp_err_t esp_wifi_remote_ftm_initiate_session(wifi_ftm_initiator_cfg_t *cfg); -esp_err_t esp_wifi_remote_ftm_end_session(void); -esp_err_t esp_wifi_remote_ftm_resp_set_offset(int16_t offset_cm); -esp_err_t esp_wifi_remote_ftm_get_report(wifi_ftm_report_entry_t *report, uint8_t num_entries); -esp_err_t esp_wifi_remote_config_11b_rate(wifi_interface_t ifx, _Bool disable); -esp_err_t esp_wifi_remote_connectionless_module_set_wake_interval(uint16_t wake_interval); -esp_err_t esp_wifi_remote_force_wakeup_acquire(void); -esp_err_t esp_wifi_remote_force_wakeup_release(void); -esp_err_t esp_wifi_remote_set_country_code(const char *country, _Bool ieee80211d_enabled); -esp_err_t esp_wifi_remote_get_country_code(char *country); -esp_err_t esp_wifi_remote_config_80211_tx_rate(wifi_interface_t ifx, wifi_phy_rate_t rate); -esp_err_t esp_wifi_remote_disable_pmf_config(wifi_interface_t ifx); -esp_err_t esp_wifi_remote_sta_get_aid(uint16_t *aid); -esp_err_t esp_wifi_remote_sta_get_negotiated_phymode(wifi_phy_mode_t *phymode); -esp_err_t esp_wifi_remote_set_dynamic_cs(_Bool enabled); -esp_err_t esp_wifi_remote_sta_get_rssi(int *rssi); diff --git a/components/esp_wifi_remote/idf_v5.3/include/esp_wifi_types_native.h b/components/esp_wifi_remote/idf_v5.3/include/esp_wifi_types_native.h deleted file mode 100644 index 4ae9c80250..0000000000 --- a/components/esp_wifi_remote/idf_v5.3/include/esp_wifi_types_native.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once - -#include "sdkconfig.h" -#include "esp_wifi_types_generic.h" -#if CONFIG_SLAVE_SOC_WIFI_HE_SUPPORT -#include "esp_wifi_he_types.h" -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#if CONFIG_SLAVE_IDF_TARGET_ESP32C2 -#define ESP_WIFI_MAX_CONN_NUM (4) /**< max number of stations which can connect to ESP32C2 soft-AP */ -#elif CONFIG_SLAVE_IDF_TARGET_ESP32C3 || CONFIG_SLAVE_IDF_TARGET_ESP32C6 || CONFIG_SLAVE_IDF_TARGET_ESP32C5 -#define ESP_WIFI_MAX_CONN_NUM (10) /**< max number of stations which can connect to ESP32C3 soft-AP */ -#else -#define ESP_WIFI_MAX_CONN_NUM (15) /**< max number of stations which can connect to ESP32/ESP32S3/ESP32S2 soft-AP */ -#endif - -/** @brief List of stations associated with the Soft-AP */ -typedef struct wifi_sta_list_t { - wifi_sta_info_t sta[ESP_WIFI_MAX_CONN_NUM]; /**< station list */ - int num; /**< number of stations in the list (other entries are invalid) */ -} wifi_sta_list_t; - -#if CONFIG_SLAVE_SOC_WIFI_HE_SUPPORT -typedef esp_wifi_rxctrl_t wifi_pkt_rx_ctrl_t; -#else -/** @brief Received packet radio metadata header, this is the common header at the beginning of all promiscuous mode RX callback buffers */ -typedef struct { - signed rssi: 8; /**< Received Signal Strength Indicator(RSSI) of packet. unit: dBm */ - unsigned rate: 5; /**< PHY rate encoding of the packet. Only valid for non HT(11bg) packet */ - unsigned : 1; /**< reserved */ - unsigned sig_mode: 2; /**< Protocol of the received packet, 0: non HT(11bg) packet; 1: HT(11n) packet; 3: VHT(11ac) packet */ - unsigned : 16; /**< reserved */ - unsigned mcs: 7; /**< Modulation Coding Scheme. If is HT(11n) packet, shows the modulation, range from 0 to 76(MSC0 ~ MCS76) */ - unsigned cwb: 1; /**< Channel Bandwidth of the packet. 0: 20MHz; 1: 40MHz */ - unsigned : 16; /**< reserved */ - unsigned smoothing: 1; /**< Set to 1 indicates that channel estimate smoothing is recommended. - Set to 0 indicates that only per-carrierindependent (unsmoothed) channel estimate is recommended. */ - unsigned not_sounding: 1; /**< Set to 0 indicates that PPDU is a sounding PPDU. Set to 1indicates that the PPDU is not a sounding PPDU. - sounding PPDU is used for channel estimation by the request receiver */ - unsigned : 1; /**< reserved */ - unsigned aggregation: 1; /**< Aggregation. 0: MPDU packet; 1: AMPDU packet */ - unsigned stbc: 2; /**< Space Time Block Code(STBC). 0: non STBC packet; 1: STBC packet */ - unsigned fec_coding: 1; /**< Forward Error Correction(FEC). Flag is set for 11n packets which are LDPC */ - unsigned sgi: 1; /**< Short Guide Interval(SGI). 0: Long GI; 1: Short GI */ -#if CONFIG_SLAVE_IDF_TARGET_ESP32 - signed noise_floor: 8; /**< noise floor of Radio Frequency Module(RF). unit: dBm*/ -#elif CONFIG_SLAVE_IDF_TARGET_ESP32S2 || CONFIG_SLAVE_IDF_TARGET_ESP32S3 || CONFIG_SLAVE_IDF_TARGET_ESP32C3 || CONFIG_SLAVE_IDF_TARGET_ESP32C2 - unsigned : 8; /**< reserved */ -#endif - unsigned ampdu_cnt: 8; /**< the number of subframes aggregated in AMPDU */ - unsigned channel: 4; /**< primary channel on which this packet is received */ - unsigned secondary_channel: 4; /**< secondary channel on which this packet is received. 0: none; 1: above; 2: below */ - unsigned : 8; /**< reserved */ - unsigned timestamp: 32; /**< timestamp. The local time when this packet is received. It is precise only if modem sleep or light sleep is not enabled. unit: microsecond */ - unsigned : 32; /**< reserved */ -#if CONFIG_SLAVE_IDF_TARGET_ESP32S2 - unsigned : 32; /**< reserved */ -#elif CONFIG_SLAVE_IDF_TARGET_ESP32S3 || CONFIG_SLAVE_IDF_TARGET_ESP32C3 || CONFIG_SLAVE_IDF_TARGET_ESP32C2 - signed noise_floor: 8; /**< noise floor of Radio Frequency Module(RF). unit: dBm*/ - unsigned : 24; /**< reserved */ - unsigned : 32; /**< reserved */ -#endif - unsigned : 31; /**< reserved */ - unsigned ant: 1; /**< antenna number from which this packet is received. 0: WiFi antenna 0; 1: WiFi antenna 1 */ -#if CONFIG_SLAVE_IDF_TARGET_ESP32S2 - signed noise_floor: 8; /**< noise floor of Radio Frequency Module(RF). unit: dBm*/ - unsigned : 24; /**< reserved */ -#elif CONFIG_SLAVE_IDF_TARGET_ESP32S3 || CONFIG_SLAVE_IDF_TARGET_ESP32C3 || CONFIG_SLAVE_IDF_TARGET_ESP32C2 - unsigned : 32; /**< reserved */ - unsigned : 32; /**< reserved */ - unsigned : 32; /**< reserved */ -#endif - unsigned sig_len: 12; /**< length of packet including Frame Check Sequence(FCS) */ - unsigned : 12; /**< reserved */ - unsigned rx_state: 8; /**< state of the packet. 0: no error; others: error numbers which are not public */ -} wifi_pkt_rx_ctrl_t; -#endif - -/** - * @brief Channel state information(CSI) configuration type - * - */ -#if CONFIG_SLAVE_SOC_WIFI_HE_SUPPORT -typedef wifi_csi_acquire_config_t wifi_csi_config_t; -#else -typedef struct { - bool lltf_en; /**< enable to receive legacy long training field(lltf) data. Default enabled */ - bool htltf_en; /**< enable to receive HT long training field(htltf) data. Default enabled */ - bool stbc_htltf2_en; /**< enable to receive space time block code HT long training field(stbc-htltf2) data. Default enabled */ - bool ltf_merge_en; /**< enable to generate htlft data by averaging lltf and ht_ltf data when receiving HT packet. Otherwise, use ht_ltf data directly. Default enabled */ - bool channel_filter_en; /**< enable to turn on channel filter to smooth adjacent sub-carrier. Disable it to keep independence of adjacent sub-carrier. Default enabled */ - bool manu_scale; /**< manually scale the CSI data by left shifting or automatically scale the CSI data. If set true, please set the shift bits. false: automatically. true: manually. Default false */ - uint8_t shift; /**< manually left shift bits of the scale of the CSI data. The range of the left shift bits is 0~15 */ - bool dump_ack_en; /**< enable to dump 802.11 ACK frame, default disabled */ -} wifi_csi_config_t; -#endif // !CONFIG_SLAVE_SOC_WIFI_HE_SUPPORT - -/** @brief Payload passed to 'buf' parameter of promiscuous mode RX callback. - */ -typedef struct { - wifi_pkt_rx_ctrl_t rx_ctrl; /**< metadata header */ - uint8_t payload[0]; /**< Data or management payload. Length of payload is described by rx_ctrl.sig_len. Type of content determined by packet type argument of callback. */ -} wifi_promiscuous_pkt_t; - -/** - * @brief CSI data type - * - */ -typedef struct wifi_csi_info_t { - wifi_pkt_rx_ctrl_t rx_ctrl;/**< received packet radio metadata header of the CSI data */ - uint8_t mac[6]; /**< source MAC address of the CSI data */ - uint8_t dmac[6]; /**< destination MAC address of the CSI data */ - bool first_word_invalid; /**< first four bytes of the CSI data is invalid or not, true indicates the first four bytes is invalid due to hardware limitation */ - int8_t *buf; /**< valid buffer of CSI data */ - uint16_t len; /**< valid length of CSI data */ - uint8_t *hdr; /**< header of the wifi packet */ - uint8_t *payload; /**< payload of the wifi packet */ - uint16_t payload_len; /**< payload len of the wifi packet */ - uint16_t rx_seq; /**< rx sequence number of the wifi packet */ -} wifi_csi_info_t; - -#ifdef __cplusplus -} -#endif diff --git a/components/esp_wifi_remote/idf_v5.3/wifi_apps/roaming_app/src/Kconfig.roaming b/components/esp_wifi_remote/idf_v5.3/wifi_apps/roaming_app/src/Kconfig.roaming deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/components/esp_wifi_remote/idf_v5.4/Kconfig.slave_select.in b/components/esp_wifi_remote/idf_v5.4/Kconfig.slave_select.in deleted file mode 100644 index 5e315361b1..0000000000 --- a/components/esp_wifi_remote/idf_v5.4/Kconfig.slave_select.in +++ /dev/null @@ -1,21 +0,0 @@ -# This file is auto-generated - choice SLAVE_IDF_TARGET - prompt "choose slave target" - default SLAVE_IDF_TARGET_ESP32 - config SLAVE_IDF_TARGET_ESP32 - bool "esp32" - config SLAVE_IDF_TARGET_ESP32S2 - bool "esp32s2" - config SLAVE_IDF_TARGET_ESP32C3 - bool "esp32c3" - config SLAVE_IDF_TARGET_ESP32S3 - bool "esp32s3" - config SLAVE_IDF_TARGET_ESP32C2 - bool "esp32c2" - config SLAVE_IDF_TARGET_ESP32C6 - bool "esp32c6" - config SLAVE_IDF_TARGET_ESP32C5 - bool "esp32c5" - config SLAVE_IDF_TARGET_ESP32C61 - bool "esp32c61" - endchoice diff --git a/components/esp_wifi_remote/idf_v5.4/Kconfig.soc_wifi_caps.in b/components/esp_wifi_remote/idf_v5.4/Kconfig.soc_wifi_caps.in deleted file mode 100644 index d01366aba9..0000000000 --- a/components/esp_wifi_remote/idf_v5.4/Kconfig.soc_wifi_caps.in +++ /dev/null @@ -1,321 +0,0 @@ -# This file is auto-generated - -if SLAVE_IDF_TARGET_ESP32 - - config SLAVE_SOC_WIFI_SUPPORTED - bool - default y - - config SLAVE_SOC_WIFI_WAPI_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_CSI_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_MESH_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_SUPPORT_VARIABLE_BEACON_WINDOW - bool - default y - - config SLAVE_SOC_WIFI_NAN_SUPPORT - bool - default y - -endif # ESP32 - -if SLAVE_IDF_TARGET_ESP32S2 - - config SLAVE_SOC_WIFI_SUPPORTED - bool - default y - - config SLAVE_SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH - int - default 12 - - config SLAVE_SOC_WIFI_HW_TSF - bool - default y - - config SLAVE_SOC_WIFI_FTM_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_WAPI_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_CSI_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_MESH_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_SUPPORT_VARIABLE_BEACON_WINDOW - bool - default y - - config SLAVE_SOC_WIFI_NAN_SUPPORT - bool - default y - -endif # ESP32S2 - -if SLAVE_IDF_TARGET_ESP32C3 - - config SLAVE_SOC_WIFI_SUPPORTED - bool - default y - - config SLAVE_SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH - int - default 12 - - config SLAVE_SOC_WIFI_HW_TSF - bool - default y - - config SLAVE_SOC_WIFI_FTM_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_GCMP_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_WAPI_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_CSI_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_MESH_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_SUPPORT_VARIABLE_BEACON_WINDOW - bool - default y - - config SLAVE_SOC_WIFI_PHY_NEEDS_USB_WORKAROUND - bool - default y - -endif # ESP32C3 - -if SLAVE_IDF_TARGET_ESP32S3 - - config SLAVE_SOC_WIFI_SUPPORTED - bool - default y - - config SLAVE_SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH - int - default 12 - - config SLAVE_SOC_WIFI_HW_TSF - bool - default y - - config SLAVE_SOC_WIFI_FTM_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_GCMP_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_WAPI_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_CSI_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_MESH_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_SUPPORT_VARIABLE_BEACON_WINDOW - bool - default y - - config SLAVE_SOC_WIFI_PHY_NEEDS_USB_WORKAROUND - bool - default y - -endif # ESP32S3 - -if SLAVE_IDF_TARGET_ESP32C2 - - config SLAVE_SOC_WIFI_SUPPORTED - bool - default y - - config SLAVE_SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH - int - default 12 - - config SLAVE_SOC_WIFI_HW_TSF - bool - default y - - config SLAVE_SOC_WIFI_FTM_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_SUPPORT_VARIABLE_BEACON_WINDOW - bool - default y - - config SLAVE_SOC_WIFI_PHY_NEEDS_USB_WORKAROUND - bool - default y - -endif # ESP32C2 - -if SLAVE_IDF_TARGET_ESP32C6 - - config SLAVE_SOC_WIFI_SUPPORTED - bool - default y - - config SLAVE_SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH - int - default 12 - - config SLAVE_SOC_WIFI_HW_TSF - bool - default y - - config SLAVE_SOC_WIFI_FTM_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_GCMP_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_WAPI_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_CSI_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_MESH_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_HE_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_MAC_VERSION_NUM - int - default 2 - -endif # ESP32C6 - -if SLAVE_IDF_TARGET_ESP32C5 - - config SLAVE_SOC_WIFI_SUPPORTED - bool - default y - - config SLAVE_SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH - int - default 12 - - config SLAVE_SOC_WIFI_HW_TSF - bool - default y - - config SLAVE_SOC_WIFI_FTM_SUPPORT - bool - default n - - config SLAVE_SOC_WIFI_GCMP_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_WAPI_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_CSI_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_MESH_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_HE_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_SUPPORT_5G - bool - default y - - config SLAVE_SOC_WIFI_MAC_VERSION_NUM - int - default 3 - -endif # ESP32C5 - -if SLAVE_IDF_TARGET_ESP32C61 - - config SLAVE_SOC_WIFI_SUPPORTED - bool - default y - - config SLAVE_SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH - int - default 12 - - config SLAVE_SOC_WIFI_HW_TSF - bool - default y - - config SLAVE_SOC_WIFI_FTM_SUPPORT - bool - default n - - config SLAVE_SOC_WIFI_GCMP_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_WAPI_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_CSI_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_MESH_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_HE_SUPPORT - bool - default y - - config SLAVE_SOC_WIFI_MAC_VERSION_NUM - int - default 3 - -endif # ESP32C61 diff --git a/components/esp_wifi_remote/idf_v5.4/Kconfig.wifi.in b/components/esp_wifi_remote/idf_v5.4/Kconfig.wifi.in deleted file mode 100644 index d82c6aafd8..0000000000 --- a/components/esp_wifi_remote/idf_v5.4/Kconfig.wifi.in +++ /dev/null @@ -1,726 +0,0 @@ -# Wi-Fi configuration -# This file is auto-generated - - config ESP_WIFI_STATIC_RX_BUFFER_NUM - int "Max number of WiFi static RX buffers" - range 2 25 if !SLAVE_SOC_WIFI_HE_SUPPORT - range 2 128 if SLAVE_SOC_WIFI_HE_SUPPORT - default 10 if !SPIRAM_TRY_ALLOCATE_WIFI_LWIP - default 16 if SPIRAM_TRY_ALLOCATE_WIFI_LWIP - help - Set the number of WiFi static RX buffers. Each buffer takes approximately 1.6KB of RAM. - The static rx buffers are allocated when esp_wifi_init is called, they are not freed - until esp_wifi_deinit is called. - - WiFi hardware use these buffers to receive all 802.11 frames. - A higher number may allow higher throughput but increases memory use. If ESP_WIFI_AMPDU_RX_ENABLED - is enabled, this value is recommended to set equal or bigger than ESP_WIFI_RX_BA_WIN in order to - achieve better throughput and compatibility with both stations and APs. - - config ESP_WIFI_DYNAMIC_RX_BUFFER_NUM - int "Max number of WiFi dynamic RX buffers" - range 0 128 if !LWIP_WND_SCALE - range 0 1024 if LWIP_WND_SCALE - default 32 - help - Set the number of WiFi dynamic RX buffers, 0 means unlimited RX buffers will be allocated - (provided sufficient free RAM). The size of each dynamic RX buffer depends on the size of - the received data frame. - - For each received data frame, the WiFi driver makes a copy to an RX buffer and then delivers - it to the high layer TCP/IP stack. The dynamic RX buffer is freed after the higher layer has - successfully received the data frame. - - For some applications, WiFi data frames may be received faster than the application can - process them. In these cases we may run out of memory if RX buffer number is unlimited (0). - - If a dynamic RX buffer limit is set, it should be at least the number of static RX buffers. - - choice ESP_WIFI_TX_BUFFER - prompt "Type of WiFi TX buffers" - default ESP_WIFI_DYNAMIC_TX_BUFFER - help - Select type of WiFi TX buffers: - - If "Static" is selected, WiFi TX buffers are allocated when WiFi is initialized and released - when WiFi is de-initialized. The size of each static TX buffer is fixed to about 1.6KB. - - If "Dynamic" is selected, each WiFi TX buffer is allocated as needed when a data frame is - delivered to the Wifi driver from the TCP/IP stack. The buffer is freed after the data frame - has been sent by the WiFi driver. The size of each dynamic TX buffer depends on the length - of each data frame sent by the TCP/IP layer. - - If PSRAM is enabled, "Static" should be selected to guarantee enough WiFi TX buffers. - If PSRAM is disabled, "Dynamic" should be selected to improve the utilization of RAM. - - config ESP_WIFI_STATIC_TX_BUFFER - bool "Static" - config ESP_WIFI_DYNAMIC_TX_BUFFER - bool "Dynamic" - depends on !SPIRAM_USE_MALLOC - endchoice - - config ESP_WIFI_TX_BUFFER_TYPE - int - default 0 if ESP_WIFI_STATIC_TX_BUFFER - default 1 if ESP_WIFI_DYNAMIC_TX_BUFFER - - config ESP_WIFI_STATIC_TX_BUFFER_NUM - int "Max number of WiFi static TX buffers" - depends on ESP_WIFI_STATIC_TX_BUFFER - range 1 64 - default 16 - help - Set the number of WiFi static TX buffers. Each buffer takes approximately 1.6KB of RAM. - The static RX buffers are allocated when esp_wifi_init() is called, they are not released - until esp_wifi_deinit() is called. - - For each transmitted data frame from the higher layer TCP/IP stack, the WiFi driver makes a - copy of it in a TX buffer. For some applications especially UDP applications, the upper - layer can deliver frames faster than WiFi layer can transmit. In these cases, we may run out - of TX buffers. - - config ESP_WIFI_CACHE_TX_BUFFER_NUM - int "Max number of WiFi cache TX buffers" - depends on SPIRAM - range 16 128 - default 32 - help - Set the number of WiFi cache TX buffer number. - - For each TX packet from uplayer, such as LWIP etc, WiFi driver needs to allocate a static TX - buffer and makes a copy of uplayer packet. If WiFi driver fails to allocate the static TX buffer, - it caches the uplayer packets to a dedicated buffer queue, this option is used to configure the - size of the cached TX queue. - - config ESP_WIFI_DYNAMIC_TX_BUFFER_NUM - int "Max number of WiFi dynamic TX buffers" - depends on ESP_WIFI_DYNAMIC_TX_BUFFER - range 1 128 - default 32 - help - Set the number of WiFi dynamic TX buffers. The size of each dynamic TX buffer is not fixed, - it depends on the size of each transmitted data frame. - - For each transmitted frame from the higher layer TCP/IP stack, the WiFi driver makes a copy - of it in a TX buffer. For some applications, especially UDP applications, the upper layer - can deliver frames faster than WiFi layer can transmit. In these cases, we may run out of TX - buffers. - - choice ESP_WIFI_MGMT_RX_BUFFER - prompt "Type of WiFi RX MGMT buffers" - default ESP_WIFI_STATIC_RX_MGMT_BUFFER - help - Select type of WiFi RX MGMT buffers: - - If "Static" is selected, WiFi RX MGMT buffers are allocated when WiFi is initialized and released - when WiFi is de-initialized. The size of each static RX MGMT buffer is fixed to about 500 Bytes. - - If "Dynamic" is selected, each WiFi RX MGMT buffer is allocated as needed when a MGMT data frame is - received. The MGMT buffer is freed after the MGMT data frame has been processed by the WiFi driver. - - - config ESP_WIFI_STATIC_RX_MGMT_BUFFER - bool "Static" - config ESP_WIFI_DYNAMIC_RX_MGMT_BUFFER - bool "Dynamic" - endchoice - - config ESP_WIFI_DYNAMIC_RX_MGMT_BUF - int - default 0 if ESP_WIFI_STATIC_RX_MGMT_BUFFER - default 1 if ESP_WIFI_DYNAMIC_RX_MGMT_BUFFER - - config ESP_WIFI_RX_MGMT_BUF_NUM_DEF - int "Max number of WiFi RX MGMT buffers" - range 1 10 - default 5 - help - Set the number of WiFi RX_MGMT buffers. - - For Management buffers, the number of dynamic and static management buffers is the same. - In order to prevent memory fragmentation, the management buffer type should be set to static first. - - config ESP_WIFI_CSI_ENABLED - bool "WiFi CSI(Channel State Information)" - depends on SLAVE_SOC_WIFI_CSI_SUPPORT - default n - help - Select this option to enable CSI(Channel State Information) feature. CSI takes about - CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM KB of RAM. If CSI is not used, it is better to disable - this feature in order to save memory. - - config ESP_WIFI_AMPDU_TX_ENABLED - bool "WiFi AMPDU TX" - default y - help - Select this option to enable AMPDU TX feature - - - config ESP_WIFI_TX_BA_WIN - int "WiFi AMPDU TX BA window size" - depends on ESP_WIFI_AMPDU_TX_ENABLED - range 2 32 if !SLAVE_SOC_WIFI_HE_SUPPORT - range 2 64 if SLAVE_SOC_WIFI_HE_SUPPORT - default 6 - help - Set the size of WiFi Block Ack TX window. Generally a bigger value means higher throughput but - more memory. Most of time we should NOT change the default value unless special reason, e.g. - test the maximum UDP TX throughput with iperf etc. For iperf test in shieldbox, the recommended - value is 9~12. - - config ESP_WIFI_AMPDU_RX_ENABLED - bool "WiFi AMPDU RX" - default y - help - Select this option to enable AMPDU RX feature - - config ESP_WIFI_RX_BA_WIN - int "WiFi AMPDU RX BA window size" - depends on ESP_WIFI_AMPDU_RX_ENABLED - range 2 32 if !SLAVE_SOC_WIFI_HE_SUPPORT - range 2 64 if SLAVE_SOC_WIFI_HE_SUPPORT - default 6 if !SPIRAM_TRY_ALLOCATE_WIFI_LWIP - default 16 if SPIRAM_TRY_ALLOCATE_WIFI_LWIP - help - Set the size of WiFi Block Ack RX window. Generally a bigger value means higher throughput and better - compatibility but more memory. Most of time we should NOT change the default value unless special - reason, e.g. test the maximum UDP RX throughput with iperf etc. For iperf test in shieldbox, the - recommended value is 9~12. If PSRAM is used and WiFi memory is preferred to allocate in PSRAM first, - the default and minimum value should be 16 to achieve better throughput and compatibility with both - stations and APs. - - config ESP_WIFI_AMSDU_TX_ENABLED - bool "WiFi AMSDU TX" - depends on SPIRAM - default n - help - Select this option to enable AMSDU TX feature - - config ESP_WIFI_NVS_ENABLED - bool "WiFi NVS flash" - default y - help - Select this option to enable WiFi NVS flash - - choice ESP_WIFI_TASK_CORE_ID - depends on !FREERTOS_UNICORE - prompt "WiFi Task Core ID" - default ESP_WIFI_TASK_PINNED_TO_CORE_0 - help - Pinned WiFi task to core 0 or core 1. - - config ESP_WIFI_TASK_PINNED_TO_CORE_0 - bool "Core 0" - config ESP_WIFI_TASK_PINNED_TO_CORE_1 - bool "Core 1" - endchoice - - config ESP_WIFI_SOFTAP_BEACON_MAX_LEN - int "Max length of WiFi SoftAP Beacon" - range 752 1256 - default 752 - help - ESP-MESH utilizes beacon frames to detect and resolve root node conflicts (see documentation). However - the default length of a beacon frame can simultaneously hold only five root node identifier structures, - meaning that a root node conflict of up to five nodes can be detected at one time. In the occurrence of - more root nodes conflict involving more than five root nodes, the conflict resolution process will - detect five of the root nodes, resolve the conflict, and re-detect more root nodes. This process will - repeat until all root node conflicts are resolved. However this process can generally take a very long - time. - - To counter this situation, the beacon frame length can be increased such that more root nodes can be - detected simultaneously. Each additional root node will require 36 bytes and should be added on top of - the default beacon frame length of - 752 bytes. For example, if you want to detect 10 root nodes simultaneously, you need to set the beacon - frame length as - 932 (752+36*5). - - Setting a longer beacon length also assists with debugging as the conflicting root nodes can be - identified more quickly. - - config ESP_WIFI_MGMT_SBUF_NUM - int "WiFi mgmt short buffer number" - range 6 32 - default 32 - help - Set the maximum number of Wi-Fi management short buffers. These buffers are dynamically allocated, - with their size determined by the length of the management packet to be sent. When a management - packet is less than 64 bytes, the Wi-Fi driver classifies it as a short management packet and - assigns it to one of these buffers. - - config ESP_WIFI_IRAM_OPT - bool "WiFi IRAM speed optimization" - default n if (BT_ENABLED && SPIRAM && SLAVE_IDF_TARGET_ESP32) - default y - help - Select this option to place frequently called Wi-Fi library functions in IRAM. - When this option is disabled, more than 10Kbytes of IRAM memory will be saved - but Wi-Fi throughput will be reduced. - - config ESP_WIFI_EXTRA_IRAM_OPT - bool "WiFi EXTRA IRAM speed optimization" - default y if SLAVE_SOC_WIFI_HE_SUPPORT - default n - help - Select this option to place additional frequently called Wi-Fi library functions - in IRAM. When this option is disabled, more than 5Kbytes of IRAM memory will be saved - but Wi-Fi throughput will be reduced. - - config ESP_WIFI_RX_IRAM_OPT - bool "WiFi RX IRAM speed optimization" - default n if (BT_ENABLED && SPIRAM && SLAVE_IDF_TARGET_ESP32) - default y - help - Select this option to place frequently called Wi-Fi library RX functions in IRAM. - When this option is disabled, more than 17Kbytes of IRAM memory will be saved - but Wi-Fi performance will be reduced. - - config ESP_WIFI_ENABLE_WPA3_SAE - bool "Enable WPA3-Personal" - default y - select ESP_WIFI_MBEDTLS_CRYPTO - help - Select this option to allow the device to establish a WPA3-Personal connection with eligible AP's. - PMF (Protected Management Frames) is a prerequisite feature for a WPA3 connection, it needs to be - explicitly configured before attempting connection. Please refer to the Wi-Fi Driver API Guide - for details. - - config ESP_WIFI_ENABLE_SAE_PK - bool "Enable SAE-PK" - default y - depends on ESP_WIFI_ENABLE_WPA3_SAE - help - Select this option to enable SAE-PK - - config ESP_WIFI_SOFTAP_SAE_SUPPORT - bool "Enable WPA3 Personal(SAE) SoftAP" - default y - depends on ESP_WIFI_ENABLE_WPA3_SAE - depends on ESP_WIFI_SOFTAP_SUPPORT - help - Select this option to enable SAE support in softAP mode. - - config ESP_WIFI_ENABLE_WPA3_OWE_STA - bool "Enable OWE STA" - default y - select ESP_WIFI_MBEDTLS_CRYPTO - help - Select this option to allow the device to establish OWE connection with eligible AP's. - PMF (Protected Management Frames) is a prerequisite feature for a WPA3 connection, it needs to be - explicitly configured before attempting connection. Please refer to the Wi-Fi Driver API Guide - for details. - - config ESP_WIFI_SLP_IRAM_OPT - bool "WiFi SLP IRAM speed optimization" - select PM_SLP_DEFAULT_PARAMS_OPT - select PERIPH_CTRL_FUNC_IN_IRAM - default y if SLAVE_SOC_WIFI_HE_SUPPORT - help - Select this option to place called Wi-Fi library TBTT process and receive beacon functions in IRAM. - Some functions can be put in IRAM either by ESP_WIFI_IRAM_OPT and ESP_WIFI_RX_IRAM_OPT, or this one. - If already enabled ESP_WIFI_IRAM_OPT, the other 7.3KB IRAM memory would be taken by this option. - If already enabled ESP_WIFI_RX_IRAM_OPT, the other 1.3KB IRAM memory would be taken by this option. - If neither of them are enabled, the other 7.4KB IRAM memory would be taken by this option. - Wi-Fi power-save mode average current would be reduced if this option is enabled. - - config ESP_WIFI_SLP_DEFAULT_MIN_ACTIVE_TIME - int "Minimum active time" - range 8 60 - default 50 - help - Only for station in WIFI_PS_MIN_MODEM or WIFI_PS_MAX_MODEM. When the station enters the active state, - it will work for at least ESP_WIFI_SLP_DEFAULT_MIN_ACTIVE_TIME. If a data packet is received or sent - during this period, the time will be refreshed. If the time is up, but the station still has packets - to receive or send, the time will also be refreshed. unit: milliseconds. - - config ESP_WIFI_SLP_DEFAULT_MAX_ACTIVE_TIME - int "Maximum keep alive time" - range 10 60 - default 10 - help - Only for station in WIFI_PS_MIN_MODEM or WIFI_PS_MAX_MODEM. If no packet has been - sent within ESP_WIFI_SLP_DEFAULT_MAX_ACTIVE_TIME, a null data packet will be sent - to maintain the connection with the AP. unit: seconds. - - config ESP_WIFI_SLP_DEFAULT_WAIT_BROADCAST_DATA_TIME - int "Minimum wait broadcast data time" - range 10 30 - default 15 - help - Only for station in WIFI_PS_MIN_MODEM or WIFI_PS_MAX_MODEM. When the station knows through the beacon - that AP will send broadcast packet, it will wait for ESP_WIFI_SLP_DEFAULT_WAIT_BROADCAST_DATA_TIME - before entering the sleep process. If a broadcast packet is received with more data bits, the time - will refreshed. unit: milliseconds. - - config ESP_WIFI_FTM_ENABLE - bool "WiFi FTM" - default n - depends on SLAVE_SOC_WIFI_FTM_SUPPORT - help - Enable feature Fine Timing Measurement for calculating WiFi Round-Trip-Time (RTT). - - config ESP_WIFI_FTM_INITIATOR_SUPPORT - bool "FTM Initiator support" - default y - depends on ESP_WIFI_FTM_ENABLE - - config ESP_WIFI_FTM_RESPONDER_SUPPORT - bool "FTM Responder support" - default y - depends on ESP_WIFI_FTM_ENABLE - - config ESP_WIFI_STA_DISCONNECTED_PM_ENABLE - bool "Power Management for station at disconnected" - default y - help - Select this option to enable power_management for station when disconnected. - Chip will do modem-sleep when rf module is not in use any more. - - config ESP_WIFI_GCMP_SUPPORT - bool "WiFi GCMP Support(GCMP128 and GCMP256)" - default n - depends on SLAVE_SOC_WIFI_GCMP_SUPPORT - help - Select this option to enable GCMP support. GCMP support is compulsory for WiFi Suite-B support. - - config ESP_WIFI_GMAC_SUPPORT - bool "WiFi GMAC Support(GMAC128 and GMAC256)" - default y - help - Select this option to enable GMAC support. GMAC support is compulsory for WiFi 192 bit certification. - - config ESP_WIFI_SOFTAP_SUPPORT - bool "WiFi SoftAP Support" - default y - help - WiFi module can be compiled without SoftAP to save code size. - - config ESP_WIFI_ENHANCED_LIGHT_SLEEP - bool "WiFi modem automatically receives the beacon" - default n - depends on ESP_PHY_MAC_BB_PD && SOC_PM_SUPPORT_BEACON_WAKEUP - help - The wifi modem automatically receives the beacon frame during light sleep. - - config ESP_WIFI_SLP_BEACON_LOST_OPT - bool "Wifi sleep optimize when beacon lost" - help - Enable wifi sleep optimization when beacon loss occurs and immediately enter - sleep mode when the WiFi module detects beacon loss. - - config ESP_WIFI_SLP_BEACON_LOST_TIMEOUT - int "Beacon loss timeout" - range 5 100 - default 10 - depends on ESP_WIFI_SLP_BEACON_LOST_OPT - help - Timeout time for close rf phy when beacon loss occurs, Unit: 1024 microsecond. - - config ESP_WIFI_SLP_BEACON_LOST_THRESHOLD - int "Maximum number of consecutive lost beacons allowed" - range 0 8 - default 3 - depends on ESP_WIFI_SLP_BEACON_LOST_OPT - help - Maximum number of consecutive lost beacons allowed, WiFi keeps Rx state when - the number of consecutive beacons lost is greater than the given threshold. - - config ESP_WIFI_SLP_PHY_ON_DELTA_EARLY_TIME - int "Delta early time for RF PHY on" - range 0 100 - default 2 - depends on ESP_WIFI_SLP_BEACON_LOST_OPT && SLAVE_SOC_WIFI_SUPPORT_VARIABLE_BEACON_WINDOW - help - Delta early time for rf phy on, When the beacon is lost, the next rf phy on will - be earlier the time specified by the configuration item, Unit: 32 microsecond. - - config ESP_WIFI_SLP_PHY_OFF_DELTA_TIMEOUT_TIME - int "Delta timeout time for RF PHY off" - range 0 8 - default 2 - depends on ESP_WIFI_SLP_BEACON_LOST_OPT && SLAVE_SOC_WIFI_SUPPORT_VARIABLE_BEACON_WINDOW - help - Delta timeout time for rf phy off, When the beacon is lost, the next rf phy off will - be delayed for the time specified by the configuration item. Unit: 1024 microsecond. - - config ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM - int "Maximum espnow encrypt peers number" - range 0 4 if SLAVE_IDF_TARGET_ESP32C2 - range 0 17 if (!SLAVE_IDF_TARGET_ESP32C2) - default 2 if SLAVE_IDF_TARGET_ESP32C2 - default 7 if (!SLAVE_IDF_TARGET_ESP32C2) - help - Maximum number of encrypted peers supported by espnow. - The number of hardware keys for encryption is fixed. And the espnow and SoftAP share the same - hardware keys. So this configuration will affect the maximum connection number of SoftAP. - Maximum espnow encrypted peers number + maximum number of connections of SoftAP = Max hardware - keys number. When using ESP mesh, this value should be set to a maximum of 6. - - config ESP_WIFI_NAN_ENABLE - bool "WiFi Aware" - default n - depends on SLAVE_SOC_WIFI_NAN_SUPPORT - help - Enable WiFi Aware (NAN) feature. - - config ESP_WIFI_MBEDTLS_CRYPTO - bool "Use MbedTLS crypto APIs" - default y - select MBEDTLS_AES_C - select MBEDTLS_ECP_C - select MBEDTLS_ECDH_C - select MBEDTLS_ECDSA_C - select MBEDTLS_CMAC_C - select MBEDTLS_ECP_DP_SECP256R1_ENABLED - help - Select this option to enable the use of MbedTLS crypto APIs. - The internal crypto support within the supplicant is limited - and may not suffice for all new security features, including WPA3. - - It is recommended to always keep this option enabled. Additionally, - note that MbedTLS can leverage hardware acceleration if available, - resulting in significantly faster cryptographic operations. - - if ESP_WIFI_MBEDTLS_CRYPTO - config ESP_WIFI_MBEDTLS_TLS_CLIENT - bool "Use MbedTLS TLS client for WiFi Enterprise connection" - depends on ESP_WIFI_ENTERPRISE_SUPPORT - default y - select MBEDTLS_TLS_ENABLED - help - Select this option to use MbedTLS TLS client for WPA2 enterprise connection. - Please note that from MbedTLS-3.0 onwards, MbedTLS does not support SSL-3.0 - TLS-v1.0, TLS-v1.1 versions. In case your server is using one of these version, - it is advisable to update your server. - Please disable this option for compatibility with older TLS versions. - - config ESP_WIFI_EAP_TLS1_3 - bool "Enable EAP-TLS v1.3 Support for WiFi Enterprise connection" - default n - select MBEDTLS_SSL_PROTO_TLS1_3 - depends on ESP_WIFI_MBEDTLS_TLS_CLIENT && IDF_EXPERIMENTAL_FEATURES - help - Select this option to support EAP with TLS v1.3. - This configuration still supports compatibility with EAP-TLS v1.2. - Please note that enabling this configuration will cause every application which - uses TLS go for TLS1.3 if server supports that. TLS1.3 is still in development in mbedtls - and there may be interoperability issues with this. Please modify your application to set - max version as TLS1.2 if you want to enable TLS1.3 only for WiFi connection. - - endif - - config ESP_WIFI_WAPI_PSK - bool "Enable WAPI PSK support" - depends on SLAVE_SOC_WIFI_WAPI_SUPPORT - default n - help - Select this option to enable WAPI-PSK - which is a Chinese National Standard Encryption for Wireless LANs (GB 15629.11-2003). - - config ESP_WIFI_SUITE_B_192 - bool "Enable NSA suite B support with 192 bit key" - default n - depends on SLAVE_SOC_WIFI_GCMP_SUPPORT - select ESP_WIFI_GCMP_SUPPORT - select ESP_WIFI_GMAC_SUPPORT - help - Select this option to enable 192 bit NSA suite-B. - This is necessary to support WPA3 192 bit security. - - config ESP_WIFI_11KV_SUPPORT - bool "Enable 802.11k, 802.11v APIs Support" - default n - help - Select this option to enable 802.11k 802.11v APIs(RRM and BTM support). - Only APIs which are helpful for network assisted roaming - are supported for now. - Enable this option with BTM and RRM enabled in sta config - to make device ready for network assisted roaming. - BTM: BSS transition management enables an AP to request a station to transition - to a specific AP, or to indicate to a station a set of preferred APs. - RRM: Radio measurements enable STAs to understand the radio environment, - it enables STAs to observe and gather data on radio link performance - and on the radio environment. Current implementation adds beacon report, - link measurement, neighbor report. - - config ESP_WIFI_SCAN_CACHE - bool "Keep scan results in cache" - depends on ESP_WIFI_11KV_SUPPORT - default n - help - Keep scan results in cache, if not enabled, those - will be flushed immediately. - - config ESP_WIFI_MBO_SUPPORT - bool "Enable Multi Band Operation Certification Support" - default n - select ESP_WIFI_11KV_SUPPORT - select ESP_WIFI_SCAN_CACHE - help - Select this option to enable WiFi Multiband operation certification support. - - config ESP_WIFI_ENABLE_ROAMING_APP - bool "Advanced support for Wi-Fi Roaming (Experimental)" - depends on IDF_EXPERIMENTAL_FEATURES - default n - select ESP_WIFI_SCAN_CACHE - help - Enable Espressif's roaming app to allow for efficient Wi-Fi roaming. - This includes configurable periodic environment scans, maintaining a cache of the - best APs, handling low rssi events etc. - - Risk Warning - Please note that this feature is still experimental and enabling this potentially can - lead to unpredictable scanning, connection and roaming attempts. - We are still working on tuning and optimising this feature to ensure reliable and stable use. - - menu "Configure roaming App" - depends on ESP_WIFI_ENABLE_ROAMING_APP - rsource "wifi_apps/roaming_app/src/Kconfig.roaming" - endmenu - - config ESP_WIFI_DPP_SUPPORT - bool "Enable DPP support" - default n - select ESP_WIFI_MBEDTLS_CRYPTO - help - Select this option to enable WiFi Easy Connect Support. - - config ESP_WIFI_11R_SUPPORT - bool "Enable 802.11R (Fast Transition) Support" - default n - help - Select this option to enable WiFi Fast Transition Support. - - config ESP_WIFI_WPS_SOFTAP_REGISTRAR - bool "Add WPS Registrar support in SoftAP mode" - depends on ESP_WIFI_SOFTAP_SUPPORT - default n - help - Select this option to enable WPS registrar support in softAP mode. - - config ESP_WIFI_ENABLE_WIFI_TX_STATS - bool "Enable Wi-Fi transmission statistics" - depends on SLAVE_SOC_WIFI_HE_SUPPORT - default n - help - Enable Wi-Fi transmission statistics. Total support 4 access category. Each access category - will use 346 bytes memory. - - config ESP_WIFI_ENABLE_WIFI_RX_STATS - bool "Enable Wi-Fi reception statistics" - depends on SLAVE_SOC_WIFI_HE_SUPPORT - default n - help - Enable Wi-Fi reception statistics. Total support 2 access category. Each access category - will use 190 bytes memory. - - config ESP_WIFI_ENABLE_WIFI_RX_MU_STATS - bool "Enable Wi-Fi DL MU-MIMO and DL OFDMA reception statistics" - depends on ESP_WIFI_ENABLE_WIFI_RX_STATS - default n - help - Enable Wi-Fi DL MU-MIMO and DL OFDMA reception statistics. Will use 10932 bytes memory. - - config ESP_WIFI_TX_HETB_QUEUE_NUM - int "WiFi TX HE TB QUEUE number for STA HE TB PPDU transmission" - depends on SLAVE_SOC_WIFI_HE_SUPPORT - range 1 4 - default 3 - help - Set the maximum number of queue that can be aggregated by the STA in the A-MPDU carried in the - HE TB PPDU. - - config ESP_WIFI_ENABLE_DUMP_HESIGB - bool "Enable Wi-Fi dump HE-SIGB which is contained in DL HE MU PPDUs" - depends on SLAVE_SOC_WIFI_SUPPORT_5G - default "n" - help - Enable Wi-Fi dump HE-SIGB which is contained in DL HE MU PPDUs. - - config ESP_WIFI_ENABLE_DUMP_MU_CFO - bool "Enable Wi-Fi dump MU CFO" - depends on SLAVE_SOC_WIFI_SUPPORT_5G - default "n" - help - Enable Wi-Fi dump MU CFO. - - config ESP_WIFI_ENABLE_DUMP_CTRL_NDPA - bool "Enable Wi-Fi dump NDPA frames" - depends on SLAVE_SOC_WIFI_SUPPORT_5G - default "n" - help - Enable Wi-Fi dump NDPA frames. - - config ESP_WIFI_ENABLE_DUMP_CTRL_BFRP - bool "Enable Wi-Fi dump BFRP frames" - depends on SLAVE_SOC_WIFI_SUPPORT_5G - default "n" - help - Enable Wi-Fi dump BFRP frames. - - menu "WPS Configuration Options" - config ESP_WIFI_WPS_STRICT - bool "Strictly validate all WPS attributes" - default n - help - Select this option to enable validate each WPS attribute - rigorously. Disabling this add the workarounds with various APs. - Enabling this may cause inter operability issues with some APs. - - config ESP_WIFI_WPS_PASSPHRASE - bool "Get WPA2 passphrase in WPS config" - default n - help - Select this option to get passphrase during WPS configuration. - This option fakes the virtual display capabilities to get the - configuration in passphrase mode. - Not recommended to be used since WPS credentials should not - be shared to other devices, making it in readable format increases - that risk, also passphrase requires pbkdf2 to convert in psk. - - endmenu # "WPS Configuration Options" - - - config ESP_WIFI_DEBUG_PRINT - bool "Print debug messages from WPA Supplicant" - default n - help - Select this option to print logging information from WPA supplicant, - this includes handshake information and key hex dumps depending - on the project logging level. - - Enabling this could increase the build size ~60kb - depending on the project logging level. - - config ESP_WIFI_TESTING_OPTIONS - bool "Add DPP testing code" - default n - help - Select this to enable unity test for DPP. - - config ESP_WIFI_ENTERPRISE_SUPPORT - bool "Enable enterprise option" - default y - help - Select this to enable/disable enterprise connection support. - - disabling this will reduce binary size. - disabling this will disable the use of any esp_wifi_sta_wpa2_ent_* (as APIs will be meaningless) - - Note that when using bigger certificates on low-power chips without crypto - hardware acceleration, it is recommended to adjust the task watchdog timer (TWDT) - if it is enabled. For precise information on timing requirements, you can check - performance numbers at https://github.com/espressif/mbedtls/wiki/Performance-Numbers. - - config ESP_WIFI_ENT_FREE_DYNAMIC_BUFFER - bool "Free dynamic buffers during WiFi enterprise connection" - depends on ESP_WIFI_ENTERPRISE_SUPPORT - default y if SLAVE_IDF_TARGET_ESP32C2 - default n if !SLAVE_IDF_TARGET_ESP32C2 - help - Select this configuration to free dynamic buffers during WiFi enterprise connection. - This will enable chip to reduce heap consumption during WiFi enterprise connection. - -# Wi-Fi configuration end diff --git a/components/esp_wifi_remote/idf_v5.4/esp_wifi_remote_weak.c b/components/esp_wifi_remote/idf_v5.4/esp_wifi_remote_weak.c deleted file mode 100644 index 96979dfd67..0000000000 --- a/components/esp_wifi_remote/idf_v5.4/esp_wifi_remote_weak.c +++ /dev/null @@ -1,432 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -// This file is auto-generated -#include "esp_wifi_remote.h" -#include "esp_log.h" - -#define WEAK __attribute__((weak)) -#define LOG_UNSUPPORTED_AND_RETURN(ret) ESP_LOGW("esp_wifi_remote_weak", "%s unsupported", __func__); \ - return ret; - -WEAK esp_err_t esp_wifi_remote_init(const wifi_init_config_t *config) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_deinit(void) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_mode(wifi_mode_t mode) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_mode(wifi_mode_t *mode) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_start(void) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_stop(void) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_restore(void) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_connect(void) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_disconnect(void) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_clear_fast_connect(void) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_deauth_sta(uint16_t aid) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_scan_start(const wifi_scan_config_t *config, _Bool block) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_scan_parameters(const wifi_scan_default_params_t *config) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_scan_parameters(wifi_scan_default_params_t *config) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_scan_stop(void) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_scan_get_ap_num(uint16_t *number) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_scan_get_ap_record(wifi_ap_record_t *ap_record) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_clear_ap_list(void) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_sta_get_ap_info(wifi_ap_record_t *ap_info) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_ps(wifi_ps_type_t type) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_ps(wifi_ps_type_t *type) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_channel(uint8_t primary, wifi_second_chan_t second) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_channel(uint8_t *primary, wifi_second_chan_t *second) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_country(const wifi_country_t *country) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_country(wifi_country_t *country) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_mac(wifi_interface_t ifx, const uint8_t mac[6]) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_mac(wifi_interface_t ifx, uint8_t mac[6]) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_promiscuous(_Bool en) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_promiscuous(_Bool *en) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_promiscuous_filter(const wifi_promiscuous_filter_t *filter) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_promiscuous_filter(wifi_promiscuous_filter_t *filter) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_promiscuous_ctrl_filter(const wifi_promiscuous_filter_t *filter) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_promiscuous_ctrl_filter(wifi_promiscuous_filter_t *filter) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_config(wifi_interface_t interface, wifi_config_t *conf) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_config(wifi_interface_t interface, wifi_config_t *conf) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_ap_get_sta_list(wifi_sta_list_t *sta) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_ap_get_sta_aid(const uint8_t mac[6], uint16_t *aid) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_storage(wifi_storage_t storage) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_vendor_ie(_Bool enable, wifi_vendor_ie_type_t type, wifi_vendor_ie_id_t idx, const void *vnd_ie) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_max_tx_power(int8_t power) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_max_tx_power(int8_t *power) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_event_mask(uint32_t mask) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_event_mask(uint32_t *mask) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_80211_tx(wifi_interface_t ifx, const void *buffer, int len, _Bool en_sys_seq) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_csi_rx_cb(wifi_csi_cb_t cb, void *ctx) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_csi_config(const wifi_csi_config_t *config) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_csi_config(wifi_csi_config_t *config) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_csi(_Bool en) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK int64_t esp_wifi_remote_get_tsf_time(wifi_interface_t interface) -{ - LOG_UNSUPPORTED_AND_RETURN(-1); -} - -WEAK esp_err_t esp_wifi_remote_set_inactive_time(wifi_interface_t ifx, uint16_t sec) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_inactive_time(wifi_interface_t ifx, uint16_t *sec) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_statis_dump(uint32_t modules) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_rssi_threshold(int32_t rssi) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_ftm_initiate_session(wifi_ftm_initiator_cfg_t *cfg) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_ftm_end_session(void) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_ftm_resp_set_offset(int16_t offset_cm) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_ftm_get_report(wifi_ftm_report_entry_t *report, uint8_t num_entries) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_config_11b_rate(wifi_interface_t ifx, _Bool disable) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_connectionless_module_set_wake_interval(uint16_t wake_interval) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_force_wakeup_acquire(void) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_force_wakeup_release(void) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_country_code(const char *country, _Bool ieee80211d_enabled) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_country_code(char *country) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_config_80211_tx_rate(wifi_interface_t ifx, wifi_phy_rate_t rate) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_disable_pmf_config(wifi_interface_t ifx) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_sta_get_aid(uint16_t *aid) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_sta_get_negotiated_phymode(wifi_phy_mode_t *phymode) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_dynamic_cs(_Bool enabled) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_sta_get_rssi(int *rssi) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_band(wifi_band_t band) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_band(wifi_band_t *band) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_band_mode(wifi_band_mode_t band_mode) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_band_mode(wifi_band_mode_t *band_mode) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_protocols(wifi_interface_t ifx, wifi_protocols_t *protocols) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_protocols(wifi_interface_t ifx, wifi_protocols_t *protocols) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_set_bandwidths(wifi_interface_t ifx, wifi_bandwidths_t *bw) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} - -WEAK esp_err_t esp_wifi_remote_get_bandwidths(wifi_interface_t ifx, wifi_bandwidths_t *bw) -{ - LOG_UNSUPPORTED_AND_RETURN(ESP_ERR_NOT_SUPPORTED); -} diff --git a/components/esp_wifi_remote/idf_v5.4/esp_wifi_with_remote.c b/components/esp_wifi_remote/idf_v5.4/esp_wifi_with_remote.c deleted file mode 100644 index ad9764330b..0000000000 --- a/components/esp_wifi_remote/idf_v5.4/esp_wifi_with_remote.c +++ /dev/null @@ -1,428 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -// This file is auto-generated -#include "esp_wifi.h" -#include "esp_wifi_remote.h" - -esp_err_t esp_wifi_init(const wifi_init_config_t *config) -{ - return esp_wifi_remote_init(config); -} - -esp_err_t esp_wifi_deinit(void) -{ - return esp_wifi_remote_deinit(); -} - -esp_err_t esp_wifi_set_mode(wifi_mode_t mode) -{ - return esp_wifi_remote_set_mode(mode); -} - -esp_err_t esp_wifi_get_mode(wifi_mode_t *mode) -{ - return esp_wifi_remote_get_mode(mode); -} - -esp_err_t esp_wifi_start(void) -{ - return esp_wifi_remote_start(); -} - -esp_err_t esp_wifi_stop(void) -{ - return esp_wifi_remote_stop(); -} - -esp_err_t esp_wifi_restore(void) -{ - return esp_wifi_remote_restore(); -} - -esp_err_t esp_wifi_connect(void) -{ - return esp_wifi_remote_connect(); -} - -esp_err_t esp_wifi_disconnect(void) -{ - return esp_wifi_remote_disconnect(); -} - -esp_err_t esp_wifi_clear_fast_connect(void) -{ - return esp_wifi_remote_clear_fast_connect(); -} - -esp_err_t esp_wifi_deauth_sta(uint16_t aid) -{ - return esp_wifi_remote_deauth_sta(aid); -} - -esp_err_t esp_wifi_scan_start(const wifi_scan_config_t *config, _Bool block) -{ - return esp_wifi_remote_scan_start(config, block); -} - -esp_err_t esp_wifi_set_scan_parameters(const wifi_scan_default_params_t *config) -{ - return esp_wifi_remote_set_scan_parameters(config); -} - -esp_err_t esp_wifi_get_scan_parameters(wifi_scan_default_params_t *config) -{ - return esp_wifi_remote_get_scan_parameters(config); -} - -esp_err_t esp_wifi_scan_stop(void) -{ - return esp_wifi_remote_scan_stop(); -} - -esp_err_t esp_wifi_scan_get_ap_num(uint16_t *number) -{ - return esp_wifi_remote_scan_get_ap_num(number); -} - -esp_err_t esp_wifi_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records) -{ - return esp_wifi_remote_scan_get_ap_records(number, ap_records); -} - -esp_err_t esp_wifi_scan_get_ap_record(wifi_ap_record_t *ap_record) -{ - return esp_wifi_remote_scan_get_ap_record(ap_record); -} - -esp_err_t esp_wifi_clear_ap_list(void) -{ - return esp_wifi_remote_clear_ap_list(); -} - -esp_err_t esp_wifi_sta_get_ap_info(wifi_ap_record_t *ap_info) -{ - return esp_wifi_remote_sta_get_ap_info(ap_info); -} - -esp_err_t esp_wifi_set_ps(wifi_ps_type_t type) -{ - return esp_wifi_remote_set_ps(type); -} - -esp_err_t esp_wifi_get_ps(wifi_ps_type_t *type) -{ - return esp_wifi_remote_get_ps(type); -} - -esp_err_t esp_wifi_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap) -{ - return esp_wifi_remote_set_protocol(ifx, protocol_bitmap); -} - -esp_err_t esp_wifi_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap) -{ - return esp_wifi_remote_get_protocol(ifx, protocol_bitmap); -} - -esp_err_t esp_wifi_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw) -{ - return esp_wifi_remote_set_bandwidth(ifx, bw); -} - -esp_err_t esp_wifi_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw) -{ - return esp_wifi_remote_get_bandwidth(ifx, bw); -} - -esp_err_t esp_wifi_set_channel(uint8_t primary, wifi_second_chan_t second) -{ - return esp_wifi_remote_set_channel(primary, second); -} - -esp_err_t esp_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second) -{ - return esp_wifi_remote_get_channel(primary, second); -} - -esp_err_t esp_wifi_set_country(const wifi_country_t *country) -{ - return esp_wifi_remote_set_country(country); -} - -esp_err_t esp_wifi_get_country(wifi_country_t *country) -{ - return esp_wifi_remote_get_country(country); -} - -esp_err_t esp_wifi_set_mac(wifi_interface_t ifx, const uint8_t mac[6]) -{ - return esp_wifi_remote_set_mac(ifx, mac); -} - -esp_err_t esp_wifi_get_mac(wifi_interface_t ifx, uint8_t mac[6]) -{ - return esp_wifi_remote_get_mac(ifx, mac); -} - -esp_err_t esp_wifi_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb) -{ - return esp_wifi_remote_set_promiscuous_rx_cb(cb); -} - -esp_err_t esp_wifi_set_promiscuous(_Bool en) -{ - return esp_wifi_remote_set_promiscuous(en); -} - -esp_err_t esp_wifi_get_promiscuous(_Bool *en) -{ - return esp_wifi_remote_get_promiscuous(en); -} - -esp_err_t esp_wifi_set_promiscuous_filter(const wifi_promiscuous_filter_t *filter) -{ - return esp_wifi_remote_set_promiscuous_filter(filter); -} - -esp_err_t esp_wifi_get_promiscuous_filter(wifi_promiscuous_filter_t *filter) -{ - return esp_wifi_remote_get_promiscuous_filter(filter); -} - -esp_err_t esp_wifi_set_promiscuous_ctrl_filter(const wifi_promiscuous_filter_t *filter) -{ - return esp_wifi_remote_set_promiscuous_ctrl_filter(filter); -} - -esp_err_t esp_wifi_get_promiscuous_ctrl_filter(wifi_promiscuous_filter_t *filter) -{ - return esp_wifi_remote_get_promiscuous_ctrl_filter(filter); -} - -esp_err_t esp_wifi_set_config(wifi_interface_t interface, wifi_config_t *conf) -{ - return esp_wifi_remote_set_config(interface, conf); -} - -esp_err_t esp_wifi_get_config(wifi_interface_t interface, wifi_config_t *conf) -{ - return esp_wifi_remote_get_config(interface, conf); -} - -esp_err_t esp_wifi_ap_get_sta_list(wifi_sta_list_t *sta) -{ - return esp_wifi_remote_ap_get_sta_list(sta); -} - -esp_err_t esp_wifi_ap_get_sta_aid(const uint8_t mac[6], uint16_t *aid) -{ - return esp_wifi_remote_ap_get_sta_aid(mac, aid); -} - -esp_err_t esp_wifi_set_storage(wifi_storage_t storage) -{ - return esp_wifi_remote_set_storage(storage); -} - -esp_err_t esp_wifi_set_vendor_ie(_Bool enable, wifi_vendor_ie_type_t type, wifi_vendor_ie_id_t idx, const void *vnd_ie) -{ - return esp_wifi_remote_set_vendor_ie(enable, type, idx, vnd_ie); -} - -esp_err_t esp_wifi_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx) -{ - return esp_wifi_remote_set_vendor_ie_cb(cb, ctx); -} - -esp_err_t esp_wifi_set_max_tx_power(int8_t power) -{ - return esp_wifi_remote_set_max_tx_power(power); -} - -esp_err_t esp_wifi_get_max_tx_power(int8_t *power) -{ - return esp_wifi_remote_get_max_tx_power(power); -} - -esp_err_t esp_wifi_set_event_mask(uint32_t mask) -{ - return esp_wifi_remote_set_event_mask(mask); -} - -esp_err_t esp_wifi_get_event_mask(uint32_t *mask) -{ - return esp_wifi_remote_get_event_mask(mask); -} - -esp_err_t esp_wifi_80211_tx(wifi_interface_t ifx, const void *buffer, int len, _Bool en_sys_seq) -{ - return esp_wifi_remote_80211_tx(ifx, buffer, len, en_sys_seq); -} - -esp_err_t esp_wifi_set_csi_rx_cb(wifi_csi_cb_t cb, void *ctx) -{ - return esp_wifi_remote_set_csi_rx_cb(cb, ctx); -} - -esp_err_t esp_wifi_set_csi_config(const wifi_csi_config_t *config) -{ - return esp_wifi_remote_set_csi_config(config); -} - -esp_err_t esp_wifi_get_csi_config(wifi_csi_config_t *config) -{ - return esp_wifi_remote_get_csi_config(config); -} - -esp_err_t esp_wifi_set_csi(_Bool en) -{ - return esp_wifi_remote_set_csi(en); -} - -int64_t esp_wifi_get_tsf_time(wifi_interface_t interface) -{ - return esp_wifi_remote_get_tsf_time(interface); -} - -esp_err_t esp_wifi_set_inactive_time(wifi_interface_t ifx, uint16_t sec) -{ - return esp_wifi_remote_set_inactive_time(ifx, sec); -} - -esp_err_t esp_wifi_get_inactive_time(wifi_interface_t ifx, uint16_t *sec) -{ - return esp_wifi_remote_get_inactive_time(ifx, sec); -} - -esp_err_t esp_wifi_statis_dump(uint32_t modules) -{ - return esp_wifi_remote_statis_dump(modules); -} - -esp_err_t esp_wifi_set_rssi_threshold(int32_t rssi) -{ - return esp_wifi_remote_set_rssi_threshold(rssi); -} - -esp_err_t esp_wifi_ftm_initiate_session(wifi_ftm_initiator_cfg_t *cfg) -{ - return esp_wifi_remote_ftm_initiate_session(cfg); -} - -esp_err_t esp_wifi_ftm_end_session(void) -{ - return esp_wifi_remote_ftm_end_session(); -} - -esp_err_t esp_wifi_ftm_resp_set_offset(int16_t offset_cm) -{ - return esp_wifi_remote_ftm_resp_set_offset(offset_cm); -} - -esp_err_t esp_wifi_ftm_get_report(wifi_ftm_report_entry_t *report, uint8_t num_entries) -{ - return esp_wifi_remote_ftm_get_report(report, num_entries); -} - -esp_err_t esp_wifi_config_11b_rate(wifi_interface_t ifx, _Bool disable) -{ - return esp_wifi_remote_config_11b_rate(ifx, disable); -} - -esp_err_t esp_wifi_connectionless_module_set_wake_interval(uint16_t wake_interval) -{ - return esp_wifi_remote_connectionless_module_set_wake_interval(wake_interval); -} - -esp_err_t esp_wifi_force_wakeup_acquire(void) -{ - return esp_wifi_remote_force_wakeup_acquire(); -} - -esp_err_t esp_wifi_force_wakeup_release(void) -{ - return esp_wifi_remote_force_wakeup_release(); -} - -esp_err_t esp_wifi_set_country_code(const char *country, _Bool ieee80211d_enabled) -{ - return esp_wifi_remote_set_country_code(country, ieee80211d_enabled); -} - -esp_err_t esp_wifi_get_country_code(char *country) -{ - return esp_wifi_remote_get_country_code(country); -} - -esp_err_t esp_wifi_config_80211_tx_rate(wifi_interface_t ifx, wifi_phy_rate_t rate) -{ - return esp_wifi_remote_config_80211_tx_rate(ifx, rate); -} - -esp_err_t esp_wifi_disable_pmf_config(wifi_interface_t ifx) -{ - return esp_wifi_remote_disable_pmf_config(ifx); -} - -esp_err_t esp_wifi_sta_get_aid(uint16_t *aid) -{ - return esp_wifi_remote_sta_get_aid(aid); -} - -esp_err_t esp_wifi_sta_get_negotiated_phymode(wifi_phy_mode_t *phymode) -{ - return esp_wifi_remote_sta_get_negotiated_phymode(phymode); -} - -esp_err_t esp_wifi_set_dynamic_cs(_Bool enabled) -{ - return esp_wifi_remote_set_dynamic_cs(enabled); -} - -esp_err_t esp_wifi_sta_get_rssi(int *rssi) -{ - return esp_wifi_remote_sta_get_rssi(rssi); -} - -esp_err_t esp_wifi_set_band(wifi_band_t band) -{ - return esp_wifi_remote_set_band(band); -} - -esp_err_t esp_wifi_get_band(wifi_band_t *band) -{ - return esp_wifi_remote_get_band(band); -} - -esp_err_t esp_wifi_set_band_mode(wifi_band_mode_t band_mode) -{ - return esp_wifi_remote_set_band_mode(band_mode); -} - -esp_err_t esp_wifi_get_band_mode(wifi_band_mode_t *band_mode) -{ - return esp_wifi_remote_get_band_mode(band_mode); -} - -esp_err_t esp_wifi_set_protocols(wifi_interface_t ifx, wifi_protocols_t *protocols) -{ - return esp_wifi_remote_set_protocols(ifx, protocols); -} - -esp_err_t esp_wifi_get_protocols(wifi_interface_t ifx, wifi_protocols_t *protocols) -{ - return esp_wifi_remote_get_protocols(ifx, protocols); -} - -esp_err_t esp_wifi_set_bandwidths(wifi_interface_t ifx, wifi_bandwidths_t *bw) -{ - return esp_wifi_remote_set_bandwidths(ifx, bw); -} - -esp_err_t esp_wifi_get_bandwidths(wifi_interface_t ifx, wifi_bandwidths_t *bw) -{ - return esp_wifi_remote_get_bandwidths(ifx, bw); -} diff --git a/components/esp_wifi_remote/idf_v5.4/include/esp_wifi_remote_api.h b/components/esp_wifi_remote/idf_v5.4/include/esp_wifi_remote_api.h deleted file mode 100644 index 9704c15606..0000000000 --- a/components/esp_wifi_remote/idf_v5.4/include/esp_wifi_remote_api.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -// This file is auto-generated -#pragma once -esp_err_t esp_wifi_remote_init(const wifi_init_config_t *config); -esp_err_t esp_wifi_remote_deinit(void); -esp_err_t esp_wifi_remote_set_mode(wifi_mode_t mode); -esp_err_t esp_wifi_remote_get_mode(wifi_mode_t *mode); -esp_err_t esp_wifi_remote_start(void); -esp_err_t esp_wifi_remote_stop(void); -esp_err_t esp_wifi_remote_restore(void); -esp_err_t esp_wifi_remote_connect(void); -esp_err_t esp_wifi_remote_disconnect(void); -esp_err_t esp_wifi_remote_clear_fast_connect(void); -esp_err_t esp_wifi_remote_deauth_sta(uint16_t aid); -esp_err_t esp_wifi_remote_scan_start(const wifi_scan_config_t *config, _Bool block); -esp_err_t esp_wifi_remote_set_scan_parameters(const wifi_scan_default_params_t *config); -esp_err_t esp_wifi_remote_get_scan_parameters(wifi_scan_default_params_t *config); -esp_err_t esp_wifi_remote_scan_stop(void); -esp_err_t esp_wifi_remote_scan_get_ap_num(uint16_t *number); -esp_err_t esp_wifi_remote_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records); -esp_err_t esp_wifi_remote_scan_get_ap_record(wifi_ap_record_t *ap_record); -esp_err_t esp_wifi_remote_clear_ap_list(void); -esp_err_t esp_wifi_remote_sta_get_ap_info(wifi_ap_record_t *ap_info); -esp_err_t esp_wifi_remote_set_ps(wifi_ps_type_t type); -esp_err_t esp_wifi_remote_get_ps(wifi_ps_type_t *type); -esp_err_t esp_wifi_remote_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap); -esp_err_t esp_wifi_remote_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap); -esp_err_t esp_wifi_remote_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw); -esp_err_t esp_wifi_remote_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw); -esp_err_t esp_wifi_remote_set_channel(uint8_t primary, wifi_second_chan_t second); -esp_err_t esp_wifi_remote_get_channel(uint8_t *primary, wifi_second_chan_t *second); -esp_err_t esp_wifi_remote_set_country(const wifi_country_t *country); -esp_err_t esp_wifi_remote_get_country(wifi_country_t *country); -esp_err_t esp_wifi_remote_set_mac(wifi_interface_t ifx, const uint8_t mac[6]); -esp_err_t esp_wifi_remote_get_mac(wifi_interface_t ifx, uint8_t mac[6]); -esp_err_t esp_wifi_remote_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb); -esp_err_t esp_wifi_remote_set_promiscuous(_Bool en); -esp_err_t esp_wifi_remote_get_promiscuous(_Bool *en); -esp_err_t esp_wifi_remote_set_promiscuous_filter(const wifi_promiscuous_filter_t *filter); -esp_err_t esp_wifi_remote_get_promiscuous_filter(wifi_promiscuous_filter_t *filter); -esp_err_t esp_wifi_remote_set_promiscuous_ctrl_filter(const wifi_promiscuous_filter_t *filter); -esp_err_t esp_wifi_remote_get_promiscuous_ctrl_filter(wifi_promiscuous_filter_t *filter); -esp_err_t esp_wifi_remote_set_config(wifi_interface_t interface, wifi_config_t *conf); -esp_err_t esp_wifi_remote_get_config(wifi_interface_t interface, wifi_config_t *conf); -esp_err_t esp_wifi_remote_ap_get_sta_list(wifi_sta_list_t *sta); -esp_err_t esp_wifi_remote_ap_get_sta_aid(const uint8_t mac[6], uint16_t *aid); -esp_err_t esp_wifi_remote_set_storage(wifi_storage_t storage); -esp_err_t esp_wifi_remote_set_vendor_ie(_Bool enable, wifi_vendor_ie_type_t type, wifi_vendor_ie_id_t idx, const void *vnd_ie); -esp_err_t esp_wifi_remote_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx); -esp_err_t esp_wifi_remote_set_max_tx_power(int8_t power); -esp_err_t esp_wifi_remote_get_max_tx_power(int8_t *power); -esp_err_t esp_wifi_remote_set_event_mask(uint32_t mask); -esp_err_t esp_wifi_remote_get_event_mask(uint32_t *mask); -esp_err_t esp_wifi_remote_80211_tx(wifi_interface_t ifx, const void *buffer, int len, _Bool en_sys_seq); -esp_err_t esp_wifi_remote_set_csi_rx_cb(wifi_csi_cb_t cb, void *ctx); -esp_err_t esp_wifi_remote_set_csi_config(const wifi_csi_config_t *config); -esp_err_t esp_wifi_remote_get_csi_config(wifi_csi_config_t *config); -esp_err_t esp_wifi_remote_set_csi(_Bool en); -int64_t esp_wifi_remote_get_tsf_time(wifi_interface_t interface); -esp_err_t esp_wifi_remote_set_inactive_time(wifi_interface_t ifx, uint16_t sec); -esp_err_t esp_wifi_remote_get_inactive_time(wifi_interface_t ifx, uint16_t *sec); -esp_err_t esp_wifi_remote_statis_dump(uint32_t modules); -esp_err_t esp_wifi_remote_set_rssi_threshold(int32_t rssi); -esp_err_t esp_wifi_remote_ftm_initiate_session(wifi_ftm_initiator_cfg_t *cfg); -esp_err_t esp_wifi_remote_ftm_end_session(void); -esp_err_t esp_wifi_remote_ftm_resp_set_offset(int16_t offset_cm); -esp_err_t esp_wifi_remote_ftm_get_report(wifi_ftm_report_entry_t *report, uint8_t num_entries); -esp_err_t esp_wifi_remote_config_11b_rate(wifi_interface_t ifx, _Bool disable); -esp_err_t esp_wifi_remote_connectionless_module_set_wake_interval(uint16_t wake_interval); -esp_err_t esp_wifi_remote_force_wakeup_acquire(void); -esp_err_t esp_wifi_remote_force_wakeup_release(void); -esp_err_t esp_wifi_remote_set_country_code(const char *country, _Bool ieee80211d_enabled); -esp_err_t esp_wifi_remote_get_country_code(char *country); -esp_err_t esp_wifi_remote_config_80211_tx_rate(wifi_interface_t ifx, wifi_phy_rate_t rate); -esp_err_t esp_wifi_remote_disable_pmf_config(wifi_interface_t ifx); -esp_err_t esp_wifi_remote_sta_get_aid(uint16_t *aid); -esp_err_t esp_wifi_remote_sta_get_negotiated_phymode(wifi_phy_mode_t *phymode); -esp_err_t esp_wifi_remote_set_dynamic_cs(_Bool enabled); -esp_err_t esp_wifi_remote_sta_get_rssi(int *rssi); -esp_err_t esp_wifi_remote_set_band(wifi_band_t band); -esp_err_t esp_wifi_remote_get_band(wifi_band_t *band); -esp_err_t esp_wifi_remote_set_band_mode(wifi_band_mode_t band_mode); -esp_err_t esp_wifi_remote_get_band_mode(wifi_band_mode_t *band_mode); -esp_err_t esp_wifi_remote_set_protocols(wifi_interface_t ifx, wifi_protocols_t *protocols); -esp_err_t esp_wifi_remote_get_protocols(wifi_interface_t ifx, wifi_protocols_t *protocols); -esp_err_t esp_wifi_remote_set_bandwidths(wifi_interface_t ifx, wifi_bandwidths_t *bw); -esp_err_t esp_wifi_remote_get_bandwidths(wifi_interface_t ifx, wifi_bandwidths_t *bw); diff --git a/components/esp_wifi_remote/idf_v5.4/include/esp_wifi_types_native.h b/components/esp_wifi_remote/idf_v5.4/include/esp_wifi_types_native.h deleted file mode 100644 index 0963572a85..0000000000 --- a/components/esp_wifi_remote/idf_v5.4/include/esp_wifi_types_native.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once - -#include "sdkconfig.h" -#include "esp_wifi_types_generic.h" -#if CONFIG_SLAVE_SOC_WIFI_HE_SUPPORT -#include "esp_wifi_he_types.h" -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#if CONFIG_SLAVE_IDF_TARGET_ESP32C2 -#define ESP_WIFI_MAX_CONN_NUM (4) /**< max number of stations which can connect to ESP32C2 soft-AP */ -#elif CONFIG_SLAVE_IDF_TARGET_ESP32C3 || CONFIG_SLAVE_IDF_TARGET_ESP32C6 || CONFIG_SLAVE_IDF_TARGET_ESP32C5 || CONFIG_SLAVE_IDF_TARGET_ESP32C61 -#define ESP_WIFI_MAX_CONN_NUM (10) /**< max number of stations which can connect to ESP32C3/ESP32C6/ESP32C5/ESP32C61 soft-AP */ -#else -#define ESP_WIFI_MAX_CONN_NUM (15) /**< max number of stations which can connect to ESP32/ESP32S3/ESP32S2 soft-AP */ -#endif - -/** @brief List of stations associated with the Soft-AP */ -typedef struct wifi_sta_list_t { - wifi_sta_info_t sta[ESP_WIFI_MAX_CONN_NUM]; /**< station list */ - int num; /**< number of stations in the list (other entries are invalid) */ -} wifi_sta_list_t; - -#if CONFIG_SLAVE_SOC_WIFI_HE_SUPPORT -typedef esp_wifi_rxctrl_t wifi_pkt_rx_ctrl_t; -#else -/** @brief Received packet radio metadata header, this is the common header at the beginning of all promiscuous mode RX callback buffers */ -typedef struct { - signed rssi: 8; /**< Received Signal Strength Indicator(RSSI) of packet. unit: dBm */ - unsigned rate: 5; /**< PHY rate encoding of the packet. Only valid for non HT(11bg) packet */ - unsigned : 1; /**< reserved */ - unsigned sig_mode: 2; /**< Protocol of the received packet, 0: non HT(11bg) packet; 1: HT(11n) packet; 3: VHT(11ac) packet */ - unsigned : 16; /**< reserved */ - unsigned mcs: 7; /**< Modulation Coding Scheme. If is HT(11n) packet, shows the modulation, range from 0 to 76(MSC0 ~ MCS76) */ - unsigned cwb: 1; /**< Channel Bandwidth of the packet. 0: 20MHz; 1: 40MHz */ - unsigned : 16; /**< reserved */ - unsigned smoothing: 1; /**< Set to 1 indicates that channel estimate smoothing is recommended. - Set to 0 indicates that only per-carrierindependent (unsmoothed) channel estimate is recommended. */ - unsigned not_sounding: 1; /**< Set to 0 indicates that PPDU is a sounding PPDU. Set to 1indicates that the PPDU is not a sounding PPDU. - sounding PPDU is used for channel estimation by the request receiver */ - unsigned : 1; /**< reserved */ - unsigned aggregation: 1; /**< Aggregation. 0: MPDU packet; 1: AMPDU packet */ - unsigned stbc: 2; /**< Space Time Block Code(STBC). 0: non STBC packet; 1: STBC packet */ - unsigned fec_coding: 1; /**< Forward Error Correction(FEC). Flag is set for 11n packets which are LDPC */ - unsigned sgi: 1; /**< Short Guide Interval(SGI). 0: Long GI; 1: Short GI */ -#if CONFIG_SLAVE_IDF_TARGET_ESP32 - signed noise_floor: 8; /**< noise floor of Radio Frequency Module(RF). unit: dBm*/ -#elif CONFIG_SLAVE_IDF_TARGET_ESP32S2 || CONFIG_SLAVE_IDF_TARGET_ESP32S3 || CONFIG_SLAVE_IDF_TARGET_ESP32C3 || CONFIG_SLAVE_IDF_TARGET_ESP32C2 - unsigned : 8; /**< reserved */ -#endif - unsigned ampdu_cnt: 8; /**< the number of subframes aggregated in AMPDU */ - unsigned channel: 4; /**< primary channel on which this packet is received */ - unsigned secondary_channel: 4; /**< secondary channel on which this packet is received. 0: none; 1: above; 2: below */ - unsigned : 8; /**< reserved */ - unsigned timestamp: 32; /**< timestamp. The local time when this packet is received. It is precise only if modem sleep or light sleep is not enabled. unit: microsecond */ - unsigned : 32; /**< reserved */ -#if CONFIG_SLAVE_IDF_TARGET_ESP32S2 - unsigned : 32; /**< reserved */ -#elif CONFIG_SLAVE_IDF_TARGET_ESP32S3 || CONFIG_SLAVE_IDF_TARGET_ESP32C3 || CONFIG_SLAVE_IDF_TARGET_ESP32C2 - signed noise_floor: 8; /**< noise floor of Radio Frequency Module(RF). unit: dBm*/ - unsigned : 24; /**< reserved */ - unsigned : 32; /**< reserved */ -#endif - unsigned : 31; /**< reserved */ - unsigned ant: 1; /**< antenna number from which this packet is received. 0: WiFi antenna 0; 1: WiFi antenna 1 */ -#if CONFIG_SLAVE_IDF_TARGET_ESP32S2 - signed noise_floor: 8; /**< noise floor of Radio Frequency Module(RF). unit: dBm*/ - unsigned : 24; /**< reserved */ -#elif CONFIG_SLAVE_IDF_TARGET_ESP32S3 || CONFIG_SLAVE_IDF_TARGET_ESP32C3 || CONFIG_SLAVE_IDF_TARGET_ESP32C2 - unsigned : 32; /**< reserved */ - unsigned : 32; /**< reserved */ - unsigned : 32; /**< reserved */ -#endif - unsigned sig_len: 12; /**< length of packet including Frame Check Sequence(FCS) */ - unsigned : 12; /**< reserved */ - unsigned rx_state: 8; /**< state of the packet. 0: no error; others: error numbers which are not public */ -} wifi_pkt_rx_ctrl_t; -#endif - -/** - * @brief Channel state information(CSI) configuration type - * - */ -#if CONFIG_SLAVE_SOC_WIFI_HE_SUPPORT -typedef wifi_csi_acquire_config_t wifi_csi_config_t; -#else -typedef struct { - bool lltf_en; /**< enable to receive legacy long training field(lltf) data. Default enabled */ - bool htltf_en; /**< enable to receive HT long training field(htltf) data. Default enabled */ - bool stbc_htltf2_en; /**< enable to receive space time block code HT long training field(stbc-htltf2) data. Default enabled */ - bool ltf_merge_en; /**< enable to generate htlft data by averaging lltf and ht_ltf data when receiving HT packet. Otherwise, use ht_ltf data directly. Default enabled */ - bool channel_filter_en; /**< enable to turn on channel filter to smooth adjacent sub-carrier. Disable it to keep independence of adjacent sub-carrier. Default enabled */ - bool manu_scale; /**< manually scale the CSI data by left shifting or automatically scale the CSI data. If set true, please set the shift bits. false: automatically. true: manually. Default false */ - uint8_t shift; /**< manually left shift bits of the scale of the CSI data. The range of the left shift bits is 0~15 */ - bool dump_ack_en; /**< enable to dump 802.11 ACK frame, default disabled */ -} wifi_csi_config_t; -#endif // !CONFIG_SLAVE_SOC_WIFI_HE_SUPPORT - -/** @brief Payload passed to 'buf' parameter of promiscuous mode RX callback. - */ -typedef struct { - wifi_pkt_rx_ctrl_t rx_ctrl; /**< metadata header */ - uint8_t payload[0]; /**< Data or management payload. Length of payload is described by rx_ctrl.sig_len. Type of content determined by packet type argument of callback. */ -} wifi_promiscuous_pkt_t; - -/** - * @brief CSI data type - * - */ -typedef struct wifi_csi_info_t { - wifi_pkt_rx_ctrl_t rx_ctrl;/**< received packet radio metadata header of the CSI data */ - uint8_t mac[6]; /**< source MAC address of the CSI data */ - uint8_t dmac[6]; /**< destination MAC address of the CSI data */ - bool first_word_invalid; /**< first four bytes of the CSI data is invalid or not, true indicates the first four bytes is invalid due to hardware limitation */ - int8_t *buf; /**< valid buffer of CSI data */ - uint16_t len; /**< valid length of CSI data */ - uint8_t *hdr; /**< header of the wifi packet */ - uint8_t *payload; /**< payload of the wifi packet */ - uint16_t payload_len; /**< payload len of the wifi packet */ - uint16_t rx_seq; /**< rx sequence number of the wifi packet */ -} wifi_csi_info_t; - -#ifdef __cplusplus -} -#endif diff --git a/components/esp_wifi_remote/idf_v5.4/wifi_apps/roaming_app/src/Kconfig.roaming b/components/esp_wifi_remote/idf_v5.4/wifi_apps/roaming_app/src/Kconfig.roaming deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/components/esp_wifi_remote/include/esp_wifi_remote.h b/components/esp_wifi_remote/include/esp_wifi_remote.h deleted file mode 100644 index f6f2c93c65..0000000000 --- a/components/esp_wifi_remote/include/esp_wifi_remote.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -#pragma once -#include "esp_wifi.h" -#include "esp_wifi_remote_api.h" - -/** - * @brief Remote channel Rx function pointer - */ -typedef esp_err_t (*esp_remote_channel_rx_fn_t)(void *h, void *buffer, void *buff_to_free, size_t len); - -/** - * @brief Remote channel Tx function pointer - */ -typedef esp_err_t (*esp_remote_channel_tx_fn_t)(void *h, void *buffer, size_t len); - -/** - * @brief Remote channel handle - */ -typedef struct esp_remote_channel *esp_remote_channel_t; - -/** - * @brief Remote channel configuration - */ -typedef struct esp_remote_channel_config *esp_remote_channel_config_t; - - -// handling channels -/** - * @brief Receive packet to the esp_wifi network layers - * @param h Channel handle - * @param buffer Packet buffer ptr - * @param buff_to_free Packet ptr to free - * @param len Packet len - * @return ESP_OK on success - */ -esp_err_t esp_wifi_remote_channel_rx(void *h, void *buffer, void *buff_to_free, size_t len); - -/** - * @brief Sets Tx callback for the remote channel - * @param ifx Wifi interface - * @param h Channel handle - * @param tx_cb Callback type - * @return ESP_OK on success - */ -esp_err_t esp_wifi_remote_channel_set(wifi_interface_t ifx, void *h, esp_remote_channel_tx_fn_t tx_cb); diff --git a/components/esp_wifi_remote/include/esp_wifi_remote_with_hosted.h b/components/esp_wifi_remote/include/esp_wifi_remote_with_hosted.h deleted file mode 100644 index 6797138f10..0000000000 --- a/components/esp_wifi_remote/include/esp_wifi_remote_with_hosted.h +++ /dev/null @@ -1,386 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include "esp_hosted_wifi_api.h" - -static inline esp_err_t esp_wifi_remote_init(const wifi_init_config_t *config) -{ - return esp_hosted_wifi_init(config); -} - -static inline esp_err_t esp_wifi_remote_deinit(void) -{ - return esp_hosted_wifi_deinit(); -} - -static inline esp_err_t esp_wifi_remote_set_mode(wifi_mode_t mode) -{ - return esp_hosted_wifi_set_mode(mode); -} - -static inline esp_err_t esp_wifi_remote_get_mode(wifi_mode_t *mode) -{ - return esp_hosted_wifi_get_mode(mode); -} - -static inline esp_err_t esp_wifi_remote_start(void) -{ - return esp_hosted_wifi_start(); -} - -static inline esp_err_t esp_wifi_remote_stop(void) -{ - return esp_hosted_wifi_stop(); -} - -static inline esp_err_t esp_wifi_remote_restore(void) -{ - return esp_hosted_wifi_restore(); -} - -static inline esp_err_t esp_wifi_remote_connect(void) -{ - return esp_hosted_wifi_connect(); -} - -static inline esp_err_t esp_wifi_remote_disconnect(void) -{ - return esp_hosted_wifi_disconnect(); -} - -static inline esp_err_t esp_wifi_remote_clear_fast_connect(void) -{ - return esp_hosted_wifi_clear_fast_connect(); -} - -static inline esp_err_t esp_wifi_remote_deauth_sta(uint16_t aid) -{ - return esp_hosted_wifi_deauth_sta(aid); -} - -static inline esp_err_t esp_wifi_remote_scan_start(const wifi_scan_config_t *config, _Bool block) -{ - return esp_hosted_wifi_scan_start(config, block); -} - -static inline esp_err_t esp_wifi_remote_scan_stop(void) -{ - return esp_hosted_wifi_scan_stop(); -} - -static inline esp_err_t esp_wifi_remote_scan_get_ap_num(uint16_t *number) -{ - return esp_hosted_wifi_scan_get_ap_num(number); -} - -static inline esp_err_t esp_wifi_remote_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records) -{ - return esp_hosted_wifi_scan_get_ap_records(number, ap_records); -} - -static inline esp_err_t esp_wifi_remote_scan_get_ap_record(wifi_ap_record_t *ap_record) -{ - return esp_hosted_wifi_scan_get_ap_record(ap_record); -} - -static inline esp_err_t esp_wifi_remote_clear_ap_list(void) -{ - return esp_hosted_wifi_clear_ap_list(); -} - -static inline esp_err_t esp_wifi_remote_sta_get_ap_info(wifi_ap_record_t *ap_info) -{ - return esp_hosted_wifi_sta_get_ap_info(ap_info); -} - -static inline esp_err_t esp_wifi_remote_set_ps(wifi_ps_type_t type) -{ - return esp_hosted_wifi_set_ps(type); -} - -static inline esp_err_t esp_wifi_remote_get_ps(wifi_ps_type_t *type) -{ - return esp_hosted_wifi_get_ps(type); -} - -static inline esp_err_t esp_wifi_remote_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap) -{ - return esp_hosted_wifi_set_protocol(ifx, protocol_bitmap); -} - -static inline esp_err_t esp_wifi_remote_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap) -{ - return esp_hosted_wifi_get_protocol(ifx, protocol_bitmap); -} - -static inline esp_err_t esp_wifi_remote_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw) -{ - return esp_hosted_wifi_set_bandwidth(ifx, bw); -} - -static inline esp_err_t esp_wifi_remote_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw) -{ - return esp_hosted_wifi_get_bandwidth(ifx, bw); -} - -static inline esp_err_t esp_wifi_remote_set_channel(uint8_t primary, wifi_second_chan_t second) -{ - return esp_hosted_wifi_set_channel(primary, second); -} - -static inline esp_err_t esp_wifi_remote_get_channel(uint8_t *primary, wifi_second_chan_t *second) -{ - return esp_hosted_wifi_get_channel(primary, second); -} - -static inline esp_err_t esp_wifi_remote_set_country(const wifi_country_t *country) -{ - return esp_hosted_wifi_set_country(country); -} - -static inline esp_err_t esp_wifi_remote_get_country(wifi_country_t *country) -{ - return esp_hosted_wifi_get_country(country); -} - -static inline esp_err_t esp_wifi_remote_set_mac(wifi_interface_t ifx, const uint8_t mac[6]) -{ - return esp_hosted_wifi_set_mac(ifx, mac); -} - -static inline esp_err_t esp_wifi_remote_get_mac(wifi_interface_t ifx, uint8_t mac[6]) -{ - return esp_hosted_wifi_get_mac(ifx, mac); -} - -static inline esp_err_t esp_wifi_remote_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb) -{ - return esp_hosted_wifi_set_promiscuous_rx_cb(cb); -} - -static inline esp_err_t esp_wifi_remote_set_promiscuous(_Bool en) -{ - return esp_hosted_wifi_set_promiscuous(en); -} - -static inline esp_err_t esp_wifi_remote_get_promiscuous(_Bool *en) -{ - return esp_hosted_wifi_get_promiscuous(en); -} - -static inline esp_err_t esp_wifi_remote_set_promiscuous_filter(const wifi_promiscuous_filter_t *filter) -{ - return esp_hosted_wifi_set_promiscuous_filter(filter); -} - -static inline esp_err_t esp_wifi_remote_get_promiscuous_filter(wifi_promiscuous_filter_t *filter) -{ - return esp_hosted_wifi_get_promiscuous_filter(filter); -} - -static inline esp_err_t esp_wifi_remote_set_promiscuous_ctrl_filter(const wifi_promiscuous_filter_t *filter) -{ - return esp_hosted_wifi_set_promiscuous_ctrl_filter(filter); -} - -static inline esp_err_t esp_wifi_remote_get_promiscuous_ctrl_filter(wifi_promiscuous_filter_t *filter) -{ - return esp_hosted_wifi_get_promiscuous_ctrl_filter(filter); -} - -static inline esp_err_t esp_wifi_remote_set_config(wifi_interface_t interface, wifi_config_t *conf) -{ - return esp_hosted_wifi_set_config(interface, conf); -} - -static inline esp_err_t esp_wifi_remote_get_config(wifi_interface_t interface, wifi_config_t *conf) -{ - return esp_hosted_wifi_get_config(interface, conf); -} - -static inline esp_err_t esp_wifi_remote_ap_get_sta_list(wifi_sta_list_t *sta) -{ - return esp_hosted_wifi_ap_get_sta_list(sta); -} - -static inline esp_err_t esp_wifi_remote_ap_get_sta_aid(const uint8_t mac[6], uint16_t *aid) -{ - return esp_hosted_wifi_ap_get_sta_aid(mac, aid); -} - -static inline esp_err_t esp_wifi_remote_set_storage(wifi_storage_t storage) -{ - return esp_hosted_wifi_set_storage(storage); -} - -static inline esp_err_t esp_wifi_remote_set_vendor_ie(_Bool enable, wifi_vendor_ie_type_t type, wifi_vendor_ie_id_t idx, const void *vnd_ie) -{ - return esp_hosted_wifi_set_vendor_ie(enable, type, idx, vnd_ie); -} - -static inline esp_err_t esp_wifi_remote_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx) -{ - return esp_hosted_wifi_set_vendor_ie_cb(cb, ctx); -} - -static inline esp_err_t esp_wifi_remote_set_max_tx_power(int8_t power) -{ - return esp_hosted_wifi_set_max_tx_power(power); -} - -static inline esp_err_t esp_wifi_remote_get_max_tx_power(int8_t *power) -{ - return esp_hosted_wifi_get_max_tx_power(power); -} - -static inline esp_err_t esp_wifi_remote_set_event_mask(uint32_t mask) -{ - return esp_hosted_wifi_set_event_mask(mask); -} - -static inline esp_err_t esp_wifi_remote_get_event_mask(uint32_t *mask) -{ - return esp_hosted_wifi_get_event_mask(mask); -} - -static inline esp_err_t esp_wifi_remote_80211_tx(wifi_interface_t ifx, const void *buffer, int len, _Bool en_sys_seq) -{ - return esp_hosted_wifi_80211_tx(ifx, buffer, len, en_sys_seq); -} - -static inline esp_err_t esp_wifi_remote_set_csi_rx_cb(wifi_csi_cb_t cb, void *ctx) -{ - return esp_hosted_wifi_set_csi_rx_cb(cb, ctx); -} - -static inline esp_err_t esp_wifi_remote_set_csi_config(const wifi_csi_config_t *config) -{ - return esp_hosted_wifi_set_csi_config(config); -} - -static inline esp_err_t esp_wifi_remote_set_csi(_Bool en) -{ - return esp_hosted_wifi_set_csi(en); -} - -static inline esp_err_t esp_wifi_remote_set_ant_gpio(const wifi_ant_gpio_config_t *config) -{ - return esp_hosted_wifi_set_ant_gpio(config); -} - -static inline esp_err_t esp_wifi_remote_get_ant_gpio(wifi_ant_gpio_config_t *config) -{ - return esp_hosted_wifi_get_ant_gpio(config); -} - -static inline esp_err_t esp_wifi_remote_set_ant(const wifi_ant_config_t *config) -{ - return esp_hosted_wifi_set_ant(config); -} - -static inline esp_err_t esp_wifi_remote_get_ant(wifi_ant_config_t *config) -{ - return esp_hosted_wifi_get_ant(config); -} - -static inline int64_t esp_wifi_remote_get_tsf_time(wifi_interface_t interface) -{ - return esp_hosted_wifi_get_tsf_time(interface); -} - -static inline esp_err_t esp_wifi_remote_set_inactive_time(wifi_interface_t ifx, uint16_t sec) -{ - return esp_hosted_wifi_set_inactive_time(ifx, sec); -} - -static inline esp_err_t esp_wifi_remote_get_inactive_time(wifi_interface_t ifx, uint16_t *sec) -{ - return esp_hosted_wifi_get_inactive_time(ifx, sec); -} - -static inline esp_err_t esp_wifi_remote_statis_dump(uint32_t modules) -{ - return esp_hosted_wifi_statis_dump(modules); -} - -static inline esp_err_t esp_wifi_remote_set_rssi_threshold(int32_t rssi) -{ - return esp_hosted_wifi_set_rssi_threshold(rssi); -} - -static inline esp_err_t esp_wifi_remote_ftm_initiate_session(wifi_ftm_initiator_cfg_t *cfg) -{ - return esp_hosted_wifi_ftm_initiate_session(cfg); -} - -static inline esp_err_t esp_wifi_remote_ftm_end_session(void) -{ - return esp_hosted_wifi_ftm_end_session(); -} - -static inline esp_err_t esp_wifi_remote_ftm_resp_set_offset(int16_t offset_cm) -{ - return esp_hosted_wifi_ftm_resp_set_offset(offset_cm); -} - -static inline esp_err_t esp_wifi_remote_config_11b_rate(wifi_interface_t ifx, _Bool disable) -{ - return esp_hosted_wifi_config_11b_rate(ifx, disable); -} - -static inline esp_err_t esp_wifi_remote_connectionless_module_set_wake_interval(uint16_t wake_interval) -{ - return esp_hosted_wifi_connectionless_module_set_wake_interval(wake_interval); -} - -static inline esp_err_t esp_wifi_remote_force_wakeup_acquire(void) -{ - return esp_hosted_wifi_force_wakeup_acquire(); -} - -static inline esp_err_t esp_wifi_remote_force_wakeup_release(void) -{ - return esp_hosted_wifi_force_wakeup_release(); -} - -static inline esp_err_t esp_wifi_remote_set_country_code(const char *country, _Bool ieee80211d_enabled) -{ - return esp_hosted_wifi_set_country_code(country, ieee80211d_enabled); -} - -static inline esp_err_t esp_wifi_remote_get_country_code(char *country) -{ - return esp_hosted_wifi_get_country_code(country); -} - -static inline esp_err_t esp_wifi_remote_config_80211_tx_rate(wifi_interface_t ifx, wifi_phy_rate_t rate) -{ - return esp_hosted_wifi_config_80211_tx_rate(ifx, rate); -} - -static inline esp_err_t esp_wifi_remote_disable_pmf_config(wifi_interface_t ifx) -{ - return esp_hosted_wifi_disable_pmf_config(ifx); -} - -static inline esp_err_t esp_wifi_remote_sta_get_aid(uint16_t *aid) -{ - return esp_hosted_wifi_sta_get_aid(aid); -} - -static inline esp_err_t esp_wifi_remote_sta_get_negotiated_phymode(wifi_phy_mode_t *phymode) -{ - return esp_hosted_wifi_sta_get_negotiated_phymode(phymode); -} - -static inline esp_err_t esp_wifi_remote_set_dynamic_cs(_Bool enabled) -{ - return esp_hosted_wifi_set_dynamic_cs(enabled); -} - -static inline esp_err_t esp_wifi_remote_sta_get_rssi(int *rssi) -{ - return esp_hosted_wifi_sta_get_rssi(rssi); -} diff --git a/components/esp_wifi_remote/scripts/Kconfig b/components/esp_wifi_remote/scripts/Kconfig deleted file mode 100644 index e52b8e74f8..0000000000 --- a/components/esp_wifi_remote/scripts/Kconfig +++ /dev/null @@ -1,633 +0,0 @@ -menu "Wi-Fi Remote" - orsource "./Kconfig.soc_wifi_caps.in" - - config ESP_WIFI_STATIC_RX_BUFFER_NUM - int "Max number of WiFi static RX buffers" - range 2 25 if !SLAVE_SOC_WIFI_HE_SUPPORT - range 2 128 if SLAVE_SOC_WIFI_HE_SUPPORT - default 10 if !SPIRAM_TRY_ALLOCATE_WIFI_LWIP - default 16 if SPIRAM_TRY_ALLOCATE_WIFI_LWIP - help - Set the number of WiFi static RX buffers. Each buffer takes approximately 1.6KB of RAM. - The static rx buffers are allocated when esp_wifi_init is called, they are not freed - until esp_wifi_deinit is called. - - WiFi hardware use these buffers to receive all 802.11 frames. - A higher number may allow higher throughput but increases memory use. If ESP_WIFI_AMPDU_RX_ENABLED - is enabled, this value is recommended to set equal or bigger than ESP_WIFI_RX_BA_WIN in order to - achieve better throughput and compatibility with both stations and APs. - - config ESP_WIFI_DYNAMIC_RX_BUFFER_NUM - int "Max number of WiFi dynamic RX buffers" - range 0 128 if !LWIP_WND_SCALE - range 0 1024 if LWIP_WND_SCALE - default 32 - help - Set the number of WiFi dynamic RX buffers, 0 means unlimited RX buffers will be allocated - (provided sufficient free RAM). The size of each dynamic RX buffer depends on the size of - the received data frame. - - For each received data frame, the WiFi driver makes a copy to an RX buffer and then delivers - it to the high layer TCP/IP stack. The dynamic RX buffer is freed after the higher layer has - successfully received the data frame. - - For some applications, WiFi data frames may be received faster than the application can - process them. In these cases we may run out of memory if RX buffer number is unlimited (0). - - If a dynamic RX buffer limit is set, it should be at least the number of static RX buffers. - - choice ESP_WIFI_TX_BUFFER - prompt "Type of WiFi TX buffers" - default ESP_WIFI_DYNAMIC_TX_BUFFER - help - Select type of WiFi TX buffers: - - If "Static" is selected, WiFi TX buffers are allocated when WiFi is initialized and released - when WiFi is de-initialized. The size of each static TX buffer is fixed to about 1.6KB. - - If "Dynamic" is selected, each WiFi TX buffer is allocated as needed when a data frame is - delivered to the Wifi driver from the TCP/IP stack. The buffer is freed after the data frame - has been sent by the WiFi driver. The size of each dynamic TX buffer depends on the length - of each data frame sent by the TCP/IP layer. - - If PSRAM is enabled, "Static" should be selected to guarantee enough WiFi TX buffers. - If PSRAM is disabled, "Dynamic" should be selected to improve the utilization of RAM. - - config ESP_WIFI_STATIC_TX_BUFFER - bool "Static" - config ESP_WIFI_DYNAMIC_TX_BUFFER - bool "Dynamic" - depends on !SPIRAM_USE_MALLOC - endchoice - - config ESP_WIFI_TX_BUFFER_TYPE - int - default 0 if ESP_WIFI_STATIC_TX_BUFFER - default 1 if ESP_WIFI_DYNAMIC_TX_BUFFER - - config ESP_WIFI_STATIC_TX_BUFFER_NUM - int "Max number of WiFi static TX buffers" - depends on ESP_WIFI_STATIC_TX_BUFFER - range 1 64 - default 16 - help - Set the number of WiFi static TX buffers. Each buffer takes approximately 1.6KB of RAM. - The static RX buffers are allocated when esp_wifi_init() is called, they are not released - until esp_wifi_deinit() is called. - - For each transmitted data frame from the higher layer TCP/IP stack, the WiFi driver makes a - copy of it in a TX buffer. For some applications especially UDP applications, the upper - layer can deliver frames faster than WiFi layer can transmit. In these cases, we may run out - of TX buffers. - - config ESP_WIFI_CACHE_TX_BUFFER_NUM - int "Max number of WiFi cache TX buffers" - depends on SPIRAM - range 16 128 - default 32 - help - Set the number of WiFi cache TX buffer number. - - For each TX packet from uplayer, such as LWIP etc, WiFi driver needs to allocate a static TX - buffer and makes a copy of uplayer packet. If WiFi driver fails to allocate the static TX buffer, - it caches the uplayer packets to a dedicated buffer queue, this option is used to configure the - size of the cached TX queue. - - config ESP_WIFI_DYNAMIC_TX_BUFFER_NUM - int "Max number of WiFi dynamic TX buffers" - depends on ESP_WIFI_DYNAMIC_TX_BUFFER - range 1 128 - default 32 - help - Set the number of WiFi dynamic TX buffers. The size of each dynamic TX buffer is not fixed, - it depends on the size of each transmitted data frame. - - For each transmitted frame from the higher layer TCP/IP stack, the WiFi driver makes a copy - of it in a TX buffer. For some applications, especially UDP applications, the upper layer - can deliver frames faster than WiFi layer can transmit. In these cases, we may run out of TX - buffers. - - choice ESP_WIFI_MGMT_RX_BUFFER - prompt "Type of WiFi RX MGMT buffers" - default ESP_WIFI_STATIC_RX_MGMT_BUFFER - help - Select type of WiFi RX MGMT buffers: - - If "Static" is selected, WiFi RX MGMT buffers are allocated when WiFi is initialized and released - when WiFi is de-initialized. The size of each static RX MGMT buffer is fixed to about 500 Bytes. - - If "Dynamic" is selected, each WiFi RX MGMT buffer is allocated as needed when a MGMT data frame is - received. The MGMT buffer is freed after the MGMT data frame has been processed by the WiFi driver. - - - config ESP_WIFI_STATIC_RX_MGMT_BUFFER - bool "Static" - config ESP_WIFI_DYNAMIC_RX_MGMT_BUFFER - bool "Dynamic" - endchoice - - config ESP_WIFI_DYNAMIC_RX_MGMT_BUF - int - default 0 if ESP_WIFI_STATIC_RX_MGMT_BUFFER - default 1 if ESP_WIFI_DYNAMIC_RX_MGMT_BUFFER - - config ESP_WIFI_RX_MGMT_BUF_NUM_DEF - int "Max number of WiFi RX MGMT buffers" - range 1 10 - default 5 - help - Set the number of WiFi RX_MGMT buffers. - - For Management buffers, the number of dynamic and static management buffers is the same. - In order to prevent memory fragmentation, the management buffer type should be set to static first. - - config ESP_WIFI_CSI_ENABLED - bool "WiFi CSI(Channel State Information)" - depends on SLAVE_SOC_WIFI_CSI_SUPPORT - default n - help - Select this option to enable CSI(Channel State Information) feature. CSI takes about - CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM KB of RAM. If CSI is not used, it is better to disable - this feature in order to save memory. - - config ESP_WIFI_AMPDU_TX_ENABLED - bool "WiFi AMPDU TX" - default y - help - Select this option to enable AMPDU TX feature - - - config ESP_WIFI_TX_BA_WIN - int "WiFi AMPDU TX BA window size" - depends on ESP_WIFI_AMPDU_TX_ENABLED - range 2 32 if !SLAVE_SOC_WIFI_HE_SUPPORT - range 2 64 if SLAVE_SOC_WIFI_HE_SUPPORT - default 6 - help - Set the size of WiFi Block Ack TX window. Generally a bigger value means higher throughput but - more memory. Most of time we should NOT change the default value unless special reason, e.g. - test the maximum UDP TX throughput with iperf etc. For iperf test in shieldbox, the recommended - value is 9~12. - - config ESP_WIFI_AMPDU_RX_ENABLED - bool "WiFi AMPDU RX" - default y - help - Select this option to enable AMPDU RX feature - - config ESP_WIFI_RX_BA_WIN - int "WiFi AMPDU RX BA window size" - depends on ESP_WIFI_AMPDU_RX_ENABLED - range 2 32 if !SLAVE_SOC_WIFI_HE_SUPPORT - range 2 64 if SLAVE_SOC_WIFI_HE_SUPPORT - default 6 if !SPIRAM_TRY_ALLOCATE_WIFI_LWIP - default 16 if SPIRAM_TRY_ALLOCATE_WIFI_LWIP - help - Set the size of WiFi Block Ack RX window. Generally a bigger value means higher throughput and better - compatibility but more memory. Most of time we should NOT change the default value unless special - reason, e.g. test the maximum UDP RX throughput with iperf etc. For iperf test in shieldbox, the - recommended value is 9~12. If PSRAM is used and WiFi memory is prefered to allocat in PSRAM first, - the default and minimum value should be 16 to achieve better throughput and compatibility with both - stations and APs. - - config ESP_WIFI_AMSDU_TX_ENABLED - bool "WiFi AMSDU TX" - depends on SPIRAM - default n - help - Select this option to enable AMSDU TX feature - - config ESP_WIFI_NVS_ENABLED - bool "WiFi NVS flash" - default y - help - Select this option to enable WiFi NVS flash - - choice ESP_WIFI_TASK_CORE_ID - depends on !FREERTOS_UNICORE - prompt "WiFi Task Core ID" - default ESP_WIFI_TASK_PINNED_TO_CORE_0 - help - Pinned WiFi task to core 0 or core 1. - - config ESP_WIFI_TASK_PINNED_TO_CORE_0 - bool "Core 0" - config ESP_WIFI_TASK_PINNED_TO_CORE_1 - bool "Core 1" - endchoice - - config ESP_WIFI_SOFTAP_BEACON_MAX_LEN - int "Max length of WiFi SoftAP Beacon" - range 752 1256 - default 752 - help - ESP-MESH utilizes beacon frames to detect and resolve root node conflicts (see documentation). However - the default length of a beacon frame can simultaneously hold only five root node identifier structures, - meaning that a root node conflict of up to five nodes can be detected at one time. In the occurence of - more root nodes conflict involving more than five root nodes, the conflict resolution process will - detect five of the root nodes, resolve the conflict, and re-detect more root nodes. This process will - repeat until all root node conflicts are resolved. However this process can generally take a very long - time. - - To counter this situation, the beacon frame length can be increased such that more root nodes can be - detected simultaneously. Each additional root node will require 36 bytes and should be added ontop of - the default beacon frame length of - 752 bytes. For example, if you want to detect 10 root nodes simultaneously, you need to set the beacon - frame length as - 932 (752+36*5). - - Setting a longer beacon length also assists with debugging as the conflicting root nodes can be - identified more quickly. - - config ESP_WIFI_MGMT_SBUF_NUM - int "WiFi mgmt short buffer number" - range 6 32 - default 32 - help - Set the number of WiFi management short buffer. - - config ESP_WIFI_IRAM_OPT - bool "WiFi IRAM speed optimization" - default n if (BT_ENABLED && SPIRAM && SLAVE_IDF_TARGET_ESP32) - default y - help - Select this option to place frequently called Wi-Fi library functions in IRAM. - When this option is disabled, more than 10Kbytes of IRAM memory will be saved - but Wi-Fi throughput will be reduced. - - config ESP_WIFI_EXTRA_IRAM_OPT - bool "WiFi EXTRA IRAM speed optimization" - default y if SLAVE_IDF_TARGET_ESP32C6 - default n - help - Select this option to place additional frequently called Wi-Fi library functions - in IRAM. When this option is disabled, more than 5Kbytes of IRAM memory will be saved - but Wi-Fi throughput will be reduced. - - config ESP_WIFI_RX_IRAM_OPT - bool "WiFi RX IRAM speed optimization" - default n if (BT_ENABLED && SPIRAM && SLAVE_IDF_TARGET_ESP32) - default y - help - Select this option to place frequently called Wi-Fi library RX functions in IRAM. - When this option is disabled, more than 17Kbytes of IRAM memory will be saved - but Wi-Fi performance will be reduced. - - config ESP_WIFI_ENABLE_WPA3_SAE - bool "Enable WPA3-Personal" - default y - select ESP_WIFI_MBEDTLS_CRYPTO - help - Select this option to allow the device to establish a WPA3-Personal connection with eligible AP's. - PMF (Protected Management Frames) is a prerequisite feature for a WPA3 connection, it needs to be - explicitly configured before attempting connection. Please refer to the Wi-Fi Driver API Guide - for details. - - config ESP_WIFI_ENABLE_SAE_PK - bool "Enable SAE-PK" - default y - depends on ESP_WIFI_ENABLE_WPA3_SAE - help - Select this option to enable SAE-PK - - config ESP_WIFI_SOFTAP_SAE_SUPPORT - bool "Enable WPA3 Personal(SAE) SoftAP" - default y - depends on ESP_WIFI_ENABLE_WPA3_SAE - depends on ESP_WIFI_SOFTAP_SUPPORT - help - Select this option to enable SAE support in softAP mode. - - config ESP_WIFI_ENABLE_WPA3_OWE_STA - bool "Enable OWE STA" - default y - select ESP_WIFI_MBEDTLS_CRYPTO - help - Select this option to allow the device to establish OWE connection with eligible AP's. - PMF (Protected Management Frames) is a prerequisite feature for a WPA3 connection, it needs to be - explicitly configured before attempting connection. Please refer to the Wi-Fi Driver API Guide - for details. - - config ESP_WIFI_SLP_IRAM_OPT - bool "WiFi SLP IRAM speed optimization" - select PM_SLP_DEFAULT_PARAMS_OPT - select PERIPH_CTRL_FUNC_IN_IRAM - help - Select this option to place called Wi-Fi library TBTT process and receive beacon functions in IRAM. - Some functions can be put in IRAM either by ESP_WIFI_IRAM_OPT and ESP_WIFI_RX_IRAM_OPT, or this one. - If already enabled ESP_WIFI_IRAM_OPT, the other 7.3KB IRAM memory would be taken by this option. - If already enabled ESP_WIFI_RX_IRAM_OPT, the other 1.3KB IRAM memory would be taken by this option. - If neither of them are enabled, the other 7.4KB IRAM memory would be taken by this option. - Wi-Fi power-save mode average current would be reduced if this option is enabled. - - config ESP_WIFI_SLP_DEFAULT_MIN_ACTIVE_TIME - int "Minimum active time" - range 8 60 - default 50 - depends on ESP_WIFI_SLP_IRAM_OPT - help - The minimum timeout for waiting to receive data, unit: milliseconds. - - config ESP_WIFI_SLP_DEFAULT_MAX_ACTIVE_TIME - int "Maximum keep alive time" - range 10 60 - default 10 - depends on ESP_WIFI_SLP_IRAM_OPT - help - The maximum time that wifi keep alive, unit: seconds. - - config ESP_WIFI_FTM_ENABLE - bool "WiFi FTM" - default n - depends on SLAVE_SOC_WIFI_FTM_SUPPORT - help - Enable feature Fine Timing Measurement for calculating WiFi Round-Trip-Time (RTT). - - config ESP_WIFI_FTM_INITIATOR_SUPPORT - bool "FTM Initiator support" - default y - depends on ESP_WIFI_FTM_ENABLE - - config ESP_WIFI_FTM_RESPONDER_SUPPORT - bool "FTM Responder support" - default y - depends on ESP_WIFI_FTM_ENABLE - - config ESP_WIFI_STA_DISCONNECTED_PM_ENABLE - bool "Power Management for station at disconnected" - default y - help - Select this option to enable power_management for station when disconnected. - Chip will do modem-sleep when rf module is not in use any more. - - config ESP_WIFI_GCMP_SUPPORT - bool "WiFi GCMP Support(GCMP128 and GCMP256)" - default n - depends on SLAVE_SOC_WIFI_GCMP_SUPPORT - help - Select this option to enable GCMP support. GCMP support is compulsory for WiFi Suite-B support. - - config ESP_WIFI_GMAC_SUPPORT - bool "WiFi GMAC Support(GMAC128 and GMAC256)" - default n - help - Select this option to enable GMAC support. GMAC support is compulsory for WiFi 192 bit certification. - - config ESP_WIFI_SOFTAP_SUPPORT - bool "WiFi SoftAP Support" - default y - help - WiFi module can be compiled without SoftAP to save code size. - - config ESP_WIFI_ENHANCED_LIGHT_SLEEP - bool "WiFi modem automatically receives the beacon" - default n - depends on ESP_PHY_MAC_BB_PD && SOC_PM_SUPPORT_BEACON_WAKEUP - help - The wifi modem automatically receives the beacon frame during light sleep. - - config ESP_WIFI_SLP_BEACON_LOST_OPT - bool "Wifi sleep optimize when beacon lost" - help - Enable wifi sleep optimization when beacon loss occurs and immediately enter - sleep mode when the WiFi module detects beacon loss. - - config ESP_WIFI_SLP_BEACON_LOST_TIMEOUT - int "Beacon loss timeout" - range 5 100 - default 10 - depends on ESP_WIFI_SLP_BEACON_LOST_OPT - help - Timeout time for close rf phy when beacon loss occurs, Unit: 1024 microsecond. - - config ESP_WIFI_SLP_BEACON_LOST_THRESHOLD - int "Maximum number of consecutive lost beacons allowed" - range 0 8 - default 3 - depends on ESP_WIFI_SLP_BEACON_LOST_OPT - help - Maximum number of consecutive lost beacons allowed, WiFi keeps Rx state when - the number of consecutive beacons lost is greater than the given threshold. - - config ESP_WIFI_SLP_PHY_ON_DELTA_EARLY_TIME - int "Delta early time for RF PHY on" - range 0 100 - default 2 - depends on ESP_WIFI_SLP_BEACON_LOST_OPT && SLAVE_SOC_WIFI_SUPPORT_VARIABLE_BEACON_WINDOW - help - Delta early time for rf phy on, When the beacon is lost, the next rf phy on will - be earlier the time specified by the configuration item, Unit: 32 microsecond. - - config ESP_WIFI_SLP_PHY_OFF_DELTA_TIMEOUT_TIME - int "Delta timeout time for RF PHY off" - range 0 8 - default 2 - depends on ESP_WIFI_SLP_BEACON_LOST_OPT && SLAVE_SOC_WIFI_SUPPORT_VARIABLE_BEACON_WINDOW - help - Delta timeout time for rf phy off, When the beacon is lost, the next rf phy off will - be delayed for the time specified by the configuration item. Unit: 1024 microsecond. - - config ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM - int "Maximum espnow encrypt peers number" - range 0 4 if SLAVE_IDF_TARGET_ESP32C2 - range 0 17 if (!SLAVE_IDF_TARGET_ESP32C2) - default 2 if SLAVE_IDF_TARGET_ESP32C2 - default 7 if (!SLAVE_IDF_TARGET_ESP32C2) - help - Maximum number of encrypted peers supported by espnow. - The number of hardware keys for encryption is fixed. And the espnow and SoftAP share the same - hardware keys. So this configuration will affect the maximum connection number of SoftAP. - Maximum espnow encrypted peers number + maximum number of connections of SoftAP = Max hardware - keys number. When using ESP mesh, this value should be set to a maximum of 6. - - config ESP_WIFI_NAN_ENABLE - bool "WiFi Aware" - default n - depends on SLAVE_SOC_WIFI_NAN_SUPPORT - help - Enable WiFi Aware (NAN) feature. - - config ESP_WIFI_ENABLE_WIFI_TX_STATS - bool "Enable Wi-Fi transmission statistics" - depends on SLAVE_SOC_WIFI_HE_SUPPORT - default "y" - help - Enable Wi-Fi transmission statistics. Total support 4 access category. Each access category - will use 346 bytes memory. - - config ESP_WIFI_MBEDTLS_CRYPTO - bool "Use MbedTLS crypto APIs" - default y - select MBEDTLS_AES_C - select MBEDTLS_ECP_C - select MBEDTLS_ECDH_C - select MBEDTLS_ECDSA_C - select MBEDTLS_CMAC_C - select MBEDTLS_ECP_DP_SECP256R1_ENABLED - help - Select this option to enable the use of MbedTLS crypto APIs. - The internal crypto support within the supplicant is limited - and may not suffice for all new security features, including WPA3. - - It is recommended to always keep this option enabled. Additionally, - note that MbedTLS can leverage hardware acceleration if available, - resulting in significantly faster cryptographic operations. - - if ESP_WIFI_MBEDTLS_CRYPTO - config ESP_WIFI_MBEDTLS_TLS_CLIENT - bool "Use MbedTLS TLS client for WiFi Enterprise connection" - depends on ESP_WIFI_ENTERPRISE_SUPPORT - default y - select MBEDTLS_TLS_ENABLED - help - Select this option to use MbedTLS TLS client for WPA2 enterprise connection. - Please note that from MbedTLS-3.0 onwards, MbedTLS does not support SSL-3.0 - TLS-v1.0, TLS-v1.1 versions. Incase your server is using one of these version, - it is advisable to update your server. - Please disable this option for compatibilty with older TLS versions. - endif - - config ESP_WIFI_WAPI_PSK - bool "Enable WAPI PSK support" - depends on SLAVE_SOC_WIFI_WAPI_SUPPORT - default n - help - Select this option to enable WAPI-PSK - which is a Chinese National Standard Encryption for Wireless LANs (GB 15629.11-2003). - - config ESP_WIFI_SUITE_B_192 - bool "Enable NSA suite B support with 192 bit key" - default n - depends on SLAVE_SOC_WIFI_GCMP_SUPPORT - select ESP_WIFI_GCMP_SUPPORT - select ESP_WIFI_GMAC_SUPPORT - help - Select this option to enable 192 bit NSA suite-B. - This is necessary to support WPA3 192 bit security. - - config ESP_WIFI_11KV_SUPPORT - bool "Enable 802.11k, 802.11v APIs Support" - default n - help - Select this option to enable 802.11k 802.11v APIs(RRM and BTM support). - Only APIs which are helpful for network assisted roaming - are supported for now. - Enable this option with BTM and RRM enabled in sta config - to make device ready for network assisted roaming. - BTM: BSS transition management enables an AP to request a station to transition - to a specific AP, or to indicate to a station a set of preferred APs. - RRM: Radio measurements enable STAs to understand the radio environment, - it enables STAs to observe and gather data on radio link performance - and on the radio environment. Current implementation adds beacon report, - link measurement, neighbor report. - - config ESP_WIFI_SCAN_CACHE - bool "Keep scan results in cache" - depends on ESP_WIFI_11KV_SUPPORT - default n - help - Keep scan results in cache, if not enabled, those - will be flushed immediately. - - config ESP_WIFI_MBO_SUPPORT - bool "Enable Multi Band Operation Certification Support" - default n - select ESP_WIFI_11KV_SUPPORT - select ESP_WIFI_SCAN_CACHE - help - Select this option to enable WiFi Multiband operation certification support. - - config ESP_WIFI_DPP_SUPPORT - bool "Enable DPP support" - default n - select ESP_WIFI_MBEDTLS_CRYPTO - help - Select this option to enable WiFi Easy Connect Support. - - config ESP_WIFI_11R_SUPPORT - bool "Enable 802.11R (Fast Transition) Support" - default n - help - Select this option to enable WiFi Fast Transition Support. - - config ESP_WIFI_WPS_SOFTAP_REGISTRAR - bool "Add WPS Registrar support in SoftAP mode" - depends on ESP_WIFI_SOFTAP_SUPPORT - default n - help - Select this option to enable WPS registrar support in softAP mode. - - config ESP_WIFI_ENABLE_WIFI_RX_STATS - bool "Enable Wi-Fi reception statistics" - depends on SLAVE_SOC_WIFI_HE_SUPPORT - default "y" - help - Enable Wi-Fi reception statistics. Total support 2 access category. Each access category - will use 190 bytes memory. - - config ESP_WIFI_ENABLE_WIFI_RX_MU_STATS - bool "Enable Wi-Fi DL MU-MIMO and DL OFDMA reception statistics" - depends on ESP_WIFI_ENABLE_WIFI_RX_STATS - default "y" - help - Enable Wi-Fi DL MU-MIMO and DL OFDMA reception statistics. Will use 10932 bytes memory. - - menu "WPS Configuration Options" - config ESP_WIFI_WPS_STRICT - bool "Strictly validate all WPS attributes" - default n - help - Select this option to enable validate each WPS attribute - rigorously. Disabling this add the workaorunds with various APs. - Enabling this may cause inter operability issues with some APs. - - config ESP_WIFI_WPS_PASSPHRASE - bool "Get WPA2 passphrase in WPS config" - default n - help - Select this option to get passphrase during WPS configuration. - This option fakes the virtual display capabilites to get the - configuration in passphrase mode. - Not recommanded to be used since WPS credentials should not - be shared to other devices, making it in readable format increases - that risk, also passphrase requires pbkdf2 to convert in psk. - - endmenu # "WPS Configuration Options" - - - config ESP_WIFI_DEBUG_PRINT - bool "Print debug messages from WPA Supplicant" - default n - help - Select this option to print logging information from WPA supplicant, - this includes handshake information and key hex dumps depending - on the project logging level. - - Enabling this could increase the build size ~60kb - depending on the project logging level. - - config ESP_WIFI_TESTING_OPTIONS - bool "Add DPP testing code" - default n - help - Select this to enable unity test for DPP. - - config ESP_WIFI_ENTERPRISE_SUPPORT - bool "Enable enterprise option" - default y - help - Select this to enable/disable enterprise connection support. - - disabling this will reduce binary size. - disabling this will disable the use of any esp_wifi_sta_wpa2_ent_* (as APIs will be meaningless) - - config ESP_WIFI_ENT_FREE_DYNAMIC_BUFFER - bool "Free dynamic buffers during WiFi enterprise connection" - depends on ESP_WIFI_ENTERPRISE_SUPPORT - default y if SLAVE_IDF_TARGET_ESP32C2 - default n if !SLAVE_IDF_TARGET_ESP32C2 - help - Select this configuration to free dynamic buffers during WiFi enterprise connection. - This will enable chip to reduce heap consumption during WiFi enterprise connection. - -endmenu # Wi-Fi Remote diff --git a/components/esp_wifi_remote/scripts/README.md b/components/esp_wifi_remote/scripts/README.md deleted file mode 100644 index 777b04e2bc..0000000000 --- a/components/esp_wifi_remote/scripts/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# Parsing and generating code - -This folder contains scripts for parsing `esp_wifi` component headers and configs and generates configs, headers and sources of `esp_wifi_remote`. - -The CI job runs the parse and generation step, after which the generated files appear locally in this folder. Then the CI jobs compares the generated files with the specific version files. In case of a mismatch (CI failure), please check if the generated file is correct. If so, update the component and create a new version. If not, update the scripts. - -## Parsing `esp_wifi` headers - -Extract prototypes from the selected wifi headers - -## Generating `Kconfig` - -* Kconfig -- we only replace `SOC_WIFI_` -> `SLAVE_SOC_WIFI_` and `IDF_TARGET_` -> `SLAVE_IDF_TARGET_` configs -* Kconfig.soc_wifi_caps.in -- we parse `IDF/components/soc/$SLAVE/include/soc/Kconfig.soc_caps.in` for all slaves and collect `SOC_WIFI_` configs, which we enclose with `if SLAVE_IDF_TARGET...` ... `endif`. -This way the slave's WiFi capabilities become runtime available in `esp_wifi_remote` submenu - -## Generating headers and forwarding to `esp_hosted` - -Based on extracted WiFi function prototypes we generate - -* `esp_wifi_remote_api.h` -- declares all wifi APIs with `esp_wifi_remote...()` prefix -* `esp_wifi_with_remote.c` -- defines all original wifi APIs that forward calls for `esp_wifi_remote` -- This file is used only for targets with no WiFi capabilities, so the original WiFi APIs could be called the same way as on WiFi targets. (this file is not compiled for targets with WiFi caps) -* `esp_wifi_remote_with_hosted.h` -- defines `static inline` functions that directly forward calls from `esp_wifi_remote` to `esp_hosted` - -## Generating slave's WiFi native types - -* `esp_wifi_types_native.h` -- defines specific WiFi types based on the selected WiFI slave and its capabilities. We use the original header and only replace `CONFIG_SOC_WIFI_` -> `CONFIG_SLAVE_SOC_WIFI_` and `CONFIG_IDF_TARGET_` -> `CONFIG_SLAVE_IDF_TARGET_` configs - -## Generating test cases - -This component includes a simple build-only test that exercises all APIs from `esp_wifi_remote` (and also from `esp_wifi`). The test is also generated by the same script, since we know the function prototypes, so we could tell what parameters we call the exercised APIs. -This test includes a mocked version of the `esp_hosted` component, so the generated files are: - -* `esp_hosted_mock.c` -- all WiFi APIs to just return a default value (typically `ESP_OK`) -* `esp_hosted_mock.h` -- declares all WiFi related APIs -* `Kconfig` -- selection of all SLAVE targets (with WiFi capabilities) -* `all_wifi_calls.c` -- calls all WiFi APIs (to check that targets without WiFi caps can use the original APIs) -* `all_wifi_remote_calls.c` -- calls all remote WiFi APIs (to check that also the targets with WiFi caps can use the remote wifi functionality) diff --git a/components/esp_wifi_remote/scripts/generate_and_check.py b/components/esp_wifi_remote/scripts/generate_and_check.py deleted file mode 100644 index d72b82d474..0000000000 --- a/components/esp_wifi_remote/scripts/generate_and_check.py +++ /dev/null @@ -1,401 +0,0 @@ -# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD -# SPDX-License-Identifier: Apache-2.0 -import argparse -import json -import os -import re -import subprocess -from collections import namedtuple - -from idf_build_apps.constants import PREVIEW_TARGETS, SUPPORTED_TARGETS -from pycparser import c_ast, c_parser, preprocess_file - -Param = namedtuple('Param', ['ptr', 'array', 'qual', 'type', 'name']) - -AUTO_GENERATED = 'This file is auto-generated' -COPYRIGHT_HEADER = open('copyright_header.h', 'r').read() -NAMESPACE = re.compile(r'^esp_wifi') -DEPRECATED_API = ['esp_wifi_set_ant_gpio', 'esp_wifi_get_ant', 'esp_wifi_get_ant_gpio', 'esp_wifi_set_ant'] - - -class FunctionVisitor(c_ast.NodeVisitor): - def __init__(self, header): - self.function_prototypes = {} - self.ptr = 0 - self.array = 0 - self.content = open(header, 'r').read() - - def get_type(self, node, suffix='param'): - if suffix == 'param': - self.ptr = 0 - self.array = 0 - - if isinstance(node.type, c_ast.TypeDecl): - typename = node.type.declname - quals = '' - if node.type.quals: - quals = ' '.join(node.type.quals) - if node.type.type.names: - type = node.type.type.names[0] - return quals, type, typename - if isinstance(node.type, c_ast.PtrDecl): - quals, type, name = self.get_type(node.type, 'ptr') - self.ptr += 1 - return quals, type, name - - if isinstance(node.type, c_ast.ArrayDecl): - quals, type, name = self.get_type(node.type, 'array') - self.array = int(node.type.dim.value) - return quals, type, name - - def visit_FuncDecl(self, node): - if isinstance(node.type, c_ast.TypeDecl): - func_name = node.type.declname - if func_name.startswith('esp_wifi') and func_name in self.content: - if func_name in DEPRECATED_API: - return - ret = node.type.type.names[0] - args = [] - for param in node.args.params: - quals, type, name = self.get_type(param) - param = Param(ptr=self.ptr, array=self.array, qual=quals, type=type, name=name) - args.append(param) - self.function_prototypes[func_name] = (ret, args) - - -# Parse the header file and extract function prototypes -def extract_function_prototypes(header_code, header): - parser = c_parser.CParser() # Set debug parameter to False - ast = parser.parse(header_code) - visitor = FunctionVisitor(header) - visitor.visit(ast) - return visitor.function_prototypes - - -def exec_cmd(what, out_file=None): - p = subprocess.Popen(what, stdin=subprocess.PIPE, stdout=out_file if out_file is not None else subprocess.PIPE, stderr=subprocess.PIPE) - output_b, err_b = p.communicate() - rc = p.returncode - output: str = output_b.decode('utf-8') if output_b is not None else '' - err: str = err_b.decode('utf-8') if err_b is not None else '' - return rc, output, err, ' '.join(what) - - -def preprocess(idf_path, header): - project_dir = os.path.join(idf_path, 'examples', 'get-started', 'blink') - build_dir = os.path.join(project_dir, 'build') - subprocess.check_call(['idf.py', '-B', build_dir, 'reconfigure'], cwd=project_dir) - build_commands_json = os.path.join(build_dir, 'compile_commands.json') - with open(build_commands_json, 'r', encoding='utf-8') as f: - build_command = json.load(f)[0]['command'].split() - include_dir_flags = [] - include_dirs = [] - # process compilation flags (includes and defines) - for item in build_command: - if item.startswith('-I'): - include_dir_flags.append(item) - if 'components' in item: - include_dirs.append(item[2:]) # Removing the leading "-I" - if item.startswith('-D'): - include_dir_flags.append(item.replace('\\','')) # removes escaped quotes, eg: -DMBEDTLS_CONFIG_FILE=\\\"mbedtls/esp_config.h\\\" - include_dir_flags.append('-I' + os.path.join(build_dir, 'config')) - temp_file = 'esp_wifi_preprocessed.h' - with open(temp_file, 'w') as f: - f.write('#define asm\n') - f.write('#define volatile\n') - f.write('#define __asm__\n') - f.write('#define __volatile__\n') - with open(temp_file, 'a') as f: - rc, out, err, cmd = exec_cmd(['xtensa-esp32-elf-gcc', '-w', '-P', '-include', 'ignore_extensions.h', '-E', header] + include_dir_flags, f) - if rc != 0: - print(f'command {cmd} failed!') - print(err) - preprocessed_code = preprocess_file(temp_file) - return preprocessed_code - - -def get_args(parameters): - params = [] - names = [] - for param in parameters: - typename = param.type - if typename == 'void' and param.ptr == 0 and param.name is None: - params.append(f'{typename}') - continue - if param.qual != '': - typename = f'{param.qual} ' + typename - declname = param.name - names.append(f'{declname}') - if param.ptr > 0: - declname = '*' * param.ptr + declname - if param.array > 0: - declname += f'[{param.array}]' - params.append(f'{typename} {declname}') - comma_separated_params = ', '.join(params) - comma_separated_names = ', '.join(names) - return comma_separated_params, comma_separated_names - - -def get_vars(parameters): - definitions = '' - names = [] - for param in parameters: - typename = param.type - if typename == 'void' and param.ptr == 0 and param.name is None: - continue - default_value = '0' - declname = param.name - names.append(f'{declname}') - if param.qual != '': - typename = f'{param.qual} ' + typename - if param.ptr > 0: - declname = '*' * param.ptr + declname - default_value = 'NULL' - if param.array > 0: - declname += f'[{param.array}]' - default_value = '{}' - definitions += f' {typename} {declname} = {default_value};\n' - comma_separated_names = ', '.join(names) - return definitions, comma_separated_names - - -def generate_kconfig_wifi_caps(idf_path, idf_ver_dir, component_path): - kconfig = os.path.join(component_path, idf_ver_dir, 'Kconfig.soc_wifi_caps.in') - slave_select = os.path.join(component_path, idf_ver_dir, 'Kconfig.slave_select.in') - with open(kconfig, 'w') as slave_caps, open(slave_select, 'w') as slave: - slave_caps.write(f'# {AUTO_GENERATED}\n') - slave.write(f'# {AUTO_GENERATED}\n') - slave.write(' choice SLAVE_IDF_TARGET\n') - slave.write(' prompt "choose slave target"\n') - slave.write(' default SLAVE_IDF_TARGET_ESP32\n') - for slave_target in SUPPORTED_TARGETS + PREVIEW_TARGETS: - add_slave = False - kconfig_content = [] - soc_caps = os.path.join(idf_path, 'components', 'soc', slave_target, 'include', 'soc', 'Kconfig.soc_caps.in') - with open(soc_caps, 'r') as f: - for line in f: - if line.strip().startswith('config SOC_WIFI_'): - if 'config SOC_WIFI_SUPPORTED' in line: - # if WiFi supported for this target, add it to Kconfig slave options and test this slave - add_slave = True - replaced = re.sub(r'SOC_WIFI_', 'SLAVE_SOC_WIFI_', line) - kconfig_content.append(f' {replaced}') - kconfig_content.append(f' {f.readline()}') # type - kconfig_content.append(f' {f.readline()}\n') # default - if add_slave: - slave_caps.write(f'\nif SLAVE_IDF_TARGET_{slave_target.upper()}\n\n') - slave_caps.writelines(kconfig_content) - slave_caps.write(f'endif # {slave_target.upper()}\n') - - slave_config_name = 'SLAVE_IDF_TARGET_' + slave_target.upper() - slave.write(f' config {slave_config_name}\n') - slave.write(f' bool "{slave_target}"\n') - - slave.write(' endchoice\n') - return [kconfig, slave_select] - - -def generate_remote_wifi_api(function_prototypes, idf_ver_dir, component_path): - header = os.path.join(component_path, idf_ver_dir, 'include', 'esp_wifi_remote_api.h') - wifi_source = os.path.join(component_path, idf_ver_dir, 'esp_wifi_with_remote.c') - remote_source = os.path.join(component_path, idf_ver_dir, 'esp_wifi_remote_weak.c') - with open(header, 'w') as f: - f.write(COPYRIGHT_HEADER) - f.write('#pragma once\n') - for func_name, args in function_prototypes.items(): - params, _ = get_args(args[1]) - remote_func_name = NAMESPACE.sub('esp_wifi_remote', func_name) - f.write(f'{args[0]} {remote_func_name}({params});\n') - with open(wifi_source, 'w') as wifi, open(remote_source, 'w') as remote: - wifi.write(COPYRIGHT_HEADER) - wifi.write('#include "esp_wifi.h"\n') - wifi.write('#include "esp_wifi_remote.h"\n') - remote.write(COPYRIGHT_HEADER) - remote.write('#include "esp_wifi_remote.h"\n') - remote.write('#include "esp_log.h"\n\n') - remote.write('#define WEAK __attribute__((weak))\n') - remote.write('#define LOG_UNSUPPORTED_AND_RETURN(ret) ESP_LOGW("esp_wifi_remote_weak", "%s unsupported", __func__); \\\n return ret;\n') - for func_name, args in function_prototypes.items(): - remote_func_name = NAMESPACE.sub('esp_wifi_remote', func_name) - params, names = get_args(args[1]) - ret_type = args[0] - ret_value = '-1' # default return value indicating error - if (ret_type == 'esp_err_t'): - ret_value = 'ESP_ERR_NOT_SUPPORTED' - wifi.write(f'\n{args[0]} {func_name}({params})\n') - wifi.write('{\n') - wifi.write(f' return {remote_func_name}({names});\n') - wifi.write('}\n') - remote.write(f'\nWEAK {args[0]} {remote_func_name}({params})\n') - remote.write('{\n') - remote.write(f' LOG_UNSUPPORTED_AND_RETURN({ret_value});\n') - remote.write('}\n') - return [header, wifi_source, remote_source] - - -def generate_hosted_mocks(function_prototypes, idf_ver_dir, component_path): - source = os.path.join(component_path, 'test', 'smoke_test', 'components', 'esp_hosted', idf_ver_dir, 'esp_hosted_mock.c') - header = os.path.join(component_path, 'test', 'smoke_test', 'components', 'esp_hosted', idf_ver_dir, 'include', 'esp_hosted_mock.h') - with open(source, 'w') as f, open(header, 'w') as h: - f.write(COPYRIGHT_HEADER) - h.write(COPYRIGHT_HEADER) - h.write('#pragma once\n') - f.write('#include "esp_wifi.h"\n') - f.write('#include "esp_wifi_remote.h"\n') - for func_name, args in function_prototypes.items(): - hosted_func_name = NAMESPACE.sub('esp_wifi_remote', func_name) - params, names = get_args(args[1]) - ret_type = args[0] - ret_value = '0' # default return value - if (ret_type == 'esp_err_t'): - ret_value = 'ESP_OK' - f.write(f'\n{ret_type} {hosted_func_name}({params})\n') - f.write('{\n') - f.write(f' return {ret_value};\n') - f.write('}\n') - h.write(f'{ret_type} {hosted_func_name}({params});\n') - return [source, header] - - -def generate_test_cases(function_prototypes, idf_ver_dir, component_path): - wifi_cases = os.path.join(component_path, 'test', 'smoke_test', 'main', idf_ver_dir, 'all_wifi_calls.c') - remote_wifi_cases = os.path.join(component_path, 'test', 'smoke_test', 'main', idf_ver_dir, 'all_wifi_remote_calls.c') - with open(wifi_cases, 'w') as wifi, open(remote_wifi_cases, 'w') as remote: - wifi.write(COPYRIGHT_HEADER) - remote.write(COPYRIGHT_HEADER) - wifi.write('#include "esp_wifi.h"\n\n') - remote.write('#include "esp_wifi_remote.h"\n\n') - wifi.write('void run_all_wifi_apis(void)\n{\n') - remote.write('void run_all_wifi_remote_apis(void)\n{\n') - for func_name, args in function_prototypes.items(): - remote_func_name = NAMESPACE.sub('esp_wifi_remote', func_name) - defs, names = get_vars(args[1]) - wifi.write(' {\n') - wifi.write(f'{defs}') - wifi.write(f' {func_name}({names});\n') - wifi.write(' }\n\n') - remote.write(' {\n') - remote.write(f'{defs}') - remote.write(f' {remote_func_name}({names});\n') - remote.write(' }\n\n') - wifi.write('}\n') - remote.write('}\n') - return [wifi_cases, remote_wifi_cases] - - -def generate_wifi_native(idf_path, idf_ver_dir, component_path): - wifi_native = os.path.join(component_path, idf_ver_dir, 'include', 'esp_wifi_types_native.h') - native_header = os.path.join(idf_path, 'components', 'esp_wifi', 'include', 'local', 'esp_wifi_types_native.h') - orig_content = open(native_header, 'r').read() - content = orig_content.replace('CONFIG_','CONFIG_SLAVE_') - open(wifi_native, 'w').write(content) - return [wifi_native] - - -def generate_kconfig(idf_path, idf_ver_dir, component_path): - remote_kconfig = os.path.join(component_path, idf_ver_dir, 'Kconfig.wifi.in') - slave_configs = ['SOC_WIFI_', 'IDF_TARGET_'] - lines = open(os.path.join(idf_path, 'components', 'esp_wifi', 'Kconfig'), 'r').readlines() - copy = 100 # just a big number to be greater than nested_if in the first few iterations - nested_if = 0 - with open(remote_kconfig, 'w') as f: - f.write(f'# Wi-Fi configuration\n') - f.write(f'# {AUTO_GENERATED}\n') - for line1 in lines: - line = line1.strip() - if re.match(r'^if\s+[A-Z_0-9]+\s*$', line): - nested_if += 1 - elif line.startswith('endif'): - nested_if -= 1 - - if nested_if >= copy: - - for config in slave_configs: - line1 = re.compile(config).sub('SLAVE_' + config, line1) - f.write(line1) - - if re.match(r'^if\s+\(?ESP_WIFI_ENABLED', line): - copy = nested_if - f.write(f'# Wi-Fi configuration end\n') - return [remote_kconfig] - - -def compare_files(base_dir, component_path, files_to_check): - failures = [] - for file_path in files_to_check: - relative_path = os.path.relpath(file_path, component_path) - base_file = os.path.join(base_dir, relative_path) - - if not os.path.exists(base_file): - failures.append((relative_path, 'File does not exist in base directory')) - continue - - diff_cmd = ['diff', '-I', 'Copyright', file_path, base_file] - result = subprocess.run(diff_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - - if result.returncode != 0: # diff returns 0 if files are identical - failures.append((relative_path, result.stdout.decode('utf-8'))) - - return failures - - -if __name__ == '__main__': - parser = argparse.ArgumentParser( - description='Build all projects', - formatter_class=argparse.ArgumentDefaultsHelpFormatter, - epilog='''\ -TEST FAILED ------------ -Some of the component files are different from the pregenerated output. -Please check the files that marked as "FAILED" in this step, -typically you'd just need to commit the changes and create a new version. -Please be aware that the pregenerated files use the same copyright header, so after -making changes you might need to modify 'copyright_header.h' in the script directory. - ''') - parser.add_argument('-s', '--skip-check', help='Skip checking the versioned files against the re-generated', action='store_true') - parser.add_argument('--base-dir', help='Base directory to compare generated files against') - args = parser.parse_args() - - idf_version = os.getenv('ESP_IDF_VERSION') - if idf_version is None: - raise RuntimeError("Environment variable 'ESP_IDF_VERSION' wasn't set.") - idf_ver_dir = f'idf_v{idf_version}' - - component_path = os.path.normpath(os.path.join(os.path.realpath(__file__),'..', '..')) - idf_path = os.getenv('IDF_PATH') - if idf_path is None: - raise RuntimeError("Environment variable 'IDF_PATH' wasn't set.") - header = os.path.join(idf_path, 'components', 'esp_wifi', 'include', 'esp_wifi.h') - function_prototypes = extract_function_prototypes(preprocess(idf_path, header), header) - - files_to_check = [] - - files_to_check += generate_kconfig_wifi_caps(idf_path, idf_ver_dir, component_path) - - files_to_check += generate_remote_wifi_api(function_prototypes, idf_ver_dir, component_path) - - files_to_check += generate_hosted_mocks(function_prototypes, idf_ver_dir, component_path) - - files_to_check += generate_test_cases(function_prototypes, idf_ver_dir, component_path) - - files_to_check += generate_wifi_native(idf_path, idf_ver_dir, component_path) - - files_to_check += generate_kconfig(idf_path, idf_ver_dir, component_path) - - for f in files_to_check: - print(f) - - if args.skip_check or args.base_dir is None: - exit(0) - - failures = compare_files(args.base_dir, component_path, files_to_check) - - if failures: - print(parser.epilog) - print('\nDifferent files:\n') - for file, diff in failures: - print(f'{file}\nChanges:\n{diff}') - exit(1) - else: - print('All files are identical to the base directory.') - exit(0) diff --git a/components/esp_wifi_remote/scripts/generate_slave_configs.py b/components/esp_wifi_remote/scripts/generate_slave_configs.py deleted file mode 100644 index 33ebef9b23..0000000000 --- a/components/esp_wifi_remote/scripts/generate_slave_configs.py +++ /dev/null @@ -1,33 +0,0 @@ -# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD -# SPDX-License-Identifier: Apache-2.0 -import os -import re -import sys - -if len(sys.argv) < 2: - print('Usage: python generate_slave_configs.py ') - sys.exit(1) -output_directory = sys.argv[1] - -# Input Kconfig file -component_path = os.path.normpath(os.path.join(os.path.realpath(__file__),'..', '..')) -kconfig_file = os.path.join(component_path, f"idf_v{os.getenv('ESP_IDF_VERSION')}", 'Kconfig.slave_select.in') - -# Output file prefix -output_prefix = 'sdkconfig.ci.' - -# Regex pattern to match all available options for SLAVE_IDF_TARGET -pattern = r'^ *config SLAVE_IDF_TARGET_(\w+)' - -# Read the Kconfig and generate specific sdkconfig.ci.{slave} for each option -with open(kconfig_file, 'r') as file: - for line in file: - match = re.match(pattern, line) - if match: - slave = match.group(1) - output_file = os.path.join(output_directory, f'{output_prefix}{slave.lower()}') - - with open(output_file, 'w') as out_file: - out_file.write(f'CONFIG_SLAVE_IDF_TARGET_{slave.upper()}=y\n') - - print(f'Generated: {output_file}') diff --git a/components/esp_wifi_remote/scripts/ignore_extensions.h b/components/esp_wifi_remote/scripts/ignore_extensions.h deleted file mode 100644 index f65b3caf42..0000000000 --- a/components/esp_wifi_remote/scripts/ignore_extensions.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -#define __attribute__(x) -#define __asm__(x) -#define __volatile__(...) -#define volatile(...) -typedef void *__builtin_va_list; -#define __inline__ inline -#define __inline inline -#define __extension__ diff --git a/components/esp_wifi_remote/test/smoke_test/README.md b/components/esp_wifi_remote/test/smoke_test/README.md deleted file mode 100644 index 900d946a15..0000000000 --- a/components/esp_wifi_remote/test/smoke_test/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Smoke (build-only) test - -This test tries to build an application which calls all declared APIs from this component and from `esp_wifi`. -Most of the test code is autogenerated, please see [README.md](../../scripts/README.md) for more details on the generation process. -This test should be build for all combinations of host and slave targets. diff --git a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/CMakeLists.txt b/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/CMakeLists.txt deleted file mode 100644 index daa27d1f02..0000000000 --- a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -set(IDF_VER_DIR "idf_v${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}") - -idf_component_register(SRCS "${IDF_VER_DIR}/esp_hosted_mock.c" - INCLUDE_DIRS "${IDF_VER_DIR}/include" "include" - REQUIRES esp_wifi esp_wifi_remote) diff --git a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/idf_component.yml b/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/idf_component.yml deleted file mode 100644 index 2ef3d523ab..0000000000 --- a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/idf_component.yml +++ /dev/null @@ -1 +0,0 @@ -version: 1.0.0 diff --git a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/idf_v5.3/esp_hosted_mock.c b/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/idf_v5.3/esp_hosted_mock.c deleted file mode 100644 index dea3acf2ef..0000000000 --- a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/idf_v5.3/esp_hosted_mock.c +++ /dev/null @@ -1,388 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -// This file is auto-generated -#include "esp_wifi.h" -#include "esp_wifi_remote.h" - -esp_err_t esp_wifi_remote_init(const wifi_init_config_t *config) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_deinit(void) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_mode(wifi_mode_t mode) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_mode(wifi_mode_t *mode) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_start(void) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_stop(void) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_restore(void) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_connect(void) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_disconnect(void) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_clear_fast_connect(void) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_deauth_sta(uint16_t aid) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_scan_start(const wifi_scan_config_t *config, _Bool block) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_scan_parameters(const wifi_scan_default_params_t *config) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_scan_parameters(wifi_scan_default_params_t *config) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_scan_stop(void) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_scan_get_ap_num(uint16_t *number) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_scan_get_ap_record(wifi_ap_record_t *ap_record) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_clear_ap_list(void) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_sta_get_ap_info(wifi_ap_record_t *ap_info) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_ps(wifi_ps_type_t type) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_ps(wifi_ps_type_t *type) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_channel(uint8_t primary, wifi_second_chan_t second) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_channel(uint8_t *primary, wifi_second_chan_t *second) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_country(const wifi_country_t *country) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_country(wifi_country_t *country) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_mac(wifi_interface_t ifx, const uint8_t mac[6]) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_mac(wifi_interface_t ifx, uint8_t mac[6]) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_promiscuous(_Bool en) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_promiscuous(_Bool *en) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_promiscuous_filter(const wifi_promiscuous_filter_t *filter) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_promiscuous_filter(wifi_promiscuous_filter_t *filter) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_promiscuous_ctrl_filter(const wifi_promiscuous_filter_t *filter) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_promiscuous_ctrl_filter(wifi_promiscuous_filter_t *filter) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_config(wifi_interface_t interface, wifi_config_t *conf) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_config(wifi_interface_t interface, wifi_config_t *conf) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_ap_get_sta_list(wifi_sta_list_t *sta) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_ap_get_sta_aid(const uint8_t mac[6], uint16_t *aid) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_storage(wifi_storage_t storage) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_vendor_ie(_Bool enable, wifi_vendor_ie_type_t type, wifi_vendor_ie_id_t idx, const void *vnd_ie) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_max_tx_power(int8_t power) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_max_tx_power(int8_t *power) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_event_mask(uint32_t mask) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_event_mask(uint32_t *mask) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_80211_tx(wifi_interface_t ifx, const void *buffer, int len, _Bool en_sys_seq) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_csi_rx_cb(wifi_csi_cb_t cb, void *ctx) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_csi_config(const wifi_csi_config_t *config) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_csi_config(wifi_csi_config_t *config) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_csi(_Bool en) -{ - return ESP_OK; -} - -int64_t esp_wifi_remote_get_tsf_time(wifi_interface_t interface) -{ - return 0; -} - -esp_err_t esp_wifi_remote_set_inactive_time(wifi_interface_t ifx, uint16_t sec) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_inactive_time(wifi_interface_t ifx, uint16_t *sec) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_statis_dump(uint32_t modules) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_rssi_threshold(int32_t rssi) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_ftm_initiate_session(wifi_ftm_initiator_cfg_t *cfg) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_ftm_end_session(void) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_ftm_resp_set_offset(int16_t offset_cm) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_ftm_get_report(wifi_ftm_report_entry_t *report, uint8_t num_entries) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_config_11b_rate(wifi_interface_t ifx, _Bool disable) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_connectionless_module_set_wake_interval(uint16_t wake_interval) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_force_wakeup_acquire(void) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_force_wakeup_release(void) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_country_code(const char *country, _Bool ieee80211d_enabled) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_country_code(char *country) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_config_80211_tx_rate(wifi_interface_t ifx, wifi_phy_rate_t rate) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_disable_pmf_config(wifi_interface_t ifx) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_sta_get_aid(uint16_t *aid) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_sta_get_negotiated_phymode(wifi_phy_mode_t *phymode) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_dynamic_cs(_Bool enabled) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_sta_get_rssi(int *rssi) -{ - return ESP_OK; -} diff --git a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/idf_v5.3/include/esp_hosted_mock.h b/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/idf_v5.3/include/esp_hosted_mock.h deleted file mode 100644 index 0a0a31a16f..0000000000 --- a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/idf_v5.3/include/esp_hosted_mock.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -// This file is auto-generated -#pragma once -esp_err_t esp_wifi_remote_init(const wifi_init_config_t *config); -esp_err_t esp_wifi_remote_deinit(void); -esp_err_t esp_wifi_remote_set_mode(wifi_mode_t mode); -esp_err_t esp_wifi_remote_get_mode(wifi_mode_t *mode); -esp_err_t esp_wifi_remote_start(void); -esp_err_t esp_wifi_remote_stop(void); -esp_err_t esp_wifi_remote_restore(void); -esp_err_t esp_wifi_remote_connect(void); -esp_err_t esp_wifi_remote_disconnect(void); -esp_err_t esp_wifi_remote_clear_fast_connect(void); -esp_err_t esp_wifi_remote_deauth_sta(uint16_t aid); -esp_err_t esp_wifi_remote_scan_start(const wifi_scan_config_t *config, _Bool block); -esp_err_t esp_wifi_remote_set_scan_parameters(const wifi_scan_default_params_t *config); -esp_err_t esp_wifi_remote_get_scan_parameters(wifi_scan_default_params_t *config); -esp_err_t esp_wifi_remote_scan_stop(void); -esp_err_t esp_wifi_remote_scan_get_ap_num(uint16_t *number); -esp_err_t esp_wifi_remote_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records); -esp_err_t esp_wifi_remote_scan_get_ap_record(wifi_ap_record_t *ap_record); -esp_err_t esp_wifi_remote_clear_ap_list(void); -esp_err_t esp_wifi_remote_sta_get_ap_info(wifi_ap_record_t *ap_info); -esp_err_t esp_wifi_remote_set_ps(wifi_ps_type_t type); -esp_err_t esp_wifi_remote_get_ps(wifi_ps_type_t *type); -esp_err_t esp_wifi_remote_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap); -esp_err_t esp_wifi_remote_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap); -esp_err_t esp_wifi_remote_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw); -esp_err_t esp_wifi_remote_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw); -esp_err_t esp_wifi_remote_set_channel(uint8_t primary, wifi_second_chan_t second); -esp_err_t esp_wifi_remote_get_channel(uint8_t *primary, wifi_second_chan_t *second); -esp_err_t esp_wifi_remote_set_country(const wifi_country_t *country); -esp_err_t esp_wifi_remote_get_country(wifi_country_t *country); -esp_err_t esp_wifi_remote_set_mac(wifi_interface_t ifx, const uint8_t mac[6]); -esp_err_t esp_wifi_remote_get_mac(wifi_interface_t ifx, uint8_t mac[6]); -esp_err_t esp_wifi_remote_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb); -esp_err_t esp_wifi_remote_set_promiscuous(_Bool en); -esp_err_t esp_wifi_remote_get_promiscuous(_Bool *en); -esp_err_t esp_wifi_remote_set_promiscuous_filter(const wifi_promiscuous_filter_t *filter); -esp_err_t esp_wifi_remote_get_promiscuous_filter(wifi_promiscuous_filter_t *filter); -esp_err_t esp_wifi_remote_set_promiscuous_ctrl_filter(const wifi_promiscuous_filter_t *filter); -esp_err_t esp_wifi_remote_get_promiscuous_ctrl_filter(wifi_promiscuous_filter_t *filter); -esp_err_t esp_wifi_remote_set_config(wifi_interface_t interface, wifi_config_t *conf); -esp_err_t esp_wifi_remote_get_config(wifi_interface_t interface, wifi_config_t *conf); -esp_err_t esp_wifi_remote_ap_get_sta_list(wifi_sta_list_t *sta); -esp_err_t esp_wifi_remote_ap_get_sta_aid(const uint8_t mac[6], uint16_t *aid); -esp_err_t esp_wifi_remote_set_storage(wifi_storage_t storage); -esp_err_t esp_wifi_remote_set_vendor_ie(_Bool enable, wifi_vendor_ie_type_t type, wifi_vendor_ie_id_t idx, const void *vnd_ie); -esp_err_t esp_wifi_remote_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx); -esp_err_t esp_wifi_remote_set_max_tx_power(int8_t power); -esp_err_t esp_wifi_remote_get_max_tx_power(int8_t *power); -esp_err_t esp_wifi_remote_set_event_mask(uint32_t mask); -esp_err_t esp_wifi_remote_get_event_mask(uint32_t *mask); -esp_err_t esp_wifi_remote_80211_tx(wifi_interface_t ifx, const void *buffer, int len, _Bool en_sys_seq); -esp_err_t esp_wifi_remote_set_csi_rx_cb(wifi_csi_cb_t cb, void *ctx); -esp_err_t esp_wifi_remote_set_csi_config(const wifi_csi_config_t *config); -esp_err_t esp_wifi_remote_get_csi_config(wifi_csi_config_t *config); -esp_err_t esp_wifi_remote_set_csi(_Bool en); -int64_t esp_wifi_remote_get_tsf_time(wifi_interface_t interface); -esp_err_t esp_wifi_remote_set_inactive_time(wifi_interface_t ifx, uint16_t sec); -esp_err_t esp_wifi_remote_get_inactive_time(wifi_interface_t ifx, uint16_t *sec); -esp_err_t esp_wifi_remote_statis_dump(uint32_t modules); -esp_err_t esp_wifi_remote_set_rssi_threshold(int32_t rssi); -esp_err_t esp_wifi_remote_ftm_initiate_session(wifi_ftm_initiator_cfg_t *cfg); -esp_err_t esp_wifi_remote_ftm_end_session(void); -esp_err_t esp_wifi_remote_ftm_resp_set_offset(int16_t offset_cm); -esp_err_t esp_wifi_remote_ftm_get_report(wifi_ftm_report_entry_t *report, uint8_t num_entries); -esp_err_t esp_wifi_remote_config_11b_rate(wifi_interface_t ifx, _Bool disable); -esp_err_t esp_wifi_remote_connectionless_module_set_wake_interval(uint16_t wake_interval); -esp_err_t esp_wifi_remote_force_wakeup_acquire(void); -esp_err_t esp_wifi_remote_force_wakeup_release(void); -esp_err_t esp_wifi_remote_set_country_code(const char *country, _Bool ieee80211d_enabled); -esp_err_t esp_wifi_remote_get_country_code(char *country); -esp_err_t esp_wifi_remote_config_80211_tx_rate(wifi_interface_t ifx, wifi_phy_rate_t rate); -esp_err_t esp_wifi_remote_disable_pmf_config(wifi_interface_t ifx); -esp_err_t esp_wifi_remote_sta_get_aid(uint16_t *aid); -esp_err_t esp_wifi_remote_sta_get_negotiated_phymode(wifi_phy_mode_t *phymode); -esp_err_t esp_wifi_remote_set_dynamic_cs(_Bool enabled); -esp_err_t esp_wifi_remote_sta_get_rssi(int *rssi); diff --git a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/idf_v5.4/esp_hosted_mock.c b/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/idf_v5.4/esp_hosted_mock.c deleted file mode 100644 index c490148bcc..0000000000 --- a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/idf_v5.4/esp_hosted_mock.c +++ /dev/null @@ -1,428 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -// This file is auto-generated -#include "esp_wifi.h" -#include "esp_wifi_remote.h" - -esp_err_t esp_wifi_remote_init(const wifi_init_config_t *config) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_deinit(void) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_mode(wifi_mode_t mode) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_mode(wifi_mode_t *mode) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_start(void) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_stop(void) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_restore(void) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_connect(void) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_disconnect(void) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_clear_fast_connect(void) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_deauth_sta(uint16_t aid) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_scan_start(const wifi_scan_config_t *config, _Bool block) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_scan_parameters(const wifi_scan_default_params_t *config) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_scan_parameters(wifi_scan_default_params_t *config) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_scan_stop(void) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_scan_get_ap_num(uint16_t *number) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_scan_get_ap_record(wifi_ap_record_t *ap_record) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_clear_ap_list(void) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_sta_get_ap_info(wifi_ap_record_t *ap_info) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_ps(wifi_ps_type_t type) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_ps(wifi_ps_type_t *type) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_channel(uint8_t primary, wifi_second_chan_t second) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_channel(uint8_t *primary, wifi_second_chan_t *second) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_country(const wifi_country_t *country) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_country(wifi_country_t *country) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_mac(wifi_interface_t ifx, const uint8_t mac[6]) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_mac(wifi_interface_t ifx, uint8_t mac[6]) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_promiscuous(_Bool en) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_promiscuous(_Bool *en) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_promiscuous_filter(const wifi_promiscuous_filter_t *filter) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_promiscuous_filter(wifi_promiscuous_filter_t *filter) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_promiscuous_ctrl_filter(const wifi_promiscuous_filter_t *filter) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_promiscuous_ctrl_filter(wifi_promiscuous_filter_t *filter) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_config(wifi_interface_t interface, wifi_config_t *conf) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_config(wifi_interface_t interface, wifi_config_t *conf) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_ap_get_sta_list(wifi_sta_list_t *sta) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_ap_get_sta_aid(const uint8_t mac[6], uint16_t *aid) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_storage(wifi_storage_t storage) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_vendor_ie(_Bool enable, wifi_vendor_ie_type_t type, wifi_vendor_ie_id_t idx, const void *vnd_ie) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_max_tx_power(int8_t power) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_max_tx_power(int8_t *power) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_event_mask(uint32_t mask) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_event_mask(uint32_t *mask) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_80211_tx(wifi_interface_t ifx, const void *buffer, int len, _Bool en_sys_seq) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_csi_rx_cb(wifi_csi_cb_t cb, void *ctx) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_csi_config(const wifi_csi_config_t *config) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_csi_config(wifi_csi_config_t *config) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_csi(_Bool en) -{ - return ESP_OK; -} - -int64_t esp_wifi_remote_get_tsf_time(wifi_interface_t interface) -{ - return 0; -} - -esp_err_t esp_wifi_remote_set_inactive_time(wifi_interface_t ifx, uint16_t sec) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_inactive_time(wifi_interface_t ifx, uint16_t *sec) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_statis_dump(uint32_t modules) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_rssi_threshold(int32_t rssi) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_ftm_initiate_session(wifi_ftm_initiator_cfg_t *cfg) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_ftm_end_session(void) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_ftm_resp_set_offset(int16_t offset_cm) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_ftm_get_report(wifi_ftm_report_entry_t *report, uint8_t num_entries) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_config_11b_rate(wifi_interface_t ifx, _Bool disable) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_connectionless_module_set_wake_interval(uint16_t wake_interval) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_force_wakeup_acquire(void) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_force_wakeup_release(void) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_country_code(const char *country, _Bool ieee80211d_enabled) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_country_code(char *country) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_config_80211_tx_rate(wifi_interface_t ifx, wifi_phy_rate_t rate) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_disable_pmf_config(wifi_interface_t ifx) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_sta_get_aid(uint16_t *aid) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_sta_get_negotiated_phymode(wifi_phy_mode_t *phymode) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_dynamic_cs(_Bool enabled) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_sta_get_rssi(int *rssi) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_band(wifi_band_t band) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_band(wifi_band_t *band) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_band_mode(wifi_band_mode_t band_mode) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_band_mode(wifi_band_mode_t *band_mode) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_protocols(wifi_interface_t ifx, wifi_protocols_t *protocols) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_protocols(wifi_interface_t ifx, wifi_protocols_t *protocols) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_set_bandwidths(wifi_interface_t ifx, wifi_bandwidths_t *bw) -{ - return ESP_OK; -} - -esp_err_t esp_wifi_remote_get_bandwidths(wifi_interface_t ifx, wifi_bandwidths_t *bw) -{ - return ESP_OK; -} diff --git a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/idf_v5.4/include/esp_hosted_mock.h b/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/idf_v5.4/include/esp_hosted_mock.h deleted file mode 100644 index 9704c15606..0000000000 --- a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/idf_v5.4/include/esp_hosted_mock.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -// This file is auto-generated -#pragma once -esp_err_t esp_wifi_remote_init(const wifi_init_config_t *config); -esp_err_t esp_wifi_remote_deinit(void); -esp_err_t esp_wifi_remote_set_mode(wifi_mode_t mode); -esp_err_t esp_wifi_remote_get_mode(wifi_mode_t *mode); -esp_err_t esp_wifi_remote_start(void); -esp_err_t esp_wifi_remote_stop(void); -esp_err_t esp_wifi_remote_restore(void); -esp_err_t esp_wifi_remote_connect(void); -esp_err_t esp_wifi_remote_disconnect(void); -esp_err_t esp_wifi_remote_clear_fast_connect(void); -esp_err_t esp_wifi_remote_deauth_sta(uint16_t aid); -esp_err_t esp_wifi_remote_scan_start(const wifi_scan_config_t *config, _Bool block); -esp_err_t esp_wifi_remote_set_scan_parameters(const wifi_scan_default_params_t *config); -esp_err_t esp_wifi_remote_get_scan_parameters(wifi_scan_default_params_t *config); -esp_err_t esp_wifi_remote_scan_stop(void); -esp_err_t esp_wifi_remote_scan_get_ap_num(uint16_t *number); -esp_err_t esp_wifi_remote_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records); -esp_err_t esp_wifi_remote_scan_get_ap_record(wifi_ap_record_t *ap_record); -esp_err_t esp_wifi_remote_clear_ap_list(void); -esp_err_t esp_wifi_remote_sta_get_ap_info(wifi_ap_record_t *ap_info); -esp_err_t esp_wifi_remote_set_ps(wifi_ps_type_t type); -esp_err_t esp_wifi_remote_get_ps(wifi_ps_type_t *type); -esp_err_t esp_wifi_remote_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap); -esp_err_t esp_wifi_remote_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap); -esp_err_t esp_wifi_remote_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw); -esp_err_t esp_wifi_remote_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw); -esp_err_t esp_wifi_remote_set_channel(uint8_t primary, wifi_second_chan_t second); -esp_err_t esp_wifi_remote_get_channel(uint8_t *primary, wifi_second_chan_t *second); -esp_err_t esp_wifi_remote_set_country(const wifi_country_t *country); -esp_err_t esp_wifi_remote_get_country(wifi_country_t *country); -esp_err_t esp_wifi_remote_set_mac(wifi_interface_t ifx, const uint8_t mac[6]); -esp_err_t esp_wifi_remote_get_mac(wifi_interface_t ifx, uint8_t mac[6]); -esp_err_t esp_wifi_remote_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb); -esp_err_t esp_wifi_remote_set_promiscuous(_Bool en); -esp_err_t esp_wifi_remote_get_promiscuous(_Bool *en); -esp_err_t esp_wifi_remote_set_promiscuous_filter(const wifi_promiscuous_filter_t *filter); -esp_err_t esp_wifi_remote_get_promiscuous_filter(wifi_promiscuous_filter_t *filter); -esp_err_t esp_wifi_remote_set_promiscuous_ctrl_filter(const wifi_promiscuous_filter_t *filter); -esp_err_t esp_wifi_remote_get_promiscuous_ctrl_filter(wifi_promiscuous_filter_t *filter); -esp_err_t esp_wifi_remote_set_config(wifi_interface_t interface, wifi_config_t *conf); -esp_err_t esp_wifi_remote_get_config(wifi_interface_t interface, wifi_config_t *conf); -esp_err_t esp_wifi_remote_ap_get_sta_list(wifi_sta_list_t *sta); -esp_err_t esp_wifi_remote_ap_get_sta_aid(const uint8_t mac[6], uint16_t *aid); -esp_err_t esp_wifi_remote_set_storage(wifi_storage_t storage); -esp_err_t esp_wifi_remote_set_vendor_ie(_Bool enable, wifi_vendor_ie_type_t type, wifi_vendor_ie_id_t idx, const void *vnd_ie); -esp_err_t esp_wifi_remote_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx); -esp_err_t esp_wifi_remote_set_max_tx_power(int8_t power); -esp_err_t esp_wifi_remote_get_max_tx_power(int8_t *power); -esp_err_t esp_wifi_remote_set_event_mask(uint32_t mask); -esp_err_t esp_wifi_remote_get_event_mask(uint32_t *mask); -esp_err_t esp_wifi_remote_80211_tx(wifi_interface_t ifx, const void *buffer, int len, _Bool en_sys_seq); -esp_err_t esp_wifi_remote_set_csi_rx_cb(wifi_csi_cb_t cb, void *ctx); -esp_err_t esp_wifi_remote_set_csi_config(const wifi_csi_config_t *config); -esp_err_t esp_wifi_remote_get_csi_config(wifi_csi_config_t *config); -esp_err_t esp_wifi_remote_set_csi(_Bool en); -int64_t esp_wifi_remote_get_tsf_time(wifi_interface_t interface); -esp_err_t esp_wifi_remote_set_inactive_time(wifi_interface_t ifx, uint16_t sec); -esp_err_t esp_wifi_remote_get_inactive_time(wifi_interface_t ifx, uint16_t *sec); -esp_err_t esp_wifi_remote_statis_dump(uint32_t modules); -esp_err_t esp_wifi_remote_set_rssi_threshold(int32_t rssi); -esp_err_t esp_wifi_remote_ftm_initiate_session(wifi_ftm_initiator_cfg_t *cfg); -esp_err_t esp_wifi_remote_ftm_end_session(void); -esp_err_t esp_wifi_remote_ftm_resp_set_offset(int16_t offset_cm); -esp_err_t esp_wifi_remote_ftm_get_report(wifi_ftm_report_entry_t *report, uint8_t num_entries); -esp_err_t esp_wifi_remote_config_11b_rate(wifi_interface_t ifx, _Bool disable); -esp_err_t esp_wifi_remote_connectionless_module_set_wake_interval(uint16_t wake_interval); -esp_err_t esp_wifi_remote_force_wakeup_acquire(void); -esp_err_t esp_wifi_remote_force_wakeup_release(void); -esp_err_t esp_wifi_remote_set_country_code(const char *country, _Bool ieee80211d_enabled); -esp_err_t esp_wifi_remote_get_country_code(char *country); -esp_err_t esp_wifi_remote_config_80211_tx_rate(wifi_interface_t ifx, wifi_phy_rate_t rate); -esp_err_t esp_wifi_remote_disable_pmf_config(wifi_interface_t ifx); -esp_err_t esp_wifi_remote_sta_get_aid(uint16_t *aid); -esp_err_t esp_wifi_remote_sta_get_negotiated_phymode(wifi_phy_mode_t *phymode); -esp_err_t esp_wifi_remote_set_dynamic_cs(_Bool enabled); -esp_err_t esp_wifi_remote_sta_get_rssi(int *rssi); -esp_err_t esp_wifi_remote_set_band(wifi_band_t band); -esp_err_t esp_wifi_remote_get_band(wifi_band_t *band); -esp_err_t esp_wifi_remote_set_band_mode(wifi_band_mode_t band_mode); -esp_err_t esp_wifi_remote_get_band_mode(wifi_band_mode_t *band_mode); -esp_err_t esp_wifi_remote_set_protocols(wifi_interface_t ifx, wifi_protocols_t *protocols); -esp_err_t esp_wifi_remote_get_protocols(wifi_interface_t ifx, wifi_protocols_t *protocols); -esp_err_t esp_wifi_remote_set_bandwidths(wifi_interface_t ifx, wifi_bandwidths_t *bw); -esp_err_t esp_wifi_remote_get_bandwidths(wifi_interface_t ifx, wifi_bandwidths_t *bw); diff --git a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/include/esp_hosted_api.h b/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/include/esp_hosted_api.h deleted file mode 100644 index e1efa1a93b..0000000000 --- a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/include/esp_hosted_api.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Unlicense OR CC0-1.0 - */ -#pragma once -#include "esp_wifi.h" -#include "esp_hosted_mock.h" -#include "esp_wifi_remote.h" - -#define ESP_HOSTED_CHANNEL_CONFIG_DEFAULT() {} -#define ESP_SERIAL_IF 0 -#define ESP_STA_IF 1 -#define ESP_AP_IF 2 - -struct esp_remote_channel_config { - int if_type; - bool secure; -}; - -esp_remote_channel_t esp_hosted_add_channel(struct esp_remote_channel_config *config, esp_remote_channel_tx_fn_t *tx_cb, esp_remote_channel_rx_fn_t rx_cb); diff --git a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/include/esp_hosted_wifi_api.h b/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/include/esp_hosted_wifi_api.h deleted file mode 100644 index 7fd42fb0f0..0000000000 --- a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/include/esp_hosted_wifi_api.h +++ /dev/null @@ -1,8 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Unlicense OR CC0-1.0 - */ -#pragma once -#include "esp_wifi.h" -#include "esp_hosted_api.h" diff --git a/components/esp_wifi_remote/test/smoke_test/main/CMakeLists.txt b/components/esp_wifi_remote/test/smoke_test/main/CMakeLists.txt deleted file mode 100644 index fe54b8a66c..0000000000 --- a/components/esp_wifi_remote/test/smoke_test/main/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -set(IDF_VER_DIR "idf_v${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}") - -idf_component_register(SRCS "smoke_test.c" - "${IDF_VER_DIR}/all_wifi_calls.c" - "${IDF_VER_DIR}/all_wifi_remote_calls.c" - INCLUDE_DIRS ".") diff --git a/components/esp_wifi_remote/test/smoke_test/main/idf_component.yml b/components/esp_wifi_remote/test/smoke_test/main/idf_component.yml deleted file mode 100644 index cb6183a90c..0000000000 --- a/components/esp_wifi_remote/test/smoke_test/main/idf_component.yml +++ /dev/null @@ -1,8 +0,0 @@ -## IDF Component Manager Manifest File -dependencies: - ## Required IDF version - idf: - version: '>=5.3' - espressif/esp_wifi_remote: - version: "*" - override_path: ../../.. diff --git a/components/esp_wifi_remote/test/smoke_test/main/idf_v5.3/all_wifi_calls.c b/components/esp_wifi_remote/test/smoke_test/main/idf_v5.3/all_wifi_calls.c deleted file mode 100644 index 6e928dcff7..0000000000 --- a/components/esp_wifi_remote/test/smoke_test/main/idf_v5.3/all_wifi_calls.c +++ /dev/null @@ -1,406 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -// This file is auto-generated -#include "esp_wifi.h" - -void run_all_wifi_apis(void) -{ - { - const wifi_init_config_t *config = NULL; - esp_wifi_init(config); - } - - { - esp_wifi_deinit(); - } - - { - wifi_mode_t mode = 0; - esp_wifi_set_mode(mode); - } - - { - wifi_mode_t *mode = NULL; - esp_wifi_get_mode(mode); - } - - { - esp_wifi_start(); - } - - { - esp_wifi_stop(); - } - - { - esp_wifi_restore(); - } - - { - esp_wifi_connect(); - } - - { - esp_wifi_disconnect(); - } - - { - esp_wifi_clear_fast_connect(); - } - - { - uint16_t aid = 0; - esp_wifi_deauth_sta(aid); - } - - { - const wifi_scan_config_t *config = NULL; - _Bool block = 0; - esp_wifi_scan_start(config, block); - } - - { - const wifi_scan_default_params_t *config = NULL; - esp_wifi_set_scan_parameters(config); - } - - { - wifi_scan_default_params_t *config = NULL; - esp_wifi_get_scan_parameters(config); - } - - { - esp_wifi_scan_stop(); - } - - { - uint16_t *number = NULL; - esp_wifi_scan_get_ap_num(number); - } - - { - uint16_t *number = NULL; - wifi_ap_record_t *ap_records = NULL; - esp_wifi_scan_get_ap_records(number, ap_records); - } - - { - wifi_ap_record_t *ap_record = NULL; - esp_wifi_scan_get_ap_record(ap_record); - } - - { - esp_wifi_clear_ap_list(); - } - - { - wifi_ap_record_t *ap_info = NULL; - esp_wifi_sta_get_ap_info(ap_info); - } - - { - wifi_ps_type_t type = 0; - esp_wifi_set_ps(type); - } - - { - wifi_ps_type_t *type = NULL; - esp_wifi_get_ps(type); - } - - { - wifi_interface_t ifx = 0; - uint8_t protocol_bitmap = 0; - esp_wifi_set_protocol(ifx, protocol_bitmap); - } - - { - wifi_interface_t ifx = 0; - uint8_t *protocol_bitmap = NULL; - esp_wifi_get_protocol(ifx, protocol_bitmap); - } - - { - wifi_interface_t ifx = 0; - wifi_bandwidth_t bw = 0; - esp_wifi_set_bandwidth(ifx, bw); - } - - { - wifi_interface_t ifx = 0; - wifi_bandwidth_t *bw = NULL; - esp_wifi_get_bandwidth(ifx, bw); - } - - { - uint8_t primary = 0; - wifi_second_chan_t second = 0; - esp_wifi_set_channel(primary, second); - } - - { - uint8_t *primary = NULL; - wifi_second_chan_t *second = NULL; - esp_wifi_get_channel(primary, second); - } - - { - const wifi_country_t *country = NULL; - esp_wifi_set_country(country); - } - - { - wifi_country_t *country = NULL; - esp_wifi_get_country(country); - } - - { - wifi_interface_t ifx = 0; - const uint8_t mac[6] = {}; - esp_wifi_set_mac(ifx, mac); - } - - { - wifi_interface_t ifx = 0; - uint8_t mac[6] = {}; - esp_wifi_get_mac(ifx, mac); - } - - { - wifi_promiscuous_cb_t cb = 0; - esp_wifi_set_promiscuous_rx_cb(cb); - } - - { - _Bool en = 0; - esp_wifi_set_promiscuous(en); - } - - { - _Bool *en = NULL; - esp_wifi_get_promiscuous(en); - } - - { - const wifi_promiscuous_filter_t *filter = NULL; - esp_wifi_set_promiscuous_filter(filter); - } - - { - wifi_promiscuous_filter_t *filter = NULL; - esp_wifi_get_promiscuous_filter(filter); - } - - { - const wifi_promiscuous_filter_t *filter = NULL; - esp_wifi_set_promiscuous_ctrl_filter(filter); - } - - { - wifi_promiscuous_filter_t *filter = NULL; - esp_wifi_get_promiscuous_ctrl_filter(filter); - } - - { - wifi_interface_t interface = 0; - wifi_config_t *conf = NULL; - esp_wifi_set_config(interface, conf); - } - - { - wifi_interface_t interface = 0; - wifi_config_t *conf = NULL; - esp_wifi_get_config(interface, conf); - } - - { - wifi_sta_list_t *sta = NULL; - esp_wifi_ap_get_sta_list(sta); - } - - { - const uint8_t mac[6] = {}; - uint16_t *aid = NULL; - esp_wifi_ap_get_sta_aid(mac, aid); - } - - { - wifi_storage_t storage = 0; - esp_wifi_set_storage(storage); - } - - { - _Bool enable = 0; - wifi_vendor_ie_type_t type = 0; - wifi_vendor_ie_id_t idx = 0; - const void *vnd_ie = NULL; - esp_wifi_set_vendor_ie(enable, type, idx, vnd_ie); - } - - { - esp_vendor_ie_cb_t cb = 0; - void *ctx = NULL; - esp_wifi_set_vendor_ie_cb(cb, ctx); - } - - { - int8_t power = 0; - esp_wifi_set_max_tx_power(power); - } - - { - int8_t *power = NULL; - esp_wifi_get_max_tx_power(power); - } - - { - uint32_t mask = 0; - esp_wifi_set_event_mask(mask); - } - - { - uint32_t *mask = NULL; - esp_wifi_get_event_mask(mask); - } - - { - wifi_interface_t ifx = 0; - const void *buffer = NULL; - int len = 0; - _Bool en_sys_seq = 0; - esp_wifi_80211_tx(ifx, buffer, len, en_sys_seq); - } - - { - wifi_csi_cb_t cb = 0; - void *ctx = NULL; - esp_wifi_set_csi_rx_cb(cb, ctx); - } - - { - const wifi_csi_config_t *config = NULL; - esp_wifi_set_csi_config(config); - } - - { - wifi_csi_config_t *config = NULL; - esp_wifi_get_csi_config(config); - } - - { - _Bool en = 0; - esp_wifi_set_csi(en); - } - - { - wifi_interface_t interface = 0; - esp_wifi_get_tsf_time(interface); - } - - { - wifi_interface_t ifx = 0; - uint16_t sec = 0; - esp_wifi_set_inactive_time(ifx, sec); - } - - { - wifi_interface_t ifx = 0; - uint16_t *sec = NULL; - esp_wifi_get_inactive_time(ifx, sec); - } - - { - uint32_t modules = 0; - esp_wifi_statis_dump(modules); - } - - { - int32_t rssi = 0; - esp_wifi_set_rssi_threshold(rssi); - } - - { - wifi_ftm_initiator_cfg_t *cfg = NULL; - esp_wifi_ftm_initiate_session(cfg); - } - - { - esp_wifi_ftm_end_session(); - } - - { - int16_t offset_cm = 0; - esp_wifi_ftm_resp_set_offset(offset_cm); - } - - { - wifi_ftm_report_entry_t *report = NULL; - uint8_t num_entries = 0; - esp_wifi_ftm_get_report(report, num_entries); - } - - { - wifi_interface_t ifx = 0; - _Bool disable = 0; - esp_wifi_config_11b_rate(ifx, disable); - } - - { - uint16_t wake_interval = 0; - esp_wifi_connectionless_module_set_wake_interval(wake_interval); - } - - { - esp_wifi_force_wakeup_acquire(); - } - - { - esp_wifi_force_wakeup_release(); - } - - { - const char *country = NULL; - _Bool ieee80211d_enabled = 0; - esp_wifi_set_country_code(country, ieee80211d_enabled); - } - - { - char *country = NULL; - esp_wifi_get_country_code(country); - } - - { - wifi_interface_t ifx = 0; - wifi_phy_rate_t rate = 0; - esp_wifi_config_80211_tx_rate(ifx, rate); - } - - { - wifi_interface_t ifx = 0; - esp_wifi_disable_pmf_config(ifx); - } - - { - uint16_t *aid = NULL; - esp_wifi_sta_get_aid(aid); - } - - { - wifi_phy_mode_t *phymode = NULL; - esp_wifi_sta_get_negotiated_phymode(phymode); - } - - { - _Bool enabled = 0; - esp_wifi_set_dynamic_cs(enabled); - } - - { - int *rssi = NULL; - esp_wifi_sta_get_rssi(rssi); - } - -} diff --git a/components/esp_wifi_remote/test/smoke_test/main/idf_v5.3/all_wifi_remote_calls.c b/components/esp_wifi_remote/test/smoke_test/main/idf_v5.3/all_wifi_remote_calls.c deleted file mode 100644 index b5d16a69aa..0000000000 --- a/components/esp_wifi_remote/test/smoke_test/main/idf_v5.3/all_wifi_remote_calls.c +++ /dev/null @@ -1,406 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -// This file is auto-generated -#include "esp_wifi_remote.h" - -void run_all_wifi_remote_apis(void) -{ - { - const wifi_init_config_t *config = NULL; - esp_wifi_remote_init(config); - } - - { - esp_wifi_remote_deinit(); - } - - { - wifi_mode_t mode = 0; - esp_wifi_remote_set_mode(mode); - } - - { - wifi_mode_t *mode = NULL; - esp_wifi_remote_get_mode(mode); - } - - { - esp_wifi_remote_start(); - } - - { - esp_wifi_remote_stop(); - } - - { - esp_wifi_remote_restore(); - } - - { - esp_wifi_remote_connect(); - } - - { - esp_wifi_remote_disconnect(); - } - - { - esp_wifi_remote_clear_fast_connect(); - } - - { - uint16_t aid = 0; - esp_wifi_remote_deauth_sta(aid); - } - - { - const wifi_scan_config_t *config = NULL; - _Bool block = 0; - esp_wifi_remote_scan_start(config, block); - } - - { - const wifi_scan_default_params_t *config = NULL; - esp_wifi_remote_set_scan_parameters(config); - } - - { - wifi_scan_default_params_t *config = NULL; - esp_wifi_remote_get_scan_parameters(config); - } - - { - esp_wifi_remote_scan_stop(); - } - - { - uint16_t *number = NULL; - esp_wifi_remote_scan_get_ap_num(number); - } - - { - uint16_t *number = NULL; - wifi_ap_record_t *ap_records = NULL; - esp_wifi_remote_scan_get_ap_records(number, ap_records); - } - - { - wifi_ap_record_t *ap_record = NULL; - esp_wifi_remote_scan_get_ap_record(ap_record); - } - - { - esp_wifi_remote_clear_ap_list(); - } - - { - wifi_ap_record_t *ap_info = NULL; - esp_wifi_remote_sta_get_ap_info(ap_info); - } - - { - wifi_ps_type_t type = 0; - esp_wifi_remote_set_ps(type); - } - - { - wifi_ps_type_t *type = NULL; - esp_wifi_remote_get_ps(type); - } - - { - wifi_interface_t ifx = 0; - uint8_t protocol_bitmap = 0; - esp_wifi_remote_set_protocol(ifx, protocol_bitmap); - } - - { - wifi_interface_t ifx = 0; - uint8_t *protocol_bitmap = NULL; - esp_wifi_remote_get_protocol(ifx, protocol_bitmap); - } - - { - wifi_interface_t ifx = 0; - wifi_bandwidth_t bw = 0; - esp_wifi_remote_set_bandwidth(ifx, bw); - } - - { - wifi_interface_t ifx = 0; - wifi_bandwidth_t *bw = NULL; - esp_wifi_remote_get_bandwidth(ifx, bw); - } - - { - uint8_t primary = 0; - wifi_second_chan_t second = 0; - esp_wifi_remote_set_channel(primary, second); - } - - { - uint8_t *primary = NULL; - wifi_second_chan_t *second = NULL; - esp_wifi_remote_get_channel(primary, second); - } - - { - const wifi_country_t *country = NULL; - esp_wifi_remote_set_country(country); - } - - { - wifi_country_t *country = NULL; - esp_wifi_remote_get_country(country); - } - - { - wifi_interface_t ifx = 0; - const uint8_t mac[6] = {}; - esp_wifi_remote_set_mac(ifx, mac); - } - - { - wifi_interface_t ifx = 0; - uint8_t mac[6] = {}; - esp_wifi_remote_get_mac(ifx, mac); - } - - { - wifi_promiscuous_cb_t cb = 0; - esp_wifi_remote_set_promiscuous_rx_cb(cb); - } - - { - _Bool en = 0; - esp_wifi_remote_set_promiscuous(en); - } - - { - _Bool *en = NULL; - esp_wifi_remote_get_promiscuous(en); - } - - { - const wifi_promiscuous_filter_t *filter = NULL; - esp_wifi_remote_set_promiscuous_filter(filter); - } - - { - wifi_promiscuous_filter_t *filter = NULL; - esp_wifi_remote_get_promiscuous_filter(filter); - } - - { - const wifi_promiscuous_filter_t *filter = NULL; - esp_wifi_remote_set_promiscuous_ctrl_filter(filter); - } - - { - wifi_promiscuous_filter_t *filter = NULL; - esp_wifi_remote_get_promiscuous_ctrl_filter(filter); - } - - { - wifi_interface_t interface = 0; - wifi_config_t *conf = NULL; - esp_wifi_remote_set_config(interface, conf); - } - - { - wifi_interface_t interface = 0; - wifi_config_t *conf = NULL; - esp_wifi_remote_get_config(interface, conf); - } - - { - wifi_sta_list_t *sta = NULL; - esp_wifi_remote_ap_get_sta_list(sta); - } - - { - const uint8_t mac[6] = {}; - uint16_t *aid = NULL; - esp_wifi_remote_ap_get_sta_aid(mac, aid); - } - - { - wifi_storage_t storage = 0; - esp_wifi_remote_set_storage(storage); - } - - { - _Bool enable = 0; - wifi_vendor_ie_type_t type = 0; - wifi_vendor_ie_id_t idx = 0; - const void *vnd_ie = NULL; - esp_wifi_remote_set_vendor_ie(enable, type, idx, vnd_ie); - } - - { - esp_vendor_ie_cb_t cb = 0; - void *ctx = NULL; - esp_wifi_remote_set_vendor_ie_cb(cb, ctx); - } - - { - int8_t power = 0; - esp_wifi_remote_set_max_tx_power(power); - } - - { - int8_t *power = NULL; - esp_wifi_remote_get_max_tx_power(power); - } - - { - uint32_t mask = 0; - esp_wifi_remote_set_event_mask(mask); - } - - { - uint32_t *mask = NULL; - esp_wifi_remote_get_event_mask(mask); - } - - { - wifi_interface_t ifx = 0; - const void *buffer = NULL; - int len = 0; - _Bool en_sys_seq = 0; - esp_wifi_remote_80211_tx(ifx, buffer, len, en_sys_seq); - } - - { - wifi_csi_cb_t cb = 0; - void *ctx = NULL; - esp_wifi_remote_set_csi_rx_cb(cb, ctx); - } - - { - const wifi_csi_config_t *config = NULL; - esp_wifi_remote_set_csi_config(config); - } - - { - wifi_csi_config_t *config = NULL; - esp_wifi_remote_get_csi_config(config); - } - - { - _Bool en = 0; - esp_wifi_remote_set_csi(en); - } - - { - wifi_interface_t interface = 0; - esp_wifi_remote_get_tsf_time(interface); - } - - { - wifi_interface_t ifx = 0; - uint16_t sec = 0; - esp_wifi_remote_set_inactive_time(ifx, sec); - } - - { - wifi_interface_t ifx = 0; - uint16_t *sec = NULL; - esp_wifi_remote_get_inactive_time(ifx, sec); - } - - { - uint32_t modules = 0; - esp_wifi_remote_statis_dump(modules); - } - - { - int32_t rssi = 0; - esp_wifi_remote_set_rssi_threshold(rssi); - } - - { - wifi_ftm_initiator_cfg_t *cfg = NULL; - esp_wifi_remote_ftm_initiate_session(cfg); - } - - { - esp_wifi_remote_ftm_end_session(); - } - - { - int16_t offset_cm = 0; - esp_wifi_remote_ftm_resp_set_offset(offset_cm); - } - - { - wifi_ftm_report_entry_t *report = NULL; - uint8_t num_entries = 0; - esp_wifi_remote_ftm_get_report(report, num_entries); - } - - { - wifi_interface_t ifx = 0; - _Bool disable = 0; - esp_wifi_remote_config_11b_rate(ifx, disable); - } - - { - uint16_t wake_interval = 0; - esp_wifi_remote_connectionless_module_set_wake_interval(wake_interval); - } - - { - esp_wifi_remote_force_wakeup_acquire(); - } - - { - esp_wifi_remote_force_wakeup_release(); - } - - { - const char *country = NULL; - _Bool ieee80211d_enabled = 0; - esp_wifi_remote_set_country_code(country, ieee80211d_enabled); - } - - { - char *country = NULL; - esp_wifi_remote_get_country_code(country); - } - - { - wifi_interface_t ifx = 0; - wifi_phy_rate_t rate = 0; - esp_wifi_remote_config_80211_tx_rate(ifx, rate); - } - - { - wifi_interface_t ifx = 0; - esp_wifi_remote_disable_pmf_config(ifx); - } - - { - uint16_t *aid = NULL; - esp_wifi_remote_sta_get_aid(aid); - } - - { - wifi_phy_mode_t *phymode = NULL; - esp_wifi_remote_sta_get_negotiated_phymode(phymode); - } - - { - _Bool enabled = 0; - esp_wifi_remote_set_dynamic_cs(enabled); - } - - { - int *rssi = NULL; - esp_wifi_remote_sta_get_rssi(rssi); - } - -} diff --git a/components/esp_wifi_remote/test/smoke_test/main/idf_v5.4/all_wifi_calls.c b/components/esp_wifi_remote/test/smoke_test/main/idf_v5.4/all_wifi_calls.c deleted file mode 100644 index a5a4e8bf5a..0000000000 --- a/components/esp_wifi_remote/test/smoke_test/main/idf_v5.4/all_wifi_calls.c +++ /dev/null @@ -1,450 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -// This file is auto-generated -#include "esp_wifi.h" - -void run_all_wifi_apis(void) -{ - { - const wifi_init_config_t *config = NULL; - esp_wifi_init(config); - } - - { - esp_wifi_deinit(); - } - - { - wifi_mode_t mode = 0; - esp_wifi_set_mode(mode); - } - - { - wifi_mode_t *mode = NULL; - esp_wifi_get_mode(mode); - } - - { - esp_wifi_start(); - } - - { - esp_wifi_stop(); - } - - { - esp_wifi_restore(); - } - - { - esp_wifi_connect(); - } - - { - esp_wifi_disconnect(); - } - - { - esp_wifi_clear_fast_connect(); - } - - { - uint16_t aid = 0; - esp_wifi_deauth_sta(aid); - } - - { - const wifi_scan_config_t *config = NULL; - _Bool block = 0; - esp_wifi_scan_start(config, block); - } - - { - const wifi_scan_default_params_t *config = NULL; - esp_wifi_set_scan_parameters(config); - } - - { - wifi_scan_default_params_t *config = NULL; - esp_wifi_get_scan_parameters(config); - } - - { - esp_wifi_scan_stop(); - } - - { - uint16_t *number = NULL; - esp_wifi_scan_get_ap_num(number); - } - - { - uint16_t *number = NULL; - wifi_ap_record_t *ap_records = NULL; - esp_wifi_scan_get_ap_records(number, ap_records); - } - - { - wifi_ap_record_t *ap_record = NULL; - esp_wifi_scan_get_ap_record(ap_record); - } - - { - esp_wifi_clear_ap_list(); - } - - { - wifi_ap_record_t *ap_info = NULL; - esp_wifi_sta_get_ap_info(ap_info); - } - - { - wifi_ps_type_t type = 0; - esp_wifi_set_ps(type); - } - - { - wifi_ps_type_t *type = NULL; - esp_wifi_get_ps(type); - } - - { - wifi_interface_t ifx = 0; - uint8_t protocol_bitmap = 0; - esp_wifi_set_protocol(ifx, protocol_bitmap); - } - - { - wifi_interface_t ifx = 0; - uint8_t *protocol_bitmap = NULL; - esp_wifi_get_protocol(ifx, protocol_bitmap); - } - - { - wifi_interface_t ifx = 0; - wifi_bandwidth_t bw = 0; - esp_wifi_set_bandwidth(ifx, bw); - } - - { - wifi_interface_t ifx = 0; - wifi_bandwidth_t *bw = NULL; - esp_wifi_get_bandwidth(ifx, bw); - } - - { - uint8_t primary = 0; - wifi_second_chan_t second = 0; - esp_wifi_set_channel(primary, second); - } - - { - uint8_t *primary = NULL; - wifi_second_chan_t *second = NULL; - esp_wifi_get_channel(primary, second); - } - - { - const wifi_country_t *country = NULL; - esp_wifi_set_country(country); - } - - { - wifi_country_t *country = NULL; - esp_wifi_get_country(country); - } - - { - wifi_interface_t ifx = 0; - const uint8_t mac[6] = {}; - esp_wifi_set_mac(ifx, mac); - } - - { - wifi_interface_t ifx = 0; - uint8_t mac[6] = {}; - esp_wifi_get_mac(ifx, mac); - } - - { - wifi_promiscuous_cb_t cb = 0; - esp_wifi_set_promiscuous_rx_cb(cb); - } - - { - _Bool en = 0; - esp_wifi_set_promiscuous(en); - } - - { - _Bool *en = NULL; - esp_wifi_get_promiscuous(en); - } - - { - const wifi_promiscuous_filter_t *filter = NULL; - esp_wifi_set_promiscuous_filter(filter); - } - - { - wifi_promiscuous_filter_t *filter = NULL; - esp_wifi_get_promiscuous_filter(filter); - } - - { - const wifi_promiscuous_filter_t *filter = NULL; - esp_wifi_set_promiscuous_ctrl_filter(filter); - } - - { - wifi_promiscuous_filter_t *filter = NULL; - esp_wifi_get_promiscuous_ctrl_filter(filter); - } - - { - wifi_interface_t interface = 0; - wifi_config_t *conf = NULL; - esp_wifi_set_config(interface, conf); - } - - { - wifi_interface_t interface = 0; - wifi_config_t *conf = NULL; - esp_wifi_get_config(interface, conf); - } - - { - wifi_sta_list_t *sta = NULL; - esp_wifi_ap_get_sta_list(sta); - } - - { - const uint8_t mac[6] = {}; - uint16_t *aid = NULL; - esp_wifi_ap_get_sta_aid(mac, aid); - } - - { - wifi_storage_t storage = 0; - esp_wifi_set_storage(storage); - } - - { - _Bool enable = 0; - wifi_vendor_ie_type_t type = 0; - wifi_vendor_ie_id_t idx = 0; - const void *vnd_ie = NULL; - esp_wifi_set_vendor_ie(enable, type, idx, vnd_ie); - } - - { - esp_vendor_ie_cb_t cb = 0; - void *ctx = NULL; - esp_wifi_set_vendor_ie_cb(cb, ctx); - } - - { - int8_t power = 0; - esp_wifi_set_max_tx_power(power); - } - - { - int8_t *power = NULL; - esp_wifi_get_max_tx_power(power); - } - - { - uint32_t mask = 0; - esp_wifi_set_event_mask(mask); - } - - { - uint32_t *mask = NULL; - esp_wifi_get_event_mask(mask); - } - - { - wifi_interface_t ifx = 0; - const void *buffer = NULL; - int len = 0; - _Bool en_sys_seq = 0; - esp_wifi_80211_tx(ifx, buffer, len, en_sys_seq); - } - - { - wifi_csi_cb_t cb = 0; - void *ctx = NULL; - esp_wifi_set_csi_rx_cb(cb, ctx); - } - - { - const wifi_csi_config_t *config = NULL; - esp_wifi_set_csi_config(config); - } - - { - wifi_csi_config_t *config = NULL; - esp_wifi_get_csi_config(config); - } - - { - _Bool en = 0; - esp_wifi_set_csi(en); - } - - { - wifi_interface_t interface = 0; - esp_wifi_get_tsf_time(interface); - } - - { - wifi_interface_t ifx = 0; - uint16_t sec = 0; - esp_wifi_set_inactive_time(ifx, sec); - } - - { - wifi_interface_t ifx = 0; - uint16_t *sec = NULL; - esp_wifi_get_inactive_time(ifx, sec); - } - - { - uint32_t modules = 0; - esp_wifi_statis_dump(modules); - } - - { - int32_t rssi = 0; - esp_wifi_set_rssi_threshold(rssi); - } - - { - wifi_ftm_initiator_cfg_t *cfg = NULL; - esp_wifi_ftm_initiate_session(cfg); - } - - { - esp_wifi_ftm_end_session(); - } - - { - int16_t offset_cm = 0; - esp_wifi_ftm_resp_set_offset(offset_cm); - } - - { - wifi_ftm_report_entry_t *report = NULL; - uint8_t num_entries = 0; - esp_wifi_ftm_get_report(report, num_entries); - } - - { - wifi_interface_t ifx = 0; - _Bool disable = 0; - esp_wifi_config_11b_rate(ifx, disable); - } - - { - uint16_t wake_interval = 0; - esp_wifi_connectionless_module_set_wake_interval(wake_interval); - } - - { - esp_wifi_force_wakeup_acquire(); - } - - { - esp_wifi_force_wakeup_release(); - } - - { - const char *country = NULL; - _Bool ieee80211d_enabled = 0; - esp_wifi_set_country_code(country, ieee80211d_enabled); - } - - { - char *country = NULL; - esp_wifi_get_country_code(country); - } - - { - wifi_interface_t ifx = 0; - wifi_phy_rate_t rate = 0; - esp_wifi_config_80211_tx_rate(ifx, rate); - } - - { - wifi_interface_t ifx = 0; - esp_wifi_disable_pmf_config(ifx); - } - - { - uint16_t *aid = NULL; - esp_wifi_sta_get_aid(aid); - } - - { - wifi_phy_mode_t *phymode = NULL; - esp_wifi_sta_get_negotiated_phymode(phymode); - } - - { - _Bool enabled = 0; - esp_wifi_set_dynamic_cs(enabled); - } - - { - int *rssi = NULL; - esp_wifi_sta_get_rssi(rssi); - } - - { - wifi_band_t band = 0; - esp_wifi_set_band(band); - } - - { - wifi_band_t *band = NULL; - esp_wifi_get_band(band); - } - - { - wifi_band_mode_t band_mode = 0; - esp_wifi_set_band_mode(band_mode); - } - - { - wifi_band_mode_t *band_mode = NULL; - esp_wifi_get_band_mode(band_mode); - } - - { - wifi_interface_t ifx = 0; - wifi_protocols_t *protocols = NULL; - esp_wifi_set_protocols(ifx, protocols); - } - - { - wifi_interface_t ifx = 0; - wifi_protocols_t *protocols = NULL; - esp_wifi_get_protocols(ifx, protocols); - } - - { - wifi_interface_t ifx = 0; - wifi_bandwidths_t *bw = NULL; - esp_wifi_set_bandwidths(ifx, bw); - } - - { - wifi_interface_t ifx = 0; - wifi_bandwidths_t *bw = NULL; - esp_wifi_get_bandwidths(ifx, bw); - } - -} diff --git a/components/esp_wifi_remote/test/smoke_test/main/idf_v5.4/all_wifi_remote_calls.c b/components/esp_wifi_remote/test/smoke_test/main/idf_v5.4/all_wifi_remote_calls.c deleted file mode 100644 index 8861531b84..0000000000 --- a/components/esp_wifi_remote/test/smoke_test/main/idf_v5.4/all_wifi_remote_calls.c +++ /dev/null @@ -1,450 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -// This file is auto-generated -#include "esp_wifi_remote.h" - -void run_all_wifi_remote_apis(void) -{ - { - const wifi_init_config_t *config = NULL; - esp_wifi_remote_init(config); - } - - { - esp_wifi_remote_deinit(); - } - - { - wifi_mode_t mode = 0; - esp_wifi_remote_set_mode(mode); - } - - { - wifi_mode_t *mode = NULL; - esp_wifi_remote_get_mode(mode); - } - - { - esp_wifi_remote_start(); - } - - { - esp_wifi_remote_stop(); - } - - { - esp_wifi_remote_restore(); - } - - { - esp_wifi_remote_connect(); - } - - { - esp_wifi_remote_disconnect(); - } - - { - esp_wifi_remote_clear_fast_connect(); - } - - { - uint16_t aid = 0; - esp_wifi_remote_deauth_sta(aid); - } - - { - const wifi_scan_config_t *config = NULL; - _Bool block = 0; - esp_wifi_remote_scan_start(config, block); - } - - { - const wifi_scan_default_params_t *config = NULL; - esp_wifi_remote_set_scan_parameters(config); - } - - { - wifi_scan_default_params_t *config = NULL; - esp_wifi_remote_get_scan_parameters(config); - } - - { - esp_wifi_remote_scan_stop(); - } - - { - uint16_t *number = NULL; - esp_wifi_remote_scan_get_ap_num(number); - } - - { - uint16_t *number = NULL; - wifi_ap_record_t *ap_records = NULL; - esp_wifi_remote_scan_get_ap_records(number, ap_records); - } - - { - wifi_ap_record_t *ap_record = NULL; - esp_wifi_remote_scan_get_ap_record(ap_record); - } - - { - esp_wifi_remote_clear_ap_list(); - } - - { - wifi_ap_record_t *ap_info = NULL; - esp_wifi_remote_sta_get_ap_info(ap_info); - } - - { - wifi_ps_type_t type = 0; - esp_wifi_remote_set_ps(type); - } - - { - wifi_ps_type_t *type = NULL; - esp_wifi_remote_get_ps(type); - } - - { - wifi_interface_t ifx = 0; - uint8_t protocol_bitmap = 0; - esp_wifi_remote_set_protocol(ifx, protocol_bitmap); - } - - { - wifi_interface_t ifx = 0; - uint8_t *protocol_bitmap = NULL; - esp_wifi_remote_get_protocol(ifx, protocol_bitmap); - } - - { - wifi_interface_t ifx = 0; - wifi_bandwidth_t bw = 0; - esp_wifi_remote_set_bandwidth(ifx, bw); - } - - { - wifi_interface_t ifx = 0; - wifi_bandwidth_t *bw = NULL; - esp_wifi_remote_get_bandwidth(ifx, bw); - } - - { - uint8_t primary = 0; - wifi_second_chan_t second = 0; - esp_wifi_remote_set_channel(primary, second); - } - - { - uint8_t *primary = NULL; - wifi_second_chan_t *second = NULL; - esp_wifi_remote_get_channel(primary, second); - } - - { - const wifi_country_t *country = NULL; - esp_wifi_remote_set_country(country); - } - - { - wifi_country_t *country = NULL; - esp_wifi_remote_get_country(country); - } - - { - wifi_interface_t ifx = 0; - const uint8_t mac[6] = {}; - esp_wifi_remote_set_mac(ifx, mac); - } - - { - wifi_interface_t ifx = 0; - uint8_t mac[6] = {}; - esp_wifi_remote_get_mac(ifx, mac); - } - - { - wifi_promiscuous_cb_t cb = 0; - esp_wifi_remote_set_promiscuous_rx_cb(cb); - } - - { - _Bool en = 0; - esp_wifi_remote_set_promiscuous(en); - } - - { - _Bool *en = NULL; - esp_wifi_remote_get_promiscuous(en); - } - - { - const wifi_promiscuous_filter_t *filter = NULL; - esp_wifi_remote_set_promiscuous_filter(filter); - } - - { - wifi_promiscuous_filter_t *filter = NULL; - esp_wifi_remote_get_promiscuous_filter(filter); - } - - { - const wifi_promiscuous_filter_t *filter = NULL; - esp_wifi_remote_set_promiscuous_ctrl_filter(filter); - } - - { - wifi_promiscuous_filter_t *filter = NULL; - esp_wifi_remote_get_promiscuous_ctrl_filter(filter); - } - - { - wifi_interface_t interface = 0; - wifi_config_t *conf = NULL; - esp_wifi_remote_set_config(interface, conf); - } - - { - wifi_interface_t interface = 0; - wifi_config_t *conf = NULL; - esp_wifi_remote_get_config(interface, conf); - } - - { - wifi_sta_list_t *sta = NULL; - esp_wifi_remote_ap_get_sta_list(sta); - } - - { - const uint8_t mac[6] = {}; - uint16_t *aid = NULL; - esp_wifi_remote_ap_get_sta_aid(mac, aid); - } - - { - wifi_storage_t storage = 0; - esp_wifi_remote_set_storage(storage); - } - - { - _Bool enable = 0; - wifi_vendor_ie_type_t type = 0; - wifi_vendor_ie_id_t idx = 0; - const void *vnd_ie = NULL; - esp_wifi_remote_set_vendor_ie(enable, type, idx, vnd_ie); - } - - { - esp_vendor_ie_cb_t cb = 0; - void *ctx = NULL; - esp_wifi_remote_set_vendor_ie_cb(cb, ctx); - } - - { - int8_t power = 0; - esp_wifi_remote_set_max_tx_power(power); - } - - { - int8_t *power = NULL; - esp_wifi_remote_get_max_tx_power(power); - } - - { - uint32_t mask = 0; - esp_wifi_remote_set_event_mask(mask); - } - - { - uint32_t *mask = NULL; - esp_wifi_remote_get_event_mask(mask); - } - - { - wifi_interface_t ifx = 0; - const void *buffer = NULL; - int len = 0; - _Bool en_sys_seq = 0; - esp_wifi_remote_80211_tx(ifx, buffer, len, en_sys_seq); - } - - { - wifi_csi_cb_t cb = 0; - void *ctx = NULL; - esp_wifi_remote_set_csi_rx_cb(cb, ctx); - } - - { - const wifi_csi_config_t *config = NULL; - esp_wifi_remote_set_csi_config(config); - } - - { - wifi_csi_config_t *config = NULL; - esp_wifi_remote_get_csi_config(config); - } - - { - _Bool en = 0; - esp_wifi_remote_set_csi(en); - } - - { - wifi_interface_t interface = 0; - esp_wifi_remote_get_tsf_time(interface); - } - - { - wifi_interface_t ifx = 0; - uint16_t sec = 0; - esp_wifi_remote_set_inactive_time(ifx, sec); - } - - { - wifi_interface_t ifx = 0; - uint16_t *sec = NULL; - esp_wifi_remote_get_inactive_time(ifx, sec); - } - - { - uint32_t modules = 0; - esp_wifi_remote_statis_dump(modules); - } - - { - int32_t rssi = 0; - esp_wifi_remote_set_rssi_threshold(rssi); - } - - { - wifi_ftm_initiator_cfg_t *cfg = NULL; - esp_wifi_remote_ftm_initiate_session(cfg); - } - - { - esp_wifi_remote_ftm_end_session(); - } - - { - int16_t offset_cm = 0; - esp_wifi_remote_ftm_resp_set_offset(offset_cm); - } - - { - wifi_ftm_report_entry_t *report = NULL; - uint8_t num_entries = 0; - esp_wifi_remote_ftm_get_report(report, num_entries); - } - - { - wifi_interface_t ifx = 0; - _Bool disable = 0; - esp_wifi_remote_config_11b_rate(ifx, disable); - } - - { - uint16_t wake_interval = 0; - esp_wifi_remote_connectionless_module_set_wake_interval(wake_interval); - } - - { - esp_wifi_remote_force_wakeup_acquire(); - } - - { - esp_wifi_remote_force_wakeup_release(); - } - - { - const char *country = NULL; - _Bool ieee80211d_enabled = 0; - esp_wifi_remote_set_country_code(country, ieee80211d_enabled); - } - - { - char *country = NULL; - esp_wifi_remote_get_country_code(country); - } - - { - wifi_interface_t ifx = 0; - wifi_phy_rate_t rate = 0; - esp_wifi_remote_config_80211_tx_rate(ifx, rate); - } - - { - wifi_interface_t ifx = 0; - esp_wifi_remote_disable_pmf_config(ifx); - } - - { - uint16_t *aid = NULL; - esp_wifi_remote_sta_get_aid(aid); - } - - { - wifi_phy_mode_t *phymode = NULL; - esp_wifi_remote_sta_get_negotiated_phymode(phymode); - } - - { - _Bool enabled = 0; - esp_wifi_remote_set_dynamic_cs(enabled); - } - - { - int *rssi = NULL; - esp_wifi_remote_sta_get_rssi(rssi); - } - - { - wifi_band_t band = 0; - esp_wifi_remote_set_band(band); - } - - { - wifi_band_t *band = NULL; - esp_wifi_remote_get_band(band); - } - - { - wifi_band_mode_t band_mode = 0; - esp_wifi_remote_set_band_mode(band_mode); - } - - { - wifi_band_mode_t *band_mode = NULL; - esp_wifi_remote_get_band_mode(band_mode); - } - - { - wifi_interface_t ifx = 0; - wifi_protocols_t *protocols = NULL; - esp_wifi_remote_set_protocols(ifx, protocols); - } - - { - wifi_interface_t ifx = 0; - wifi_protocols_t *protocols = NULL; - esp_wifi_remote_get_protocols(ifx, protocols); - } - - { - wifi_interface_t ifx = 0; - wifi_bandwidths_t *bw = NULL; - esp_wifi_remote_set_bandwidths(ifx, bw); - } - - { - wifi_interface_t ifx = 0; - wifi_bandwidths_t *bw = NULL; - esp_wifi_remote_get_bandwidths(ifx, bw); - } - -} diff --git a/components/esp_wifi_remote/test/smoke_test/main/smoke_test.c b/components/esp_wifi_remote/test/smoke_test/main/smoke_test.c deleted file mode 100644 index c2104972e5..0000000000 --- a/components/esp_wifi_remote/test/smoke_test/main/smoke_test.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Unlicense OR CC0-1.0 - */ -#include -#include "esp_wifi_remote.h" - -void run_all_wifi_apis(void); -void run_all_wifi_remote_apis(void); - -void app_main(void) -{ - // manual init and deinit - wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); - esp_wifi_init(&cfg); - esp_wifi_deinit(); - -#if CONFIG_SOC_WIFI_SUPPORTED - run_all_wifi_remote_apis(); -#else - run_all_wifi_apis(); -#endif -} diff --git a/components/esp_wifi_remote/test/smoke_test/sdkconfig.defaults b/components/esp_wifi_remote/test/smoke_test/sdkconfig.defaults deleted file mode 100644 index 25ec8b5aab..0000000000 --- a/components/esp_wifi_remote/test/smoke_test/sdkconfig.defaults +++ /dev/null @@ -1 +0,0 @@ -CONFIG_ESP_WIFI_REMOTE_LIBRARY_HOSTED=y diff --git a/components/mdns/.cz.yaml b/components/mdns/.cz.yaml index adb708debb..1ab8bd7b80 100644 --- a/components/mdns/.cz.yaml +++ b/components/mdns/.cz.yaml @@ -3,6 +3,6 @@ commitizen: bump_message: 'bump(mdns): $current_version -> $new_version' pre_bump_hooks: python ../../ci/changelog.py mdns tag_format: mdns-v$version - version: 1.4.0 + version: 1.4.2 version_files: - idf_component.yml diff --git a/components/mdns/CHANGELOG.md b/components/mdns/CHANGELOG.md index 2f4f5b209d..d375d6e69e 100644 --- a/components/mdns/CHANGELOG.md +++ b/components/mdns/CHANGELOG.md @@ -1,5 +1,27 @@ # Changelog +## [1.4.2](https://github.com/espressif/esp-protocols/commits/mdns-v1.4.2) + +### Features + +- support update subtype ([062b8dca](https://github.com/espressif/esp-protocols/commit/062b8dca)) + +### Updated + +- chore(mdns): Add more info to idf_component.yml ([4a1cb65c](https://github.com/espressif/esp-protocols/commit/4a1cb65c)) + +## [1.4.1](https://github.com/espressif/esp-protocols/commits/mdns-v1.4.1) + +### Features + +- Send PTR query for mdns browse when interface is ready ([010a404a](https://github.com/espressif/esp-protocols/commit/010a404a)) + +### Bug Fixes + +- Prevent deadlock when deleting a browse request ([3f48f9ea](https://github.com/espressif/esp-protocols/commit/3f48f9ea)) +- Fix use after free reported by coverity ([25b3d5fd](https://github.com/espressif/esp-protocols/commit/25b3d5fd)) +- Fixed dead-code reported by coverity ([11846c7d](https://github.com/espressif/esp-protocols/commit/11846c7d)) + ## [1.4.0](https://github.com/espressif/esp-protocols/commits/mdns-v1.4.0) ### Major changes diff --git a/components/mdns/idf_component.yml b/components/mdns/idf_component.yml index 781b534fe9..c0fc4e545e 100644 --- a/components/mdns/idf_component.yml +++ b/components/mdns/idf_component.yml @@ -1,6 +1,9 @@ -version: "1.4.0" -description: mDNS -url: https://github.com/espressif/esp-protocols/tree/master/components/mdns +version: "1.4.2" +description: "Multicast UDP service used to provide local network service and host discovery." +url: "https://github.com/espressif/esp-protocols/tree/master/components/mdns" +issues: "https://github.com/espressif/esp-protocols/issues" +documentation: "https://docs.espressif.com/projects/esp-protocols/mdns/docs/latest/en/index.html" +repository: "https://github.com/espressif/esp-protocols.git" dependencies: idf: version: ">=5.0" diff --git a/components/mdns/include/mdns.h b/components/mdns/include/mdns.h index ddb31feac5..c15ecb6221 100644 --- a/components/mdns/include/mdns.h +++ b/components/mdns/include/mdns.h @@ -60,6 +60,14 @@ typedef struct { const char *value; /*!< item value string */ } mdns_txt_item_t; +/** + * @brief mDNS basic subtype item structure + * Used in mdns_service_subtype_xxx() APIs + */ +typedef struct { + const char *subtype; /*!< subtype name */ +} mdns_subtype_item_t; + /** * @brief mDNS query linked list IP item */ @@ -544,7 +552,7 @@ esp_err_t mdns_service_txt_item_remove_for_host(const char *instance, const char const char *key); /** - * @brief Add subtype for service. + * @brief Add a subtype for service. * * @param instance_name instance name. If NULL, will find the first service with the same service type and protocol. * @param service_type service type (_http, _ftp, etc) @@ -561,6 +569,60 @@ esp_err_t mdns_service_txt_item_remove_for_host(const char *instance, const char esp_err_t mdns_service_subtype_add_for_host(const char *instance_name, const char *service_type, const char *proto, const char *hostname, const char *subtype); +/** + * @brief Remove a subtype for service. + * + * @param instance_name instance name. If NULL, will find the first service with the same service type and protocol. + * @param service_type service type (_http, _ftp, etc) + * @param proto service protocol (_tcp, _udp) + * @param hostname service hostname. If NULL, local hostname will be used. + * @param subtype The subtype to remove. + * + * @return + * - ESP_OK success + * - ESP_ERR_INVALID_ARG Parameter error + * - ESP_ERR_NOT_FOUND Service not found + */ +esp_err_t mdns_service_subtype_remove_for_host(const char *instance_name, const char *service_type, const char *proto, + const char *hostname, const char *subtype); + +/** + * @brief Add multiple subtypes for service at once. + * + * @param instance_name instance name. If NULL, will find the first service with the same service type and protocol. + * @param service_type service type (_http, _ftp, etc) + * @param proto service protocol (_tcp, _udp) + * @param hostname service hostname. If NULL, local hostname will be used. + * @param subtype the pointer of subtype array to add. + * @param num_items number of items in subtype array + * + * @return + * - ESP_OK success + * - ESP_ERR_INVALID_ARG Parameter error + * - ESP_ERR_NOT_FOUND Service not found + * - ESP_ERR_NO_MEM memory error + */ +esp_err_t mdns_service_subtype_add_multiple_items_for_host(const char *instance_name, const char *service_type, const char *proto, + const char *hostname, mdns_subtype_item_t subtype[], uint8_t num_items); + +/** + * @brief Update subtype for service. + * + * @param instance_name instance name. If NULL, will find the first service with the same service type and protocol. + * @param service_type service type (_http, _ftp, etc) + * @param proto service protocol (_tcp, _udp) + * @param hostname service hostname. If NULL, local hostname will be used. + * @param subtype the pointer of subtype array to add. + * @param num_items number of items in subtype array + * + * @return + * - ESP_OK success + * - ESP_ERR_INVALID_ARG Parameter error + * - ESP_ERR_NOT_FOUND Service not found + * - ESP_ERR_NO_MEM memory error + */ +esp_err_t mdns_service_subtype_update_multiple_items_for_host(const char *instance_name, const char *service_type, const char *proto, + const char *hostname, mdns_subtype_item_t subtype[], uint8_t num_items); /** * @brief Remove and free all services from mDNS server * diff --git a/components/mdns/mdns.c b/components/mdns/mdns.c index a5e8a00a70..113a1e999b 100644 --- a/components/mdns/mdns.c +++ b/components/mdns/mdns.c @@ -25,7 +25,7 @@ static esp_err_t _mdns_sync_browse_action(mdns_action_type_t type, mdns_browse_s static void _mdns_browse_sync(mdns_browse_sync_t *browse_sync); static void _mdns_browse_finish(mdns_browse_t *browse); static void _mdns_browse_add(mdns_browse_t *browse); -static void _mdns_browse_send(mdns_browse_t *browse); +static void _mdns_browse_send(mdns_browse_t *browse, mdns_if_t interface); #if CONFIG_ETH_ENABLED && CONFIG_MDNS_PREDEF_NETIF_ETH #include "esp_eth.h" @@ -2794,6 +2794,16 @@ static void _mdns_remove_scheduled_service_packets(mdns_service_t *service) } } +static void _mdns_free_service_subtype(mdns_service_t *service) +{ + while (service->subtype) { + mdns_subtype_t *next = service->subtype->next; + free((char *)service->subtype->subtype); + free(service->subtype); + service->subtype = next; + } +} + /** * @brief free service memory * @@ -2815,12 +2825,7 @@ static void _mdns_free_service(mdns_service_t *service) free((char *)s->value); free(s); } - while (service->subtype) { - mdns_subtype_t *next = service->subtype->next; - free((char *)service->subtype->subtype); - free(service->subtype); - service->subtype = next; - } + _mdns_free_service_subtype(service); free(service); } @@ -4476,7 +4481,11 @@ void mdns_preset_if_handle_system_event(void *arg, esp_event_base_t event_base, post_mdns_enable_pcb(mdns_if, MDNS_IP_PROTOCOL_V6); post_mdns_announce_pcb(mdns_if, MDNS_IP_PROTOCOL_V4); } - + mdns_browse_t *browse = _mdns_server->browse; + while (browse) { + _mdns_browse_send(browse, mdns_if); + browse = browse->next; + } } break; default: @@ -6295,7 +6304,36 @@ esp_err_t mdns_service_txt_item_remove(const char *service, const char *proto, c return mdns_service_txt_item_remove_for_host(NULL, service, proto, NULL, key); } -esp_err_t mdns_service_subtype_add_for_host(const char *instance_name, const char *service, const char *proto, +static esp_err_t _mdns_service_subtype_remove_for_host(mdns_srv_item_t *service, const char *subtype) +{ + esp_err_t ret = ESP_ERR_NOT_FOUND; + mdns_subtype_t *srv_subtype = service->service->subtype; + mdns_subtype_t *pre = service->service->subtype; + while (srv_subtype) { + if (strcmp(srv_subtype->subtype, subtype) == 0) { + // Target subtype is found. + if (srv_subtype == service->service->subtype) { + // The first node needs to be removed + service->service->subtype = service->service->subtype->next; + } else { + pre->next = srv_subtype->next; + } + free((char *)srv_subtype->subtype); + free(srv_subtype); + ret = ESP_OK; + break; + } + pre = srv_subtype; + srv_subtype = srv_subtype->next; + } + if (ret == ESP_ERR_NOT_FOUND) { + ESP_LOGE(TAG, "Subtype : %s doesn't exist", subtype); + } + + return ret; +} + +esp_err_t mdns_service_subtype_remove_for_host(const char *instance_name, const char *service, const char *proto, const char *hostname, const char *subtype) { MDNS_SERVICE_LOCK(); @@ -6306,30 +6344,125 @@ esp_err_t mdns_service_subtype_add_for_host(const char *instance_name, const cha mdns_srv_item_t *s = _mdns_get_service_item_instance(instance_name, service, proto, hostname); ESP_GOTO_ON_FALSE(s, ESP_ERR_NOT_FOUND, err, TAG, "Service doesn't exist"); - mdns_subtype_t *srv_subtype = s->service->subtype; + ret = _mdns_service_subtype_remove_for_host(s, subtype); + ESP_GOTO_ON_ERROR(ret, err, TAG, "Failed to remove the subtype: %s", subtype); + + // TODO: Need to transmit a sendbye message for the removed subtype. + // TODO: Need to remove this subtype answer from the scheduled answer list. +err: + MDNS_SERVICE_UNLOCK(); + return ret; +} + +static esp_err_t _mdns_service_subtype_add_for_host(mdns_srv_item_t *service, const char *subtype) +{ + esp_err_t ret = ESP_OK; + mdns_subtype_t *srv_subtype = service->service->subtype; while (srv_subtype) { - ESP_GOTO_ON_FALSE(strcmp(srv_subtype->subtype, subtype) != 0, ESP_ERR_INVALID_ARG, err, TAG, "The same subtype has already been added"); + ESP_GOTO_ON_FALSE(strcmp(srv_subtype->subtype, subtype) != 0, ESP_ERR_INVALID_ARG, err, TAG, "Subtype: %s has already been added", subtype); srv_subtype = srv_subtype->next; } - mdns_service_t *srv = s->service; mdns_subtype_t *subtype_item = (mdns_subtype_t *)malloc(sizeof(mdns_subtype_t)); ESP_GOTO_ON_FALSE(subtype_item, ESP_ERR_NO_MEM, out_of_mem, TAG, "Out of memory"); subtype_item->subtype = strdup(subtype); ESP_GOTO_ON_FALSE(subtype_item->subtype, ESP_ERR_NO_MEM, out_of_mem, TAG, "Out of memory"); - subtype_item->next = srv->subtype; - srv->subtype = subtype_item; + subtype_item->next = service->service->subtype; + service->service->subtype = subtype_item; err: - MDNS_SERVICE_UNLOCK(); return ret; out_of_mem: - MDNS_SERVICE_UNLOCK(); HOOK_MALLOC_FAILED; free(subtype_item); return ret; } +esp_err_t mdns_service_subtype_add_multiple_items_for_host(const char *instance_name, const char *service, const char *proto, + const char *hostname, mdns_subtype_item_t subtype[], uint8_t num_items) +{ + MDNS_SERVICE_LOCK(); + esp_err_t ret = ESP_OK; + int cur_index = 0; + ESP_GOTO_ON_FALSE(_mdns_server && _mdns_server->services && !_str_null_or_empty(service) && !_str_null_or_empty(proto) && + (num_items > 0), ESP_ERR_INVALID_ARG, err, TAG, "Invalid state or arguments"); + + mdns_srv_item_t *s = _mdns_get_service_item_instance(instance_name, service, proto, hostname); + ESP_GOTO_ON_FALSE(s, ESP_ERR_NOT_FOUND, err, TAG, "Service doesn't exist"); + + for (; cur_index < num_items; cur_index++) { + ret = _mdns_service_subtype_add_for_host(s, subtype[cur_index].subtype); + if (ret == ESP_OK) { + continue; + } else if (ret == ESP_ERR_NO_MEM) { + ESP_LOGE(TAG, "Out of memory"); + goto err; + } else { + ESP_LOGE(TAG, "Failed to add subtype: %s", subtype[cur_index].subtype); + goto exit; + } + } + + _mdns_announce_all_pcbs(&s, 1, false); +err: + if (ret == ESP_ERR_NO_MEM) { + for (int idx = 0; idx < cur_index; idx++) { + _mdns_service_subtype_remove_for_host(s, subtype[idx].subtype); + } + } +exit: + MDNS_SERVICE_UNLOCK(); + return ret; +} + +esp_err_t mdns_service_subtype_add_for_host(const char *instance_name, const char *service_type, const char *proto, + const char *hostname, const char *subtype) +{ + mdns_subtype_item_t _subtype[1]; + _subtype[0].subtype = subtype; + return mdns_service_subtype_add_multiple_items_for_host(instance_name, service_type, proto, hostname, _subtype, 1); +} + +esp_err_t mdns_service_subtype_update_multiple_items_for_host(const char *instance_name, const char *service_type, const char *proto, + const char *hostname, mdns_subtype_item_t subtype[], uint8_t num_items) +{ + MDNS_SERVICE_LOCK(); + esp_err_t ret = ESP_OK; + int cur_index = 0; + ESP_GOTO_ON_FALSE(_mdns_server && _mdns_server->services && !_str_null_or_empty(service_type) && !_str_null_or_empty(proto) && + (num_items > 0), ESP_ERR_INVALID_ARG, err, TAG, "Invalid state or arguments"); + + mdns_srv_item_t *s = _mdns_get_service_item_instance(instance_name, service_type, proto, hostname); + ESP_GOTO_ON_FALSE(s, ESP_ERR_NOT_FOUND, err, TAG, "Service doesn't exist"); + + // TODO: find subtype needs to say sendbye + _mdns_free_service_subtype(s->service); + + for (; cur_index < num_items; cur_index++) { + ret = _mdns_service_subtype_add_for_host(s, subtype[cur_index].subtype); + if (ret == ESP_OK) { + continue; + } else if (ret == ESP_ERR_NO_MEM) { + ESP_LOGE(TAG, "Out of memory"); + goto err; + } else { + ESP_LOGE(TAG, "Failed to add subtype: %s", subtype[cur_index].subtype); + goto exit; + } + } + + _mdns_announce_all_pcbs(&s, 1, false); +err: + if (ret == ESP_ERR_NO_MEM) { + for (int idx = 0; idx < cur_index; idx++) { + _mdns_service_subtype_remove_for_host(s, subtype[idx].subtype); + } + } +exit: + MDNS_SERVICE_UNLOCK(); + return ret; +} + esp_err_t mdns_service_instance_name_set_for_host(const char *instance_old, const char *service, const char *proto, const char *host, const char *instance) { @@ -6996,7 +7129,7 @@ static void _mdns_browse_item_free(mdns_browse_t *browse) free(browse->service); free(browse->proto); if (browse->result) { - mdns_query_results_free(browse->result); + _mdns_query_results_free(browse->result); } free(browse); } @@ -7119,7 +7252,9 @@ static void _mdns_browse_add(mdns_browse_t *browse) browse->next = _mdns_server->browse; _mdns_server->browse = browse; } - _mdns_browse_send(browse); + for (uint8_t interface_idx = 0; interface_idx < MDNS_MAX_INTERFACES; interface_idx++) { + _mdns_browse_send(browse, (mdns_if_t)interface_idx); + } if (found) { _mdns_browse_item_free(browse); } @@ -7128,7 +7263,7 @@ static void _mdns_browse_add(mdns_browse_t *browse) /** * @brief Send PTR query packet to all available interfaces for browsing. */ -static void _mdns_browse_send(mdns_browse_t *browse) +static void _mdns_browse_send(mdns_browse_t *browse, mdns_if_t interface) { // Using search once for sending the PTR query mdns_search_once_t search = {0}; @@ -7141,11 +7276,8 @@ static void _mdns_browse_send(mdns_browse_t *browse) search.result = NULL; search.next = NULL; - uint8_t i, j; - for (i = 0; i < MDNS_MAX_INTERFACES; i++) { - for (j = 0; j < MDNS_IP_PROTOCOL_MAX; j++) { - _mdns_search_send_pcb(&search, (mdns_if_t)i, (mdns_ip_protocol_t)j); - } + for (uint8_t protocol_idx = 0; protocol_idx < MDNS_IP_PROTOCOL_MAX; protocol_idx++) { + _mdns_search_send_pcb(&search, interface, (mdns_ip_protocol_t)protocol_idx); } } diff --git a/components/mosquitto/.cz.yaml b/components/mosquitto/.cz.yaml index eb00948490..f9b741cd0b 100644 --- a/components/mosquitto/.cz.yaml +++ b/components/mosquitto/.cz.yaml @@ -1,7 +1,8 @@ +--- commitizen: bump_message: 'bump(mosq): $current_version -> $new_version' - pre_bump_hooks: python ../../ci/changelog.py mosq + pre_bump_hooks: python ../../ci/changelog.py mosquitto tag_format: mosq-v$version - version: 2.0.27 + version: 2.0.28~0 version_files: - - idf_component.yml + - idf_component.yml diff --git a/components/mosquitto/CHANGELOG.md b/components/mosquitto/CHANGELOG.md new file mode 100644 index 0000000000..bcc1c9a553 --- /dev/null +++ b/components/mosquitto/CHANGELOG.md @@ -0,0 +1,16 @@ +## [2.0.28~0](https://github.com/espressif/esp-protocols/commits/mosq-v2.0.28_0) + +### Features + +- Added support for TLS transport using ESP-TLS ([1af4bbe1](https://github.com/espressif/esp-protocols/commit/1af4bbe1)) +- Add API docs, memory consideration and tests ([a20c0c9d](https://github.com/espressif/esp-protocols/commit/a20c0c9d)) +- Add target tests with localhost broker-client ([5c850cda](https://github.com/espressif/esp-protocols/commit/5c850cda)) +- Initial moquitto v2.0.18 port (TCP only) ([de4531e8](https://github.com/espressif/esp-protocols/commit/de4531e8)) + +### Bug Fixes + +- Fix clean compilation addressing _GNU_SOURCE redefined ([e2392c36](https://github.com/espressif/esp-protocols/commit/e2392c36)) + +### Updated + +- docs(mosq): Prepare mosquitto component for publishing ([c2c4bf83](https://github.com/espressif/esp-protocols/commit/c2c4bf83)) diff --git a/components/mosquitto/CMakeLists.txt b/components/mosquitto/CMakeLists.txt index ef43060db1..1db843ec19 100644 --- a/components/mosquitto/CMakeLists.txt +++ b/components/mosquitto/CMakeLists.txt @@ -7,7 +7,6 @@ set(m_deps_dir ${m_dir}/deps) set(m_srcs ${m_lib_dir}/memory_mosq.c ${m_lib_dir}/util_mosq.c - ${m_lib_dir}/net_mosq.c ${m_lib_dir}/will_mosq.c ${m_lib_dir}/alias_mosq.c ${m_lib_dir}/send_mosq.c @@ -46,7 +45,6 @@ set(m_srcs ${m_src_dir}/mux.c ${m_src_dir}/mux_epoll.c ${m_src_dir}/mux_poll.c - ${m_src_dir}/net.c ${m_src_dir}/password_mosq.c ${m_src_dir}/persist_read.c ${m_src_dir}/persist_read_v234.c @@ -73,20 +71,26 @@ set(m_srcs ${m_src_dir}/xtreport.c) idf_component_register(SRCS ${m_srcs} - port/callbacks.c port/config.c port/signals.c port/ifaddrs.c port/broker.c port/files.c + port/callbacks.c + port/config.c + port/signals.c + port/ifaddrs.c + port/broker.c + port/files.c + port/net__esp_tls.c PRIV_INCLUDE_DIRS port/priv_include port/priv_include/sys ${m_dir} ${m_src_dir} ${m_incl_dir} ${m_lib_dir} ${m_deps_dir} INCLUDE_DIRS ${m_incl_dir} port/include - PRIV_REQUIRES newlib + PRIV_REQUIRES newlib esp-tls ) target_compile_definitions(${COMPONENT_LIB} PRIVATE "WITH_BROKER") target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") -# Some mosquittos source unconditionally define `_GNU_SOURCE` which collides with IDF build system +# Some mosquitto source unconditionally define `_GNU_SOURCE` which collides with IDF build system # producing warning: "_GNU_SOURCE" redefined # This workarounds this issue by undefining the macro for the selected files -set(sources_that_define_gnu_source ${m_lib_dir}/net_mosq.c ${m_src_dir}/loop.c ${m_src_dir}/mux_poll.c) +set(sources_that_define_gnu_source ${m_src_dir}/loop.c ${m_src_dir}/mux_poll.c) foreach(offending_src ${sources_that_define_gnu_source}) set_source_files_properties(${offending_src} PROPERTIES COMPILE_OPTIONS "-U_GNU_SOURCE") endforeach() diff --git a/components/mosquitto/README.md b/components/mosquitto/README.md index 9199917ed4..a6408db29a 100644 --- a/components/mosquitto/README.md +++ b/components/mosquitto/README.md @@ -1,21 +1,21 @@ # ESP32 Mosquitto Port -This is a lightweight port of the Mosquitto broker designed to run on the ESP32. It currently supports a single listener and TCP transport only. +This is a lightweight port of the Mosquitto broker designed to run on the ESP32. It currently supports a single listener with TCP transport or TLS transport based on ESP-TLS library. ## Supported Options -The Espressif port supports a limited set of options (with plans to add more in future releases). These options can be configured through a structure passed to the `mosq_broker_start()` function. For detailed information on available configuration options, refer to the [API documentation](api.md). +The Espressif port supports a limited set of options (with plans to add more in future releases). These options can be configured through a structure passed to the `mosq_broker_run()` function. For detailed information on available configuration options, refer to the [API documentation](api.md). ## API ### Starting the Broker -To start the broker, call the `mosq_broker_start()` function with a properly configured settings structure. The broker operates in the context of the calling task and does not create a separate task. +To start the broker, call the `mosq_broker_run()` function with a properly configured settings structure. The broker operates in the context of the calling task and does not create a separate task. It's recommended to analyze the stack size needed for the task, but in general, the broker requires at least 4 kB of stack size. ```c -mosq_broker_start(&config); +mosq_broker_run(&config); ``` ## Memory Footprint Considerations diff --git a/components/mosquitto/api.md b/components/mosquitto/api.md index 39668bde34..f010cbb241 100644 --- a/components/mosquitto/api.md +++ b/components/mosquitto/api.md @@ -20,7 +20,8 @@ | Type | Name | | ---: | :--- | -| int | [**mosq\_broker\_start**](#function-mosq_broker_start) (struct [**mosq\_broker\_config**](#struct-mosq_broker_config) \*config)
_Start mosquitto broker._ | +| int | [**mosq\_broker\_run**](#function-mosq_broker_run) (struct [**mosq\_broker\_config**](#struct-mosq_broker_config) \*config)
_Start mosquitto broker._ | +| void | [**mosq\_broker\_stop**](#function-mosq_broker_stop) (void)
_Stops running broker._ | ## Structures and Types Documentation @@ -37,14 +38,16 @@ Variables: - int port
Port number of the broker to listen to +- esp\_tls\_cfg\_server\_t \* tls_cfg
ESP-TLS configuration (if TLS transport used) Please refer to the ESP-TLS official documentation for more details on configuring the TLS options. You can open the respective docs with this idf.py command: `idf.py docs -sp api-reference/protocols/esp_tls.html` + ## Functions Documentation -### function `mosq_broker_start` +### function `mosq_broker_run` _Start mosquitto broker._ ```c -int mosq_broker_start ( +int mosq_broker_run ( struct mosq_broker_config *config ) ``` @@ -63,3 +66,16 @@ This API runs the broker in the calling thread and blocks until the mosquitto ex **Returns:** int Exit code (0 on success) +### function `mosq_broker_stop` + +_Stops running broker._ +```c +void mosq_broker_stop ( + void +) +``` + + +**Note:** + +After calling this API, function mosq\_broker\_run() unblocks and returns. diff --git a/components/mosquitto/examples/broker/README.md b/components/mosquitto/examples/broker/README.md index 6d8545505c..c9043733df 100644 --- a/components/mosquitto/examples/broker/README.md +++ b/components/mosquitto/examples/broker/README.md @@ -2,7 +2,7 @@ ## Overview -This example runs a TCP broker on a specified host and port. +This example runs a broker on TLS or TCP transport, specified host and port. ### How to use this example @@ -13,6 +13,19 @@ If you enabled also the mqtt client, this example will connect to the local brok You can connect to the ESP32 mosquitto broker using some other client using the ESP32 IPv4 address and the port specified in the project configuration menu. +> [!IMPORTANT] +> The certificates and keys provided in this example are intended for testing purposes only. They are self-signed, single-use, and configured with a common name of "127.0.0.1". Do not reuse these credentials in any production or real-world applications, as they are not secure for such environments. + +For more information on setting up TLS configuration (including certificates and keys), please refer to the ESP-TLS documentation: +```bash +idf.py docs -sp api-reference/protocols/esp_tls.html +``` + +Configuring the TLS option for the broker is quite similar to setting it up for an HTTPS server, as both involve server-side security configuration. Refer to the HTTPS server documentation for details: +```bash +idf.py docs -sp api-reference/protocols/esp_https_server.html +``` + ### Test version This example is also used for testing on loopback interface only, disabling any actual connection, just using the local mqtt client to the loopback interface. diff --git a/components/mosquitto/examples/broker/main/CMakeLists.txt b/components/mosquitto/examples/broker/main/CMakeLists.txt index b76a5b5306..1f3299ddcc 100644 --- a/components/mosquitto/examples/broker/main/CMakeLists.txt +++ b/components/mosquitto/examples/broker/main/CMakeLists.txt @@ -1,2 +1,3 @@ -idf_component_register(SRCS "broker.c" - PRIV_REQUIRES newlib nvs_flash esp_netif esp_event mqtt) +idf_component_register(SRCS "example_broker.c" + PRIV_REQUIRES newlib nvs_flash esp_netif esp_event mqtt + EMBED_TXTFILES servercert.pem serverkey.pem cacert.pem) diff --git a/components/mosquitto/examples/broker/main/Kconfig.projbuild b/components/mosquitto/examples/broker/main/Kconfig.projbuild index 2e5efc912a..44c9e8f2d0 100644 --- a/components/mosquitto/examples/broker/main/Kconfig.projbuild +++ b/components/mosquitto/examples/broker/main/Kconfig.projbuild @@ -19,4 +19,11 @@ menu "Example Configuration" If enabled, it runs a local mqtt client connecting to the same endpoint ans the broker listens to + config EXAMPLE_BROKER_WITH_TLS + bool "Use TLS" + default y + help + If enabled, the broker (and the client too, if enabled) + uses TLS transport layer + endmenu diff --git a/components/mosquitto/examples/broker/main/cacert.pem b/components/mosquitto/examples/broker/main/cacert.pem new file mode 100644 index 0000000000..46e0eda8c0 --- /dev/null +++ b/components/mosquitto/examples/broker/main/cacert.pem @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDIzCCAgugAwIBAgIUXichctvCn6/6xXr0+UOBaqwkBMMwDQYJKoZIhvcNAQEL +BQAwITELMAkGA1UEBhMCQ1oxEjAQBgNVBAMMCUVzcHJlc3NpZjAeFw0yNDA3MDgx +NDE5NDNaFw0yNTA3MDgxNDE5NDNaMCExCzAJBgNVBAYTAkNaMRIwEAYDVQQDDAlF +c3ByZXNzaWYwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCqAGUZALUS +AwWkslBH0RJcgyTTYZ6Q3xadG9rubTGN0DNt8INlguElN9eUhj7VzQZeGxRtAk3A +b4r5MpTWAAC8maDgZU97TOmAaxA04h0P2MHTGG4i1vSm2/jebhh5Ydh8nKs9DdAO +YJWfbtt3XukBe5VJcmp7OICz88LFc/fArrAnBFdmrVX+0Y2l/5KDW6ItvcXhorpz +sO5hOnPXIs4Hq5TYOJbUw6h9E8O6bxUG4AXcSWqqbLJ6PzEFSBMBnjwBQn4HCWvM +GV6w2+I1QbtOTe6yNzBa7O3yqzSYeTcdpjv/FFngo4oRN1RMiCYc1Ae3hJiIhDlN +SRB1CHPi4MblAgMBAAGjUzBRMB0GA1UdDgQWBBTdlh8T2ze2K81IrZCpUv9yhZq2 +qjAfBgNVHSMEGDAWgBTdlh8T2ze2K81IrZCpUv9yhZq2qjAPBgNVHRMBAf8EBTAD +AQH/MA0GCSqGSIb3DQEBCwUAA4IBAQBDTt9V3LnyBjHDi9pQa+Q8bjVYCMaOSBFE +LJj8GhkXxtfTzqO2u7vkvfz+2MaRDNpL2lePWDB0BwINT+mSYNWjD5bP2mdgJ2nK +BStzWT6MR4hiQ6u6hXy2Q8brqPN+dP4Pay8fXHe3JNadC/nSk4AC3EvVDpghCJJB +1W5az4YmJzK0F6S84AkKnXYdlYyb94RwWSevn7HYZM+xQjoJmBhQ+XnQ7o2uaEur +52igRRHQQ4xrF5JrbGAqfFVqfA8lJDYiAZCG/aNlV0VpgzyxpDxvPFvvlEYJoL63 +/asgSIzYoBknZjNZnPSKcsYGa+0Bjjh7tS50bV++5sN+aW/WDRLd +-----END CERTIFICATE----- diff --git a/components/mosquitto/examples/broker/main/broker.c b/components/mosquitto/examples/broker/main/example_broker.c similarity index 71% rename from components/mosquitto/examples/broker/main/broker.c rename to components/mosquitto/examples/broker/main/example_broker.c index 3e1d09465c..02632bb5f6 100644 --- a/components/mosquitto/examples/broker/main/broker.c +++ b/components/mosquitto/examples/broker/main/example_broker.c @@ -14,6 +14,16 @@ const static char *TAG = "mqtt_broker"; +#if CONFIG_EXAMPLE_BROKER_WITH_TLS +extern const unsigned char servercert_start[] asm("_binary_servercert_pem_start"); +extern const unsigned char servercert_end[] asm("_binary_servercert_pem_end"); +extern const unsigned char serverkey_start[] asm("_binary_serverkey_pem_start"); +extern const unsigned char serverkey_end[] asm("_binary_serverkey_pem_end"); +extern const char cacert_start[] asm("_binary_cacert_pem_start"); +extern const char cacert_end[] asm("_binary_cacert_pem_end"); +#endif + + #if CONFIG_EXAMPLE_BROKER_RUN_LOCAL_MQTT_CLIENT static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_t event_id, void *event_data) { @@ -63,7 +73,13 @@ static void mqtt_app_start(struct mosq_broker_config *config) { esp_mqtt_client_config_t mqtt_cfg = { .broker.address.hostname = "127.0.0.1", - .broker.address.transport = MQTT_TRANSPORT_OVER_TCP, // we support only TCP transport now +#if CONFIG_EXAMPLE_BROKER_WITH_TLS + .broker.address.transport = MQTT_TRANSPORT_OVER_SSL, + .broker.verification.certificate = cacert_start, + .broker.verification.certificate_len = cacert_end - cacert_start, +#else + .broker.address.transport = MQTT_TRANSPORT_OVER_TCP, +#endif .broker.address.port = config->port, }; esp_mqtt_client_handle_t client = esp_mqtt_client_init(&mqtt_cfg); @@ -79,11 +95,22 @@ void app_main(void) ESP_ERROR_CHECK(esp_event_loop_create_default()); ESP_ERROR_CHECK(example_connect()); - struct mosq_broker_config config = { .host = CONFIG_EXAMPLE_BROKER_HOST, .port = CONFIG_EXAMPLE_BROKER_PORT }; + struct mosq_broker_config config = { .host = CONFIG_EXAMPLE_BROKER_HOST, .port = CONFIG_EXAMPLE_BROKER_PORT, .tls_cfg = NULL }; #if CONFIG_EXAMPLE_BROKER_RUN_LOCAL_MQTT_CLIENT mqtt_app_start(&config); #endif + +#if CONFIG_EXAMPLE_BROKER_WITH_TLS + esp_tls_cfg_server_t tls_cfg = { + .servercert_buf = servercert_start, + .servercert_bytes = servercert_end - servercert_start, + .serverkey_buf = serverkey_start, + .serverkey_bytes = serverkey_end - serverkey_start, + }; + config.tls_cfg = &tls_cfg; +#endif + // broker continues to run in this task - mosq_broker_start(&config); + mosq_broker_run(&config); } diff --git a/components/mosquitto/examples/broker/main/servercert.pem b/components/mosquitto/examples/broker/main/servercert.pem new file mode 100644 index 0000000000..8582b46e0d --- /dev/null +++ b/components/mosquitto/examples/broker/main/servercert.pem @@ -0,0 +1,17 @@ +-----BEGIN CERTIFICATE----- +MIICvDCCAaQCFAo5BZTT6BC7rKLiWZA9mwGrEQYeMA0GCSqGSIb3DQEBCwUAMCEx +CzAJBgNVBAYTAkNaMRIwEAYDVQQDDAlFc3ByZXNzaWYwHhcNMjQwNzA4MTQxOTQ0 +WhcNMjUwNzA4MTQxOTQ0WjAUMRIwEAYDVQQDDAkxMjcuMC4wLjEwggEiMA0GCSqG +SIb3DQEBAQUAA4IBDwAwggEKAoIBAQCkCVA8MY/BMZ2e95s+oNMZ2cXEF7lbUL58 +I9OT5Y+0Mxy3mxsezEye0kKXgV7TqzXdWbu8VhDQONkKkeO4n/lPKhULmKQ7gIja +1aiL5Wt07S/jHBaYbMymbssCJaVcFpl+gclZ0oJJKDtJN9wYoUAAXeZkEE47rRWm +W5CZP92bn8TYar+3rjexHvZTtPhSKucsN/YoAtdC5ywRcf9lbhmjV4sMzUSAlPG4 +ZY8sG1mrul1AO2c7OI4lcm+iBo7WiIwtASmqvD/Ahhye5kY00jfAiQJvRl4Da65x +m6NVVUAk3pUsKjOHI/4FisnP0kIJrfMNaiiumroFApuMl3YxEN6tAgMBAAEwDQYJ +KoZIhvcNAQELBQADggEBAD+ML2Dp2GDomHoFxyTmu9msv+8YyZy4VhRGUWnG4k8f +XV+9cBoQkiV8VUDETwjcdp0lRVmyxy8w1x4ovJ/EO5udfXom8gxMS7lZVXw1Iv09 +vPHIpr9kQg2hxTpqoHSRKLRJv796kfYoPK+I43hYlhvewQko7+E8EEns46qXc4I3 +wqrwNOw1gjUzyj5DhW4RCJ9sBS/FaVyliCxICoDXRFhnSXWi0HaEjzq815muN6DG +lD5ENFExpPWpvjyVPQC6tNYRlRCAGKn5qbx/YetGNX3slHJHgHAO2dyPYdiXwkhG +GwQPqXJrvu0k83h5lTeW98wwgcqFEzVHQCJhREdW4uE= +-----END CERTIFICATE----- diff --git a/components/mosquitto/examples/broker/main/serverkey.pem b/components/mosquitto/examples/broker/main/serverkey.pem new file mode 100644 index 0000000000..02c08a1682 --- /dev/null +++ b/components/mosquitto/examples/broker/main/serverkey.pem @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCkCVA8MY/BMZ2e +95s+oNMZ2cXEF7lbUL58I9OT5Y+0Mxy3mxsezEye0kKXgV7TqzXdWbu8VhDQONkK +keO4n/lPKhULmKQ7gIja1aiL5Wt07S/jHBaYbMymbssCJaVcFpl+gclZ0oJJKDtJ +N9wYoUAAXeZkEE47rRWmW5CZP92bn8TYar+3rjexHvZTtPhSKucsN/YoAtdC5ywR +cf9lbhmjV4sMzUSAlPG4ZY8sG1mrul1AO2c7OI4lcm+iBo7WiIwtASmqvD/Ahhye +5kY00jfAiQJvRl4Da65xm6NVVUAk3pUsKjOHI/4FisnP0kIJrfMNaiiumroFApuM +l3YxEN6tAgMBAAECggEBAIAmxohAMA6+tGV9C8vh2QpZGCgaYLT2X9qcIq9oqNwf +ElBe3NEyyqlJmrzCVVMIbwx/DiwVEQ2bW/TmBQI3+I3gUpC8r5HM2R4dzY99rHWs +17yWNRDf7wIXjIIg5w8KmOA8hRGnZCHDTI3nFgwn7dhbg6KpGnWEw2U0I8OWIYty +BX/CvsaWCtkOc1o1bUfnt91YlZlFm7VSK+jdxhnt+A5FJ06CllTaur9nf3u/sLO9 +4SKtd94S/pTlIWM4x+4565fNplNuKLsrnNJHV5eiPwiMb9OZzeFa48z26No2ebHc +zA5PlrzjtQRQaSiWausgZKfLp1+lA9kNNhi6gBPt4AECgYEA2mUZErdAmm0WS+Hl +/AEJWsXzoYLGmOvToVEyUqRNffsfkbTzSHajLGzntUd/ZnQQWh5NkvOPJ3BHTszb +vwVeGIQehpwqoCvF1Nz+XhI9yAGIoSzxq0FMMcmlW0XGdK8D30qbeygBEL2FJnK5 +mixWe3dZx3kujIFJ4VI8S4g/CjcCgYEAwEgT7FCk4xw6NClI3kAQ6NqqJ+qKDwFo +LQQKUep3juA7i84KwqRCVSoKVjJfkVw7MBb520MgnjAwnekyRql6ALDrSUqgXNB9 +R8Sa5b19mmmBDtvh+IrhD6gmAyzXVdGU9fxMnW3iW3sx5Anl/4lx8r7ITcrM9dgd +xY7pwzownDsCgYBkTuz+OKb2hsYn4kC0x3EZfTQSabN3x1EzlcysQoTJKU9tqBPZ +o4v8uqSOEaHFV+euzJ5KsY19ysclvVfs27VFQ2GV6CJ34MMDquE2KeCwfWvYw4DY +bKxnbbuCOYEWVNBNfcH+Bfi/TJzcdPMkidrK6J2WzeUAad2aHSBOfOyfbwKBgEkK +WD8ZdzkqXNW5pQt/7Kx3e9GD34PJtgf7k+wAFAB7H0OBNkcv3F67hIevxOvTzEv9 +PlZTDo3ool8p2UZMVKL0kbwalAYN0Lk1bt28eHzyfOrnDdS69Llc12u3Wekontw+ +ReA7gJPdnVsRg4PpcxaR8EbUtbzhppWILzZQ4WxHAoGALs0n0pDVQlkAuDtNhA/i +7/jIo1hd3fPpWbMfcKeP+TtlpXMu/BCsR5A/u+4iSfLMy9/Ggqad4jUsdd9+myvr +j/3BzbSx7OnD+gg8ao0K2FwO33ncM1iAw3G5QCKs1waHsVen43Oe3GtQxHxxi/G0 +Y4EIG5wkDz4YQOEXacvTWMo= +-----END PRIVATE KEY----- diff --git a/components/mosquitto/idf_component.yml b/components/mosquitto/idf_component.yml index 347cc8f32b..5ef670047f 100644 --- a/components/mosquitto/idf_component.yml +++ b/components/mosquitto/idf_component.yml @@ -1,5 +1,5 @@ version: "2.0.28~0" -url: https://github.com/espressif/esp-protocols/tree/master/components/mosq +url: https://github.com/espressif/esp-protocols/tree/master/components/mosquitto description: The component provides a simple ESP32 port of mosquitto broker dependencies: idf: '>=5.1' diff --git a/components/mosquitto/port/broker.c b/components/mosquitto/port/broker.c index 7742b55980..62cfb29bce 100644 --- a/components/mosquitto/port/broker.c +++ b/components/mosquitto/port/broker.c @@ -94,7 +94,14 @@ static void listeners__stop(void) mosquitto__free(listensock); } -int mosq_broker_start(struct mosq_broker_config *broker_config) +void net__set_tls_config(esp_tls_cfg_server_t *config); + +void mosq_broker_stop(void) +{ + run = 0; +} + +int mosq_broker_run(struct mosq_broker_config *broker_config) { struct mosquitto__config config; @@ -115,6 +122,10 @@ int mosq_broker_start(struct mosq_broker_config *broker_config) config__init(&config); + if (broker_config->tls_cfg) { + net__set_tls_config(broker_config->tls_cfg); + } + db.config = &config; rc = db__open(&config); diff --git a/components/mosquitto/port/include/mosq_broker.h b/components/mosquitto/port/include/mosq_broker.h index 88e2bc6975..362943557f 100644 --- a/components/mosquitto/port/include/mosq_broker.h +++ b/components/mosquitto/port/include/mosq_broker.h @@ -5,6 +5,7 @@ */ #pragma once #include "mosquitto.h" +#include "esp_tls.h" struct mosquitto__config; @@ -17,6 +18,12 @@ struct mosquitto__config; struct mosq_broker_config { char *host; /*!< Address on which the broker is listening for connections */ int port; /*!< Port number of the broker to listen to */ + esp_tls_cfg_server_t *tls_cfg; /*!< ESP-TLS configuration (if TLS transport used) + * Please refer to the ESP-TLS official documentation + * for more details on configuring the TLS options. + * You can open the respective docs with this idf.py command: + * `idf.py docs -sp api-reference/protocols/esp_tls.html` + */ }; /** @@ -28,4 +35,11 @@ struct mosq_broker_config { * @param config Mosquitto configuration structure * @return int Exit code (0 on success) */ -int mosq_broker_start(struct mosq_broker_config *config); +int mosq_broker_run(struct mosq_broker_config *config); + +/** + * @brief Stops running broker + * + * @note After calling this API, function mosq_broker_run() unblocks and returns. + */ +void mosq_broker_stop(void); diff --git a/components/mosquitto/port/net__esp_tls.c b/components/mosquitto/port/net__esp_tls.c new file mode 100644 index 0000000000..078a47f9d9 --- /dev/null +++ b/components/mosquitto/port/net__esp_tls.c @@ -0,0 +1,467 @@ +/* + * SPDX-FileCopyrightText: 2009-2020 Roger Light + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + * + * SPDX-FileContributor: 2024 Espressif Systems (Shanghai) CO LTD + */ + +/* +All rights reserved. This program and the accompanying materials +are made available under the terms of the Eclipse Public License 2.0 +and Eclipse Distribution License v1.0 which accompany this distribution. + +The Eclipse Public License is available at + https://www.eclipse.org/legal/epl-2.0/ +and the Eclipse Distribution License is available at + http://www.eclipse.org/org/documents/edl-v10.php. + +Contributors: + Roger Light - initial implementation and documentation. + Espressif Systems (Shanghai) CO LTD - added support for ESP-TLS based connections +*/ + +#include "config.h" + +# include +# include +# include +# include +# include +# include +# include + +#include +#include +#include +#include +#include + +#ifdef HAVE_NETINET_IN_H +# include +#endif + +#include "mosquitto_broker_internal.h" +#include "mqtt_protocol.h" +#include "memory_mosq.h" +#include "misc_mosq.h" +#include "net_mosq.h" +#include "util_mosq.h" +#include "esp_tls.h" + +#include "sys_tree.h" + +#define MAX_CONNECTIONS (64) + +struct esp_tls_context { + int sock; + esp_tls_t *tls; +}; + +static struct esp_tls_context tls_ctx[MAX_CONNECTIONS]; +static esp_tls_cfg_server_t *tls_cfg; + +void net__set_tls_config(esp_tls_cfg_server_t *config) +{ + if (config) { + tls_cfg = mosquitto__calloc(1, sizeof(esp_tls_cfg_server_t)); + if (tls_cfg) { + memcpy(tls_cfg, config, sizeof(esp_tls_cfg_server_t)); + } else { + log__printf(NULL, MOSQ_LOG_ERR, "Unable to allocate ESP-TLS configuration structure, continuing with plain TCP transport only"); + } + } +} + +void net__broker_init(void) +{ + for (int i = 0; i < MAX_CONNECTIONS; ++i) { + tls_ctx[i].sock = INVALID_SOCKET; + tls_ctx[i].tls = NULL; + } + net__init(); +} + + +void net__broker_cleanup(void) +{ + net__cleanup(); + mosquitto__free(tls_cfg); + tls_cfg = NULL; +} + + +static void net__print_error(unsigned int log, const char *format_str) +{ + char *buf; + buf = strerror(errno); + log__printf(NULL, log, format_str, buf); +} + + +struct mosquitto *net__socket_accept(struct mosquitto__listener_sock *listensock) +{ + mosq_sock_t new_sock = INVALID_SOCKET; + struct mosquitto *new_context; + + new_sock = accept(listensock->sock, NULL, 0); + if (new_sock == INVALID_SOCKET) { + log__printf(NULL, MOSQ_LOG_ERR, + "Unable to accept new connection, system socket count has been exceeded. Try increasing \"ulimit -n\" or equivalent."); + return NULL; + } + + if (tls_cfg) { + // Finds first free spot in the context array + int ctx; + for (ctx = 0; ctx < MAX_CONNECTIONS; ++ctx) { + if (tls_ctx[ctx].sock == INVALID_SOCKET) { + tls_ctx[ctx].sock = new_sock; + tls_ctx[ctx].tls = esp_tls_init(); + if (!tls_ctx[ctx].tls) { + log__printf(NULL, MOSQ_LOG_ERR, "Faled to create a new ESP-TLS context"); + return NULL; + } + break; + } + } + if (ctx >= MAX_CONNECTIONS) { + log__printf(NULL, MOSQ_LOG_ERR, "Unable to create new ESP-TLS connection. Try increasing \"MAX_CONNECTIONS\""); + return NULL; + } + int ret = esp_tls_server_session_create(tls_cfg, new_sock, tls_ctx[ctx].tls); + if (ret != 0) { + log__printf(NULL, MOSQ_LOG_ERR, "Unable to create new ESP-TLS session"); + return NULL; + } + } + + G_SOCKET_CONNECTIONS_INC(); + + if (net__socket_nonblock(&new_sock)) { + return NULL; + } + + if (db.config->set_tcp_nodelay) { + int flag = 1; + if (setsockopt(new_sock, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(int)) != 0) { + log__printf(NULL, MOSQ_LOG_WARNING, "Warning: Unable to set TCP_NODELAY."); + } + } + + new_context = context__init(new_sock); + if (!new_context) { + COMPAT_CLOSE(new_sock); + return NULL; + } + new_context->listener = listensock->listener; + if (!new_context->listener) { + context__cleanup(new_context, true); + return NULL; + } + new_context->listener->client_count++; + + if (new_context->listener->max_connections > 0 && new_context->listener->client_count > new_context->listener->max_connections) { + if (db.config->connection_messages == true) { + log__printf(NULL, MOSQ_LOG_NOTICE, "Client connection from %s denied: max_connections exceeded.", new_context->address); + } + context__cleanup(new_context, true); + return NULL; + } + + if (db.config->connection_messages == true) { + log__printf(NULL, MOSQ_LOG_NOTICE, "New connection from %s:%d on port %d.", + new_context->address, new_context->remote_port, new_context->listener->port); + } + + return new_context; +} + +int net__load_certificates(struct mosquitto__listener *listener) +{ + return MOSQ_ERR_SUCCESS; +} + + +int net__tls_load_verify(struct mosquitto__listener *listener) +{ + return net__load_certificates(listener); +} + + +static int net__socket_listen_tcp(struct mosquitto__listener *listener) +{ + mosq_sock_t sock = INVALID_SOCKET; + struct addrinfo hints; + struct addrinfo *ainfo, *rp; + char service[10]; + int rc; + int ss_opt = 1; + + if (!listener) { + return MOSQ_ERR_INVAL; + } + + snprintf(service, 10, "%d", listener->port); + memset(&hints, 0, sizeof(struct addrinfo)); + if (listener->socket_domain) { + hints.ai_family = listener->socket_domain; + } else { + hints.ai_family = AF_UNSPEC; + } + hints.ai_flags = AI_PASSIVE; + hints.ai_socktype = SOCK_STREAM; + + rc = getaddrinfo(listener->host, service, &hints, &ainfo); + if (rc) { + log__printf(NULL, MOSQ_LOG_ERR, "Error creating listener: %s.", gai_strerror(rc)); + return INVALID_SOCKET; + } + + listener->sock_count = 0; + listener->socks = NULL; + + for (rp = ainfo; rp; rp = rp->ai_next) { + if (rp->ai_family == AF_INET) { + log__printf(NULL, MOSQ_LOG_INFO, "Opening ipv4 listen socket on port %d.", ntohs(((struct sockaddr_in *)rp->ai_addr)->sin_port)); + } else if (rp->ai_family == AF_INET6) { + log__printf(NULL, MOSQ_LOG_INFO, "Opening ipv6 listen socket on port %d.", ntohs(((struct sockaddr_in6 *)rp->ai_addr)->sin6_port)); + } else { + continue; + } + + sock = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol); + if (sock == INVALID_SOCKET) { + net__print_error(MOSQ_LOG_WARNING, "Warning: %s"); + continue; + } + listener->sock_count++; + listener->socks = mosquitto__realloc(listener->socks, sizeof(mosq_sock_t) * (size_t)listener->sock_count); + if (!listener->socks) { + log__printf(NULL, MOSQ_LOG_ERR, "Error: Out of memory."); + freeaddrinfo(ainfo); + COMPAT_CLOSE(sock); + return MOSQ_ERR_NOMEM; + } + listener->socks[listener->sock_count - 1] = sock; + +#ifndef WIN32 + ss_opt = 1; + /* Unimportant if this fails */ + (void)setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &ss_opt, sizeof(ss_opt)); +#endif +#ifdef IPV6_V6ONLY + ss_opt = 1; + (void)setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, &ss_opt, sizeof(ss_opt)); +#endif + + if (net__socket_nonblock(&sock)) { + freeaddrinfo(ainfo); + mosquitto__free(listener->socks); + return 1; + } + + if (listener->bind_interface) { + log__printf(NULL, MOSQ_LOG_ERR, "Error: listener->bind_interface is not supported"); + return 1; + } + + if (bind(sock, rp->ai_addr, rp->ai_addrlen) == -1) { + net__print_error(MOSQ_LOG_ERR, "Error: %s"); + COMPAT_CLOSE(sock); + freeaddrinfo(ainfo); + mosquitto__free(listener->socks); + return 1; + } + + if (listen(sock, 100) == -1) { + net__print_error(MOSQ_LOG_ERR, "Error: %s"); + freeaddrinfo(ainfo); + COMPAT_CLOSE(sock); + mosquitto__free(listener->socks); + return 1; + } + } + freeaddrinfo(ainfo); + + if (listener->bind_interface) { + mosquitto__free(listener->socks); + return 1; + } + + return 0; +} + +/* Creates a socket and listens on port 'port'. + * Returns 1 on failure + * Returns 0 on success. + */ +int net__socket_listen(struct mosquitto__listener *listener) +{ + int rc; + + if (!listener) { + return MOSQ_ERR_INVAL; + } + + rc = net__socket_listen_tcp(listener); + if (rc) { + return rc; + } + + /* We need to have at least one working socket. */ + if (listener->sock_count > 0) { + return 0; + } else { + return 1; + } +} + +int net__socket_get_address(mosq_sock_t sock, char *buf, size_t len, uint16_t *remote_port) +{ + struct sockaddr_storage addr; + socklen_t addrlen; + + memset(&addr, 0, sizeof(struct sockaddr_storage)); + addrlen = sizeof(addr); + if (!getpeername(sock, (struct sockaddr *)&addr, &addrlen)) { + if (addr.ss_family == AF_INET) { + if (remote_port) { + *remote_port = ntohs(((struct sockaddr_in *)&addr)->sin_port); + } + if (inet_ntop(AF_INET, &((struct sockaddr_in *)&addr)->sin_addr.s_addr, buf, (socklen_t)len)) { + return 0; + } + } else if (addr.ss_family == AF_INET6) { + if (remote_port) { + *remote_port = ntohs(((struct sockaddr_in6 *)&addr)->sin6_port); + } + if (inet_ntop(AF_INET6, &((struct sockaddr_in6 *)&addr)->sin6_addr.s6_addr, buf, (socklen_t)len)) { + return 0; + } + } + } + return 1; +} + +// ----------------------------------- + +ssize_t net__read(struct mosquitto *mosq, void *buf, size_t count) +{ + assert(mosq); + errno = 0; + for (int i = 0; i < MAX_CONNECTIONS; ++i) { + if (tls_ctx[i].sock == mosq->sock) { + return esp_tls_conn_read(tls_ctx[i].tls, buf, count); + } + } + return read(mosq->sock, buf, count); +} + +ssize_t net__write(struct mosquitto *mosq, const void *buf, size_t count) +{ + assert(mosq); + errno = 0; + for (int i = 0; i < MAX_CONNECTIONS; ++i) { + if (tls_ctx[i].sock == mosq->sock) { + return esp_tls_conn_write(tls_ctx[i].tls, buf, count); + } + } + return send(mosq->sock, buf, count, MSG_NOSIGNAL); +} + + +int net__socket_nonblock(mosq_sock_t *sock) +{ + int opt; + /* Set non-blocking */ + opt = fcntl(*sock, F_GETFL, 0); + if (opt == -1) { + COMPAT_CLOSE(*sock); + *sock = INVALID_SOCKET; + return MOSQ_ERR_ERRNO; + } + if (fcntl(*sock, F_SETFL, opt | O_NONBLOCK) == -1) { + /* If either fcntl fails, don't want to allow this client to connect. */ + COMPAT_CLOSE(*sock); + *sock = INVALID_SOCKET; + return MOSQ_ERR_ERRNO; + } + return MOSQ_ERR_SUCCESS; +} + + +/* Close a socket associated with a context and set it to -1. + * Returns 1 on failure (context is NULL) + * Returns 0 on success. + */ +int net__socket_close(struct mosquitto *mosq) +{ + int rc = 0; +#ifdef WITH_BROKER + struct mosquitto *mosq_found; +#endif + + assert(mosq); +#ifdef WITH_TLS +#ifdef WITH_WEBSOCKETS + if (!mosq->wsi) +#endif + { + if (mosq->ssl) { + if (!SSL_in_init(mosq->ssl)) { + SSL_shutdown(mosq->ssl); + } + SSL_free(mosq->ssl); + mosq->ssl = NULL; + } + } +#endif + +#ifdef WITH_WEBSOCKETS + if (mosq->wsi) { + if (mosq->state != mosq_cs_disconnecting) { + mosquitto__set_state(mosq, mosq_cs_disconnect_ws); + } + lws_callback_on_writable(mosq->wsi); + } else +#endif + { + if (mosq->sock != INVALID_SOCKET) { +#ifdef WITH_BROKER + HASH_FIND(hh_sock, db.contexts_by_sock, &mosq->sock, sizeof(mosq->sock), mosq_found); + if (mosq_found) { + HASH_DELETE(hh_sock, db.contexts_by_sock, mosq_found); + } +#endif + rc = COMPAT_CLOSE(mosq->sock); + // Finds first free spot in the context array + for (int i = 0; i < MAX_CONNECTIONS; ++i) { + if (tls_ctx[i].sock == mosq->sock) { + tls_ctx[i].sock = INVALID_SOCKET; + esp_tls_server_session_delete(tls_ctx[i].tls); + break; + } + } + + mosq->sock = INVALID_SOCKET; + } + } + +#ifdef WITH_BROKER + if (mosq->listener) { + mosq->listener->client_count--; + mosq->listener = NULL; + } +#endif + return rc; +} + +int net__init(void) +{ + return MOSQ_ERR_SUCCESS; +} + +void net__cleanup(void) +{ +} diff --git a/components/sock_utils/.cz.yaml b/components/sock_utils/.cz.yaml new file mode 100644 index 0000000000..f2260e5f9a --- /dev/null +++ b/components/sock_utils/.cz.yaml @@ -0,0 +1,8 @@ +--- +commitizen: + bump_message: 'bump(sockutls): $current_version -> $new_version' + pre_bump_hooks: python ../../ci/changelog.py sock_utils + tag_format: sock_utils-v$version + version: 0.1.0 + version_files: + - idf_component.yml diff --git a/components/sock_utils/CHANGELOG.md b/components/sock_utils/CHANGELOG.md new file mode 100644 index 0000000000..b08131b51c --- /dev/null +++ b/components/sock_utils/CHANGELOG.md @@ -0,0 +1,7 @@ +# Changelog + +## [0.1.0](https://github.com/espressif/esp-protocols/commits/sock_utils-v0.1.0) + +### Features + +- Add initial support for socket helpers ([31f57ad0](https://github.com/espressif/esp-protocols/commit/31f57ad0)) diff --git a/components/sock_utils/CMakeLists.txt b/components/sock_utils/CMakeLists.txt new file mode 100644 index 0000000000..4f4e189835 --- /dev/null +++ b/components/sock_utils/CMakeLists.txt @@ -0,0 +1,6 @@ +idf_component_register(SRCS "src/getnameinfo.c" + "src/ifaddrs.c" + "src/gai_strerror.c" + "src/socketpair.c" + INCLUDE_DIRS "include" + PRIV_REQUIRES lwip esp_netif) diff --git a/components/esp_wifi_remote/LICENSE b/components/sock_utils/LICENSE similarity index 99% rename from components/esp_wifi_remote/LICENSE rename to components/sock_utils/LICENSE index d645695673..261eeb9e9f 100644 --- a/components/esp_wifi_remote/LICENSE +++ b/components/sock_utils/LICENSE @@ -1,4 +1,3 @@ - Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ diff --git a/components/sock_utils/README.md b/components/sock_utils/README.md new file mode 100644 index 0000000000..e6e95375ac --- /dev/null +++ b/components/sock_utils/README.md @@ -0,0 +1,17 @@ +# Socket Utilities + +This component provides simplified implementations of common socket-related utilities using `lwIP` and `esp_netif`. It is especially useful for porting Linux-based libraries to ESP32 where performance and memory constraints are secondary considerations. + + +## Supported Functions + + +| API | Description | Limitations | +|------------------|-------------------------------------------------------------|-------------------------------------------------------------------| +| `ifaddrs()` | Retrieves interface addresses using `esp_netif` | IPv4 addresses only | +| `socketpair()` | Creates a pair of connected sockets using `lwIP` loopback stream sockets | IPv4 sockets only | +| `pipe()` | Wraps `socketpair()` to provide unidirectional pipe-like functionality | Uses bidirectional sockets in place of true pipes | +| `getnameinfo()` | Converts IP addresses to human-readable form using `lwIP`'s `inet_ntop()` | IPv4 only; supports `NI_NUMERICHOST` and `NI_NUMERICSERV` flags only | +| `gai_strerror()` | Returns error code as a string | Simple numeric string representation only | + +**Note**: `socketpair()` and `pipe()` are built on top of `lwIP` TCP sockets, inheriting the same characteristics. For instance, the maximum transmit buffer size is based on the `TCP_SND_BUF` setting. diff --git a/components/esp_wifi_remote/test/smoke_test/CMakeLists.txt b/components/sock_utils/examples/simple/CMakeLists.txt similarity index 92% rename from components/esp_wifi_remote/test/smoke_test/CMakeLists.txt rename to components/sock_utils/examples/simple/CMakeLists.txt index 413711eafb..c450c72c18 100644 --- a/components/esp_wifi_remote/test/smoke_test/CMakeLists.txt +++ b/components/sock_utils/examples/simple/CMakeLists.txt @@ -5,4 +5,4 @@ cmake_minimum_required(VERSION 3.16) include($ENV{IDF_PATH}/tools/cmake/project.cmake) -project(smoke_test) +project(sock_utils_example) diff --git a/components/sock_utils/examples/simple/README.md b/components/sock_utils/examples/simple/README.md new file mode 100644 index 0000000000..4de95164fc --- /dev/null +++ b/components/sock_utils/examples/simple/README.md @@ -0,0 +1,30 @@ +# Simple example + +This example demonstrates using socket helpers on ESP_PLATFORM + +The functionality of this example is meant to be very generic, so the application is compilable on linux without any IDF dependencies: +```bash +gcc main/app.c -lpthread +``` + +## Example output on ESP_PLATFORM + +``` +I (8073) esp_netif_handlers: example_netif_sta ip: 192.168.0.32, mask: 255.255.255.0, gw: 192.168.0.1 +I (8073) example_connect: Got IPv4 event: Interface "example_netif_sta" address: 192.168.0.32 +I (8073) example_common: Connected to example_netif_sta +I (8083) example_common: - IPv4 address: 192.168.0.32, +I (8093) example_common: - IPv6 address: fe80:0000:0000:0000:XXXX, type: ESP_IP6_ADDR_IS_LINK_LOCAL +I (8103) sock_utils_example: Received signal: IP4 +I (8103) sock_utils_example: IPv4 address of interface "sta": 192.168.0.32 +I (8113) main_task: Returned from app_main() +``` + +## Example output on linux platform + +``` +I[sock_utils_example]: Received signal: IP4 +I[sock_utils_example]: IPv4 address of interface "lo": 127.0.0.1 +I[sock_utils_example]: IPv4 address of interface "en0": 192.168.0.28 +I[sock_utils_example]: IPv4 address of interface "docker0": 172.17.0.1 +``` diff --git a/components/sock_utils/examples/simple/main/CMakeLists.txt b/components/sock_utils/examples/simple/main/CMakeLists.txt new file mode 100644 index 0000000000..1975c93631 --- /dev/null +++ b/components/sock_utils/examples/simple/main/CMakeLists.txt @@ -0,0 +1,2 @@ +idf_component_register(SRCS "app.c" + INCLUDE_DIRS ".") diff --git a/components/sock_utils/examples/simple/main/app.c b/components/sock_utils/examples/simple/main/app.c new file mode 100644 index 0000000000..fd21dcf08c --- /dev/null +++ b/components/sock_utils/examples/simple/main/app.c @@ -0,0 +1,123 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Unlicense OR CC0-1.0 + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef ESP_PLATFORM +#include "nvs_flash.h" +#include "esp_event.h" +#include "esp_netif.h" +#include "esp_log.h" +#include "protocol_examples_common.h" +#else +// Provides simplified support for building on linux (whithout official IDF linux target) +// in order to check with the actual host functionality +// use `gcc main/app.c -lpthread` +#define SIMPLE_LOG( lev, tag, format, ... ) do { printf("%s[%s]: ", lev, tag); printf(format, ##__VA_ARGS__); printf("\n"); } while(0) +#define ESP_LOGE(tag, format, ... ) SIMPLE_LOG("E", tag, format, ##__VA_ARGS__) +#define ESP_LOGI(tag, format, ... ) SIMPLE_LOG("I", tag, format, ##__VA_ARGS__) +#define ESP_ERROR_CHECK(action) action +static void example_connect(void) { } +#endif + +static const char *TAG = "sock_utils_example"; + +static void *reader_thread(void *arg) +{ + int *pipe_fds = (int *)arg; + char buffer[64]; + int len; + while ((len = read(pipe_fds[0], buffer, sizeof(buffer))) < 0) { + if (errno != EAGAIN) { + ESP_LOGE(TAG, "Failed reading from pipe: %d", errno); + return NULL; + } + usleep(100000); + } + buffer[len] = '\0'; + ESP_LOGI(TAG, "Received signal: %s", buffer); + if (strcmp(buffer, "IP4") != 0) { + ESP_LOGE(TAG, "Unknown signal"); + return NULL; + } + + struct ifaddrs *addresses, *addr; + if (getifaddrs(&addresses) == -1) { + ESP_LOGE(TAG, "getifaddrs() failed"); + return NULL; + } + addr = addresses; + + while (addr) { + if (addr->ifa_addr && addr->ifa_addr->sa_family == AF_INET) { // look for IP4 addresses + struct sockaddr_in *sock_addr = (struct sockaddr_in *) addr->ifa_addr; + if ((addr->ifa_flags & IFF_UP) == 0) { + ESP_LOGI(TAG, "Network interface \"%s\" is down", addr->ifa_name); + } else { + if (getnameinfo((struct sockaddr *)sock_addr, sizeof(*sock_addr), + buffer, sizeof(buffer), NULL, 0, NI_NUMERICHOST) != 0) { + freeifaddrs(addresses); + return NULL; + } + ESP_LOGI(TAG, "IPv4 address of interface \"%s\": %s", addr->ifa_name, buffer); + } + } + addr = addr->ifa_next; + } + freeifaddrs(addresses); + return NULL; +} + +static void simple_pipe_example(void) +{ + int pipe_fds[2]; + if (pipe(pipe_fds) == -1) { + ESP_LOGE(TAG, "Failed to create pipe"); + return; + } + + // creates reader thread to wait for a pipe signal + // and print out our IPv4 addresses + pthread_t reader; + pthread_create(&reader, NULL, reader_thread, pipe_fds); + + /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. + * Read "Establishing Wi-Fi or Ethernet Connection" section in + * examples/protocols/README.md for more information about this function. + */ + ESP_ERROR_CHECK(example_connect()); + + // at this point we should have received an IP address -> send signal to the reader thread + const char signal[] = "IP4"; + write(pipe_fds[1], signal, sizeof(signal)); + pthread_join(reader, NULL); + + // Close pipe file descriptors + close(pipe_fds[0]); + close(pipe_fds[1]); +} + +#ifdef ESP_PLATFORM +void app_main(void) +{ + ESP_ERROR_CHECK(nvs_flash_init()); + ESP_ERROR_CHECK(esp_netif_init()); + ESP_ERROR_CHECK(esp_event_loop_create_default()); + simple_pipe_example(); +} +#else +int main(void) +{ + simple_pipe_example(); +} +#endif diff --git a/components/sock_utils/examples/simple/main/idf_component.yml b/components/sock_utils/examples/simple/main/idf_component.yml new file mode 100644 index 0000000000..630a4ffee1 --- /dev/null +++ b/components/sock_utils/examples/simple/main/idf_component.yml @@ -0,0 +1,8 @@ +dependencies: + idf: + version: ">=5.0" + sock_utils: + version: "*" + override_path: '../../../' + protocol_examples_common: + path: ${IDF_PATH}/examples/common_components/protocol_examples_common diff --git a/components/sock_utils/examples/simple/pytest_sockutls.py b/components/sock_utils/examples/simple/pytest_sockutls.py new file mode 100644 index 0000000000..08f267cd06 --- /dev/null +++ b/components/sock_utils/examples/simple/pytest_sockutls.py @@ -0,0 +1,13 @@ +# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD +# SPDX-License-Identifier: Unlicense OR CC0-1.0 + +def test_sockutls(dut): + """ + steps: + 1. Start the example + 2. Check the resultant IPv4 address from station netif + """ + # Signal from the pipe simple implementation + dut.expect('Received signal: IP4') + # and the IPv4 address of the connected netif + dut.expect('IPv4 address of interface "en1"') diff --git a/components/sock_utils/examples/simple/sdkconfig.ci b/components/sock_utils/examples/simple/sdkconfig.ci new file mode 100644 index 0000000000..dcbc3a5a77 --- /dev/null +++ b/components/sock_utils/examples/simple/sdkconfig.ci @@ -0,0 +1,2 @@ +CONFIG_EXAMPLE_CONNECT_WIFI=n +CONFIG_EXAMPLE_CONNECT_ETHERNET=y diff --git a/components/sock_utils/idf_component.yml b/components/sock_utils/idf_component.yml new file mode 100644 index 0000000000..c063f0955c --- /dev/null +++ b/components/sock_utils/idf_component.yml @@ -0,0 +1,6 @@ +version: 0.1.0 +description: The component provides helper implementation of common system/socket utilities +url: https://github.com/espressif/esp-protocols/tree/master/components/sock_utils +dependencies: + idf: + version: '>=5.0' diff --git a/components/sock_utils/include/gai_strerror.h b/components/sock_utils/include/gai_strerror.h new file mode 100644 index 0000000000..ad872b982f --- /dev/null +++ b/components/sock_utils/include/gai_strerror.h @@ -0,0 +1,31 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#include "lwip/sockets.h" +#include "netdb_macros.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef CONFIG_IDF_TARGET_LINUX +// namespace with esp_ on linux to avoid duplication of symbols +#define gai_strerror esp_gai_strerror +#endif + +/** +* @brief Returns a numeric string representing of `getaddrinfo()` error code. +* +* @param[in] ecode Error code returned by `getaddrinfo()`. +* +* @return A pointer to a string describing the error. +*/ +const char *gai_strerror(int ecode); + +#ifdef __cplusplus +} +#endif diff --git a/components/sock_utils/include/getnameinfo.h b/components/sock_utils/include/getnameinfo.h new file mode 100644 index 0000000000..2749dc91cd --- /dev/null +++ b/components/sock_utils/include/getnameinfo.h @@ -0,0 +1,40 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#include "lwip/sockets.h" + +#ifdef CONFIG_IDF_TARGET_LINUX +// namespace with esp_ on linux to avoid conflict of symbols +#define getnameinfo esp_getnameinfo +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/** +* @brief Converts a socket address to a corresponding host and service name. +* +* @param[in] addr Pointer to the socket address structure. +* @param[in] addrlen Length of the socket address. +* @param[out] host Buffer to store the host name. +* @param[in] hostlen Length of the host buffer. +* @param[out] serv Buffer to store the service name. +* @param[in] servlen Length of the service buffer. +* @param[in] flags Flags to modify the behavior of the function. +* +* @return +* - 0 on success. +* - Non-zero on failure, with `errno` set to indicate the error. +*/ +int getnameinfo(const struct sockaddr *addr, socklen_t addrlen, + char *host, socklen_t hostlen, + char *serv, socklen_t servlen, int flags); + +#ifdef __cplusplus +} +#endif diff --git a/components/sock_utils/include/ifaddrs.h b/components/sock_utils/include/ifaddrs.h new file mode 100644 index 0000000000..4c6cd9e3bc --- /dev/null +++ b/components/sock_utils/include/ifaddrs.h @@ -0,0 +1,56 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#include "lwip/sockets.h" +#include "netdb_macros.h" +// include also other related headers to simplify porting of linux libs +#include "getnameinfo.h" +#include "socketpair.h" +#include "gai_strerror.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef CONFIG_IDF_TARGET_LINUX +// namespace with esp_ on linux to avoid duplication of symbols +#define getifaddrs esp_getifaddrs +#define freeifaddrs esp_freeifaddrs +#endif + +/** + * @brief Simplified version of ifaddr struct + */ +struct ifaddrs { + struct ifaddrs *ifa_next; /* Next item in list */ + char *ifa_name; /* Name of interface */ + struct sockaddr *ifa_addr; /* Address of interface */ + unsigned int ifa_flags; +}; + +/** + * @brief Retrieves a list of network interfaces and their addresses. + * + * @param[out] ifap Pointer to a linked list of `struct ifaddrs`. On success, `*ifap` will be set + * to the head of the list. + * + * @return + * - 0 on success. + * - -1 on failure, with `errno` set to indicate the error. + */ +int getifaddrs(struct ifaddrs **ifap); + +/** + * @brief Frees the memory allocated by `getifaddrs()`. + * + * @param[in] ifa Pointer to the linked list of network interfaces to be freed. + */ +void freeifaddrs(struct ifaddrs *ifa); + +#ifdef __cplusplus +} +#endif diff --git a/components/sock_utils/include/netdb_macros.h b/components/sock_utils/include/netdb_macros.h new file mode 100644 index 0000000000..3ec32b3df2 --- /dev/null +++ b/components/sock_utils/include/netdb_macros.h @@ -0,0 +1,34 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#ifndef NI_NUMERICHOST +#define NI_NUMERICHOST 0x1 +#endif + +#ifndef IFF_UP +#define IFF_UP 0x1 +#endif + +#ifndef IFF_LOOPBACK +#define IFF_LOOPBACK 0x8 +#endif + +#ifndef NI_NUMERICSERV +#define NI_NUMERICSERV 0x8 +#endif + +#ifndef NI_DGRAM +#define NI_DGRAM 0x00000010 +#endif + +#ifndef EAI_BADFLAGS +#define EAI_BADFLAGS 3 +#endif + +#ifndef AF_UNIX +#define AF_UNIX 1 +#endif diff --git a/components/esp_wifi_remote/scripts/copyright_header.h b/components/sock_utils/include/poll.h similarity index 53% rename from components/esp_wifi_remote/scripts/copyright_header.h rename to components/sock_utils/include/poll.h index f4f626a7cb..cdd5b79dff 100644 --- a/components/esp_wifi_remote/scripts/copyright_header.h +++ b/components/sock_utils/include/poll.h @@ -3,4 +3,6 @@ * * SPDX-License-Identifier: Apache-2.0 */ -// This file is auto-generated + +// This is a placeholder for poll API +// Note: some libraries require `poll.h` in public include dirs diff --git a/components/sock_utils/include/socketpair.h b/components/sock_utils/include/socketpair.h new file mode 100644 index 0000000000..996a18ed6f --- /dev/null +++ b/components/sock_utils/include/socketpair.h @@ -0,0 +1,49 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#include "lwip/sockets.h" +#include "netdb_macros.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef CONFIG_IDF_TARGET_LINUX +// namespace with esp_ on linux to avoid conflict of symbols +#define socketpair esp_socketpair +#define pipe esp_pipe +#endif + +/** +* @brief Creates a pair of connected sockets. +* +* @param[in] domain Communication domain (e.g., AF_UNIX). +* @param[in] type Socket type (e.g., SOCK_STREAM). +* @param[in] protocol Protocol to be used (usually 0). +* @param[out] sv Array of two integers to store the file descriptors of the created sockets. +* +* @return +* - 0 on success. +* - -1 on failure, with `errno` set to indicate the error. +*/ +int socketpair(int domain, int type, int protocol, int sv[2]); + +/** + * @brief Creates a unidirectional data channel (pipe). + * + * @param[out] pipefd Array of two integers where the file descriptors for the read and write ends + * of the pipe will be stored. + * + * @return + * - 0 on success. + * - -1 on failure, with `errno` set to indicate the error. + */ +int pipe(int pipefd[2]); + +#ifdef __cplusplus +} +#endif diff --git a/components/sock_utils/src/gai_strerror.c b/components/sock_utils/src/gai_strerror.c new file mode 100644 index 0000000000..a4060cf2f0 --- /dev/null +++ b/components/sock_utils/src/gai_strerror.c @@ -0,0 +1,17 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include +#include "gai_strerror.h" + +_Thread_local char gai_strerror_string[32]; + +const char *gai_strerror(int ecode) +{ + if (snprintf(gai_strerror_string, sizeof(gai_strerror_string), "EAI error:%d", ecode) < 0) { + return "gai_strerror() failed"; + } + return gai_strerror_string; +} diff --git a/components/sock_utils/src/getnameinfo.c b/components/sock_utils/src/getnameinfo.c new file mode 100644 index 0000000000..0b939c5313 --- /dev/null +++ b/components/sock_utils/src/getnameinfo.c @@ -0,0 +1,54 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include +#include "lwip/sockets.h" +#include "lwip/netdb.h" +#include "ifaddrs.h" +#include "esp_check.h" + +int getnameinfo(const struct sockaddr *addr, socklen_t addrlen, + char *host, socklen_t hostlen, + char *serv, socklen_t servlen, int flags) +{ + // Validate flags to ensure only allowed flags are passed. + if (flags & ~(NI_NUMERICHOST | NI_NUMERICSERV | NI_DGRAM)) { + return EAI_BADFLAGS; + } + + const struct sockaddr_in *sinp = (const struct sockaddr_in *) addr; + + switch (addr->sa_family) { + case AF_INET: + // Handle numeric host address + if (flags & NI_NUMERICHOST) { + if (host == NULL || hostlen == 0) { + return 0; + } + if (inet_ntop(AF_INET, &sinp->sin_addr, host, hostlen) == NULL) { + return EOVERFLOW; // Error if address couldn't be converted + } + } + + // Handle numeric service (port) + if (flags & NI_NUMERICSERV) { + // Print the port number, but for UDP services (if NI_DGRAM), we treat it the same way + int port = ntohs(sinp->sin_port); // Convert port from network byte order + if (serv == NULL || servlen == 0) { + return 0; + } + if (snprintf(serv, servlen, "%d", port) < 0) { + return EOVERFLOW; // Error if snprintf failed + } + } + + break; + + default: + return EAI_FAMILY; // Unsupported address family + } + + return 0; +} diff --git a/components/sock_utils/src/ifaddrs.c b/components/sock_utils/src/ifaddrs.c new file mode 100644 index 0000000000..bbb37814e8 --- /dev/null +++ b/components/sock_utils/src/ifaddrs.c @@ -0,0 +1,101 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include +#include +#include "esp_netif.h" +#include "esp_check.h" +#include +#include "ifaddrs.h" + +static const char *TAG = "sockutls_getifaddr"; + + +static esp_err_t getifaddrs_unsafe(void *ctx) +{ + struct ifaddrs **ifap = ctx; + struct ifaddrs *ifaddr = NULL; + struct ifaddrs **next_addr = NULL; + struct sockaddr_in *addr_in = NULL; + esp_netif_t *netif = NULL; + char if_name[5]; // lwip netif name buffer (e.g. `st1`, 2 letters + number) + esp_netif_ip_info_t ip; + esp_err_t ret = ESP_OK; + + while ((netif = esp_netif_next_unsafe(netif)) != NULL) { + ESP_GOTO_ON_FALSE((ifaddr = (struct ifaddrs *)calloc(1, sizeof(struct ifaddrs))), + ESP_ERR_NO_MEM, err, TAG, "Failed to allocate ifaddr"); + if (next_addr == NULL) { // the first address -> attach the head + *ifap = ifaddr; + } else { + *next_addr = ifaddr; // attach next addr + } + ESP_GOTO_ON_ERROR(esp_netif_get_netif_impl_name(netif, if_name), err, TAG, "Failed to get netif name"); + ESP_GOTO_ON_FALSE((ifaddr->ifa_name = strdup(if_name)), + ESP_ERR_NO_MEM, err, TAG, "Failed to allocate if name"); + ESP_GOTO_ON_FALSE((addr_in = (struct sockaddr_in *)calloc(1, sizeof(struct sockaddr_in))), + ESP_ERR_NO_MEM, err, TAG, "Failed to allocate addr_in"); + ifaddr->ifa_addr = (struct sockaddr *)addr_in; + ESP_GOTO_ON_ERROR(esp_netif_get_ip_info(netif, &ip), err, TAG, "Failed to get netif IP"); + ESP_LOGD(TAG, "IPv4 address: " IPSTR, IP2STR(&ip.ip)); + addr_in->sin_family = AF_INET; + addr_in->sin_addr.s_addr = ip.ip.addr; + ifaddr->ifa_flags = esp_netif_is_netif_up(netif) ? IFF_UP : 0; + next_addr = &ifaddr->ifa_next; + } + if (next_addr == NULL) { + *ifap = NULL; // no addresses found + } else { + *next_addr = NULL; // terminate the list + } + return ret; + +err: + if (next_addr) { + *next_addr = NULL; + freeifaddrs(*ifap); + } else { + freeifaddrs(ifaddr); + } + *ifap = NULL; + return ret; + +} + +int getifaddrs(struct ifaddrs **ifap) +{ + if (ifap == NULL) { + errno = EINVAL; + return -1; // Invalid argument + } + + esp_err_t ret = esp_netif_tcpip_exec(getifaddrs_unsafe, ifap); + switch (ret) { + case ESP_OK: + return 0; + case ESP_ERR_NO_MEM: + errno = ENOMEM; + return -1; + case ESP_ERR_INVALID_ARG: + case ESP_ERR_ESP_NETIF_INVALID_PARAMS: + errno = EINVAL; + return -1; + default: + case ESP_FAIL: + errno = EIO; // Generic I/O Error + return -1; + } +} + +void freeifaddrs(struct ifaddrs *ifa) +{ + while (ifa != NULL) { + struct ifaddrs *next = ifa->ifa_next; + free(ifa->ifa_name); + free(ifa->ifa_addr); + free(ifa); + ifa = next; + } +} diff --git a/components/sock_utils/src/socketpair.c b/components/sock_utils/src/socketpair.c new file mode 100644 index 0000000000..6573e50ef0 --- /dev/null +++ b/components/sock_utils/src/socketpair.c @@ -0,0 +1,76 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include +#include "lwip/sockets.h" +#include "socketpair.h" +#include "esp_check.h" + +#define INVALID_SOCKET (-1) + +static const char *TAG = "socket_helpers"; + +int socketpair(int domain, int type, int protocol, int sv[2]) +{ + if (protocol != 0 || type != SOCK_STREAM || domain != AF_UNIX) { + errno = ENOSYS; // not implemented + return -1; + } + struct sockaddr_storage ss; + struct sockaddr_in *sa = (struct sockaddr_in *)&ss; + socklen_t ss_len = sizeof(struct sockaddr_in); + int fd1 = INVALID_SOCKET; + int fd2 = INVALID_SOCKET; + int listenfd = INVALID_SOCKET; + int ret = 0; // Success + + sa->sin_family = AF_INET; + sa->sin_addr.s_addr = htonl(INADDR_LOOPBACK); + sa->sin_port = 0; + listenfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + ESP_GOTO_ON_FALSE(listenfd != INVALID_SOCKET, -1, err, TAG, "Cannot create listening socket"); + ESP_GOTO_ON_FALSE(listen(listenfd, 1) == 0, -1, err, TAG, "Failed to listen"); + + memset(&ss, 0, sizeof(ss)); + ss_len = sizeof(ss); + ESP_GOTO_ON_FALSE(getsockname(listenfd, (struct sockaddr *)&ss, &ss_len) >= 0, -1, err, TAG, "getsockname failed"); + + sa->sin_family = AF_INET; + sa->sin_addr.s_addr = htonl(INADDR_LOOPBACK); + + fd1 = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + ESP_GOTO_ON_FALSE(fd1 != INVALID_SOCKET, -1, err, TAG, "Cannot create read side socket"); + ESP_GOTO_ON_FALSE(connect(fd1, (struct sockaddr *)&ss, ss_len) >= 0, -1, err, TAG, "Failed to connect fd1"); + fd2 = accept(listenfd, NULL, 0); + ESP_GOTO_ON_FALSE(fd2 != INVALID_SOCKET, -1, err, TAG, "Failed to accept fd2"); + + close(listenfd); + sv[0] = fd1; + sv[1] = fd2; + return ret; + +err: + if (listenfd != INVALID_SOCKET) { + close(listenfd); + } + if (fd1 != INVALID_SOCKET) { + close(fd1); + } + return ret; +} + +int pipe(int pipefd[2]) +{ + if (socketpair(AF_UNIX, SOCK_STREAM, 0, pipefd) == -1) { + return -1; + } + // Close the unwanted ends to make it a unidirectional pipe + if (shutdown(pipefd[0], SHUT_WR) == -1 || shutdown(pipefd[1], SHUT_RD) == -1) { + close(pipefd[0]); + close(pipefd[1]); + return -1; + } + return 0; +} diff --git a/components/sock_utils/test/host/CMakeLists.txt b/components/sock_utils/test/host/CMakeLists.txt new file mode 100644 index 0000000000..2c0886a818 --- /dev/null +++ b/components/sock_utils/test/host/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.16) + +set(COMPONENTS main) + +include($ENV{IDF_PATH}/tools/cmake/project.cmake) + +project(sock_utils_host_test) diff --git a/components/sock_utils/test/host/main/CMakeLists.txt b/components/sock_utils/test/host/main/CMakeLists.txt new file mode 100644 index 0000000000..d1c9998ce5 --- /dev/null +++ b/components/sock_utils/test/host/main/CMakeLists.txt @@ -0,0 +1,6 @@ +idf_component_register(SRCS "test_sock_utils.cpp" + INCLUDE_DIRS "$ENV{IDF_PATH}/tools" + WHOLE_ARCHIVE) + +target_compile_options(${COMPONENT_LIB} PUBLIC -fsanitize=address -fconcepts) +target_link_options(${COMPONENT_LIB} PUBLIC -fsanitize=address) diff --git a/components/sock_utils/test/host/main/idf_component.yml b/components/sock_utils/test/host/main/idf_component.yml new file mode 100644 index 0000000000..54750a85bb --- /dev/null +++ b/components/sock_utils/test/host/main/idf_component.yml @@ -0,0 +1,5 @@ +dependencies: + espressif/catch2: "^3.4.0" + sock_utils: + version: "*" + override_path: '../../../' diff --git a/components/sock_utils/test/host/main/test_sock_utils.cpp b/components/sock_utils/test/host/main/test_sock_utils.cpp new file mode 100644 index 0000000000..e1d3facf6d --- /dev/null +++ b/components/sock_utils/test/host/main/test_sock_utils.cpp @@ -0,0 +1,167 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include "ifaddrs.h" +#include "esp_netif.h" +#include "esp_event.h" +#include "catch2/catch_test_macros.hpp" +#include "catch2/catch_session.hpp" + +#define TEST_PORT_NUMBER 3333 +#define TEST_PORT_STRING "3333" + +static char buffer[64]; + +static esp_err_t dummy_transmit(void *h, void *buffer, size_t len) +{ + return ESP_OK; +} + +static esp_err_t dummy_transmit_wrap(void *h, void *buffer, size_t len, void *pbuf) +{ + return ESP_OK; +} + +static esp_netif_t *create_test_netif(const char *if_key, uint8_t last_octet) +{ + esp_netif_inherent_config_t base_cfg = ESP_NETIF_INHERENT_DEFAULT_WIFI_STA(); + esp_netif_ip_info_t ip = { }; + ip.ip.addr = ESP_IP4TOADDR(1, 2, 3, last_octet); + base_cfg.ip_info = &ip; + base_cfg.if_key = if_key; + // create a dummy driver, so the netif could be started and set up + base_cfg.flags = ESP_NETIF_FLAG_AUTOUP; + esp_netif_driver_ifconfig_t driver_cfg = {}; + driver_cfg.handle = (esp_netif_iodriver_handle)1; + driver_cfg.transmit = dummy_transmit; + driver_cfg.transmit_wrap = dummy_transmit_wrap; + esp_netif_config_t cfg = { .base = &base_cfg, .driver = &driver_cfg, .stack = ESP_NETIF_NETSTACK_DEFAULT_WIFI_STA }; + esp_netif_t *netif = esp_netif_new(&cfg); + // need to start the netif to be considered in tests + esp_netif_action_start(netif, nullptr, 0, nullptr); + return netif; +} + +TEST_CASE("esp_getnameinfo() for IPv4", "[sock_utils]") +{ + struct sockaddr_in sock_addr = {}; + sock_addr.sin_family = AF_INET; + sock_addr.sin_port = htons(TEST_PORT_NUMBER); // sock_addr fields are in network byte order + REQUIRE(esp_getnameinfo((struct sockaddr *)&sock_addr, sizeof(sock_addr), buffer, sizeof(buffer), NULL, 0, NI_NUMERICHOST) == 0); + CHECK(strcmp("0.0.0.0", buffer) == 0); + CHECK(esp_getnameinfo((struct sockaddr *)&sock_addr, sizeof(sock_addr), NULL, 0, buffer, sizeof(buffer), NI_NUMERICSERV) == 0); + CHECK(strcmp(TEST_PORT_STRING, buffer) == 0); +} + +TEST_CASE("esp_getnameinfo() for IPv6", "[sock_utils]") +{ + struct sockaddr_in sock_addr = {}; + sock_addr.sin_family = AF_INET6; + // IPv6 not supported for now + CHECK(esp_getnameinfo((struct sockaddr *)&sock_addr, sizeof(sock_addr), buffer, sizeof(buffer), NULL, 0, NI_NUMERICHOST) != 0); +} + +static void test_getifaddr(int expected_nr_of_addrs) +{ + struct ifaddrs *addresses, *addr; + int nr_of_addrs = 0; + + CHECK(esp_getifaddrs(&addresses) != -1); + addr = addresses; + + while (addr) { + ++nr_of_addrs; + if (addr->ifa_addr && addr->ifa_addr->sa_family == AF_INET) { // look for IP4 addresses + struct sockaddr_in *sock_addr = (struct sockaddr_in *) addr->ifa_addr; + if (esp_getnameinfo((struct sockaddr *)sock_addr, sizeof(*sock_addr), + buffer, sizeof(buffer), NULL, 0, NI_NUMERICHOST) != 0) { + printf("esp_getnameinfo() failed\n"); + } else { + printf("IPv4 address of interface \"%s\": %s\n", addr->ifa_name, buffer); + if (strcmp(addr->ifa_name, "st1") == 0) { + CHECK(strcmp("1.2.3.1", buffer) == 0); + } else if (strcmp(addr->ifa_name, "st2") == 0) { + CHECK(strcmp("1.2.3.2", buffer) == 0); + } else { + FAIL("unexpected network interface"); + } + } + } + addr = addr->ifa_next; + } + // check that we got 1 address with exact content + CHECK(nr_of_addrs == expected_nr_of_addrs); + esp_freeifaddrs(addresses); +} + +TEST_CASE("esp_getifaddrs() with 0, 1, and 2 addresses", "[sock_utils]") +{ + test_getifaddr(0); + esp_netif_t *esp_netif = create_test_netif("station", 1); // st1 + REQUIRE(esp_netif != NULL); + test_getifaddr(1); + esp_netif_t *esp_netif2 = create_test_netif("station2", 2); // st2 + REQUIRE(esp_netif2 != NULL); + test_getifaddr(2); + esp_netif_destroy(esp_netif); + esp_netif_destroy(esp_netif2); +} + +static void test_pipe(int read_fd, int write_fd) +{ + CHECK(read_fd >= 0); + CHECK(write_fd >= 0); + CHECK(write(write_fd, buffer, 1) > 0); + CHECK(write(write_fd, buffer, 1) > 0); + CHECK(read(read_fd, buffer, 1) == 1); + CHECK(read(read_fd, buffer, 1) == 1); +} + +TEST_CASE("socketpair()", "[sock_utils]") +{ + int fds[2]; + CHECK(esp_socketpair(AF_UNIX, SOCK_STREAM, 0, fds) == 0); + printf("socketpair created fds: %d, %d\n", fds[0], fds[1]); + // check both directions + test_pipe(fds[0], fds[1]); + test_pipe(fds[1], fds[0]); + close(fds[0]); + close(fds[1]); +} + +TEST_CASE("pipe()", "[sock_utils]") +{ + int fds[2]; + CHECK(esp_pipe(fds) == 0); + printf("pipe created fds: %d, %d\n", fds[0], fds[1]); + // check only one direction + test_pipe(fds[0], fds[1]); + close(fds[0]); + close(fds[1]); +} + +TEST_CASE("gai_strerror()", "[sock_utils]") +{ + const char *str_error = esp_gai_strerror(EAI_BADFLAGS); + CHECK(str_error != NULL); +} + + +extern "C" void app_main(void) +{ + ESP_ERROR_CHECK(esp_netif_init()); + ESP_ERROR_CHECK(esp_event_loop_create_default()); + + Catch::Session session; + + int failures = session.run(); + if (failures > 0) { + printf("TEST FAILED! number of failures=%d\n", failures); + exit(1); + } else { + printf("Test passed!\n"); + exit(0); + } +} diff --git a/components/sock_utils/test/host/sdkconfig.defaults b/components/sock_utils/test/host/sdkconfig.defaults new file mode 100644 index 0000000000..e71578ad1b --- /dev/null +++ b/components/sock_utils/test/host/sdkconfig.defaults @@ -0,0 +1,7 @@ +# This file was generated using idf.py save-defconfig. It can be edited manually. +# Espressif IoT Development Framework (ESP-IDF) 5.4.0 Project Minimal Configuration +# +CONFIG_IDF_TARGET="linux" +CONFIG_COMPILER_CXX_EXCEPTIONS=y +CONFIG_FREERTOS_HZ=1000 +CONFIG_LWIP_ENABLE=y diff --git a/docs/asio/en/index.rst b/docs/asio/en/index.rst index 1a8b926a92..6700db7156 100644 --- a/docs/asio/en/index.rst +++ b/docs/asio/en/index.rst @@ -31,13 +31,13 @@ Internal asio settings for ESP include Application Example ------------------- -ESP examples are based on standard asio :example:`examples <../../../components/asio/examples>`: - -- :example:`asio_chat <../../../components/asio/examples/asio_chat>` -- :example:`async_request <../../../components/asio/examples/async_request>` -- :example:`socks4 <../../../components/asio/examples/socks4>` -- :example:`ssl_client_server <../../../components/asio/examples/ssl_client_server>` -- :example:`tcp_echo_server <../../../components/asio/examples/tcp_echo_server>` -- :example:`udp_echo_server <../../../components/asio/examples/udp_echo_server>` +ESP examples are based on standard asio :component:`asio/examples`: + +- :component:`asio/examples/asio_chat` +- :component:`asio/examples/async_request` +- :component:`asio/examples/socks4` +- :component:`asio/examples/ssl_client_server` +- :component:`asio/examples/tcp_echo_server` +- :component:`asio/examples/udp_echo_server` Please refer to the specific example README.md for details diff --git a/docs/asio/generate_docs b/docs/asio/generate_docs index 08c79b8442..014c7e3959 100755 --- a/docs/asio/generate_docs +++ b/docs/asio/generate_docs @@ -2,7 +2,7 @@ rm -rf docs -build-docs --target esp32 --language en +build-docs --target esp32 --language en --project-path ../../ mkdir -p docs/generic mv _build/en/esp32/html docs/generic diff --git a/docs/esp_modem/en/README.rst b/docs/esp_modem/en/README.rst index fbe4749677..edf9645c52 100644 --- a/docs/esp_modem/en/README.rst +++ b/docs/esp_modem/en/README.rst @@ -197,7 +197,7 @@ we need to timely interrupt to process incoming data. Here'are few suggestions t * Increase internal UART rx buffer size * Increase UART terminal task priority * Use UART flow control -If none of the above helps, you can check the test ``target_ota``, which performs OTA in two steps -- first read the data, then pass the data to mbedTLS. See the test ``README.md`` for more details. +If none of the above helps, you can check the test :component:`esp_modem/test/target_ota`, which performs OTA in two steps -- first read the data, then pass the data to mbedTLS. See the test ``README.md`` for more details. Potential issues when using CMUX mode and these devices: @@ -234,3 +234,35 @@ this patch to adapt the exit sequence https://github.com/espressif/esp-protocols if ((frame_header[3] & 1) == 0) { if (frame_header_offset + frame.len <= 4) { frame_header_offset += frame.len; + +4) Device CAVLI C16QS does not correctly enter CMUX mode with esp_modem. +The CMUX as defined in 3GPP TS 27.010: SABM response (paragraph 5.4.1) +should be a UA frame (upon success, DM frame on failure). +This device however responds with 0x3F, which is neither UA nor DM. +You can apply the below patch to adapt the entry sequence + +:: + + diff --git a/components/esp_modem/src/esp_modem_cmux.cpp b/components/esp_modem/src/esp_modem_cmux.cpp + index c47e13b..7afbf73 100644 + --- a/components/esp_modem/src/esp_modem_cmux.cpp + +++ b/components/esp_modem/src/esp_modem_cmux.cpp + @@ -137,7 +137,8 @@ bool CMux::data_available(uint8_t *data, size_t len) + } else { + return false; + } + - } else if (data == nullptr && type == (FT_UA | PF) && len == 0) { // notify the initial SABM command + + } else if (data == nullptr && (type == (FT_UA | PF) || type == 0x3f) && len == 0) { // notify the initial SABM command + Scoped l(lock); + sabm_ack = dlci; + } else if (data == nullptr && dlci > 0) { + @@ -238,8 +239,7 @@ bool CMux::on_header(CMuxFrame &frame) + type = frame_header[2]; + // Sanity check for expected values of DLCI and type, + // since CRC could be evaluated after the frame payload gets received + - if (dlci > MAX_TERMINALS_NUM || (frame_header[1] & 0x01) == 0 || + - (((type & FT_UIH) != FT_UIH) && type != (FT_UA | PF) ) ) { + + if (dlci > MAX_TERMINALS_NUM) { + recover_protocol(protocol_mismatch_reason::UNEXPECTED_HEADER); + return true; + } diff --git a/test_app/CMakeLists.txt b/test_app/CMakeLists.txt index 3743c581f6..bda7a057a9 100644 --- a/test_app/CMakeLists.txt +++ b/test_app/CMakeLists.txt @@ -14,6 +14,7 @@ set(EXTRA_COMPONENT_DIRS ../components/console_cmd_wifi ../components/console_simple_init ../components/mbedtls_cxx + ../components/sock_utils ../components/mdns)