mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
Merge pull request #10108 from bergzand/pr/coap/merge_ct_format
coap: Replace `COAP_CT_` with `COAP_FORMAT_`
This commit is contained in:
commit
cec477a5e0
@ -123,6 +123,8 @@ extern "C" {
|
||||
|
||||
/**
|
||||
* @name Content types
|
||||
* @deprecated Deprecated in favour of [COAP_FORMAT_](@ref net_coap_format)
|
||||
* style defines
|
||||
* @{
|
||||
*/
|
||||
#define COAP_CT_LINK_FORMAT (40)
|
||||
@ -134,11 +136,14 @@ extern "C" {
|
||||
|
||||
/**
|
||||
* @name Content-Format option codes
|
||||
* @anchor net_coap_format
|
||||
* @{
|
||||
*/
|
||||
#define COAP_FORMAT_TEXT (0)
|
||||
#define COAP_FORMAT_LINK (40)
|
||||
#define COAP_FORMAT_XML (41)
|
||||
#define COAP_FORMAT_OCTET (42)
|
||||
#define COAP_FORMAT_EXI (47)
|
||||
#define COAP_FORMAT_JSON (50)
|
||||
#define COAP_FORMAT_CBOR (60)
|
||||
/** @} */
|
||||
|
@ -981,7 +981,7 @@ uint8_t gcoap_op_state(void)
|
||||
int gcoap_get_resource_list(void *buf, size_t maxlen, uint8_t cf)
|
||||
{
|
||||
(void)cf; /* only used in the assert below. */
|
||||
assert(cf == COAP_CT_LINK_FORMAT);
|
||||
assert(cf == COAP_FORMAT_LINK);
|
||||
|
||||
/* skip the first listener, gcoap itself (we skip /.well-known/core) */
|
||||
gcoap_listener_t *listener = _coap_state.listeners->next;
|
||||
|
@ -842,7 +842,7 @@ ssize_t coap_well_known_core_default_handler(coap_pkt_t *pkt, uint8_t *buf, \
|
||||
coap_block2_init(pkt, &slicer);
|
||||
uint8_t *payload = buf + coap_get_total_hdr_len(pkt);
|
||||
uint8_t *bufpos = payload;
|
||||
bufpos += coap_put_option_ct(bufpos, 0, COAP_CT_LINK_FORMAT);
|
||||
bufpos += coap_put_option_ct(bufpos, 0, COAP_FORMAT_LINK);
|
||||
bufpos += coap_opt_put_block2(bufpos, COAP_OPT_CONTENT_FORMAT, &slicer, 1);
|
||||
|
||||
*bufpos++ = 0xff;
|
||||
|
@ -264,15 +264,15 @@ static void test_gcoap__server_get_resource_list(void)
|
||||
gcoap_register_listener(&listener);
|
||||
gcoap_register_listener(&listener_second);
|
||||
|
||||
size = gcoap_get_resource_list(NULL, 0, COAP_CT_LINK_FORMAT);
|
||||
size = gcoap_get_resource_list(NULL, 0, COAP_FORMAT_LINK);
|
||||
TEST_ASSERT_EQUAL_INT(strlen(resource_list_str), size);
|
||||
|
||||
res[0] = 'A';
|
||||
size = gcoap_get_resource_list(res, 0, COAP_CT_LINK_FORMAT);
|
||||
size = gcoap_get_resource_list(res, 0, COAP_FORMAT_LINK);
|
||||
TEST_ASSERT_EQUAL_INT(0, size);
|
||||
TEST_ASSERT_EQUAL_INT((int)'A', (int)res[0]);
|
||||
|
||||
size = gcoap_get_resource_list(res, 127, COAP_CT_LINK_FORMAT);
|
||||
size = gcoap_get_resource_list(res, 127, COAP_FORMAT_LINK);
|
||||
res[size] = '\0';
|
||||
TEST_ASSERT_EQUAL_INT(strlen(resource_list_str), size);
|
||||
TEST_ASSERT_EQUAL_STRING(resource_list_str, (char *)res);
|
||||
|
Loading…
Reference in New Issue
Block a user