From 67411db26f304672a9c75a12650aeed786b8c053 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Mon, 12 Feb 2024 15:40:21 +0100 Subject: [PATCH] tests/pkg: make use of nanocoap_resources --- tests/pkg/edhoc_c/Makefile | 1 + tests/pkg/edhoc_c/responder.c | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/pkg/edhoc_c/Makefile b/tests/pkg/edhoc_c/Makefile index 5d6b52fb75..901f28c92d 100644 --- a/tests/pkg/edhoc_c/Makefile +++ b/tests/pkg/edhoc_c/Makefile @@ -26,6 +26,7 @@ USEMODULE += sock_udp # Additional networking modules that can be dropped if not needed USEMODULE += gnrc_icmpv6_echo USEMODULE += nanocoap_sock +USEMODULE += nanocoap_resources # include this for printing IP addresses USEMODULE += shell_cmds_default diff --git a/tests/pkg/edhoc_c/responder.c b/tests/pkg/edhoc_c/responder.c index 11a59ebea0..537737c20b 100644 --- a/tests/pkg/edhoc_c/responder.c +++ b/tests/pkg/edhoc_c/responder.c @@ -98,14 +98,10 @@ ssize_t _edhoc_handler(coap_pkt_t *pkt, uint8_t *buf, size_t len, coap_request_c return msg_len; } -/* must be sorted by path (ASCII order) */ -const coap_resource_t coap_resources[] = { - COAP_WELL_KNOWN_CORE_DEFAULT_HANDLER, - { "/.well-known/edhoc", COAP_POST, _edhoc_handler, NULL }, +NANOCOAP_RESOURCE(edhoc) { + .path = "/.well-known/edhoc", .methods = COAP_POST, .handler = _edhoc_handler }; -const unsigned coap_resources_numof = ARRAY_SIZE(coap_resources); - int responder_cmd(int argc, char **argv) { if (argc < 2) {