Skip to content

Update mbed-coap to version 4.5.0 #7320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions features/frameworks/mbed-coap/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Change Log

## [v4.5.0](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.5.0)
**Closed issues:**
- IIOTCLT-2769 - mbed-coap: extra response received after registration

Added own flag to enable blockwise support, without setting default blockwise
payload size. This allows to receive blockwise messages while still sending
without blockwise.

Fix CoAP request blockwise response handling
When request is sent, response can have blockwise option set. All requests must
be stored to the linked list.

-[Full Changelog](https://github.com/ARMmbed/mbed-coap/compare/v4.4.4...v4.5.0)

## [v4.4.4](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.4.4)
**Closed issues:**
- IOTCLT-2638 [GitHub] hardfault during reconnection retry with Thread
Expand Down
9 changes: 9 additions & 0 deletions features/frameworks/mbed-coap/mbed-coap/sn_coap_protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,15 @@ extern void sn_coap_protocol_clear_sent_blockwise_messages(struct coap_s *handle
*/
extern void sn_coap_protocol_send_rst(struct coap_s *handle, uint16_t msg_id, sn_nsdl_addr_s *addr_ptr, void *param);

/**
* \fn uint16_t sn_coap_protocol_get_configured_blockwise_size(struct coap_s *handle)
*
* \brief Get configured CoAP payload blockwise size
*
* \param *handle Pointer to CoAP library handle
*/
extern uint16_t sn_coap_protocol_get_configured_blockwise_size(struct coap_s *handle);

#endif /* SN_COAP_PROTOCOL_H_ */

#ifdef __cplusplus
Expand Down
10 changes: 9 additions & 1 deletion features/frameworks/mbed-coap/mbed-coap/sn_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
*
* \brief For Message blockwising
* Init value for the maximum payload size to be sent and received at one blockwise message
* Setting of this value to 0 will disable this feature, and also reduce use of ROM memory
* Setting of this value to 0 with SN_COAP_BLOCKWISE_ENABLED will disable this feature, and
* also reduce use of ROM memory.
* Note: This define is common for both received and sent Blockwise messages
*/
#undef 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
Expand Down Expand Up @@ -107,6 +108,13 @@
*/
#undef SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE /* 0 */

/**
* \def SN_COAP_BLOCKWISE_ENABLED
* \brief Enables the blockwise functionality in CoAP library also when blockwise payload
* size is set to '0' in SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE.
*/
#undef SN_COAP_BLOCKWISE_ENABLED /* 0 */

#ifdef MBED_CLIENT_USER_CONFIG_FILE
#include MBED_CLIENT_USER_CONFIG_FILE
#endif
Expand Down
2 changes: 1 addition & 1 deletion features/frameworks/mbed-coap/module.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mbed-coap",
"version": "4.4.4",
"version": "4.5.0",
"description": "COAP library",
"keywords": [
"coap",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ struct sn_coap_hdr_;
#define SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE MBED_CONF_MBED_CLIENT_SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE
#endif

#ifndef SN_COAP_BLOCKWISE_ENABLED
#define SN_COAP_BLOCKWISE_ENABLED 0 /**< Enable blockwise */
#endif

#ifndef SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE
#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
Expand Down Expand Up @@ -145,9 +149,7 @@ struct sn_coap_hdr_;
#define COAP_OPTION_BLOCK_NONE (-1) /**< Internal value to represent no Block1/2 option */


#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, struct sn_coap_hdr_ *coap_hdr_ptr);
#endif

/* Structure which is stored to Linked list for message sending purposes */
typedef struct coap_send_msg_ {
Expand Down Expand Up @@ -201,6 +203,8 @@ typedef struct coap_blockwise_payload_ {
uint8_t *addr_ptr;
uint16_t port;
uint32_t block_number;
uint8_t *token_ptr;
uint8_t token_len;

uint16_t payload_len;
uint8_t *payload_ptr;
Expand Down Expand Up @@ -228,7 +232,7 @@ struct coap_s {
uint16_t count_duplication_msgs;
#endif

#if SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE /* If Message blockwise is not used at all, this part of code will not be compiled */
#if SN_COAP_BLOCKWISE_ENABLED || SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE /* If Message blockwise is not enabled, this part of code will not be compiled */
coap_blockwise_msg_list_t linked_list_blockwise_sent_msgs; /* Blockwise message to to be sent is stored to this Linked list */
coap_blockwise_payload_list_t linked_list_blockwise_received_payloads; /* Blockwise payload to to be received is stored to this Linked list */
#endif
Expand Down
2 changes: 1 addition & 1 deletion features/frameworks/mbed-coap/source/sn_coap_builder.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ uint16_t sn_coap_builder_calc_needed_packet_data_size_2(sn_coap_hdr_s *src_coap_
returned_byte_count += sn_coap_builder_options_build_add_uint_option(NULL, src_coap_msg_ptr->options_list_ptr->size2, COAP_OPTION_SIZE2, &tempInt);
}
}
#if SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE
#if SN_COAP_BLOCKWISE_ENABLED || SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE
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)) {
Expand Down
Loading