Skip to content

Commit 4a461f5

Browse files
committed
Update examples
1 parent d0835e9 commit 4a461f5

File tree

541 files changed

+145063
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

541 files changed

+145063
-1
lines changed

examples/espidf-aws-iot/platformio.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,9 @@ board_build.embed_txtfiles =
1818
src/certs/private.pem.key
1919
src/certs/certificate.pem.crt
2020
src/certs/aws-root-ca.pem
21+
22+
# IDF v5 is not supported by ASW-IoT SDK
23+
# https://github.com/espressif/esp-aws-iot/blob/bbaf03d7d1fbf8a3f91dc18489d7bd27d5b9e9df/README.md?plain=1#L21
24+
platform_packages =
25+
framework-espidf @ ~3.40403.0
26+
toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
if(NOT CONFIG_LWIP_IPV6 AND NOT CMAKE_BUILD_EARLY_EXPANSION)
2+
message(STATUS "IPV6 support is disabled so the coap component will not be built")
3+
# note: the component is still included in the build so it can become visible again in config
4+
# without needing to re-run CMake. However no source or header files are built.
5+
idf_component_register()
6+
return()
7+
endif()
8+
9+
set(include_dirs port/include port/include libcoap/include)
10+
11+
set(srcs
12+
"libcoap/src/block.c"
13+
"libcoap/src/coap_address.c"
14+
"libcoap/src/coap_asn1.c"
15+
"libcoap/src/coap_async.c"
16+
"libcoap/src/coap_cache.c"
17+
"libcoap/src/coap_debug.c"
18+
"libcoap/src/coap_event.c"
19+
"libcoap/src/coap_hashkey.c"
20+
"libcoap/src/coap_io.c"
21+
"libcoap/src/coap_notls.c"
22+
"libcoap/src/coap_option.c"
23+
"libcoap/src/coap_prng.c"
24+
"libcoap/src/coap_session.c"
25+
"libcoap/src/coap_subscribe.c"
26+
"libcoap/src/coap_tcp.c"
27+
"libcoap/src/coap_time.c"
28+
"libcoap/src/encode.c"
29+
"libcoap/src/mem.c"
30+
"libcoap/src/net.c"
31+
"libcoap/src/pdu.c"
32+
"libcoap/src/resource.c"
33+
"libcoap/src/str.c"
34+
"libcoap/src/uri.c"
35+
"libcoap/src/coap_mbedtls.c")
36+
37+
idf_component_register(SRCS "${srcs}"
38+
INCLUDE_DIRS "${include_dirs}"
39+
REQUIRES lwip mbedtls)
40+
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
41+
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
menu "CoAP Configuration"
2+
visible if LWIP_IPV6
3+
4+
choice COAP_MBEDTLS_ENCRYPTION_MODE
5+
prompt "CoAP Encryption method"
6+
default COAP_MBEDTLS_PSK
7+
help
8+
If the CoAP information is to be encrypted, the encryption environment
9+
can be set up in one of two ways (default being Pre-Shared key mode)
10+
11+
- Encrypt using defined Pre-Shared Keys (PSK if uri includes coaps://)
12+
- Encrypt using defined Public Key Infrastructure (PKI if uri includes coaps://)
13+
14+
config COAP_MBEDTLS_PSK
15+
bool "Pre-Shared Keys"
16+
17+
config COAP_MBEDTLS_PKI
18+
bool "PKI Certificates"
19+
20+
endchoice #COAP_MBEDTLS_ENCRYPTION_MODE
21+
22+
config COAP_MBEDTLS_DEBUG
23+
bool "Enable CoAP debugging"
24+
default n
25+
help
26+
Enable CoAP debugging functions at compile time for the example code.
27+
28+
If this option is enabled, call coap_set_log_level()
29+
at runtime in order to enable CoAP debug output via the ESP
30+
log mechanism.
31+
32+
Note: The Mbed TLS library logging is controlled by the mbedTLS
33+
configuration, but logging level mbedTLS must be set for CoAP
34+
to log it.
35+
36+
choice COAP_MBEDTLS_DEBUG_LEVEL
37+
bool "Set CoAP debugging level"
38+
depends on COAP_MBEDTLS_DEBUG
39+
default COAP_LOG_WARNING
40+
help
41+
Set CoAP debugging level
42+
43+
config COAP_LOG_EMERG
44+
bool "Emergency"
45+
config COAP_LOG_ALERT
46+
bool "Alert"
47+
config COAP_LOG_CRIT
48+
bool "Critical"
49+
config COAP_LOG_ERROR
50+
bool "Error"
51+
config COAP_LOG_WARNING
52+
bool "Warning"
53+
config COAP_LOG_NOTICE
54+
bool "Notice"
55+
config COAP_LOG_INFO
56+
bool "Info"
57+
config COAP_LOG_DEBUG
58+
bool "Debug"
59+
config COAP_LOG_MBEDTLS
60+
bool "mbedTLS"
61+
endchoice
62+
63+
config COAP_LOG_DEFAULT_LEVEL
64+
int
65+
default 0 if !COAP_MBEDTLS_DEBUG
66+
default 0 if COAP_LOG_EMERG
67+
default 1 if COAP_LOG_ALERT
68+
default 2 if COAP_LOG_CRIT
69+
default 3 if COAP_LOG_ERROR
70+
default 4 if COAP_LOG_WARNING
71+
default 5 if COAP_LOG_NOTICE
72+
default 6 if COAP_LOG_INFO
73+
default 7 if COAP_LOG_DEBUG
74+
default 9 if COAP_LOG_MBEDTLS
75+
76+
config COAP_TCP_SUPPORT
77+
bool "Enable TCP within CoAP"
78+
default y
79+
help
80+
Enable TCP functionality for CoAP. This is required if TLS sessions
81+
are to be used.
82+
83+
If this option is disabled, redundent CoAP TCP code is removed.
84+
85+
config COAP_CLIENT_SUPPORT
86+
bool "Enable Client functionality within CoAP"
87+
default n
88+
help
89+
Enable client functionality (ability to make requests and receive
90+
responses) for CoAP. If the server is going to act as a proxy, then
91+
this needs to be enabled to support the ongoing session going to
92+
the next hop.
93+
94+
If this option is disabled, redundent CoAP client only code is removed.
95+
If both this option and COAP_SERVER_SUPPORT are disabled, then both
96+
are automatically enabled for backwards compatability.
97+
98+
config COAP_SERVER_SUPPORT
99+
bool "Enable Server functionality within CoAP"
100+
default n
101+
help
102+
Enable server functionality (ability to receive requests and send
103+
responses) for CoAP.
104+
105+
If this option is disabled, redundent CoAP server only code is removed.
106+
If both this option and COAP_CLIENT_SUPPORT are disabled, then both
107+
are automatically enabled for backwards compatability.
108+
109+
endmenu
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
Copyright (c) 2010--2022, Olaf Bergmann and others
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are
6+
met:
7+
8+
o Redistributions of source code must retain the above copyright
9+
notice, this list of conditions and the following disclaimer.
10+
11+
o Redistributions in binary form must reproduce the above copyright
12+
notice, this list of conditions and the following disclaimer in
13+
the documentation and/or other materials provided with the
14+
distribution.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27+
28+
========================================================================
29+
getopt.c
30+
31+
License information for getopt.c. This file is only used on Windows
32+
builds of the executables in the examples folder:
33+
34+
/*
35+
* This file was copied from the following newsgroup posting:
36+
*
37+
* Newsgroups: mod.std.unix
38+
* Subject: public domain AT&T getopt source
39+
* Date: 3 Nov 85 19:34:15 GMT
40+
*
41+
* Here's something you've all been waiting for: the AT&T public domain
42+
* source for getopt(3). It is the code which was given out at the 1985
43+
* UNIFORUM conference in Dallas. I obtained it by electronic mail
44+
* directly from AT&T. The people there assure me that it is indeed
45+
* in the public domain.
46+
*/
47+
48+
========================================================================
49+
uthash
50+
51+
libcoap uses uthash.h and utlist.h from Troy D. Hanson
52+
(https://troydhanson.github.io/uthash/). These files use the revised
53+
BSD license (BSD-1-Clause license) as included in these two source
54+
files.
55+
56+
========================================================================
57+
OpenSSL
58+
59+
Binaries that are linked against OpenSSL include software developed
60+
by the OpenSSL Project for use in the OpenSSL Toolkit.
61+
(http://www.openssl.org/). Please consult the OpenSSL license
62+
(https://www.openssl.org/source/license.html) for licensing terms.
63+
64+
========================================================================
65+
GnuTLS
66+
67+
When compiled with GnuTLS support, this software includes components
68+
that are licensed under the terms of the the GNU Lesser General Public
69+
License, version 2.1
70+
(https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html).
71+
72+
========================================================================
73+
tinyDTLS
74+
75+
When compiled with tinyDTLS support, this software includes components
76+
that are licensed under the terms of the Eclipse Distribution License 1.0
77+
(http://www.eclipse.org/org/documents/edl-v10.php).
78+
79+
========================================================================
80+
Mbed TLS
81+
82+
When compiled with Mbed TLS support, this software includes components
83+
that are licensed under the terms of the Apache 2.0 license
84+
(http://www.apache.org/licenses/LICENSE-2.0).
85+
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# libcoap: A C implementation of the Constrained Application Protocol (RFC 7252)
2+
3+
[![Build Status: main](https://github.com/obgm/libcoap/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/obgm/libcoap/actions?query=branch:main)
4+
[![Build Status: develop](https://github.com/obgm/libcoap/actions/workflows/main.yml/badge.svg?branch=develop)](https://github.com/obgm/libcoap/actions?query=branch:develop)
5+
[![Static Analysis](https://scan.coverity.com/projects/10970/badge.svg?flat=1)](https://scan.coverity.com/projects/obgm-libcoap)
6+
[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/libcoap.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:libcoap)
7+
8+
Copyright (C) 2010—2022 by Olaf Bergmann <bergmann@tzi.org> and others
9+
10+
ABOUT LIBCOAP
11+
=============
12+
13+
libcoap is a C implementation of a lightweight application-protocol
14+
for devices that are constrained their resources such as computing
15+
power, RF range, memory, bandwidth, or network packet sizes. This
16+
protocol, CoAP, is standardized by the IETF as RFC 7252. For further
17+
information related to CoAP, see <http://coap.technology>.
18+
19+
You might want to check out
20+
[libcoap-minimal](https://github.com/obgm/libcoap-minimal) for usage
21+
examples.
22+
23+
DOCUMENTATION
24+
=============
25+
26+
Documentation and further information can be found at
27+
<https://libcoap.net>.
28+
29+
PACKAGE CONTENTS
30+
================
31+
32+
This package contains a protocol parser and basic networking
33+
functions for platforms with support for malloc() and BSD-style
34+
sockets. In addition, there is support for Contiki, LwIP and
35+
Espressif/ESP-IDF hosted environments.
36+
37+
The following RFCs are supported
38+
39+
* RFC7252: The Constrained Application Protocol (CoAP)
40+
41+
* RFC7390: Group Communication for the Constrained Application Protocol (CoAP)
42+
43+
* RFC7641: Observing Resources in the Constrained Application Protocol (CoAP)
44+
45+
* RFC7959: Block-Wise Transfers in the Constrained Application Protocol (CoAP)
46+
47+
* RFC7967: Constrained Application Protocol (CoAP) Option for No Server Response
48+
49+
* RFC8132: PATCH and FETCH Methods for the Constrained Application Protocol (CoAP)
50+
51+
* RFC8323: CoAP (Constrained Application Protocol) over TCP, TLS, and WebSockets
52+
[No WebSockets support]
53+
54+
* RFC8516: "Too Many Requests" Response Code for the Constrained Application Protocol
55+
56+
* RFC8768: Constrained Application Protocol (CoAP) Hop-Limit Option
57+
58+
* RFC9175: CoAP: Echo, Request-Tag, and Token Processing
59+
60+
There is (D)TLS support for the following libraries
61+
62+
* OpenSSL (Minimum version 1.1.0) [PKI, PSK and PKCS11]
63+
64+
* GnuTLS (Minimum version 3.3.0) [PKI, PSK, RPK(3.6.6+) and PKCS11]
65+
66+
* Mbed TLS (Minimum version 2.7.10) [PKI and PSK]
67+
68+
* TinyDTLS [PSK and RPK] [DTLS Only]
69+
70+
The examples directory contain a CoAP client, CoAP Resource Directory server
71+
and a CoAP server to demonstrate the use of this library.
72+
73+
BUILDING
74+
========
75+
76+
Further information can be found at <https://libcoap.net/install.html>
77+
and [BUILDING](https://raw.githubusercontent.com/obgm/libcoap/develop/BUILDING).
78+
79+
LICENSE INFORMATION
80+
===================
81+
82+
This library is published as open-source software without any warranty
83+
of any kind. Use is permitted under the terms of the simplified BSD
84+
license. It includes public domain software. libcoap binaries may also
85+
include open-source software with their respective licensing terms.
86+
Please refer to
87+
[LICENSE](https://raw.githubusercontent.com/obgm/libcoap/develop/LICENSE)
88+
for further details.
89+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
dependencies:
2+
idf: '>=4.4'
3+
description: Constrained Application Protocol (CoAP) C Library
4+
url: https://github.com/espressif/idf-extra-components/tree/master/coap
5+
version: 4.3.1~1

0 commit comments

Comments
 (0)