Skip to content

Commit 6812869

Browse files
authored
Merge pull request #11270 from anttiylitokola/update-mbed-coap-to-4.8.1
Update mbed-coap to version 4.8.1
2 parents edcde1c + 7ba7f7e commit 6812869

File tree

11 files changed

+710
-829
lines changed

11 files changed

+710
-829
lines changed

features/frameworks/mbed-coap/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Change Log
22

3+
## [v4.8.1(https://github.com/ARMmbed/mbed-coap/releases/tag/v4.8.1)
4+
- Store ACK's also into duplicate info list.
5+
- ROM size optimization. Flash size has gone down ~1100 bytes.
6+
7+
**Closed issues:**
8+
- IOTCLT-3592 - Client does not handle Duplicate ACK messages during blockwise registration correctly
9+
10+
-[Full Changelog](https://github.com/ARMmbed/mbed-coap/compare/v4.8.0...v4.8.1)
11+
312
## [v4.8.0](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.8.0)
413
- Make `sn_coap_protocol_linked_list_duplication_info_remove` API to public. User might want to delete some messages from the duplicate list.
514
- Enable support for unified client configuration.

features/frameworks/mbed-coap/Makefile.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ test: $(TESTDIRS)
4949
@rm -f lcov/index.xml
5050
@find ./ -name '*.gcno' | xargs cp --backup=numbered -t ./coverage/
5151
@find ./ -name '*.gcda' | xargs cp --backup=numbered -t ./coverage/
52-
@gcovr --object-directory ./coverage --exclude-unreachable-branches -e '.*/builds/.*' -e '.*/test/.*' -e '.*/stubs/.*' -e '.*/mbed-coap/.*' -x -o ./lcov/gcovr.xml
52+
@gcovr --object-directory ./coverage --exclude-unreachable-branches -e '.*/builds/.*' -e '.*/CppUTest/.*' -e '.*/mbed-client-libservice/.*' -e '.*/test/.*' -e '.*/stubs/.*' -e '.*/mbed-coap/.*' -x -o ./lcov/gcovr.xml
5353
@lcov -d test/. -c -o $(COVERAGEFILE)
5454
@lcov -q -r $(COVERAGEFILE) "/usr*" -o $(COVERAGEFILE)
5555
@lcov -q -r $(COVERAGEFILE) "/test*" -o $(COVERAGEFILE)

features/frameworks/mbed-coap/mbed-coap/sn_coap_header.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ extern void sn_coap_parser_release_allocated_coap_msg_mem(struct coap_s *handle,
338338
* -1 = Failure in given CoAP header structure\n
339339
* -2 = Failure in given pointer (= NULL)
340340
*/
341-
extern int16_t sn_coap_builder(uint8_t *dst_packet_data_ptr, sn_coap_hdr_s *src_coap_msg_ptr);
341+
extern int16_t sn_coap_builder(uint8_t *dst_packet_data_ptr, const sn_coap_hdr_s *src_coap_msg_ptr);
342342

343343
/**
344344
* \fn uint16_t sn_coap_builder_calc_needed_packet_data_size(sn_coap_hdr_s *src_coap_msg_ptr)
@@ -351,7 +351,7 @@ extern int16_t sn_coap_builder(uint8_t *dst_packet_data_ptr, sn_coap_hdr_s *src_
351351
* \return Return value is count of needed memory as bytes for build Packet data
352352
* Null if failed
353353
*/
354-
extern uint16_t sn_coap_builder_calc_needed_packet_data_size(sn_coap_hdr_s *src_coap_msg_ptr);
354+
extern uint16_t sn_coap_builder_calc_needed_packet_data_size(const sn_coap_hdr_s *src_coap_msg_ptr);
355355

356356
/**
357357
* \fn int16_t sn_coap_builder_2(uint8_t *dst_packet_data_ptr, sn_coap_hdr_s *src_coap_msg_ptr, uint16_t blockwise_size)
@@ -368,7 +368,7 @@ extern uint16_t sn_coap_builder_calc_needed_packet_data_size(sn_coap_hdr_s *src_
368368
* -1 = Failure in given CoAP header structure\n
369369
* -2 = Failure in given pointer (= NULL)
370370
*/
371-
extern int16_t sn_coap_builder_2(uint8_t *dst_packet_data_ptr, sn_coap_hdr_s *src_coap_msg_ptr, uint16_t blockwise_payload_size);
371+
extern int16_t sn_coap_builder_2(uint8_t *dst_packet_data_ptr, const sn_coap_hdr_s *src_coap_msg_ptr, uint16_t blockwise_payload_size);
372372

373373
/**
374374
* \fn uint16_t sn_coap_builder_calc_needed_packet_data_size_2(sn_coap_hdr_s *src_coap_msg_ptr, uint16_t blockwise_payload_size)
@@ -382,7 +382,7 @@ extern int16_t sn_coap_builder_2(uint8_t *dst_packet_data_ptr, sn_coap_hdr_s *sr
382382
* \return Return value is count of needed memory as bytes for build Packet data
383383
* Null if failed
384384
*/
385-
extern uint16_t sn_coap_builder_calc_needed_packet_data_size_2(sn_coap_hdr_s *src_coap_msg_ptr, uint16_t blockwise_payload_size);
385+
extern uint16_t sn_coap_builder_calc_needed_packet_data_size_2(const sn_coap_hdr_s *src_coap_msg_ptr, uint16_t blockwise_payload_size);
386386

387387
/**
388388
* \fn sn_coap_hdr_s *sn_coap_build_response(struct coap_s *handle, sn_coap_hdr_s *coap_packet_ptr, uint8_t msg_code)
@@ -397,7 +397,7 @@ extern uint16_t sn_coap_builder_calc_needed_packet_data_size_2(sn_coap_hdr_s *sr
397397
* NULL Error in parsing the request
398398
*
399399
*/
400-
extern sn_coap_hdr_s *sn_coap_build_response(struct coap_s *handle, sn_coap_hdr_s *coap_packet_ptr, uint8_t msg_code);
400+
extern sn_coap_hdr_s *sn_coap_build_response(struct coap_s *handle, const sn_coap_hdr_s *coap_packet_ptr, uint8_t msg_code);
401401

402402
/**
403403
* \brief Initialise a message structure to empty
@@ -436,6 +436,8 @@ extern sn_coap_hdr_s *sn_coap_parser_alloc_message(struct coap_s *handle);
436436
*/
437437
extern sn_coap_options_list_s *sn_coap_parser_alloc_options(struct coap_s *handle, sn_coap_hdr_s *coap_msg_ptr);
438438

439+
extern sn_coap_hdr_s *sn_coap_parser_alloc_message_with_options(struct coap_s *handle);
440+
439441
#ifdef __cplusplus
440442
}
441443
#endif

features/frameworks/mbed-coap/mbed-coap/sn_coap_protocol.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ extern "C" {
3838
*
3939
* \param *used_malloc_func_ptr is function pointer for used memory allocation function.
4040
*
41-
* \param *used_free_func_ptr is function pointer for used memory free function.
41+
* \param *used_free_func_ptr is function pointer for used memory free function. Note: the implementation
42+
* must handle NULL parameter and ignore it just as typical libc's free() does.
4243
*
4344
* \param *used_tx_callback_ptr function callback pointer to tx function for sending coap messages
4445
*
@@ -234,7 +235,7 @@ extern int8_t sn_coap_protocol_delete_retransmission(struct coap_s *handle, uint
234235
*
235236
* \brief If re-transmissions are enabled, this function removes message from retransmission buffer.
236237
*/
237-
extern int8_t sn_coap_protocol_delete_retransmission_by_token(struct coap_s *handle, uint8_t *token, uint8_t token_len);
238+
extern int8_t sn_coap_protocol_delete_retransmission_by_token(struct coap_s *handle, const uint8_t *token, uint8_t token_len);
238239

239240
/**
240241
* \fn int8_t sn_coap_convert_block_size(uint16_t block_size)

features/frameworks/mbed-coap/mbed-coap/sn_config.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,4 +250,14 @@
250250
#define SN_COAP_MAX_INCOMING_BLOCK_MESSAGE_SIZE UINT16_MAX
251251
#endif
252252

253+
/**
254+
* \def SN_COAP_BLOCKWISE_INTERNAL_BLOCK_2_HANDLING_ENABLED
255+
* \brief A size optimization switch, which removes the blockwise Block2 response if set to 0.
256+
* handling code which is typically overridden by a call of "sn_coap_protocol_handle_block2_response_internally(coap, false);".
257+
* By default the code is there, so the override can be reversed by "sn_coap_protocol_handle_block2_response_internally(coap, true)".
258+
*/
259+
#ifndef SN_COAP_BLOCKWISE_INTERNAL_BLOCK_2_HANDLING_ENABLED
260+
#define SN_COAP_BLOCKWISE_INTERNAL_BLOCK_2_HANDLING_ENABLED 1
261+
#endif
262+
253263
#endif // SN_CONFIG_H

features/frameworks/mbed-coap/source/include/sn_coap_header_internal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ extern "C" {
5858
* \brief This structure is returned by sn_coap_exec() for sending
5959
*/
6060
typedef struct sn_nsdl_transmit_ {
61-
sn_nsdl_addr_s *dst_addr_ptr;
61+
sn_nsdl_addr_s dst_addr_ptr;
6262

6363
sn_nsdl_capab_e protocol;
6464

@@ -69,7 +69,7 @@ typedef struct sn_nsdl_transmit_ {
6969
/* * * * * * * * * * * * * * * * * * * * * * */
7070
/* * * * EXTERNAL FUNCTION PROTOTYPES * * * */
7171
/* * * * * * * * * * * * * * * * * * * * * * */
72-
extern int8_t sn_coap_header_validity_check(sn_coap_hdr_s *src_coap_msg_ptr, coap_version_e coap_version);
72+
extern int8_t sn_coap_header_validity_check(const sn_coap_hdr_s *src_coap_msg_ptr, coap_version_e coap_version);
7373

7474
#endif /* SN_COAP_HEADER_INTERNAL_H_ */
7575

features/frameworks/mbed-coap/source/include/sn_coap_protocol_internal.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ typedef struct coap_send_msg_ {
4848
uint8_t resending_counter; /* Tells how many times message is still tried to resend */
4949
uint32_t resending_time; /* Tells next resending time */
5050

51-
sn_nsdl_transmit_s *send_msg_ptr;
51+
sn_nsdl_transmit_s send_msg_ptr;
5252

53-
struct coap_s *coap; /* CoAP library handle */
5453
void *param; /* Extra parameter that will be passed to TX/RX callback functions */
5554

5655
ns_list_link_t link;
@@ -64,7 +63,6 @@ typedef struct coap_duplication_info_ {
6463
uint16_t msg_id;
6564
uint16_t packet_len;
6665
uint8_t *packet_ptr;
67-
struct coap_s *coap; /* CoAP library handle */
6866
sn_nsdl_addr_s *address;
6967
void *param;
7068
ns_list_link_t link;
@@ -77,7 +75,6 @@ typedef struct coap_blockwise_msg_ {
7775
uint32_t timestamp; /* Tells when Blockwise message is stored to Linked list */
7876

7977
sn_coap_hdr_s *coap_msg_ptr;
80-
struct coap_s *coap; /* CoAP library handle */
8178

8279
void *param;
8380
uint16_t msg_id;
@@ -100,7 +97,6 @@ typedef struct coap_blockwise_payload_ {
10097

10198
uint16_t payload_len;
10299
uint8_t *payload_ptr;
103-
struct coap_s *coap; /* CoAP library handle */
104100

105101
ns_list_link_t link;
106102
} coap_blockwise_payload_s;
@@ -139,6 +135,12 @@ struct coap_s {
139135
uint8_t sn_coap_internal_block2_resp_handling; /* If this is set then coap itself sends a next GET request automatically */
140136
};
141137

138+
/* Utility function which performs a call to sn_coap_protocol_malloc() and memset's the result to zero. */
139+
void *sn_coap_protocol_calloc(struct coap_s *handle, uint16_t length);
140+
141+
/* Utility function which performs a call to sn_coap_protocol_malloc() and memcopy's the source to result buffer. */
142+
void *sn_coap_protocol_malloc_copy(struct coap_s *handle, const void *source, uint16_t length);
143+
142144
#ifdef __cplusplus
143145
}
144146
#endif

0 commit comments

Comments
 (0)