From 1cb9ba5076d9b0e8b6fc68a8c575333be6981c7b Mon Sep 17 00:00:00 2001 From: Harshit Malpani Date: Tue, 22 Feb 2022 17:10:28 +0530 Subject: [PATCH] Push out `coap` to idf-extra-component repository --- .gitlab/CODEOWNERS | 1 - .gitlab/ci/rules.yml | 2 - .gitmodules | 4 -- components/coap/CMakeLists.txt | 47 ------------ components/coap/Kconfig | 72 ------------------- components/coap/libcoap | 1 - components/coap/port/include/coap3/coap.h | 51 ------------- components/coap/port/include/coap_config.h | 42 ----------- .../coap/port/include/coap_config_posix.h | 60 ---------------- docs/en/COPYRIGHT.rst | 3 - .../migration-guides/removed-components.rst | 1 + .../coap_client/main/idf_component.yml | 2 + .../coap_server/main/idf_component.yml | 2 + tools/ci/check_copyright_ignore.txt | 3 - tools/ci/check_public_headers_exceptions.txt | 2 - tools/ci/static-analysis-rules.yml | 1 - 16 files changed, 5 insertions(+), 289 deletions(-) delete mode 100644 components/coap/CMakeLists.txt delete mode 100644 components/coap/Kconfig delete mode 160000 components/coap/libcoap delete mode 100644 components/coap/port/include/coap3/coap.h delete mode 100644 components/coap/port/include/coap_config.h delete mode 100644 components/coap/port/include/coap_config_posix.h create mode 100644 examples/protocols/coap_client/main/idf_component.yml create mode 100644 examples/protocols/coap_server/main/idf_component.yml diff --git a/.gitlab/CODEOWNERS b/.gitlab/CODEOWNERS index 8986617f85..78e54c340f 100644 --- a/.gitlab/CODEOWNERS +++ b/.gitlab/CODEOWNERS @@ -71,7 +71,6 @@ /components/bootloader_support/bootloader_flash/ @esp-idf-codeowners/peripherals /components/bt/ @esp-idf-codeowners/bluetooth /components/cmock/ @esp-idf-codeowners/system -/components/coap/ @esp-idf-codeowners/app-utilities /components/console/ @esp-idf-codeowners/system @esp-idf-codeowners/app-utilities /components/cxx/ @esp-idf-codeowners/system /components/driver/ @esp-idf-codeowners/peripherals diff --git a/.gitlab/ci/rules.yml b/.gitlab/ci/rules.yml index b39b28dadd..3932f2f9c0 100644 --- a/.gitlab/ci/rules.yml +++ b/.gitlab/ci/rules.yml @@ -168,8 +168,6 @@ - "components/cmock/CMock" - "components/cmock/CMock/vendor/c_exception" - "components/cmock/CMock/vendor/unity" - - "components/coap/libcoap" - - "components/coap/libcoap/ext/tinydtls" - "components/esp_phy/lib" - "components/esp_wifi/lib" - "components/esptool_py/esptool" diff --git a/.gitmodules b/.gitmodules index 22072ae29f..860a0d4bac 100644 --- a/.gitmodules +++ b/.gitmodules @@ -15,10 +15,6 @@ path = components/bootloader/subproject/components/micro-ecc/micro-ecc url = ../../kmackay/micro-ecc.git -[submodule "components/coap/libcoap"] - path = components/coap/libcoap - url = ../../obgm/libcoap.git - [submodule "components/spiffs/spiffs"] path = components/spiffs/spiffs url = ../../pellepl/spiffs.git diff --git a/components/coap/CMakeLists.txt b/components/coap/CMakeLists.txt deleted file mode 100644 index 77576e0a40..0000000000 --- a/components/coap/CMakeLists.txt +++ /dev/null @@ -1,47 +0,0 @@ -if(NOT CONFIG_LWIP_IPV6 AND NOT CMAKE_BUILD_EARLY_EXPANSION) - message(STATUS "IPV6 support is disabled so the coap component will not be built") - # note: the component is still included in the build so it can become visible again in config - # without needing to re-run CMake. However no source or header files are built. - idf_component_register() - return() -endif() - -set(include_dirs port/include port/include libcoap/include) - -set(srcs - "libcoap/src/address.c" - "libcoap/src/async.c" - "libcoap/src/block.c" - "libcoap/src/coap_asn1.c" - "libcoap/src/coap_cache.c" - "libcoap/src/coap_debug.c" - "libcoap/src/coap_event.c" - "libcoap/src/coap_hashkey.c" - "libcoap/src/coap_io.c" - "libcoap/src/coap_mbedtls.c" - "libcoap/src/coap_notls.c" - "libcoap/src/coap_prng.c" - "libcoap/src/coap_session.c" - "libcoap/src/coap_tcp.c" - "libcoap/src/coap_time.c" - "libcoap/src/encode.c" - "libcoap/src/mem.c" - "libcoap/src/net.c" - "libcoap/src/option.c" - "libcoap/src/pdu.c" - "libcoap/src/resource.c" - "libcoap/src/str.c" - "libcoap/src/subscribe.c" - "libcoap/src/uri.c") - -idf_component_register(SRCS "${srcs}" - INCLUDE_DIRS "${include_dirs}" - REQUIRES lwip mbedtls) - -# Silence format truncation warning, until it is fixed upstream -# set_source_files_properties(libcoap/src/coap_debug.c PROPERTIES COMPILE_FLAGS -Wno-format-truncation) - -# Needed for coap headers in public builds, also. -# -# TODO: find a way to move this to a port header -target_compile_definitions(${COMPONENT_LIB} PUBLIC WITH_POSIX) diff --git a/components/coap/Kconfig b/components/coap/Kconfig deleted file mode 100644 index 1221523c2b..0000000000 --- a/components/coap/Kconfig +++ /dev/null @@ -1,72 +0,0 @@ -menu "CoAP Configuration" - visible if LWIP_IPV6 - - choice COAP_MBEDTLS_ENCRYPTION_MODE - prompt "CoAP Encryption method" - default COAP_MBEDTLS_PSK - help - If the CoAP information is to be encrypted, the encryption environment - can be set up in one of two ways (default being Pre-Shared key mode) - - - Encrypt using defined Pre-Shared Keys (PSK if uri includes coaps://) - - Encrypt using defined Public Key Infrastructure (PKI if uri includes coaps://) - - config COAP_MBEDTLS_PSK - bool "Pre-Shared Keys" - - config COAP_MBEDTLS_PKI - bool "PKI Certificates" - - endchoice #COAP_MBEDTLS_ENCRYPTION_MODE - - config COAP_MBEDTLS_DEBUG - bool "Enable CoAP debugging" - default n - help - Enable CoAP debugging functions at compile time for the example code. - - If this option is enabled, call coap_set_log_level() - at runtime in order to enable CoAP debug output via the ESP - log mechanism. - - choice COAP_MBEDTLS_DEBUG_LEVEL - bool "Set CoAP debugging level" - depends on COAP_MBEDTLS_DEBUG - default COAP_LOG_WARNING - help - Set CoAP debugging level - - config COAP_LOG_EMERG - bool "Emergency" - config COAP_LOG_ALERT - bool "Alert" - config COAP_LOG_CRIT - bool "Critical" - config COAP_LOG_ERROR - bool "Error" - config COAP_LOG_WARNING - bool "Warning" - config COAP_LOG_NOTICE - bool "Notice" - config COAP_LOG_INFO - bool "Info" - config COAP_LOG_DEBUG - bool "Debug" - config COAP_LOG_MBEDTLS - bool "mbedTLS" - endchoice - - config COAP_LOG_DEFAULT_LEVEL - int - default 0 if !COAP_MBEDTLS_DEBUG - default 0 if COAP_LOG_EMERG - default 1 if COAP_LOG_ALERT - default 2 if COAP_LOG_CRIT - default 3 if COAP_LOG_ERROR - default 4 if COAP_LOG_WARNING - default 5 if COAP_LOG_NOTICE - default 6 if COAP_LOG_INFO - default 7 if COAP_LOG_DEBUG - default 9 if COAP_LOG_MBEDTLS - -endmenu diff --git a/components/coap/libcoap b/components/coap/libcoap deleted file mode 160000 index 3aa11612c1..0000000000 --- a/components/coap/libcoap +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3aa11612c143c9734d72022720f33e12506f7a2c diff --git a/components/coap/port/include/coap3/coap.h b/components/coap/port/include/coap3/coap.h deleted file mode 100644 index c69d2734b3..0000000000 --- a/components/coap/port/include/coap3/coap.h +++ /dev/null @@ -1,51 +0,0 @@ -/* Modify head file implementation for ESP32 platform. - * - * Uses libcoap software implementation for failover when concurrent - * define operations are in use. - * - * coap.h -- main header file for CoAP stack of libcoap - * - * Copyright (C) 2010-2012,2015-2016 Olaf Bergmann - * 2015 Carsten Schoenert - * - * Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD - * - * This file is part of the CoAP library libcoap. Please see README for terms - * of use. - */ - -#ifndef _COAP_H_ -#define _COAP_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "coap3/libcoap.h" - -#include "coap3/coap_forward_decls.h" -#include "coap3/address.h" -#include "coap3/async.h" -#include "coap3/block.h" -#include "coap3/coap_cache.h" -#include "coap3/coap_dtls.h" -#include "coap3/coap_event.h" -#include "coap3/coap_io.h" -#include "coap3/coap_time.h" -#include "coap3/coap_debug.h" -#include "coap3/encode.h" -#include "coap3/mem.h" -#include "coap3/net.h" -#include "coap3/option.h" -#include "coap3/pdu.h" -#include "coap3/coap_prng.h" -#include "coap3/resource.h" -#include "coap3/str.h" -#include "coap3/subscribe.h" -#include "coap3/uri.h" - -#ifdef __cplusplus -} -#endif - -#endif /* _COAP_H_ */ diff --git a/components/coap/port/include/coap_config.h b/components/coap/port/include/coap_config.h deleted file mode 100644 index 1efa37aa7f..0000000000 --- a/components/coap/port/include/coap_config.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * libcoap configure implementation for ESP32 platform. - * - * Uses libcoap software implementation for failover when concurrent - * configure operations are in use. - * - * coap.h -- main header file for CoAP stack of libcoap - * - * Copyright (C) 2010-2012,2015-2016 Olaf Bergmann - * 2015 Carsten Schoenert - * - * Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD - * - * This file is part of the CoAP library libcoap. Please see README for terms - * of use. - */ - -#ifndef _CONFIG_H_ -#define _CONFIG_H_ - -/* Always enabled in ESP-IDF */ -#ifndef WITH_POSIX -#define WITH_POSIX -#endif - -#include "coap_config_posix.h" - -#define HAVE_STDIO_H -#define HAVE_ASSERT_H - -#define PACKAGE_STRING PACKAGE_NAME PACKAGE_VERSION - -/* it's just provided by libc. i hope we don't get too many of those, as - * actually we'd need autotools again to find out what environment we're - * building in */ -#define HAVE_STRNLEN 1 - -#define HAVE_LIMITS_H - -#define COAP_RESOURCES_NOHASH - -#endif /* _CONFIG_H_ */ diff --git a/components/coap/port/include/coap_config_posix.h b/components/coap/port/include/coap_config_posix.h deleted file mode 100644 index b24335ad15..0000000000 --- a/components/coap/port/include/coap_config_posix.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * libcoap configure implementation for ESP32 platform. - * - * Uses libcoap software implementation for failover when concurrent - * configure operations are in use. - * - * coap.h -- main header file for CoAP stack of libcoap - * - * Copyright (C) 2010-2012,2015-2016 Olaf Bergmann - * 2015 Carsten Schoenert - * - * Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD - * - * This file is part of the CoAP library libcoap. Please see README for terms - * of use. - */ - -#ifndef COAP_CONFIG_POSIX_H_ -#define COAP_CONFIG_POSIX_H_ - -#ifdef WITH_POSIX - -#include -#include - -#define HAVE_SYS_SOCKET_H -#define HAVE_MALLOC -#define HAVE_ARPA_INET_H -#define HAVE_TIME_H -#define HAVE_NETDB_H -#define HAVE_NETINET_IN_H -#define HAVE_STRUCT_CMSGHDR -#define COAP_DISABLE_TCP 0 - -#define ipi_spec_dst ipi_addr -struct in6_pktinfo { - struct in6_addr ipi6_addr; /* src/dst IPv6 address */ - unsigned int ipi6_ifindex; /* send/recv interface index */ -}; -#define IN6_IS_ADDR_V4MAPPED(a) \ - ((((__const uint32_t *) (a))[0] == 0) \ - && (((__const uint32_t *) (a))[1] == 0) \ - && (((__const uint32_t *) (a))[2] == htonl (0xffff))) - -/* As not defined, just need to define is as something innocuous */ -#define IPV6_PKTINFO IPV6_CHECKSUM - -#define PACKAGE_NAME "libcoap-posix" -#define PACKAGE_VERSION "?" - -#ifdef CONFIG_MBEDTLS_TLS_ENABLED -#define HAVE_MBEDTLS -#endif /* CONFIG_MBEDTLS_TLS_ENABLED */ -#define COAP_CONSTRAINED_STACK 1 -#define ESPIDF_VERSION - -#define gai_strerror(x) "gai_strerror() not supported" - -#endif /* WITH_POSIX */ -#endif /* COAP_CONFIG_POSIX_H_ */ diff --git a/docs/en/COPYRIGHT.rst b/docs/en/COPYRIGHT.rst index f757505fef..df063a54d0 100644 --- a/docs/en/COPYRIGHT.rst +++ b/docs/en/COPYRIGHT.rst @@ -33,8 +33,6 @@ These third party libraries can be included into the application (firmware) prod * `linenoise`_ line editing library Copyright (c) 2010-2014 Salvatore Sanfilippo, Copyright (c) 2010-2013 Pieter Noordhuis, licensed under 2-clause BSD license. -* `libcoap`_ COAP library Copyright (c) 2010-2017 Olaf Bergmann and others, is licensed under 2-clause BSD license as described in :component_file:`LICENSE file ` and :component_file:`COPYING file ` . - * `FatFS`_ library, Copyright (C) 2017 ChaN, is licensed under :component_file:`a BSD-style license `. * `cJSON`_ library, Copyright (c) 2009-2017 Dave Gamble and cJSON contributors, is licensed under MIT license as described in :component_file:`LICENSE file `. @@ -161,7 +159,6 @@ Copyright (C) 2011, ChaN, all right reserved. .. _TJpgDec: http://elm-chan.org/fsw/tjpgd/00index.html .. _argtable3: https://github.com/argtable/argtable3 .. _linenoise: https://github.com/antirez/linenoise -.. _libcoap: https://github.com/obgm/libcoap .. _fatfs: http://elm-chan.org/fsw/ff/00index_e.html .. _cJSON: https://github.com/DaveGamble/cJSON .. _micro-ecc: https://github.com/kmackay/micro-ecc diff --git a/docs/en/migration-guides/removed-components.rst b/docs/en/migration-guides/removed-components.rst index d4915aec05..9ebe86f603 100644 --- a/docs/en/migration-guides/removed-components.rst +++ b/docs/en/migration-guides/removed-components.rst @@ -13,6 +13,7 @@ Following components are removed from ESP-IDF and moved to `IDF Component Regist * `sh2lib `_ * `expat `_ +* `coap `_ These components can be installed using ``idf.py add-dependency`` command. diff --git a/examples/protocols/coap_client/main/idf_component.yml b/examples/protocols/coap_client/main/idf_component.yml new file mode 100644 index 0000000000..f5767d1df6 --- /dev/null +++ b/examples/protocols/coap_client/main/idf_component.yml @@ -0,0 +1,2 @@ +dependencies: + espressif/coap: ">=4.3.0" diff --git a/examples/protocols/coap_server/main/idf_component.yml b/examples/protocols/coap_server/main/idf_component.yml new file mode 100644 index 0000000000..f5767d1df6 --- /dev/null +++ b/examples/protocols/coap_server/main/idf_component.yml @@ -0,0 +1,2 @@ +dependencies: + espressif/coap: ">=4.3.0" diff --git a/tools/ci/check_copyright_ignore.txt b/tools/ci/check_copyright_ignore.txt index 432bea84f9..34015f631e 100644 --- a/tools/ci/check_copyright_ignore.txt +++ b/tools/ci/check_copyright_ignore.txt @@ -406,9 +406,6 @@ components/bt/host/bluedroid/stack/smp/smp_keys.c components/bt/host/bluedroid/stack/smp/smp_l2c.c components/bt/host/bluedroid/stack/smp/smp_main.c components/bt/host/bluedroid/stack/smp/smp_utils.c -components/coap/port/include/coap3/coap.h -components/coap/port/include/coap_config.h -components/coap/port/include/coap_config_posix.h components/console/argtable3/argtable3.c components/console/argtable3/argtable3.h components/console/linenoise/linenoise.c diff --git a/tools/ci/check_public_headers_exceptions.txt b/tools/ci/check_public_headers_exceptions.txt index dc5feae1ec..814201df58 100644 --- a/tools/ci/check_public_headers_exceptions.txt +++ b/tools/ci/check_public_headers_exceptions.txt @@ -49,8 +49,6 @@ components/mbedtls/port/include/ components/mbedtls/mbedtls/include/mbedtls/ components/mbedtls/mbedtls/include/psa/ -components/coap/ - components/esp-tls/private_include/ components/protobuf-c/ diff --git a/tools/ci/static-analysis-rules.yml b/tools/ci/static-analysis-rules.yml index 973df65209..9852eed9d5 100644 --- a/tools/ci/static-analysis-rules.yml +++ b/tools/ci/static-analysis-rules.yml @@ -15,7 +15,6 @@ skip: - "components/bt/host/nimble/nimble" - "components/bt/lib" - "components/cmock/CMock" - - "components/coap" - "components/esp_phy/lib" - "components/esp_wifi/lib" - "components/esp_wifi/lib_esp32"