Skip to content

Commit b636241

Browse files
authored
Merge pull request #10620 from anttiylitokola/update-coap-to-4.8.0
Update mbed-coap to version 4.8.0
2 parents e4c6422 + 68400ad commit b636241

File tree

4 files changed

+67
-41
lines changed

4 files changed

+67
-41
lines changed

features/frameworks/mbed-coap/CHANGELOG.md

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

3+
## [v4.8.0](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.8.0)
4+
- Make `sn_coap_protocol_linked_list_duplication_info_remove` API to public. User might want to delete some messages from the duplicate list.
5+
- Enable support for unified client configuration.
6+
7+
-[Full Changelog](https://github.com/ARMmbed/mbed-coap/compare/v4.7.4...v4.8.0)
8+
39
## [v4.7.4](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.7.4)
410

511
- Remove dependency to yotta tool

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,21 @@ extern void sn_coap_protocol_send_rst(struct coap_s *handle, uint16_t msg_id, sn
298298
*/
299299
extern uint16_t sn_coap_protocol_get_configured_blockwise_size(struct coap_s *handle);
300300

301+
/**
302+
* \fn void sn_coap_protocol_linked_list_duplication_info_remove(struct coap_s *handle, const uint8_t *src_addr_ptr, const uint16_t port, const uint16_t msg_id);
303+
*
304+
* \brief Removes stored Duplication info from Linked list.
305+
*
306+
* \param *handle Pointer to CoAP library handle
307+
* \param *addr_ptr is pointer to Address key to be removed
308+
* \param port is Port key to be removed
309+
* \param msg_id is Message ID key to be removed
310+
*/
311+
extern void sn_coap_protocol_linked_list_duplication_info_remove(struct coap_s *handle,
312+
const uint8_t *src_addr_ptr,
313+
const uint16_t port,
314+
const uint16_t msg_id);
315+
301316
#endif /* SN_COAP_PROTOCOL_H_ */
302317

303318
#ifdef __cplusplus

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@
2121
#include MBED_CLIENT_USER_CONFIG_FILE
2222
#endif
2323

24+
#ifdef MBED_CLOUD_CLIENT_USER_CONFIG_FILE
25+
#include MBED_CLOUD_CLIENT_USER_CONFIG_FILE
26+
#endif
27+
28+
#ifdef MBED_CLOUD_CLIENT_CONFIGURATION_ENABLED
29+
#include "mbed-cloud-client/MbedCloudClientConfig.h"
30+
#endif
31+
2432
/**
2533
* \brief Configuration options (set of defines and values)
2634
*

features/frameworks/mbed-coap/source/sn_coap_protocol.c

Lines changed: 38 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
#if SN_COAP_DUPLICATION_MAX_MSGS_COUNT/* If Message duplication detection is not used at all, this part of code will not be compiled */
5151
static void sn_coap_protocol_linked_list_duplication_info_store(struct coap_s *handle, sn_nsdl_addr_s *src_addr_ptr, uint16_t msg_id, void *param);
5252
static coap_duplication_info_s *sn_coap_protocol_linked_list_duplication_info_search(const struct coap_s *handle, const sn_nsdl_addr_s *scr_addr_ptr, const uint16_t msg_id);
53-
static void sn_coap_protocol_linked_list_duplication_info_remove(struct coap_s *handle, uint8_t *scr_addr_ptr, uint16_t port, uint16_t msg_id);
5453
static void sn_coap_protocol_linked_list_duplication_info_remove_old_ones(struct coap_s *handle);
5554
static bool sn_coap_protocol_update_duplicate_package_data(const struct coap_s *handle, const sn_nsdl_addr_s *dst_addr_ptr, const sn_coap_hdr_s *coap_msg_ptr, const int16_t data_size, const uint8_t *dst_packet_data_ptr);
5655
#endif
@@ -1181,31 +1180,53 @@ static coap_duplication_info_s* sn_coap_protocol_linked_list_duplication_info_se
11811180
return NULL;
11821181
}
11831182

1183+
1184+
11841185
/**************************************************************************//**
1185-
* \fn static void sn_coap_protocol_linked_list_duplication_info_remove(struct coap_s *handle, uint8_t *addr_ptr, uint16_t port, uint16_t msg_id)
1186-
*
1187-
* \brief Removes stored Duplication info from Linked list
1188-
*
1189-
* \param *addr_ptr is pointer to Address key to be removed
1190-
*
1191-
* \param port is Port key to be removed
1186+
* \fn static void sn_coap_protocol_linked_list_duplication_info_remove_old_ones(struct coap_s *handle)
11921187
*
1193-
* \param msg_id is Message ID key to be removed
1188+
* \brief Removes old stored Duplication detection infos from Linked list
11941189
*****************************************************************************/
11951190

1196-
static void sn_coap_protocol_linked_list_duplication_info_remove(struct coap_s *handle, uint8_t *addr_ptr, uint16_t port, uint16_t msg_id)
1191+
static void sn_coap_protocol_linked_list_duplication_info_remove_old_ones(struct coap_s *handle)
1192+
{
1193+
/* Loop all stored duplication messages in Linked list */
1194+
ns_list_foreach_safe(coap_duplication_info_s, removed_duplication_info_ptr, &handle->linked_list_duplication_msgs) {
1195+
if ((handle->system_time - removed_duplication_info_ptr->timestamp) > SN_COAP_DUPLICATION_MAX_TIME_MSGS_STORED) {
1196+
/* * * * Old Duplication info found, remove it from Linked list * * * */
1197+
ns_list_remove(&handle->linked_list_duplication_msgs, removed_duplication_info_ptr);
1198+
--handle->count_duplication_msgs;
1199+
1200+
/* Free memory of stored Duplication info */
1201+
handle->sn_coap_protocol_free(removed_duplication_info_ptr->address->addr_ptr);
1202+
removed_duplication_info_ptr->address->addr_ptr = 0;
1203+
handle->sn_coap_protocol_free(removed_duplication_info_ptr->address);
1204+
removed_duplication_info_ptr->address = 0;
1205+
handle->sn_coap_protocol_free(removed_duplication_info_ptr->packet_ptr);
1206+
removed_duplication_info_ptr->packet_ptr = 0;
1207+
handle->sn_coap_protocol_free(removed_duplication_info_ptr);
1208+
removed_duplication_info_ptr = 0;
1209+
}
1210+
}
1211+
}
1212+
1213+
#endif /* SN_COAP_DUPLICATION_MAX_MSGS_COUNT */
1214+
1215+
void sn_coap_protocol_linked_list_duplication_info_remove(struct coap_s *handle, const uint8_t *scr_addr_ptr, const uint16_t port, const uint16_t msg_id)
11971216
{
1217+
#if SN_COAP_DUPLICATION_MAX_MSGS_COUNT
11981218
/* Loop all stored duplication messages in Linked list */
11991219
ns_list_foreach(coap_duplication_info_s, removed_duplication_info_ptr, &handle->linked_list_duplication_msgs) {
12001220
/* If message's Address is same than is searched */
1201-
if (handle == removed_duplication_info_ptr->coap && 0 == memcmp(addr_ptr,
1221+
if (handle == removed_duplication_info_ptr->coap && 0 == memcmp(scr_addr_ptr,
12021222
removed_duplication_info_ptr->address->addr_ptr,
12031223
removed_duplication_info_ptr->address->addr_len)) {
12041224
/* If message's Address prt is same than is searched */
12051225
if (removed_duplication_info_ptr->address->port == port) {
12061226
/* If Message ID is same than is searched */
12071227
if (removed_duplication_info_ptr->msg_id == msg_id) {
12081228
/* * * * Correct Duplication info found, remove it from Linked list * * * */
1229+
tr_info("sn_coap_protocol_linked_list_duplication_info_remove - message id %d removed", msg_id);
12091230
ns_list_remove(&handle->linked_list_duplication_msgs, removed_duplication_info_ptr);
12101231
--handle->count_duplication_msgs;
12111232

@@ -1223,38 +1244,14 @@ static void sn_coap_protocol_linked_list_duplication_info_remove(struct coap_s *
12231244
}
12241245
}
12251246
}
1247+
#else
1248+
(void)handle;
1249+
(void)scr_addr_ptr;
1250+
(void)port;
1251+
(void)msg_id;
1252+
#endif //SN_COAP_DUPLICATION_MAX_MSGS_COUNT
12261253
}
12271254

1228-
/**************************************************************************//**
1229-
* \fn static void sn_coap_protocol_linked_list_duplication_info_remove_old_ones(struct coap_s *handle)
1230-
*
1231-
* \brief Removes old stored Duplication detection infos from Linked list
1232-
*****************************************************************************/
1233-
1234-
static void sn_coap_protocol_linked_list_duplication_info_remove_old_ones(struct coap_s *handle)
1235-
{
1236-
/* Loop all stored duplication messages in Linked list */
1237-
ns_list_foreach_safe(coap_duplication_info_s, removed_duplication_info_ptr, &handle->linked_list_duplication_msgs) {
1238-
if ((handle->system_time - removed_duplication_info_ptr->timestamp) > SN_COAP_DUPLICATION_MAX_TIME_MSGS_STORED) {
1239-
/* * * * Old Duplication info found, remove it from Linked list * * * */
1240-
ns_list_remove(&handle->linked_list_duplication_msgs, removed_duplication_info_ptr);
1241-
--handle->count_duplication_msgs;
1242-
1243-
/* Free memory of stored Duplication info */
1244-
handle->sn_coap_protocol_free(removed_duplication_info_ptr->address->addr_ptr);
1245-
removed_duplication_info_ptr->address->addr_ptr = 0;
1246-
handle->sn_coap_protocol_free(removed_duplication_info_ptr->address);
1247-
removed_duplication_info_ptr->address = 0;
1248-
handle->sn_coap_protocol_free(removed_duplication_info_ptr->packet_ptr);
1249-
removed_duplication_info_ptr->packet_ptr = 0;
1250-
handle->sn_coap_protocol_free(removed_duplication_info_ptr);
1251-
removed_duplication_info_ptr = 0;
1252-
}
1253-
}
1254-
}
1255-
1256-
#endif /* SN_COAP_DUPLICATION_MAX_MSGS_COUNT */
1257-
12581255
#if SN_COAP_BLOCKWISE_ENABLED || SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE
12591256
/**************************************************************************//**
12601257
* \fn static void sn_coap_protocol_linked_list_blockwise_msg_remove(struct coap_s *handle, coap_blockwise_msg_s *removed_msg_ptr)

0 commit comments

Comments
 (0)