Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sys/net/app/cord: Support the addition of extra registration arguments #16113

Merged
merged 1 commit into from
Sep 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions sys/include/net/cord/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions sys/net/application_layer/cord/common/cord_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}