From 6ab7fab40a79a2966e79d8b5254ee0c770c9d378 Mon Sep 17 00:00:00 2001 From: Ken Bannister Date: Thu, 30 Jan 2020 05:41:39 -0500 Subject: [PATCH 1/2] net/gcoap: deprecate gcoap_add_qstring() Use Packet API function coap_opt_add_uquery() instead. --- sys/include/net/gcoap.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/include/net/gcoap.h b/sys/include/net/gcoap.h index 458d81d2493c..62093062fa2f 100644 --- a/sys/include/net/gcoap.h +++ b/sys/include/net/gcoap.h @@ -921,6 +921,9 @@ ssize_t gcoap_encode_link(const coap_resource_t *resource, char *buf, * To add multiple Uri-Query options, simply call this function multiple times. * The Uri-Query options will be added in the order those calls. * + * @deprecated Will not be available after the 2020.10 release. Use + * coap_opt_add_uquery() instead. + * * @param[out] pdu The package that is being build * @param[in] key Key to add to the query string * @param[in] val Value to assign to @p key (may be NULL) From 7f3e95389354b56ed37037b7c2b331ea87df0cb2 Mon Sep 17 00:00:00 2001 From: Ken Bannister Date: Thu, 30 Jan 2020 06:00:53 -0500 Subject: [PATCH 2/2] net/cord: update for deprecated gcoap function --- sys/net/application_layer/cord/common/cord_common.c | 6 +++--- sys/net/application_layer/cord/ep/cord_ep.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/net/application_layer/cord/common/cord_common.c b/sys/net/application_layer/cord/common/cord_common.c index 2de2e4ef2c42..edc57c58cfb0 100644 --- a/sys/net/application_layer/cord/common/cord_common.c +++ b/sys/net/application_layer/cord/common/cord_common.c @@ -57,7 +57,7 @@ void cord_common_init(void) int cord_common_add_qstring(coap_pkt_t *pkt) { /* extend the url with some query string options */ - int res = gcoap_add_qstring(pkt, "ep", cord_common_ep); + int res = coap_opt_add_uquery(pkt, "ep", cord_common_ep); if (res < 0) { return res; } @@ -66,7 +66,7 @@ int cord_common_add_qstring(coap_pkt_t *pkt) #if CORD_LT char lt[11]; lt[fmt_u32_dec(lt, CORD_LT)] = '\0'; - res = gcoap_add_qstring(pkt, "lt", lt); + res = coap_opt_add_uquery(pkt, "lt", lt); if (res < 0) { return res; } @@ -74,7 +74,7 @@ int cord_common_add_qstring(coap_pkt_t *pkt) /* [optional] set the domain parameter */ #ifdef CORD_D - res = gcoap_add_qstring(pkt, "d", CORD_D); + res = coap_opt_add_uquery(pkt, "d", CORD_D); if (res < 0) { return res; } diff --git a/sys/net/application_layer/cord/ep/cord_ep.c b/sys/net/application_layer/cord/ep/cord_ep.c index 2768cc52858e..9ef87da2736c 100644 --- a/sys/net/application_layer/cord/ep/cord_ep.c +++ b/sys/net/application_layer/cord/ep/cord_ep.c @@ -221,7 +221,7 @@ static int _discover_internal(const sock_udp_ep_t *remote, return CORD_EP_ERR; } coap_hdr_set_type(pkt.hdr, COAP_TYPE_CON); - gcoap_add_qstring(&pkt, "rt", "core.rd"); + coap_opt_add_uquery(&pkt, "rt", "core.rd"); size_t pkt_len = coap_opt_finish(&pkt, COAP_OPT_FINISH_NONE); res = gcoap_req_send(buf, pkt_len, remote, _on_discover, NULL); if (res < 0) {