Skip to content

Commit 03f50f2

Browse files
authored
merge: pull request #15 from namib-project/add_vendored_features_for_dtls
Update libcoap to 4.3.5 development version, bump dependencies, improve linking, allow compilation on ESP32.
2 parents 287c26c + 5b47b8f commit 03f50f2

File tree

24 files changed

+838
-321
lines changed

24 files changed

+838
-321
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
fail-fast: false
2020
matrix:
2121
crate: [libcoap-sys, libcoap-rs]
22-
dtls_backend: [openssl, gnutls, tinydtls]
22+
dtls_backend: [openssl, gnutls, tinydtls, mbedtls]
2323
steps:
2424
- uses: actions/checkout@v3
2525
with:
@@ -33,9 +33,13 @@ jobs:
3333
with:
3434
packages: libgnutls28-dev libgnutls30
3535
version: 1.0
36-
- if: matrix.crate == 'libcoap-rs'
36+
- if: matrix.crate == 'libcoap-rs' && matrix.dtls_backend != 'gnutls'
37+
run: cargo test -p ${{ matrix.crate }} --no-default-features --features dtls,tcp,vendored --features dtls_${{ matrix.dtls_backend }} --features dtls_${{ matrix.dtls_backend }}_vendored --no-fail-fast -- -Z unstable-options --report-time --ensure-time
38+
- if: matrix.crate == 'libcoap-rs' && matrix.dtls_backend == 'gnutls'
3739
run: cargo test -p ${{ matrix.crate }} --no-default-features --features dtls,tcp,vendored --features dtls_${{ matrix.dtls_backend }} --no-fail-fast -- -Z unstable-options --report-time --ensure-time
38-
- if: matrix.crate == 'libcoap-sys'
40+
- if: matrix.crate == 'libcoap-sys' && matrix.dtls_backend != 'gnutls'
41+
run: cargo test -p ${{ matrix.crate }} --features dtls,dtls_backend_${{ matrix.dtls_backend }},dtls_backend_${{ matrix.dtls_backend }}_vendored --no-fail-fast -- -Z unstable-options --report-time --ensure-time
42+
- if: matrix.crate == 'libcoap-sys' && matrix.dtls_backend == 'gnutls'
3943
run: cargo test -p ${{ matrix.crate }} --features dtls,dtls_backend_${{ matrix.dtls_backend }} --no-fail-fast -- -Z unstable-options --report-time --ensure-time
4044

4145
lint:

.idea/libcoap-rs.iml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/Test.xml

Lines changed: 7 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ members = [
99
"libcoap",
1010
"libcoap-sys",
1111
]
12+
resolver = "2"

libcoap-sys/Cargo.toml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ authors = ["Hugo Hakim Damer <[email protected]>"]
1717
categories = ["external-ffi-bindings", "network-programming", "embedded"]
1818
keywords = ["coap", "libcoap"]
1919
exclude = ["src/libcoap/ext/"]
20+
resolver = "2"
2021

2122
[features]
2223
# The default features match those of libcoaps configure script, except for dtls, which is disabled here because it
@@ -34,10 +35,13 @@ default = ["server", "client", "tcp", "async", "epoll", "vendored", "static"]
3435
# different backends), we select one based on the auto-detection order specified in
3536
# https://github.com/obgm/libcoap/blob/develop/configure.ac#L494 (gnutls > openssl > mbedtls > tinydtls).
3637
dtls = []
37-
dtls_backend_openssl = ["dtls", "openssl-sys"]
38-
dtls_backend_gnutls = ["dtls", "gnutls-sys"]
39-
dtls_backend_mbedtls = ["dtls", "mbedtls-sys-auto"]
40-
dtls_backend_tinydtls = ["dtls", "tinydtls-sys"]
38+
dtls_backend_openssl = ["dtls", "dep:openssl-sys"]
39+
dtls_backend_openssl_vendored = ["dtls_backend_openssl", "openssl-sys/vendored"]
40+
dtls_backend_gnutls = ["dtls"]
41+
dtls_backend_mbedtls = ["dtls"] # can't use mbedtls-sys-auto to generate linker flags here, as the crate doesn't support mbedtls >= 3.0.0
42+
dtls_backend_mbedtls_vendored = ["dep:mbedtls-sys-auto", "dtls_backend_mbedtls"]
43+
dtls_backend_tinydtls = ["dtls", "dep:tinydtls-sys", "tinydtls-sys/ecc", "tinydtls-sys/psk"]
44+
dtls_backend_tinydtls_vendored = ["dtls_backend_tinydtls", "tinydtls-sys/vendored"]
4145
# Enabling this feature will force libcoap-sys to be built with and statically linked to a vendored version of libcoap,
4246
# which will be built by the build-script before building libcoap-sys.
4347
# This way, it is no longer required to have libcoap installed to use this crate.
@@ -61,17 +65,26 @@ client = []
6165
epoll = []
6266

6367
[dependencies]
64-
gnutls-sys = {version = "^0.1.2", optional = true}
65-
openssl-sys = {version = "^0.9.74", optional = true}
66-
mbedtls-sys-auto = {version = "^2.26", optional = true}
68+
openssl-sys = { version = "^0.9.74", optional = true }
69+
mbedtls-sys-auto = { version = "^2.26", optional = true }
6770
libc = "^0.2.126"
68-
tinydtls-sys = {version = "^0.1.2", optional = true}
71+
tinydtls-sys = { version = "^0.2.0", default-features = false, optional = true }
72+
73+
[target.'cfg(target_os="espidf")'.dependencies]
74+
esp-idf-sys = { version = "0.35.0" }
6975

7076
[build-dependencies]
71-
bindgen = "^0.65.1"
77+
bindgen = "0.69.4"
7278
autotools = "^0.2.3"
7379
fs_extra = "^1.2"
7480
pkg-config = "^0.3.24"
81+
regex = "1.10.5"
82+
embuild = { version = "0.32.0", features = ["bindgen", "espidf", "cmake"] }
83+
version-compare = "0.2.0"
7584

7685
[package.metadata.docs.rs]
7786
features = ["dtls", "dtls_backend_openssl", "vendored"]
87+
88+
[[package.metadata.esp-idf-sys.extra_components]]
89+
remote_component = { name = "espressif/coap", version = "4.3.4~3" }
90+
bindings_header = "src/wrapper.h"

0 commit comments

Comments
 (0)