mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #6528 from anttiylitokola/mbed_coap_4.4.1
Update mbed-coap to version 4.4.1pull/6561/head
commit
02d4631c13
|
@ -1,5 +1,13 @@
|
|||
# Change Log
|
||||
|
||||
## [v4.4.1](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.4.1)
|
||||
**Closed issues:**
|
||||
- IOTCLT-2539 Block wise messaging call-backs not working logically
|
||||
|
||||
Improve TCP+TLS transport layer to allow send larger messages without blockwising.
|
||||
|
||||
-[Full Changelog](https://github.com/ARMmbed/mbed-coap/compare/v4.4.0...v4.4.1)
|
||||
|
||||
## [v4.4.0](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.4.0)
|
||||
**New feature:**
|
||||
- Make sn_coap_protocol_send_rst as public needed for CoAP ping sending
|
||||
|
|
|
@ -92,6 +92,21 @@
|
|||
*/
|
||||
#undef SN_COAP_MAX_INCOMING_MESSAGE_SIZE /* UINT16_MAX */
|
||||
|
||||
/**
|
||||
* \def SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE
|
||||
* \brief Sets the maximum payload size allowed before blockwising the message.
|
||||
* This option should only be used when using TCP and TLS as transport
|
||||
* with known maximum fragment size. This optimizes the number of messages
|
||||
* if it is possible to send larger than 1kB messages without blockwise transfer.
|
||||
* If payload length is larger than SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE
|
||||
* it will be sent using blockwise transfer.
|
||||
* By default, this feature is disabled, 0 disables the feature, set to positive
|
||||
* value larger than SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE to enable.
|
||||
* Note that value should be less than transport layer maximum fragment size.
|
||||
* Note that value has no effect if blockwise transfer is disabled.
|
||||
*/
|
||||
#undef SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE /* 0 */
|
||||
|
||||
#ifdef MBED_CLIENT_USER_CONFIG_FILE
|
||||
#include MBED_CLIENT_USER_CONFIG_FILE
|
||||
#endif
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "mbed-coap",
|
||||
"version": "4.4.0",
|
||||
"version": "4.4.1",
|
||||
"description": "COAP library",
|
||||
"keywords": [
|
||||
"coap",
|
||||
|
|
|
@ -117,6 +117,10 @@ struct sn_coap_hdr_;
|
|||
#define SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE 0 /**< Must be 2^x and x is at least 4. Suitable values: 0, 16, 32, 64, 128, 256, 512 and 1024 */
|
||||
#endif
|
||||
|
||||
#ifndef SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE
|
||||
#define SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE 0
|
||||
#endif
|
||||
|
||||
#ifdef MBED_CONF_MBED_CLIENT_SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED
|
||||
#define SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED MBED_CONF_MBED_CLIENT_SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED
|
||||
#endif
|
||||
|
|
|
@ -341,7 +341,9 @@ uint16_t sn_coap_builder_calc_needed_packet_data_size_2(sn_coap_hdr_s *src_coap_
|
|||
}
|
||||
}
|
||||
#if SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE
|
||||
if ((src_coap_msg_ptr->payload_len > blockwise_payload_size) && (blockwise_payload_size > 0)) {
|
||||
if ((src_coap_msg_ptr->payload_len > SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE) &&
|
||||
(src_coap_msg_ptr->payload_len > blockwise_payload_size) &&
|
||||
(blockwise_payload_size > 0)) {
|
||||
returned_byte_count += blockwise_payload_size;
|
||||
} else {
|
||||
returned_byte_count += src_coap_msg_ptr->payload_len;
|
||||
|
|
|
@ -372,7 +372,9 @@ int8_t sn_coap_protocol_delete_retransmission(struct coap_s *handle, uint16_t ms
|
|||
#if SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE /* If Message blockwising is not used at all, this part of code will not be compiled */
|
||||
int8_t prepare_blockwise_message(struct coap_s *handle, sn_coap_hdr_s *src_coap_msg_ptr)
|
||||
{
|
||||
if ((src_coap_msg_ptr->payload_len > handle->sn_coap_block_data_size) && (handle->sn_coap_block_data_size > 0)) {
|
||||
if ((src_coap_msg_ptr->payload_len > SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE) &&
|
||||
(src_coap_msg_ptr->payload_len > handle->sn_coap_block_data_size) &&
|
||||
(handle->sn_coap_block_data_size > 0)) {
|
||||
/* * * * Add Blockwise option to send CoAP message * * */
|
||||
|
||||
/* Allocate memory for less used options */
|
||||
|
@ -436,15 +438,15 @@ int16_t sn_coap_protocol_build(struct coap_s *handle, sn_nsdl_addr_s *dst_addr_p
|
|||
}
|
||||
|
||||
#if SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE /* If Message blockwising is not used at all, this part of code will not be compiled */
|
||||
|
||||
/* If blockwising needed */
|
||||
if ((src_coap_msg_ptr->payload_len > handle->sn_coap_block_data_size) && (handle->sn_coap_block_data_size > 0)) {
|
||||
if ((src_coap_msg_ptr->payload_len > SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE) &&
|
||||
(src_coap_msg_ptr->payload_len > handle->sn_coap_block_data_size) &&
|
||||
(handle->sn_coap_block_data_size > 0)) {
|
||||
/* Store original Payload length */
|
||||
original_payload_len = src_coap_msg_ptr->payload_len;
|
||||
/* Change Payload length of send message because Payload is blockwised */
|
||||
src_coap_msg_ptr->payload_len = handle->sn_coap_block_data_size;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* * * * Build Packet data from CoAP message by using CoAP Header builder * * * */
|
||||
|
@ -1264,6 +1266,15 @@ static void sn_coap_protocol_linked_list_blockwise_payload_store(struct coap_s *
|
|||
return;
|
||||
}
|
||||
|
||||
// Do not add duplicates to list, this could happen if server needs to retransmit block message again
|
||||
ns_list_foreach(coap_blockwise_payload_s, payload_info_ptr, &handle->linked_list_blockwise_received_payloads) {
|
||||
if (0 == memcmp(addr_ptr->addr_ptr, payload_info_ptr->addr_ptr, addr_ptr->addr_len)) {
|
||||
if (payload_info_ptr->port == addr_ptr->port && payload_info_ptr->block_number == block_number) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
coap_blockwise_payload_s *stored_blockwise_payload_ptr = NULL;
|
||||
|
||||
/* * * * Allocating memory for stored Payload * * * */
|
||||
|
|
Loading…
Reference in New Issue