From 3ba208a96dcdf29542ef64f4eeb3978f546b18c3 Mon Sep 17 00:00:00 2001 From: Antti Yli-Tokola Date: Thu, 22 Feb 2018 17:57:12 +0200 Subject: [PATCH] Update mbed-coap to version 4.3.0 Add new api to clear whole sent blockwise message list --- .../FEATURE_COMMON_PAL/mbed-coap/CHANGELOG.md | 6 ++++++ .../mbed-coap/mbed-coap/sn_coap_protocol.h | 9 ++++++++ .../FEATURE_COMMON_PAL/mbed-coap/module.json | 2 +- .../mbed-coap/source/sn_coap_protocol.c | 21 +++++++++++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/features/FEATURE_COMMON_PAL/mbed-coap/CHANGELOG.md b/features/FEATURE_COMMON_PAL/mbed-coap/CHANGELOG.md index 5578d8fc1f..95d4b0f81e 100644 --- a/features/FEATURE_COMMON_PAL/mbed-coap/CHANGELOG.md +++ b/features/FEATURE_COMMON_PAL/mbed-coap/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## [v4.3.0](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.3.0) +**New feature:** +- Add new API which clears the whole sent blockwise message list + +-[Full Changelog](https://github.com/ARMmbed/mbed-coap/compare/v4.2.0...v4.3.0) + ## [v4.2.0](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.2.0) **New feature:** - Add new API to remove sent blockwise message from the linked list diff --git a/features/FEATURE_COMMON_PAL/mbed-coap/mbed-coap/sn_coap_protocol.h b/features/FEATURE_COMMON_PAL/mbed-coap/mbed-coap/sn_coap_protocol.h index e71a367244..345c3672e6 100644 --- a/features/FEATURE_COMMON_PAL/mbed-coap/mbed-coap/sn_coap_protocol.h +++ b/features/FEATURE_COMMON_PAL/mbed-coap/mbed-coap/sn_coap_protocol.h @@ -247,6 +247,15 @@ extern int8_t sn_coap_convert_block_size(uint16_t block_size); */ extern int8_t sn_coap_protocol_handle_block2_response_internally(struct coap_s *handle, uint8_t handle_response); +/** + * \fn void sn_coap_protocol_clear_sent_blockwise_messages(struct coap_s *handle) + * + * \brief This function clears all the sent blockwise messages from the linked list. + * + * \param *handle Pointer to CoAP library handle + */ +extern void sn_coap_protocol_clear_sent_blockwise_messages(struct coap_s *handle); + #endif /* SN_COAP_PROTOCOL_H_ */ #ifdef __cplusplus diff --git a/features/FEATURE_COMMON_PAL/mbed-coap/module.json b/features/FEATURE_COMMON_PAL/mbed-coap/module.json index 07db997ae1..b54fb79b9c 100644 --- a/features/FEATURE_COMMON_PAL/mbed-coap/module.json +++ b/features/FEATURE_COMMON_PAL/mbed-coap/module.json @@ -1,6 +1,6 @@ { "name": "mbed-coap", - "version": "4.2.0", + "version": "4.3.0", "description": "COAP library", "keywords": [ "coap", diff --git a/features/FEATURE_COMMON_PAL/mbed-coap/source/sn_coap_protocol.c b/features/FEATURE_COMMON_PAL/mbed-coap/source/sn_coap_protocol.c index 472f2361aa..6cdcb7ea95 100644 --- a/features/FEATURE_COMMON_PAL/mbed-coap/source/sn_coap_protocol.c +++ b/features/FEATURE_COMMON_PAL/mbed-coap/source/sn_coap_protocol.c @@ -256,6 +256,27 @@ int8_t sn_coap_protocol_set_block_size(struct coap_s *handle, uint16_t block_siz } +void sn_coap_protocol_clear_sent_blockwise_messages(struct coap_s *handle) +{ + (void) handle; +#if SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE + if (handle == NULL) { + return; + } + + /* Loop all stored Blockwise messages in Linked list */ + ns_list_foreach_safe(coap_blockwise_msg_s, removed_blocwise_msg_ptr, &handle->linked_list_blockwise_sent_msgs) { + if (removed_blocwise_msg_ptr->coap_msg_ptr) { + handle->sn_coap_protocol_free(removed_blocwise_msg_ptr->coap_msg_ptr->payload_ptr); + removed_blocwise_msg_ptr->coap_msg_ptr->payload_ptr = 0; + sn_coap_parser_release_allocated_coap_msg_mem(handle, removed_blocwise_msg_ptr->coap_msg_ptr); + removed_blocwise_msg_ptr->coap_msg_ptr = 0; + } + sn_coap_protocol_linked_list_blockwise_msg_remove(handle, removed_blocwise_msg_ptr); + } +#endif +} + int8_t sn_coap_protocol_set_duplicate_buffer_size(struct coap_s *handle, uint8_t message_count) { (void) handle;