Skip to content

Commit

Permalink
Merge pull request #215 from mrdeep1/libcoap_update
Browse files Browse the repository at this point in the history
coap: Update to latest libcoap code (4.3.2rc1) (IEC-32)
  • Loading branch information
mahavirj authored Jul 27, 2023
2 parents 10a1fdd + 54bb9eb commit 83707af
Show file tree
Hide file tree
Showing 18 changed files with 310 additions and 2,739 deletions.
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@
[submodule "coap/libcoap"]
path = coap/libcoap
url = https://github.com/obgm/libcoap.git
sbom-version = 4.3.1
sbom-version = 4.3.2
sbom-cpe = cpe:2.3:a:libcoap:libcoap:{}:*:*:*:*:*:*:*
sbom-supplier = Organization: libcoap <https://libcoap.net/>
sbom-url = https://github.com/obgm/libcoap
sbom-description = A CoAP (RFC 7252) implementation in C
sbom-hash = c694baead2f9b408a7598e0b85c2f257ea8c9651
sbom-hash = 3f8bb33807f521e9a5bbddddb0fe002f60b78a68

[submodule "usb/usb_host_uvc/libuvc"]
path = usb/usb_host_uvc/libuvc
Expand Down
40 changes: 23 additions & 17 deletions coap/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,38 +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
"port/src/block.c"
"libcoap/src/coap_address.c"
"libcoap/src/coap_asn1.c"
"libcoap/src/coap_async.c"
"libcoap/src/coap_block.c"
"libcoap/src/coap_cache.c"
"libcoap/src/coap_debug.c"
"libcoap/src/coap_dtls.c"
"libcoap/src/coap_encode.c"
"libcoap/src/coap_event.c"
"libcoap/src/coap_hashkey.c"
"libcoap/src/coap_io.c"
"libcoap/src/coap_layers.c"
"libcoap/src/coap_mbedtls.c"
"libcoap/src/coap_mem.c"
"libcoap/src/coap_net.c"
"libcoap/src/coap_netif.c"
"libcoap/src/coap_notls.c"
"libcoap/src/coap_option.c"
"libcoap/src/coap_oscore.c"
"libcoap/src/coap_pdu.c"
"libcoap/src/coap_prng.c"
"libcoap/src/coap_resource.c"
"libcoap/src/coap_session.c"
"libcoap/src/coap_str.c"
"libcoap/src/coap_subscribe.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/pdu.c"
"libcoap/src/resource.c"
"libcoap/src/str.c"
"libcoap/src/uri.c"
"libcoap/src/coap_mbedtls.c")
"libcoap/src/coap_uri.c"
"libcoap/src/coap_ws.c")

if(CONFIG_COAP_OSCORE_SUPPORT)
list(APPEND srcs
"libcoap/src/oscore/oscore.c"
"libcoap/src/oscore/oscore_cbor.c"
"libcoap/src/oscore/oscore_context.c"
"libcoap/src/oscore/oscore_cose.c"
"libcoap/src/oscore/oscore_crypto.c")
endif()

idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "${include_dirs}"
Expand Down
44 changes: 34 additions & 10 deletions coap/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ menu "CoAP Configuration"

endchoice #COAP_MBEDTLS_ENCRYPTION_MODE

config COAP_MBEDTLS_DEBUG
config COAP_DEBUGGING
bool "Enable CoAP debugging"
default n
help
Expand All @@ -33,9 +33,9 @@ menu "CoAP Configuration"
configuration, but logging level mbedTLS must be set for CoAP
to log it.

choice COAP_MBEDTLS_DEBUG_LEVEL
choice COAP_DEBUGGING_LEVEL
bool "Set CoAP debugging level"
depends on COAP_MBEDTLS_DEBUG
depends on COAP_DEBUGGING
default COAP_LOG_WARNING
help
Set CoAP debugging level
Expand All @@ -56,13 +56,13 @@ menu "CoAP Configuration"
bool "Info"
config COAP_LOG_DEBUG
bool "Debug"
config COAP_LOG_MBEDTLS
bool "mbedTLS"
config COAP_LOG_OSCORE
bool "OSCORE"
endchoice

