Update mbed-coap to version 4.6.0

* Added new API which clears one item from the resend queue by token
pull/7739/head
Antti Yli-Tokola 2018-08-09 11:54:47 +03:00
parent ec4c33ca80
commit 590dfeb1f9
4 changed files with 49 additions and 1 deletions

View File

@ -1,5 +1,11 @@
# Change Log
## [v4.6.0](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.6.0)
**New feature:**
- Add new API which clears one item from the resend queue based on token
-[Full Changelog](https://github.com/ARMmbed/mbed-coap/compare/v4.5.1...v4.6.0)
## [v4.5.1](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.5.1)
**Closed issues:**
- IOTCLT-2883 - Blockwise observations not completing

View File

@ -224,6 +224,18 @@ extern void sn_coap_protocol_remove_sent_blockwise_message(struct coap_s *handle
*/
extern int8_t sn_coap_protocol_delete_retransmission(struct coap_s *handle, uint16_t msg_id);
/**
* \fn void sn_coap_protocol_delete_retransmission_by_token(struct coap_s *handle)
*
* \param *handle Pointer to CoAP library handle
* \token Token to be removed
* \token_len Length of the token
* \return returns 0 when success, -1 for invalid parameter, -2 if message was not found
*
* \brief If re-transmissions are enabled, this function removes message from retransmission buffer.
*/
extern int8_t sn_coap_protocol_delete_retransmission_by_token(struct coap_s *handle, uint8_t *token, uint8_t token_len);
/**
* \fn int8_t sn_coap_convert_block_size(uint16_t block_size)
*

View File

@ -1,6 +1,6 @@
{
"name": "mbed-coap",
"version": "4.5.1",
"version": "4.6.0",
"description": "COAP library",
"keywords": [
"coap",

View File

@ -363,6 +363,36 @@ int8_t sn_coap_protocol_delete_retransmission(struct coap_s *handle, uint16_t ms
return -2;
}
int8_t sn_coap_protocol_delete_retransmission_by_token(struct coap_s *handle, uint8_t *token, uint8_t token_len)
{
#if ENABLE_RESENDINGS /* If Message resending is not used at all, this part of code will not be compiled */
if (handle == NULL || token == NULL || token_len == 0) {
tr_error("sn_coap_protocol_delete_retransmission_by_token NULL");
return -1;
}
ns_list_foreach(coap_send_msg_s, stored_msg, &handle->linked_list_resent_msgs) {
uint8_t stored_token_len = (stored_msg->send_msg_ptr->packet_ptr[0] & 0x0F);
if (stored_token_len == token_len) {
uint8_t stored_token[8];
memcpy(stored_token, &stored_msg->send_msg_ptr->packet_ptr[4], stored_token_len);
if (memcmp(stored_token, token, stored_token_len) == 0) {
uint16_t temp_msg_id = (stored_msg->send_msg_ptr->packet_ptr[2] << 8);
temp_msg_id += (uint16_t)stored_msg->send_msg_ptr->packet_ptr[3];
tr_debug("sn_coap_protocol_delete_retransmission_by_token - removed msg_id: %d", temp_msg_id);
ns_list_remove(&handle->linked_list_resent_msgs, stored_msg);
--handle->count_resent_msgs;
/* Free memory of stored message */
sn_coap_protocol_release_allocated_send_msg_mem(handle, stored_msg);
return 0;
}
}
}
#endif
return -2;
}
int8_t prepare_blockwise_message(struct coap_s *handle, sn_coap_hdr_s *src_coap_msg_ptr)
{