From 0bee606bd418206921b6f63f72f1e5fb5cf609a5 Mon Sep 17 00:00:00 2001 From: Jose Alamos Date: Thu, 14 Jan 2021 15:06:30 +0100 Subject: [PATCH] gcoap: remove gcoap_add_qstring This feature was marked to be deprecated after the release 2020.10. Therefore this commit removes that feature. --- sys/include/net/gcoap.h | 20 -------------------- sys/net/application_layer/gcoap/gcoap.c | 23 ----------------------- 2 files changed, 43 deletions(-) diff --git a/sys/include/net/gcoap.h b/sys/include/net/gcoap.h index 7179de4026..433dc8a283 100644 --- a/sys/include/net/gcoap.h +++ b/sys/include/net/gcoap.h @@ -917,26 +917,6 @@ int gcoap_get_resource_list(void *buf, size_t maxlen, uint8_t cf); ssize_t gcoap_encode_link(const coap_resource_t *resource, char *buf, size_t maxlen, coap_link_encoder_ctx_t *context); -/** - * @brief Adds a single Uri-Query option to a CoAP request - * - * 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_uri_query() 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) - * - * @pre ((pdu != NULL) && (key != NULL)) - * - * @return overall length of new query string - * @return -1 on error - */ -int gcoap_add_qstring(coap_pkt_t *pdu, const char *key, const char *val); - #ifdef __cplusplus } #endif diff --git a/sys/net/application_layer/gcoap/gcoap.c b/sys/net/application_layer/gcoap/gcoap.c index 6139ac8b10..7355b4b8f0 100644 --- a/sys/net/application_layer/gcoap/gcoap.c +++ b/sys/net/application_layer/gcoap/gcoap.c @@ -1067,27 +1067,4 @@ ssize_t gcoap_encode_link(const coap_resource_t *resource, char *buf, return exp_size; } -int gcoap_add_qstring(coap_pkt_t *pdu, const char *key, const char *val) -{ - char qs[CONFIG_NANOCOAP_QS_MAX]; - size_t len = strlen(key); - size_t val_len = (val) ? (strlen(val) + 1) : 0; - - /* test if the query string fits, account for the zero termination */ - if ((len + val_len + 1) >= CONFIG_NANOCOAP_QS_MAX) { - return -1; - } - - memcpy(&qs[0], key, len); - if (val) { - qs[len] = '='; - /* the `=` character was already counted in `val_len`, so subtract it here */ - memcpy(&qs[len + 1], val, (val_len - 1)); - len += val_len; - } - qs[len] = '\0'; - - return coap_opt_add_string(pdu, COAP_OPT_URI_QUERY, qs, '&'); -} - /** @} */