config COAP_LOG_DEFAULT_LEVEL
int
default 0 if !COAP_MBEDTLS_DEBUG
default 0 if !COAP_DEBUGGING
default 0 if COAP_LOG_EMERG
default 1 if COAP_LOG_ALERT
default 2 if COAP_LOG_CRIT
Expand All @@ -71,7 +71,7 @@ menu "CoAP Configuration"
default 5 if COAP_LOG_NOTICE
default 6 if COAP_LOG_INFO
default 7 if COAP_LOG_DEBUG
default 9 if COAP_LOG_MBEDTLS
default 8 if COAP_LOG_OSCORE

config COAP_TCP_SUPPORT
bool "Enable TCP within CoAP"
Expand All @@ -80,7 +80,31 @@ menu "CoAP Configuration"
Enable TCP functionality for CoAP. This is required if TLS sessions
are to be used.

If this option is disabled, redundent CoAP TCP code is removed.
If this option is disabled, redundant CoAP TCP code is removed.

config COAP_OSCORE_SUPPORT
bool "Enable OSCORE support within CoAP"
default n
help
Enable OSCORE (Object Security for Constrained RESTful Environments) functionality for CoAP.

If this option is disabled, redundant CoAP OSCORE code is removed.

config COAP_OBSERVE_PERSIST
bool "Enable Server Observe Persist support within CoAP"
default n
help
Enable Server Observe Persist support for CoAP.

If this option is disabled, redundant CoAP Observe Persist code is removed.

config COAP_WEBSOCKETS
bool "Enable WebSockets support within CoAP"
default n
help
Enable WebSockets support for CoAP.

If this option is disabled, redundant CoAP WebSocket code is removed.

config COAP_CLIENT_SUPPORT
bool "Enable Client functionality within CoAP"
Expand All @@ -91,7 +115,7 @@ menu "CoAP Configuration"
this needs to be enabled to support the ongoing session going to
the next hop.

If this option is disabled, redundent CoAP client only code is removed.
If this option is disabled, redundant CoAP client only code is removed.
If both this option and COAP_SERVER_SUPPORT are disabled, then both
are automatically enabled for backwards compatability.

Expand All @@ -102,7 +126,7 @@ menu "CoAP Configuration"
Enable server functionality (ability to receive requests and send
responses) for CoAP.

If this option is disabled, redundent CoAP server only code is removed.
If this option is disabled, redundant CoAP server only code is removed.
If both this option and COAP_CLIENT_SUPPORT are disabled, then both
are automatically enabled for backwards compatability.

Expand Down
8 changes: 5 additions & 3 deletions coap/examples/coap_client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,17 @@ published under EPL+EDL: http://www.eclipse.org/californium/

## libcoap Documentation
This can be found at [libcoap Documentation](https://libcoap.net/documentation.html).
The current API is 4.3.0.
The current API is 4.3.2.

## libcoap Specific Issues
These can be raised at [libcoap Issues](https://github.com/obgm/libcoap/issues).

## Troubleshooting
* Please make sure Target Url includes valid `host`, optional `port`,
optional `path`, and begins with `coap://`, `coaps://`, `coap+tcp://` or `coaps+tcp://`
(not all hosts support TCP/TLS including coap+tcp://californium.eclipseprojects.io).
optional `path`, and begins with `coap://`, `coaps://`, `coap+tcp://`, `coaps+tcp://`,
`coap+ws://` or `coaps+ws://`.
* Not all hosts support TCP/TLS including coap+tcp://californium.eclipseprojects.io
* Not all hosts support WebSockets, which needs to be enabled as an option

* CoAP logging can be enabled by running 'idf.py menuconfig -> Component config -> CoAP Configuration -> Enable CoAP debugging'
and setting appropriate log level. If Mbed TLS logging is required, this needs to be configured separately under mbedTLS
Expand Down
6 changes: 0 additions & 6 deletions coap/examples/coap_client/main/Kconfig.projbuild
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
menu "Example CoAP Client Configuration"

# Hidden option that selects IPv4
config EXAMPLE_COAP_NEEDS_IPV4
bool
default true
select LWIP_IPV4

config EXAMPLE_TARGET_DOMAIN_URI
string "Target Uri"
default "coaps://californium.eclipseprojects.io"
Expand Down
Loading

0 comments on commit 83707af

Please sign in to comment.