mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
gcoap: Rename gcoap_get_resource_list_tl to gcoap_get_resource_list
This is an API change in the latter, which would typically now take an extra argument GCOAP_SOCKET_TYPE_UNDEF. Follow-Up-For: https://github.com/RIOT-OS/RIOT/pull/16688
This commit is contained in:
parent
523a39acd3
commit
5db24d4f51
@ -1087,9 +1087,6 @@ uint8_t gcoap_op_state(void);
|
||||
* @brief Get the resource list, currently only `CoRE Link Format`
|
||||
* (COAP_FORMAT_LINK) supported
|
||||
*
|
||||
* @deprecated Will be an alias for @ref gcoap_get_resource_list after the
|
||||
* 2022.01 release. Will be removed after the 2022.04 release.
|
||||
*
|
||||
* If @p buf := NULL, nothing will be written but the size of the resulting
|
||||
* resource list is computed and returned.
|
||||
*
|
||||
@ -1109,32 +1106,9 @@ uint8_t gcoap_op_state(void);
|
||||
* @return the number of bytes written to @p buf
|
||||
* @return -1 on error
|
||||
*/
|
||||
int gcoap_get_resource_list_tl(void *buf, size_t maxlen, uint8_t cf,
|
||||
int gcoap_get_resource_list(void *buf, size_t maxlen, uint8_t cf,
|
||||
gcoap_socket_type_t tl_type);
|
||||
|
||||
/**
|
||||
* @brief Get the resource list for all transports,
|
||||
* currently only `CoRE Link Format` (COAP_FORMAT_LINK) supported
|
||||
*
|
||||
* If @p buf := NULL, nothing will be written but the size of the resulting
|
||||
* resource list is computed and returned.
|
||||
*
|
||||
* @param[out] buf output buffer to write resource list into, my be NULL
|
||||
* @param[in] maxlen length of @p buf, ignored if @p buf is NULL
|
||||
* @param[in] cf content format to use for the resource list, currently
|
||||
* only COAP_FORMAT_LINK supported
|
||||
*
|
||||
* @todo add support for `JSON CoRE Link Format`
|
||||
* @todo add support for 'CBOR CoRE Link Format`
|
||||
*
|
||||
* @return the number of bytes written to @p buf
|
||||
* @return -1 on error
|
||||
*/
|
||||
static inline int gcoap_get_resource_list(void *buf, size_t maxlen, uint8_t cf)
|
||||
{
|
||||
return gcoap_get_resource_list_tl(buf, maxlen, cf, GCOAP_SOCKET_TYPE_UNDEF);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Writes a resource in CoRE Link Format to a provided buffer.
|
||||
*
|
||||
|
@ -286,7 +286,7 @@ int cord_ep_register(const sock_udp_ep_t *remote, const char *regif)
|
||||
|
||||
/* add the resource description as payload */
|
||||
res = gcoap_get_resource_list(pkt.payload, pkt.payload_len,
|
||||
COAP_FORMAT_LINK);
|
||||
COAP_FORMAT_LINK, GCOAP_SOCKET_TYPE_UNDEF);
|
||||
if (res < 0) {
|
||||
retval = CORD_EP_ERR;
|
||||
goto end;
|
||||
|
@ -946,7 +946,7 @@ static ssize_t _well_known_core_handler(coap_pkt_t* pdu, uint8_t *buf, size_t le
|
||||
coap_opt_add_format(pdu, COAP_FORMAT_LINK);
|
||||
ssize_t plen = coap_opt_finish(pdu, COAP_OPT_FINISH_PAYLOAD);
|
||||
|
||||
plen += gcoap_get_resource_list_tl(pdu->payload, (size_t)pdu->payload_len,
|
||||
plen += gcoap_get_resource_list(pdu->payload, (size_t)pdu->payload_len,
|
||||
COAP_FORMAT_LINK,
|
||||
(gcoap_socket_type_t)coap_request_ctx_get_tl_type(ctx));
|
||||
return plen;
|
||||
@ -1706,7 +1706,7 @@ uint8_t gcoap_op_state(void)
|
||||
return count;
|
||||
}
|
||||
|
||||
int gcoap_get_resource_list_tl(void *buf, size_t maxlen, uint8_t cf,
|
||||
int gcoap_get_resource_list(void *buf, size_t maxlen, uint8_t cf,
|
||||
gcoap_socket_type_t tl_type)
|
||||
{
|
||||
assert(cf == COAP_FORMAT_LINK);
|
||||
|
@ -378,15 +378,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_FORMAT_LINK);
|
||||
size = gcoap_get_resource_list(NULL, 0, COAP_FORMAT_LINK, GCOAP_SOCKET_TYPE_UNDEF);
|
||||
TEST_ASSERT_EQUAL_INT(strlen(resource_list_str), size);
|
||||
|
||||
res[0] = 'A';
|
||||
size = gcoap_get_resource_list(res, 0, COAP_FORMAT_LINK);
|
||||
size = gcoap_get_resource_list(res, 0, COAP_FORMAT_LINK, GCOAP_SOCKET_TYPE_UNDEF);
|
||||
TEST_ASSERT_EQUAL_INT(0, size);
|
||||
TEST_ASSERT_EQUAL_INT((int)'A', (int)res[0]);
|
||||
|
||||
size = gcoap_get_resource_list(res, 127, COAP_FORMAT_LINK);
|
||||
size = gcoap_get_resource_list(res, 127, COAP_FORMAT_LINK, GCOAP_SOCKET_TYPE_UNDEF);
|
||||
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