Merge pull request #16113 from chrysn-pull-requests/cord-extraargs
sys/net/app/cord: Support the addition of extra registration arguments
This commit is contained in:
commit
7381fb638a
@ -91,6 +91,22 @@ extern "C" {
|
|||||||
#endif
|
#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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -79,5 +79,15 @@ int cord_common_add_qstring(coap_pkt_t *pkt)
|
|||||||
}
|
}
|
||||||
#endif
|
#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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user