gcoap: remove gcoap_add_qstring

This feature was marked to be deprecated after the release 2020.10.
Therefore this commit removes that feature.
This commit is contained in:
Jose Alamos 2021-01-14 15:06:30 +01:00
parent 2bf10413d0
commit 0bee606bd4
No known key found for this signature in database
GPG Key ID: F483EB800EF89DD9
2 changed files with 0 additions and 43 deletions

View File

@ -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, ssize_t gcoap_encode_link(const coap_resource_t *resource, char *buf,
size_t maxlen, coap_link_encoder_ctx_t *context); 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 #ifdef __cplusplus
} }
#endif #endif

View File

@ -1067,27 +1067,4 @@ ssize_t gcoap_encode_link(const coap_resource_t *resource, char *buf,
return exp_size; 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, '&');
}
/** @} */ /** @} */