Add libcoap to Component Manager
This commit is contained in:
parent
3e2b836926
commit
db60efdfb6
|
@ -15,6 +15,6 @@ jobs:
|
||||||
- name: Upload components to component service
|
- name: Upload components to component service
|
||||||
uses: espressif/github-actions/upload_components@master
|
uses: espressif/github-actions/upload_components@master
|
||||||
with:
|
with:
|
||||||
directories: "cbor;jsmn;libsodium;pid_ctrl;qrcode;nghttp;sh2lib;expat;esp_encrypted_img"
|
directories: "cbor;jsmn;libsodium;pid_ctrl;qrcode;nghttp;sh2lib;expat;esp_encrypted_img;coap"
|
||||||
namespace: "espressif"
|
namespace: "espressif"
|
||||||
api_token: ${{ secrets.IDF_COMPONENT_API_TOKEN }}
|
api_token: ${{ secrets.IDF_COMPONENT_API_TOKEN }}
|
||||||
|
|
|
@ -10,3 +10,6 @@
|
||||||
[submodule "expat/expat"]
|
[submodule "expat/expat"]
|
||||||
path = expat/expat
|
path = expat/expat
|
||||||
url = https://github.com/libexpat/libexpat.git
|
url = https://github.com/libexpat/libexpat.git
|
||||||
|
[submodule "coap/libcoap"]
|
||||||
|
path = coap/libcoap
|
||||||
|
url = https://github.com/obgm/libcoap.git
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
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)
|
||||||
|
|
||||||
|
# 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)
|
|
@ -0,0 +1,72 @@
|
||||||
|
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
|
|
@ -0,0 +1 @@
|
||||||
|
libcoap/LICENSE
|
|
@ -0,0 +1 @@
|
||||||
|
libcoap/README.md
|
|
@ -0,0 +1,5 @@
|
||||||
|
version: "4.3.0"
|
||||||
|
description: Constrained Application Protocol (CoAP) C Library
|
||||||
|
url: https://github.com/espressif/idf-extra-components/tree/master/coap
|
||||||
|
dependencies:
|
||||||
|
idf: ">=4.4"
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 3aa11612c143c9734d72022720f33e12506f7a2c
|
|
@ -0,0 +1,51 @@
|
||||||
|
/* 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 <bergmann@tzi.org>
|
||||||
|
* 2015 Carsten Schoenert <c.schoenert@t-online.de>
|
||||||
|
*
|
||||||
|
* 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_ */
|
|
@ -0,0 +1,42 @@
|
||||||
|
/*
|
||||||
|
* 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 <bergmann@tzi.org>
|
||||||
|
* 2015 Carsten Schoenert <c.schoenert@t-online.de>
|
||||||
|
*
|
||||||
|
* 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_ */
|
|
@ -0,0 +1,60 @@
|
||||||
|
/*
|
||||||
|
* 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 <bergmann@tzi.org>
|
||||||
|
* 2015 Carsten Schoenert <c.schoenert@t-online.de>
|
||||||
|
*
|
||||||
|
* 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 <sys/socket.h>
|
||||||
|
#include <net/if.h>
|
||||||
|
|
||||||
|
#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 "4.3.0"
|
||||||
|
|
||||||
|
#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_ */
|
Loading…
Reference in New Issue