diff --git a/sys/include/net/cord/config.h b/sys/include/net/cord/config.h index 56ed8b3e96..b6f7a47ba6 100644 --- a/sys/include/net/cord/config.h +++ b/sys/include/net/cord/config.h @@ -91,6 +91,22 @@ extern "C" { #endif /** @} */ +/** + * @brief Extra query parameters added during registration + * + * Must be suitable for constructing a static array out of them. + * + * Example: + * + * ``` + * CFLAGS += '-DCONFIG_CORD_EXTRAARGS="proxy=on","et=tag:riot-os.org,2020:board"' + * ``` + */ +#ifdef DOXYGEN +#define CONFIG_CORD_EXTRAARGS +#endif +/** @} */ + #ifdef __cplusplus } #endif diff --git a/sys/net/application_layer/cord/common/cord_common.c b/sys/net/application_layer/cord/common/cord_common.c index 73815f5e28..63985eab59 100644 --- a/sys/net/application_layer/cord/common/cord_common.c +++ b/sys/net/application_layer/cord/common/cord_common.c @@ -79,5 +79,15 @@ int cord_common_add_qstring(coap_pkt_t *pkt) } #endif +#ifdef CONFIG_CORD_EXTRAARGS + static const char *extra[] = { CONFIG_CORD_EXTRAARGS }; + for (unsigned i = 0; i < ARRAY_SIZE(extra); ++i) { + res = coap_opt_add_uri_query(pkt, extra[i], NULL); + if (res < 0) { + return res; + } + } +#endif + return 0; }