mirror of https://github.com/ARMmbed/mbed-os.git
Update mbed-coap to version 4.4.3
Fixes error: IOTCLT-2506 [GitHub] Cannot set registration time if server does not use max age option Improvements; Extend blockwise message transfer status to have states for sending as well. NOTE! These are internal changes required for cloud client. This has no direct relevance to any mbed-os functionality.pull/6883/head
parent
30e39eeb10
commit
511df14eb0
|
@ -1,5 +1,13 @@
|
||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
|
## [v4.4.3](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.4.3)
|
||||||
|
**Closed issues:**
|
||||||
|
- IOTCLT-2506 [GitHub] Cannot set registration time if server does not use max age option
|
||||||
|
|
||||||
|
Extend blockwise message transfer status to have states for sending as well.
|
||||||
|
|
||||||
|
-[Full Changelog](https://github.com/ARMmbed/mbed-coap/compare/v4.4.2...v4.4.3)
|
||||||
|
|
||||||
## [v4.4.2](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.4.2)
|
## [v4.4.2](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.4.2)
|
||||||
**Closed issues:**
|
**Closed issues:**
|
||||||
- IOTCLT-2469 CoAP UDP retransmission does not work for blocks after first one for requests (Eg. registration POST)
|
- IOTCLT-2469 CoAP UDP retransmission does not work for blocks after first one for requests (Eg. registration POST)
|
||||||
|
|
|
@ -158,8 +158,16 @@ typedef enum sn_coap_status_ {
|
||||||
COAP_STATUS_PARSER_BLOCKWISE_MSG_REJECTED = 5, /**< Blockwise message received but not supported by compiling switch */
|
COAP_STATUS_PARSER_BLOCKWISE_MSG_REJECTED = 5, /**< Blockwise message received but not supported by compiling switch */
|
||||||
COAP_STATUS_PARSER_BLOCKWISE_MSG_RECEIVED = 6, /**< Blockwise message fully received and returned to app.
|
COAP_STATUS_PARSER_BLOCKWISE_MSG_RECEIVED = 6, /**< Blockwise message fully received and returned to app.
|
||||||
User must take care of releasing whole payload of the blockwise messages */
|
User must take care of releasing whole payload of the blockwise messages */
|
||||||
COAP_STATUS_BUILDER_MESSAGE_SENDING_FAILED = 7 /**< When re-transmissions have been done and ACK not received, CoAP library calls
|
COAP_STATUS_BUILDER_MESSAGE_SENDING_FAILED = 7, /**< When re-transmissions have been done and ACK not received, CoAP library calls
|
||||||
RX callback with this status */
|
RX callback with this status */
|
||||||
|
|
||||||
|
COAP_STATUS_BUILDER_BLOCK_SENDING_FAILED = 8, /**< Blockwise message sending timeout.
|
||||||
|
The msg_id in sn_coap_hdr_s* parameter of RX callback is set to the same value
|
||||||
|
as in the first block sent, and parameter sn_nsdl_addr_s* is set as NULL. */
|
||||||
|
COAP_STATUS_BUILDER_BLOCK_SENDING_DONE = 9 /**< Blockwise message sending, last block sent.
|
||||||
|
The msg_id in sn_coap_hdr_s* parameter of RX callback is set to the same value
|
||||||
|
as in the first block sent, and parameter sn_nsdl_addr_s* is set as NULL. */
|
||||||
|
|
||||||
} sn_coap_status_e;
|
} sn_coap_status_e;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "mbed-coap",
|
"name": "mbed-coap",
|
||||||
"version": "4.4.2",
|
"version": "4.4.3",
|
||||||
"description": "COAP library",
|
"description": "COAP library",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"coap",
|
"coap",
|
||||||
|
|
|
@ -185,7 +185,10 @@ typedef struct coap_blockwise_msg_ {
|
||||||
sn_coap_hdr_s *coap_msg_ptr;
|
sn_coap_hdr_s *coap_msg_ptr;
|
||||||
struct coap_s *coap; /* CoAP library handle */
|
struct coap_s *coap; /* CoAP library handle */
|
||||||
|
|
||||||
ns_list_link_t link;
|
void *param;
|
||||||
|
uint16_t msg_id;
|
||||||
|
|
||||||
|
ns_list_link_t link;
|
||||||
} coap_blockwise_msg_s;
|
} coap_blockwise_msg_s;
|
||||||
|
|
||||||
typedef NS_LIST_HEAD(coap_blockwise_msg_s, link) coap_blockwise_msg_list_t;
|
typedef NS_LIST_HEAD(coap_blockwise_msg_s, link) coap_blockwise_msg_list_t;
|
||||||
|
|
|
@ -102,7 +102,7 @@ sn_coap_options_list_s *sn_coap_parser_alloc_options(struct coap_s *handle, sn_c
|
||||||
/* XXX not technically legal to memset pointers to 0 */
|
/* XXX not technically legal to memset pointers to 0 */
|
||||||
memset(coap_msg_ptr->options_list_ptr, 0x00, sizeof(sn_coap_options_list_s));
|
memset(coap_msg_ptr->options_list_ptr, 0x00, sizeof(sn_coap_options_list_s));
|
||||||
|
|
||||||
coap_msg_ptr->options_list_ptr->max_age = COAP_OPTION_MAX_AGE_DEFAULT;
|
coap_msg_ptr->options_list_ptr->max_age = 0;
|
||||||
coap_msg_ptr->options_list_ptr->uri_port = COAP_OPTION_URI_PORT_NONE;
|
coap_msg_ptr->options_list_ptr->uri_port = COAP_OPTION_URI_PORT_NONE;
|
||||||
coap_msg_ptr->options_list_ptr->observe = COAP_OBSERVE_NONE;
|
coap_msg_ptr->options_list_ptr->observe = COAP_OBSERVE_NONE;
|
||||||
coap_msg_ptr->options_list_ptr->accept = COAP_CT_NONE;
|
coap_msg_ptr->options_list_ptr->accept = COAP_CT_NONE;
|
||||||
|
|
|
@ -61,7 +61,7 @@ static bool sn_coap_protocol_linked_list_blockwise_payload_comp
|
||||||
static void sn_coap_protocol_linked_list_blockwise_payload_remove(struct coap_s *handle, coap_blockwise_payload_s *removed_payload_ptr);
|
static void sn_coap_protocol_linked_list_blockwise_payload_remove(struct coap_s *handle, coap_blockwise_payload_s *removed_payload_ptr);
|
||||||
static void sn_coap_protocol_linked_list_blockwise_payload_remove_oldest(struct coap_s *handle);
|
static void sn_coap_protocol_linked_list_blockwise_payload_remove_oldest(struct coap_s *handle);
|
||||||
static uint32_t sn_coap_protocol_linked_list_blockwise_payloads_get_len(struct coap_s *handle, sn_nsdl_addr_s *src_addr_ptr);
|
static uint32_t sn_coap_protocol_linked_list_blockwise_payloads_get_len(struct coap_s *handle, sn_nsdl_addr_s *src_addr_ptr);
|
||||||
static void sn_coap_protocol_linked_list_blockwise_remove_old_data(struct coap_s *handle);
|
static void sn_coap_protocol_handle_blockwise_timout(struct coap_s *handle);
|
||||||
static sn_coap_hdr_s *sn_coap_handle_blockwise_message(struct coap_s *handle, sn_nsdl_addr_s *src_addr_ptr, sn_coap_hdr_s *received_coap_msg_ptr, void *param);
|
static sn_coap_hdr_s *sn_coap_handle_blockwise_message(struct coap_s *handle, sn_nsdl_addr_s *src_addr_ptr, sn_coap_hdr_s *received_coap_msg_ptr, void *param);
|
||||||
static sn_coap_hdr_s *sn_coap_protocol_copy_header(struct coap_s *handle, sn_coap_hdr_s *source_header_ptr);
|
static sn_coap_hdr_s *sn_coap_protocol_copy_header(struct coap_s *handle, sn_coap_hdr_s *source_header_ptr);
|
||||||
#endif
|
#endif
|
||||||
|
@ -538,6 +538,8 @@ int16_t sn_coap_protocol_build(struct coap_s *handle, sn_nsdl_addr_s *dst_addr_p
|
||||||
memcpy(stored_blockwise_msg_ptr->coap_msg_ptr->payload_ptr, src_coap_msg_ptr->payload_ptr, stored_blockwise_msg_ptr->coap_msg_ptr->payload_len);
|
memcpy(stored_blockwise_msg_ptr->coap_msg_ptr->payload_ptr, src_coap_msg_ptr->payload_ptr, stored_blockwise_msg_ptr->coap_msg_ptr->payload_len);
|
||||||
|
|
||||||
stored_blockwise_msg_ptr->coap = handle;
|
stored_blockwise_msg_ptr->coap = handle;
|
||||||
|
stored_blockwise_msg_ptr->param = param;
|
||||||
|
stored_blockwise_msg_ptr->msg_id = stored_blockwise_msg_ptr->coap_msg_ptr->msg_id;
|
||||||
ns_list_add_to_end(&handle->linked_list_blockwise_sent_msgs, stored_blockwise_msg_ptr);
|
ns_list_add_to_end(&handle->linked_list_blockwise_sent_msgs, stored_blockwise_msg_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -564,6 +566,8 @@ int16_t sn_coap_protocol_build(struct coap_s *handle, sn_nsdl_addr_s *dst_addr_p
|
||||||
}
|
}
|
||||||
|
|
||||||
stored_blockwise_msg_ptr->coap = handle;
|
stored_blockwise_msg_ptr->coap = handle;
|
||||||
|
stored_blockwise_msg_ptr->param = param;
|
||||||
|
stored_blockwise_msg_ptr->msg_id = stored_blockwise_msg_ptr->coap_msg_ptr->msg_id;
|
||||||
ns_list_add_to_end(&handle->linked_list_blockwise_sent_msgs, stored_blockwise_msg_ptr);
|
ns_list_add_to_end(&handle->linked_list_blockwise_sent_msgs, stored_blockwise_msg_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -794,11 +798,11 @@ int8_t sn_coap_protocol_exec(struct coap_s *handle, uint32_t current_time)
|
||||||
|
|
||||||
/* * * * Store current System time * * * */
|
/* * * * Store current System time * * * */
|
||||||
handle->system_time = current_time;
|
handle->system_time = current_time;
|
||||||
#if SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE
|
|
||||||
/* * * * Remove old blocwise data * * * */
|
|
||||||
sn_coap_protocol_linked_list_blockwise_remove_old_data(handle);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#if SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE
|
||||||
|
/* * * * Handle block transfer timed outs * * * */
|
||||||
|
sn_coap_protocol_handle_blockwise_timout(handle);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if SN_COAP_DUPLICATION_MAX_MSGS_COUNT
|
#if SN_COAP_DUPLICATION_MAX_MSGS_COUNT
|
||||||
/* * * * Remove old duplication messages * * * */
|
/* * * * Remove old duplication messages * * * */
|
||||||
|
@ -1455,20 +1459,29 @@ static uint32_t sn_coap_protocol_linked_list_blockwise_payloads_get_len(struct c
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************//**
|
/**************************************************************************//**
|
||||||
* \fn static void sn_coap_protocol_linked_list_blockwise_remove_old_data(struct coap_s *handle)
|
* \fn static void sn_coap_protocol_handle_blockwise_timout(struct coap_s *handle)
|
||||||
*
|
*
|
||||||
* \brief Removes old stored Blockwise messages and payloads from Linked list
|
* \brief Check incoming and outgoing blockwise messages for time out.
|
||||||
|
* Remove timed out messages from lists. Notify application if
|
||||||
|
* outgoing message times out.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
static void sn_coap_protocol_linked_list_blockwise_remove_old_data(struct coap_s *handle)
|
static void sn_coap_protocol_handle_blockwise_timout(struct coap_s *handle)
|
||||||
{
|
{
|
||||||
/* Loop all stored Blockwise messages in Linked list */
|
/* Loop all outgoing blockwise messages */
|
||||||
ns_list_foreach_safe(coap_blockwise_msg_s, removed_blocwise_msg_ptr, &handle->linked_list_blockwise_sent_msgs) {
|
ns_list_foreach_safe(coap_blockwise_msg_s, removed_blocwise_msg_ptr, &handle->linked_list_blockwise_sent_msgs) {
|
||||||
if ((handle->system_time - removed_blocwise_msg_ptr->timestamp) > SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED) {
|
if ((handle->system_time - removed_blocwise_msg_ptr->timestamp) > SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED) {
|
||||||
//TODO: Check do we need to check handle == removed_blocwise_msg_ptr->coap here?
|
|
||||||
|
|
||||||
/* * * * Old Blockise message found, remove it from Linked list * * * */
|
/* * * * This messages has timed out, remove it from Linked list * * * */
|
||||||
if( removed_blocwise_msg_ptr->coap_msg_ptr ){
|
if( removed_blocwise_msg_ptr->coap_msg_ptr ){
|
||||||
|
|
||||||
|
if (handle->sn_coap_rx_callback) {
|
||||||
|
/* Notify the application about the time out */
|
||||||
|
removed_blocwise_msg_ptr->coap_msg_ptr->coap_status = COAP_STATUS_BUILDER_BLOCK_SENDING_FAILED;
|
||||||
|
removed_blocwise_msg_ptr->coap_msg_ptr->msg_id = removed_blocwise_msg_ptr->msg_id;
|
||||||
|
handle->sn_coap_rx_callback(removed_blocwise_msg_ptr->coap_msg_ptr, NULL, removed_blocwise_msg_ptr->param);
|
||||||
|
}
|
||||||
|
|
||||||
if(removed_blocwise_msg_ptr->coap_msg_ptr->payload_ptr){
|
if(removed_blocwise_msg_ptr->coap_msg_ptr->payload_ptr){
|
||||||
handle->sn_coap_protocol_free(removed_blocwise_msg_ptr->coap_msg_ptr->payload_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;
|
removed_blocwise_msg_ptr->coap_msg_ptr->payload_ptr = 0;
|
||||||
|
@ -1480,10 +1493,10 @@ static void sn_coap_protocol_linked_list_blockwise_remove_old_data(struct coap_s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Loop all stored Blockwise payloads in Linked list */
|
/* Loop all incoming Blockwise messages */
|
||||||
ns_list_foreach_safe(coap_blockwise_payload_s, removed_blocwise_payload_ptr, &handle->linked_list_blockwise_received_payloads) {
|
ns_list_foreach_safe(coap_blockwise_payload_s, removed_blocwise_payload_ptr, &handle->linked_list_blockwise_received_payloads) {
|
||||||
if ((handle->system_time - removed_blocwise_payload_ptr->timestamp) > SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED) {
|
if ((handle->system_time - removed_blocwise_payload_ptr->timestamp) > SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED) {
|
||||||
/* * * * Old Blockise payload found, remove it from Linked list * * * */
|
/* * * * This messages has timed out, remove it from Linked list * * * */
|
||||||
sn_coap_protocol_linked_list_blockwise_payload_remove(handle, removed_blocwise_payload_ptr);
|
sn_coap_protocol_linked_list_blockwise_payload_remove(handle, removed_blocwise_payload_ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2056,6 +2069,8 @@ static sn_coap_hdr_s *sn_coap_handle_blockwise_message(struct coap_s *handle, sn
|
||||||
|
|
||||||
stored_blockwise_msg_ptr->coap_msg_ptr = src_coap_blockwise_ack_msg_ptr;
|
stored_blockwise_msg_ptr->coap_msg_ptr = src_coap_blockwise_ack_msg_ptr;
|
||||||
stored_blockwise_msg_ptr->coap = handle;
|
stored_blockwise_msg_ptr->coap = handle;
|
||||||
|
stored_blockwise_msg_ptr->param = param;
|
||||||
|
stored_blockwise_msg_ptr->msg_id = stored_blockwise_msg_ptr->coap_msg_ptr->msg_id;
|
||||||
ns_list_add_to_end(&handle->linked_list_blockwise_sent_msgs, stored_blockwise_msg_ptr);
|
ns_list_add_to_end(&handle->linked_list_blockwise_sent_msgs, stored_blockwise_msg_ptr);
|
||||||
|
|
||||||
/* * * Then release memory of CoAP Acknowledgement message * * */
|
/* * * Then release memory of CoAP Acknowledgement message * * */
|
||||||
|
@ -2201,6 +2216,13 @@ static sn_coap_hdr_s *sn_coap_handle_blockwise_message(struct coap_s *handle, sn
|
||||||
stored_blockwise_msg_temp_ptr->coap_msg_ptr->payload_ptr = original_payload_ptr;
|
stored_blockwise_msg_temp_ptr->coap_msg_ptr->payload_ptr = original_payload_ptr;
|
||||||
|
|
||||||
if ((block_size * (block_number + 1)) >= stored_blockwise_msg_temp_ptr->coap_msg_ptr->payload_len) {
|
if ((block_size * (block_number + 1)) >= stored_blockwise_msg_temp_ptr->coap_msg_ptr->payload_len) {
|
||||||
|
|
||||||
|
if (handle->sn_coap_rx_callback) {
|
||||||
|
stored_blockwise_msg_temp_ptr->coap_msg_ptr->coap_status = COAP_STATUS_BUILDER_BLOCK_SENDING_DONE;
|
||||||
|
stored_blockwise_msg_temp_ptr->coap_msg_ptr->msg_id = stored_blockwise_msg_temp_ptr->msg_id;
|
||||||
|
handle->sn_coap_rx_callback(stored_blockwise_msg_temp_ptr->coap_msg_ptr, NULL, stored_blockwise_msg_temp_ptr->param);
|
||||||
|
}
|
||||||
|
|
||||||
sn_coap_protocol_linked_list_blockwise_msg_remove(handle, stored_blockwise_msg_temp_ptr);
|
sn_coap_protocol_linked_list_blockwise_msg_remove(handle, stored_blockwise_msg_temp_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue